Some postings ago I already told you that the AI for Project “W” is the first more complex AI that I did (and still do) so I’m gonna post a bit about it this time. My initial goal was to create an artificial intelligence that’s giving the player a challenge without cheating but that’s also behaving different from game-to-game. The first point is pretty clear, if an AI is cheating the player will start to notice it after some matches and it makes the player feel betrayed, which is a real no-go. The second point should also be clear as having the AI do the same things over and over in each game would make replaying the game pretty boring.
Basically my AI is a finite state-machine with a lot of randomness and though that sounds like something very simple it’s actually not. The AI has to do all the things that the player does like constructing buildings, creating and moving armies, researching and managing staff and (one of the more diffucult things to implement) balancing ressources. It’s constructing buildings depending on a priority-list and now even replaces old buildings with better (or newly researched) ones. It creates and assigns divisions and also moves them around to overtake enemy regions, for that it also needs to calculate risk and expanding-factors for it’s region that are the base of a lot of it’s decissions.
It also has different available personality that are randomly assigned with each personality having different parameters and preferences. So a military personalty for example will spend more money on units than a civil one and the possibility that it attacks enemy regions is also a lot higher. And most of the preferences and parameters are also at least marginally randomized so that a military personality is also a bit different each time within it’s own personality. So currently it’s doing everything a player does and it also seems to do it’s job very good. And in order to be able to see what the AI does (or what not) I’ve implemented several “aids” like an extensive log where the AI clearly states what it’s doing and what it tries to do, and also the possibility to automatically calculate turns, either turn after turn controlled by a timer or 100 turns at once. Together with the territorial map I can quickly see the AI’s actions and it’s also easy to see that every match turns out different, which in the end means that my implementation of the AI isn’t that bad at all.
Above you’ll see a “screenshot” that in the center shows the initial territorial map (after starting a fresh new game) and above and below you see different territorial standings after 100 turns. As can easily be seen each one looks different, which is due to the dozens of random parameters and preferences and the main different personalitites. So this variance in the AI’s behaviour should give each game a different feeling and make replaying the game a lot more interesting.