Update.
Over the past 3 months or so, I have been working on strategic AI for the game. This has taken a lot more time than I had initially imagined. Mainly because of how I written the interaction code, it was mostly synchronous and heavily tied to the player. I had to convert everything to async and add a layer of abstraction to allow AI and the Player to interact with the game through the same interface.
Actual AI is based on a paper called Adaptive Intelligence for Turn-based Strategy Games by Maurice Bergsma and Pieter Spronck
It proposes a modular architecture for decision-making with a very straight-forward implementation.
It took a while to write the tools for building so-called “Influence Maps”. In the end Might is Right uses 2 maps for it’s attack/move decision-making:
- threat map. This dictates how much danger each game tile presents to the agent
- reward map. This abstracts how attractive each game time is to the agent
I built a small tool for AI prototyping, here is what a threat map looks like:
Here’s a reward map:
If you look closely, you will notice that the maps are influenced by walking distances, here’s an example of a distance map:
So Dijkstra’s algorithm has seen a lot of use here
Finally the AI is here, it consists of 2 parts:
- spawner. Creates new enemies, decides which enemies to create, how strong, where to place them and when.
- scheduler. Computes “Actions” for each enemy and executes them.
It has been one of the hardest features to implement by far, an incredible journey and a satisfying challenge.
The changes are now live. Feedback, as always, greatly appreciated.