Harold Serrano

View Original

Cleaning up the AI Architecture- Soccer Game v0.0.5

The video below shows the latest implementations to the soccer game. In a nutshell, I cleaned up the AI architecture and implemented a Player Indicator.

Implemented modularity to the AI system

This month I focused on cleaning up the AI game architecture. As it turned out I was violating an OOP principle which states that:

A class should have only one responsibility.

In my case, one of the classes was not only responsible for assigning roles to each player, such as the attacker, defender and supporter role. It was also responsible for executing AI algorithms.

To remedy this, I created several classes responsible for AI operations. Specifically, I created an AI class responsible for Defending. And another class responsible for Attacking AI operations.

However, I went further and created an interface for these classes. Doing so provides modularity and flexibility whenever I need to change an AI strategy.

I also implemented methods in the AI to steal the ball from the attacking player. However, it does not know what to do once it gets possession of the ball, yet. I plan to fix this soon.

Added a Player Indicator

In the previous version of the game, it was somewhat hard to follow which player had possession of the ball. To remedy this, I added an indicator which shows who is the dribbling player and what is its heading. The indicator also points out the current defending player.

Improving the Soccer Kits

Finally, I decided to hire a game artist. I was not happy with the soccer kit texture; which was painted by me. He is currently working on the soccer kits, and I like what he has done as of now. Hopefully, by the next version update, I can show you a small video of the game with more realistic soccer kits.

Thanks for reading.