Tank FSM and ML Agents
For the AI course I decided to write a program that generates an enemy tank AI which isable to respond to player actions and figure out how to fire and block projectiles. The player decides the movement of the tank, firing a bullet and using a shield to block anattack.
The FSM agent patrols and attacks when the player is in range. If it has low health, it will try to run away and shield after shooting.
For training and using the ML-Agents algorithm and to generate a usable Neural Network, I am using the “ml agents” package provided by Unityto use Tensorflow provided by google with Python as the primary scripting language.
The key learning for the AI should be to move towards the player and when looking at the player, it should try to shoot. The game is relatively straight forward but defining an AI that does these movements in a “non predictable” fashion is quite challenging due tothe simplicity of the game.
There are 3 scenes:
- FSMScene: Play against a tank controlled by a finite state machine
- MLAgentFSMScene: To train a ML agent against the FSM
- MLAgentMLScene: To train an ML Agent against another ML Agent
- MLPlayingScene: Play against an ML agent
- W,A,S,D to move
- SPACE to shoot
- Shift to shield