yiotro / Antiyoy

A source code of android game called 'antiyoy'.
422 stars 54 forks source link

AI doesn't defend its supply lines when attacking #3

Open ThrawnCA opened 7 years ago

ThrawnCA commented 7 years ago

The AI, even on Expert, doesn't make any attempt to defend its supply lines. A Knight, for example, might advance deep into enemy territory alone, allowing a line of peasants to run behind it and cut it off from its home territory, starving it.

Is it feasible to do some kind of calculation of how well defended the region attached to a unit is? Something that would give the AI the ability to estimate whether its supplies are reasonably safe?

yiotro commented 7 years ago

Well, it's possible to do something like this: unit finds way to the capital and checks if every hex in that way defended enough. Only problem with this is that it involves much pathfinding and can slow down everything. But I will try to do it. Also I have to say that AI is not ideal by any means, but I think that it's also better than in majority of games.

ThrawnCA commented 7 years ago

Well, it would really only make sense for level 3 and 4 units, and you could probably spiral outward just to check for enough territory to support it, instead of actual pathfinding. But yes, I'm finding the AI challenging now that I'm past the easy phase of the campaign.