Mutant Gangland is a fast, neat and simple turn-based-strategy game where mutants fight robots . Build units, Conquer buildings and use them to Fund your army. Battles are short but the game packs 50 quick battles and a level editor to design your own maps.
Improvements to the AI. In this news post I showcase version 9 of the AI (dubbed Irene).
Posted by BacioiuC on Oct 19th, 2013
Until now I only worried about getting the AI to move the units across the map and accomplish each units goal. One thing I notice from play tests, and from other people's feedback, is that it's easy to kinda rush the AI with a bunch of units early on and catch them of guard. Previously Harrold (previous AI) created his units pseudo-random, based on a few tables (or arrays) for predetermined situations. Here's an example:
In the early turns (first 3) he would create units based on the first few tables, first turn focusing on getting some scouts out and a Rifle unit. The second turn another scout and a Rifle, and so on. Mid game he would just create units at random from tables 2 to 5 and, if under threat, he would go all out and spawn units from table 6 and 7. In order to detect what situation he was in, Harrold would perform a check at the start of his turn to see if a enemy unit is in range of assaulting one of his buildings. That check would return true and a threat value. If a Battle Unit was nearby one of his houses or temples, the threat value would be 0 (since Battle Units cannot conquer) but if a Assault Unit would wander in range of his temples Harrold would spawn Rifles or Rokkits at all of his temples and send them off to engage it. With Irene I hope on fixing two big problems that severely hindered Harrold:
In order to solve this issue I decided to add another component to the AI (besides the Tactical One) and it works a little bit like this:
With this new behavior in place I decided to pit Irene (PINK) against Harrold (BLUE) on a map I previously designed and, to my surprise, Irene did not only beat Harrold, but she did it in 2 minutes and had 60% of the map covered in units. Here's a video I have recorded of Irene dominating the battlefield:
Truth be told I was expecting Irene to win the battle but not by so much. Having a better control over unit creation indeed balanced the game towards her side. The rule by witch she spawns unit takes in factors such as:
In order to create the units, I loop through a table containing all the units that are available for that team and score them based on the factors above. The rule I currently use (and made for Irene) is:
equationToDecide = earlyFactor + unitScore * unitFactor * (self._player[team].coins - unitCost)
One thing that's a tad messed up in Irene at this point is the tendency to not create Rokkiter's. Currently, the price for a Rifle unit is 40 coins, while a Rokkit costs 120. Scoring the unit would return a score of 60 points for a Rifle and 140 for a Rokkit. From her point of view, it's better to create 3 Rifle units rather then one Rokkiter. Hopefully by changing a few weights (pointsPerHP, pointsPerMobility, pointsPerDamage) I can fine tune her behavior a bit and get her to make even better decisions.
That's it for this article. Next thing I want to handle on the AI side is to get Irene to use Rokkit's properly and in a strategic fashion (since it's a range/artillery unit). Thanks for reading and if you have any questions or suggestions, be sure to post them.