Tactical Pathfinding ML

Loading and training model

About

This is a project to teach myself the basics of machine learning with ml5's NeuralNetwork class. It's based on the work I did on tactical pathfinding in games for my Master's thesis (PDF link).

The general thrust of my thesis was examining if AI units could perform better in a team deathmatch scenario by taking into account various factors when finding a path:

This happened before Unity made pathfinding available to free users, so I had to write my own based off a tutorial from the UnityGems website. The main difference between this and regular A* is that each node also contained the number of deaths for each team, the number of reported sightings, and an exposure weighting (i.e. distance to the nearest wall). One team (Orange) would be configured to use these weightings, while the other (Blue) stuck with A*.

The deathmatches were 20 minutes long, and grouped into tournaments of 20 matches. For the sake of testing, the weights used for the above factors were either 1 or 0, but there's nothing to say they can't be larger.

Control results

The maps I tested on were built by myself in Unity, and one was horrifically unbalanced, as indicated by the results below. I ended using the "Hybrid" map to provide the statistics for the neural network because overall, it seemed to be the most balanced.

TeamDataMazeFieldHybrid
BlueTotal Kills239622112556
Average119.8110.55127.8
Maximum138126156
Minimum10796111
OrangeTotal Kills167521422546
Average119.8110.55127.8
Maximum93115146
Minimum7293106

So how does this work?

The neural network is trained against the weightings and scores for each match on the Hybrid map. Once it's ready, you can enter your own values and see how it should affect the Orange team's performance.

TODO: dig up the executable I made for it and attach for verification.