I’ve been working on the AI of Mechadrones these days. I was a little worried about it because I’ve tried programming AI in previous games and it always has been a very high step. But, to be honest, this time everything has been pretty easy.
There is going to be three different states for the enemy, that is, combat, flee or configure. The most important one will be the combat state because it’s the more common state for the enemy and the most complex one. So I decide to start with it.
The first thing to program was collecting all the useful info for the enemy decisions, the senses of the enemy. This was the easy part, the list was:
- The state of each robot part (that is armor and health).
- Kind of weapon, damage and ammo of each arm.
- Distance between them.
- The kind of legs (legged, caterpillar or flying).
- Available programs and the software pack into their heads.
- The drones of both and if they’re active.
And that’s most of the things your enemy needs to know for a global sight of the situation.
Ok, I have a lot of game data but I need to put then in useful data for the enemy. For example the AI needs to know which weapon can make more damage in which part, if weapons have enough ammo to start shooting right now or it’s better to get closer and don’t spent ammo, if a program must be used now or if it’s worthless. A lot of this things are just simplifications of the collected data and I used some formula to filter the data and simplify the numbers.
After all the work the enemy begin to understand each situation, he have X action points and he must advance (but he can try one shoot) so he advance and let 4 action points to try one shoot. Or he only have close combat weapons so his priority is to advance towards the player. Maybe he has enough ammo and hit chance to stand there shooting you, while you try to get closer. Now, the stupid AI is so good that it’s hard for me to win in a balanced combat (shit!).
There is a lot work to do yet. I want to introduce a bit randomness in some enemy decisions to make him more unpredictable. I have to program de flee and configure states but the main core of the AI seems good right now and the most important part, It’s funny to fight against it!