Awesome game!
How did you program the AI?
With some implementation of Utility AI, or some other system?
It is impressive how the AI knows to keep some units back to defend, that would otherwise be at the frontline with a simpler algorithm!
Thanks!
Yes I'd say it is a utility based AI at it's core. The AI always simulates a few diffferent moves from the ginormous number of options, this is done following some heuristics that try to cheaply guess which moves make sense; there's a bunch of auxiliary data structures that help the AI understand which tiles are important to defend or capture etc. After it has those candidate moves, it then runs a pretty expensive utility function to properly score the end result of each candidate move sequence and pick the best looking one.
Balancing defense and offense correctly was indeed a daunting part, but the solution I ended up is pretty simple. One of the candidate moves always includes commiting everything to offense (because sometimes that's the best defense :)), and the others each use different offense/defense splits. The utility function will decide which approach works out best for this turn.