Auto-translated
What if Igor is still reading this thread?... :-)
Unfortunately, I couldn't find any information on the forum about the AI's battle algorithm when fighting neutral creatures (I consider battles with heroes as a special case of battles with neutral creatures, which is less interesting for online play).
I have a few questions:
- What is the AI's objective in a battle at the algorithm level? To inflict maximum damage, or to eliminate the maximum number of creatures, taking into account their level? Or something else?
This is particularly interesting when the AI knows that the battle is a guaranteed loss, i.e., there is no scenario in which it can still win (3 behemoths vs. 1 behemoth, or 1 angel in a mini-dungeon).
Based on the answer, it will be possible to test several strategies for typical battles, different formations, etc. For example, a standard capture of a resource with a group stack of an army, with the main attacking ranged unit in the 6th stack. Well, almost always, the group stack of griffins flies to block the ranged unit, without attacking the ranged units themselves. Although it is precisely the ranged units that pose a threat and ultimately bring victory.
- What principle does the AI use to determine whether to attack a single unit/tank or to attack the main stack if it can reach both in one turn? I have some observations on this, but without details. For example, if the AI sees that it can kill an angel in 1-2 rounds, it will not rush to kill a "tasty" stack of spearmen, which, in terms of total HP, may be greater than the angel's HP. In the case of a main stack and a single unit, if the AI can reach both and has one stack (1 + 70 troglodytes vs. 25 centaurs), then in some cases it will attack the single unit, and in another case, it will attack the main stack (probably when it knows that it will not die in return).
- How does the AI choose its target to attack?
Sometimes you attack a ranged unit, run single units of centaurs towards the ranged units, and the computer starts attacking them instead of your ranged unit. And in another case, exactly the opposite, no matter how many single units you put in front, it shoots at the ranged units until the last one. There is definitely some pattern here, and I would like to know it. Similar situations occur with melee units, but I can't remember all of them.
- Sometimes the AI does not attack, even when it has the opportunity. Are there any rules that, if followed, will prevent the AI from attacking?
That is, magic or other obstacles are not involved. We are not talking about dragons that are afraid to expose themselves or breathe on their own, or about the first-second round of the battle "hydra vs. hive," where the little snakes scatter in different directions, fearing a simultaneous attack; in this case, the pattern is clear (although a description of all such cases would also be useful).
--
It may be difficult to get the answers from the code, but I would be glad to hear observations on this from experienced players.