| Driving program
What is AI Bots?
Most computer games require the user to control the player in a virtual
environment with the use of some input device like the mouse or the keyboard.
In AI Bots, you are required to write a program that does it. So one can call
AI Bots a programmer's game. The players in the virtual environment are called
bots. Your program can make the bot move, scan the arena for enemies, throw
bombs, send messages to its team members, etc. Typically two such programs are
made to fight against each other.
What is the objective of the game AI Bots II?
There are two teams of bots, each controlled by a different program. The
objective is to steal the enemy team's flag(s) and keep it with you for the
maximum amount of time while protecting your teams flag(s) from the enemies.
You are required to write a single program multiple (five) instances of which will
control different bots of the same team.
What are the fundamental laws in the AI Bots II arena?
1. Whenever a moving bot hits a wall it suffers a damage of 1 and stops right
2. Whenever a moving bot hits another bot both of them suffer a damage of 2 and
they stop right there.
3. A bot can take its enemy team's flags by colliding with them. However, they
can not do the same with their team's flags.
4. A flag carrying bot loses more health points than it does without a flag.
This vulnerability increases with the increase in number of flags.
decrease in health points = (vulnerability) x (damage)
vulnerability = 1 + 4 x (number of flags carried by the bot)
5. A bot can scan the arena for enemies. Bots of the same team can not see each
other in a scan. Bots can not see enemies beyond 35 steps.
6. Whenever a bot is near an exploding bomb it will lose health points depending
on its proximity from it.
7. A bot dies if its health points are exhausted. There is life after death!!
A bot that dies will reappear after 600 game time (a game runs for 12000 game
time) with maximum health points at a point chosen in random inside a
square. This point will be uniformly distributed inside the square. The combat
server will not process any of the requests sent by the bot. Those functions
will be blocked till the bot reappears after death.
8. Whenever a bot dies it loses all its flags, which go back to a point which
is chosen at random inside a predefined square.
9. Bots of the same team can send and receive messages among them.
10. A bot is deactivated (removed from the arena) if its driving program
terminates (normally or abnormally) or it makes an unusual request to the game
simulation program. The flags carried by the bot will be restored to their
How is the scoring done?
1. Bots lose 1 point for hitting walls.
2. Whenever a bot drops a bomb it gets points equal to
(total damage suffered by enemy bots) -
(total damage suffered by bots of its team)
Note that only damage is considered not decrease in health points.
3. A bot gains 0.125 points for each game time for each flag it carries.
4. Whenever a bot dies it will lose 10 points.
5. Whenever a bot is deactivated it loses 100 points.
6. The sum of the final scores of all the bots in a team is the final team
How do I write a program that plays AI Bots II?
A program that plays AI Bots (driving program) is written in C or C++. This
version of AI Bots II works in Windows and Linux.
What do I need to play AI Bots II in my computer?
You should download the AI Bots II distribution.
For Linux, you need to have at least a basic C compiler to play the game. The
distribution comes with three kinds of displays. You will also need to download
and install additional libraries for Linux. See install.html for details.
For Windows, you need Microsoft Visual C++ or an equivalent compiler. The text
display works but not too well. For the OpenGL display, you need to install
the necessary libraries, headers and dll's for OpenGL, glut and glu.
For further details on installing the additional libraries,
What do the AI Bots II distributions contain?
The aibots-2.xx.tar.gz file contains the source codes of programs for
game simulation, game display and other files. There is one header file and a
C file that contain the basic functions that the driving program uses to give
instructions to the bots. There are also some sample maps and driving programs.
What do I do after downloading the distribution?
Extract the files into the respective directories and follow the instructions
given in the Readme file for instructions on compiling the code. Some of
the files that will be created are:
1. ./combat - The game simulating program.
2. ./mapview - The program for viewing map.
3. ./files/makebot and ./files/makebot-c++ - The scripts that
compile the driving program.
If there are any errors in the compilation, you may not have the required files
How do I run the game?
To run a game between two programs prog1 and prog2 go to the aibots directory
./combat <map file> <prog1> <prog2> [-speedoption]
combat <map file> <prog1> <prog2> [-speedoption]
The speedoption controls the game speed. (The speed option doesn't work
correctly in Windows version).
In the text display, the bots are represented by alphabets, flags are
represented by 'O's, walls are represented by '=' and red coloured clusters of
small alphabets represent the fragments of an exploding bomb.
When using the text display, pressing the alphabet corresponding to a bot will
make the display follow the bot. Pressing 'm' will let you control the display
region manually using arrow keys. Pressing 'n' will make the display follow the
centre of mass of the bots. Pressing 'q' will terminate the game.
When using the GL display, pressing the 0,1,2, etc. will position the
camera just behind the corresponding bot. Pressing 'n' will position the
camera at the default point. Pressing 'q' will terminate the game. Press 'f' to
toggle texture. Turning off texture will improve the refresh rate of the
graphics screen. If a bot carries a flag, it is highlighted by a rectangle.
The score, health and flags carried by each bot will be displayed in the top of
What is a map file?
A map file contains information about an arena,i.e, the positions of walls the
teams. In a map file '=' represents a wall and a blank space represents an empty
Map files do not contain information about the positions of
flags or load points since these are randomized. It used to be so in
version 2.01 but has been removed because this resulted in map specific
solutions in which various co-ordinates are hard coded. We
also recommend the use of blank map only for combat. If you want to put
some walls inside the arena, take a look at combat.c to know where flags
and bots are never loaded so that you can put walls at those points.
You can study a map using either a text editor or the mapview program.
How do I use mapview?
To study a map using mapview type ./mapview <map file> . In the
text version, you have a cursor 'X' that can be moved using the arrow keys. The
co-ordinates of the cursor location are indicated in the top of the screen.
Typing 'q' will quit the program.
The GL version of mapview works in a similar fashion. Pressing 'f' will
toggle texture. Use this to improve the cursor speed.
| Driving program
For bugs, queries and suggestions contact :
(regarding the game engine and the text and graphics displays in Linux)
(regarding OS independence and Windows text display).