Introduction
Tanks is a game that was originally created to accompany a section in the book “Game Programming
Gems 2” that discussed the operation of the neural network in the game. In the original version of Tanks,
an MLP neural network was used to set the elevation of the AI tank’s barrel subject to a small random
perturbation that was used to mimic random human-like errors. This rather simplistic and abstract model
of aiming errors is replaced in this version of the game by a model of the actual random variations in the
aiming of the game’s author.
How to play
Left click in the area above your tank (the leftmost one) to indicate the direction you want to fire. Hit the
enemy tank to score.
The player’s and AI’s scores are displayed in the top left and top right corners of the game window
respectively. The arrow in the centre of the top of the window indicates wind speed and direction.
Hints
Click far from your tank to allow fine adjustments in barrel angle.
Do not move the mouse between shots because this prevents you making fine adjustments.
Take notice of changes in wind speed and direction.
How do I generate new training data?
Set boGeneratingErrorTrainingData=TRUE (in TankDoc.cpp) and compile.
The game will start in a special mode within which you have control of the AI tank and the AI has no
turn. Every time you fire a shot, the game compares the angle you set the barrel to with the optimal angle
(as estimated by the barrel-angle neural network) to derive the angular error in barrel angle. This quantity
is saved to disk (in the file NewExemplarData.txt by default). Once enough data has been collected
(i.e. several thousand shots) it should be possible to load the data into the game to produce a model of
your own random aiming variation.
Make sure the first line of the exemplar file gives the number of examples it contains, followed by the
number of inputs to the conditional distribution model (which is one, by default). Before producing a new
model, you’ll need to rename the newly created exemplar file to that used for training (called
AimingErrorExemplarData.txt by default).
…and how do I produce a new aiming error model?
Set boGeneratingErrorTrainingData=FALSE and boLoadTrainedErrorNetwork=FALSE
(in TankDoc.cpp) and recompile. The latter flag indicates that we do not have a pretrained model to
load and a new one will have to be created.
When the program is run, it will automatically load the exemplar data and create and train new
unconditional and conditional aiming error distribution models from it. Because of the location of the
training loop, the game window will not appear until training is complete, but the progress of training can
be monitored by opening the backup file (the default name ErrorTrainingBackup.cdm is given in
CConditionalDistribution.cpp) in a text editor or watching the debug messages in the
compiler’s output window. Training may take several hours (the pretrained conditional distribution model