An AI for Pocket Tanks
- Install necessary dependencies, in requirements.txt.
- Open PocketTanks.exe.
- Make sure the only weapon that can be used is "Single Shot" in options.
- Enter target practice or 1 player mode.
- Make sure that your tank is cyan and the other one is orange.
- Run the script "PocketTanksAgent.py"
- You'll be asked to enter the values of 3 things
- Speed hack factor, I used Cheat Engine to make the game faster, particularly useful when gathering data from the game. If you use speed hack as well, it's necessary to enter it in the program at the beginning to synchronize the timing between the program and the game. If you don't use it, just enter 1.
- The angle currently displayed in the game, that will be updated by the program.
- The in game power.
- Press Enter and switch to the game, the agent should start playing.
File | Discription |
---|---|
OpenCV.py | Contains OpenCV based functions which detect tanks coordinates, projectile coordinates and world shape features |
PocketTanksAgent.py | Starts the agent |
PocketTanksAgent.sln | Visual Studio Solution |
Variables.py | Contains global variables used by both PocketTanksAgent.py and DataGathering.py |
data.csv | Contains data I collected from the game |
dataGathering.py | Generates random values and collects results, updates data.csv |
keyboard.py | Contains keyboard related functions, responsible for updating ingame power and angle |
model.h5 | keras sequential model |
requirements.txt | Contains project dependencies, generated by Visual Studio, although I'm sure not all of them are necessary |
tank_blue.png | Blue tank template for feature matching |
tank_blue3.png | Blue tank template for template matching |
tank_yellow.png | Yellow tank template for feature matching |
tank_yellow3.png | Yellow tank template for template matching |
training.py | Creates a neural network, trains it and saves the model to model.h5 |