





🌟 Special thanks to our amazing supporters:
✨ $10 Tier: [Geeks Love Detail]
🌈 $5 Tier: [Benedikt][David Martínez Martí]
Hello there, fellow Companions!
Today we'd like to talk a bit the approach we've taken into designing and building our combat AI systems. In a combat heavy game it is paramount for the AI to behave in a realistic and seemingly smart way. Players want it to be challenging and yet play fair - by the same rules that the game world imposes on them.
In order to check all the boxes and build an easily extensible module, we've decided to explore and utilize the so-called Utility AI approach (used in games such as Hitman or Civilization). Instead of following a bunch of set defined rules the AI system takes a look at all the possible actions and scores them using a list of considerations. The decision making layer then takes all these scores and chooses an action in one of the few possible ways, i.e. by simply choosing the best one or by performing weighted randomization where each option's weight is represented by its score (in other words: if attacking a unit has a utility score of 5 and moving away has a score of 1 then attacking would be 5 times as likely to roll compared to running away).
We've quickly found out that in Glorious Companions simply looking at a single action ahead wouldn't be enough to build an immersive system. Consider the following:
In this situation if we were to analyze only the very next command, then the Scarrling on the right would almost always choose to attack the beefy Avenger that stands right next to him as opposed to moving to a different tile. There's way more immediate value to that, whereas the correct play would be to move past him and then attack the wounded captain in order to win the battle. What constitutes a reasonable play in context of the entire turn gets in fact quite complicated especially as you introduce more and more mechanics into the game.
In order to get the best response from our AI controlled enemies, we have implemented a solution which looks at all the different permutations of all the possible actions a unit can take. AI agents construct a list of command chains and then evaluate them as a set. For instance, suppose we only have two possible to execute actions: AttackAction and MoveAction and a scenario from the image above, the AI would build a list of the following chains:
[ 5693 ]
[ 1481 ]
[ 2067 ]