AI Tournament
Video game
Concept build-up
This workshop was intended for us to explore the possibilities of machine learning inside Unity. The ML-Agents toolkit offers an accessible interface and documentation to train your own models. We had total freedom on how we could approach the tool. One of the toolkit’s demo presented a model able to walk with a rigged character from point A to point B. I found it very interesting and challenging as well so I decided to look more into this.
Machine learning
The first step of the project was to train my own character. For the sake of time, I downloaded a 3D model already rigged on the internet. I then imported the model into Unity where I had to set up colliders for each character’s limb and specify to the neural network which bone he could use and what was their angle constraint.
After setting up the character bones, I had to set some rules for the neural network to train and improve. His goal was to walk from point A to point B without falling. He will get a penalty for falling and a reward for each step he makes and if he reaches point B. Those penalties and rewards are points which are subtracted or added to a total named “cumulative reward”, ranging from 0 to 100.
You can follow those statistics through TensorBoard and detect if the training doesn’t improve over time.
After roughly 24 hours of non-stop training, the character was roughly able to walk (his goofy moves drifted into a funny feature in the end). I then attached a sword to his hand and made him swing it erratically at the player.
On the other end, the player is dropped inside the arena with multiple characters to fight. For each takedown, he earns a point and if he gets hit, he loses one.