So what’s changed in the last nine months?
From an end user standpoint, the high-level highlights are:
- The official expansion pieces (Mosquito, Ladybug, Pillbug) are now fully supported
- Lots of Viewer updates, including:
- Graphical bug pieces, rather than just the text names
- Sound effects
- Progress bars while the AI is thinking
- Improved layout to maximize the playing area
- Ability to “lift” pieces that are stacked to see underneath them
- “BoardSpace” notation (the defacto way to record Hive games)
- The Viewer now includes an “Internal” implementation of the Mzinga Engine, in case no engine executable is available
- Engines can now expose their options to be set by the Viewer
- There is now a “portable” release, ie. a simple zip file for users who can’t/won’t install
- The “updater” now only checks for updates but doesn’t offer to download and install them (security issue)
From an engine / AI standpoint, the highlights are:
- Switched to a Principal Variation Search, ie., assume that the best move from a previous, shallow search, is the best place to when starting a deeper search
- Pre-sort moves to try moves with the most potential to upset the game first (ie moves that affect how surrounded the queens are)
- Switched to tapered evaluation, ie. how you should play near the start of the game can be different than how you should play near the end of the game, so evaluate the board with different metric weights as the game progresses
- Different metrics for different game types: one general set of metric weights for all game types (all the combinations of with/without expansions pieces) just isn’t effective, so the AI now has different specialized metric weights for each game type
- Better usage of multi-threaded searches
- Various perf improvements
I think the biggest upgrades for users are the inclusion of the expansion pieces, the much friendlier Viewer, and the fact that it’s now portable. Technically all you need to play Hive is the single Mzinga.Viewer.exe from the portable release. You can throw it on a flash drive and play Hive on any Windows (Vista or higher) computer.
On the research front, the biggest discovery for me was of the TreeStrap self-training algorithm. I won’t go into details here, (I talk about it a little in this BoardGameGeek post), but suffice it to say that it provided a more targeted way to improve Mzinga’s AI. Rather than rely solely on my evolution-based model (which, due to the limitations of my population sizes and my “rough” implementation of genetics, produced an often homogeneous pool of AIs) TreeStrap let me force an individual AI to self-train by playing games against itself and intelligently updating its own metric weights.
It was through using TreeStrap that I created a decent AI for playing games with both the Mosquito and Ladybug expansion pieces. However, it was only in testing that AI against my existing pool of evolved AIs that I learned that it only excelled in that game type. In fact that AI did horribly in other game types, which lead me to believe that it might not be possible to create one set of weights that works in all game types. This propelled me to finally expand Mzinga to support specialized weights for each game type.
But now I have a pretty robust “pipeline” for improving Mzinga’s AI. First, I have eight special AIs, each self-training against for one particular game type. Then I push those AIs into my pool of other AIs and have them all fight each other (no more evolution, just the fighting) to evaluate their strength. Then I take the top AIs for each game type (usually, but not always, the self-trained AIs) and inject their weights into Mzinga’s Engine.
In theory, if I keep repeating that loop then Mzinga’s AI should get stronger and stronger. Also I can keep “snapshot” the AI every time I release a new version and keep it in the AI pool, so I can track that the newer AIs are objectively stronger than the older ones.
As this self-improvement loop is already starting to pan out, I’ve begun spreading the load across multiple computers. I can now have one set of computers that continuously run the self-training algorithm on the special AIs and push the results to OneDrive, while another computer regularly grabs those AIs and tests them in combat.