                    Genetic Warfare - The flexible AI project
                    -----------------------------------------

IMPORTANT !!!
BEFORE YOU START PLAYING, PLEASE READ THE FILE  'QUESTION.TXT'
This file contains the questions about the AI, that I would like you to answer.
It is important that you read through the questions before you play.
When you are done, e-mail your answers to purple@diku.dk.
Try to send your answers before the 1st of December 2000. If you cannot make
this date, send your answers anyway, they may still be useful to me.

-----------------------------------------------------------------------------------

Requirements
------------

Windows 95+
DirectX 5.0+
Pentium-class CPU
32MB RAM
Graphics card capable of displaying 800x600 in hicolor.


Instructions for playing Genetic Warfare B
------------------------------------------

You are the commander of a small group of military units.
Your aim is to score as many victory points as possible.
The game is in two rounds. In round 1 you are the attacker, while the computer is
the defender. In round 2 you switch sides. The winner is the one who has scored the
most points in total over both rounds.
The game is turn based. In each turn, the attacker first gets to move his pieces,
as well as shoot and perform reload actions. Then the defender gets to act. When
both players have acted, victory points are awarded to the players.


Victory points are awarded for holding certain key locations on the playing field.
On the map, victory point locations are marked with a number, either 25 or 50.
This is the number of points you receive each turn you hold the location. To conquer
a victory location, move a piece into that hex. It is not necessary for a unit to
be positioned on the hex in order to hold it. The location will be under your control
until the enemy moves a unit into the hex.

Each round is 16 turns long.

The attacker and the defender do not start with the same units. The attacker starts
with 10 units: 
  2 recon squads, 3 assault squads, 2 machineguns, 2 grenadiers and 1 sniper.
The defender starts with 7 units:
  2 recon squads, 1 assault squad, 2 machineguns and 2 snipers.
The defender has the advantage that when the game starts, he holds 3 of the 5
victory locations, while the attacker holds none.


Units
-----

The units in the game have the following characteristics:

           |Accuracy |Damage |Shots per salvo |Range     |
----------------------------------------------------------
Recon      | 80%     | 1 - 3 | 1              |  4 hexes |
Assault    | 60%     | 1 - 3 | 3              |  3 hexes |
Sniper     | 90%     | 2 - 5 | 1              | 12 hexes |
Machinegun | 65%     | 2 - 3 | 5              |  9 hexes |
Grenadier  | 85%     | 1 - 5 | 1              |  3 hexes |

           |Defense |Hit-points |Ammo |Reload cost |Move-points |View range |
-----------------------------------------------------------------------------
Recon      | 20     | 3         | 10  | 4 MP       | 6 MP       | 10 hexes  |
Assault    | 15     | 5         | 18  | 3 MP       | 5 MP       |  8 hexes  |
Sniper     | 10     | 3         |  1  | 2 MP       | 5 MP       |  8 hexes  |
Nachinegun |  5     | 3         | 25  | 4 MP       | 5 MP       |  8 hexes  |
Grenadier  | 10     | 3         |  1  | 1 MP       | 5 MP       |  8 hexes  |

Move-points (MPs) are required for any action. Moving costs at least 1 MP per hex,
depending on which type of terrain it is. 
Shooting also costs MPs. There are two fire modes: aimed and snap fire. Aimed fire
costs 3 MPs while snap fire is quicker costing only 2 MPs. Snap fire is less
accurate though, using only 65% of the attackers accuracy rating.

When firing on an enemy unit, the shooter's accuracy and the target's defense and the
range to the target, determine the chance to hit. Accuracy is reduced by 15% for every
hex (more than the first) the target is away.
Example 1:
  A sniper unit fires on a machinegun which is right next to it.
  The chance to hit is: 90 (accuracy) - 5 (defense) = 85%
Example 2:  
  A sniper unit fires on a machinegun which is 5 hexes away.
  The chance to hit is: (90 - 5) * 0.85 * 0.85 * 0.85 * 0.85 = 44.4%
Note that in some forms of terrain, the target gets a defense bonus.

With every shot, one unit of ammo is used. Machineguns and assault squads fire several
shots in one salvo, so they use several units of ammo with every attack. A unit can
reload at any time. Reloading costs a number of MPs. If you want one of your units to
reload, press key 'R' on the keyboard. Also, if you try to fire on an enemy, and your
unit is out of ammo and has enough MPs left to reload, the unit will reload automatically.

Hit-points determine how much damage a unit can take. Once its hit-points have been
reduced to 0 or less, the unit is destroyed.

View range determines how far the unit can see. This is explained below in the section
on terrain.


Terrain
-------

There are different types of terrain on the map. The terrain types have these
characteristics:

            |Movement cost |Defense bonus |Cover
--------------------------------------------------
Asphalt     | 1            |  0           |  0% 
Grass       | 1            |  0           | 20%
Dirt        | 1            |  0           | 10%
Barbed wire | 3            |  5           | 60%
Forest      | 4            | 10           | 80%
Building    | 1            | 10           | 70%

The movement cost is the number of MPs a unit uses when moving into the hex.

The defense bonus is added to the unit's basic defense rating when it is positioned
in a hex with this terrain type.

Cover is how difficult it is for the enemy to spot the unit. A cover of 60% means
that any enemy unit that has this unit within its view range, has a 40% chance to spot
the unit. Whether or not a unit is visible to the enemy, is redetermined every time the
unit moves, and every time an enemy unit with this unit in its view range, moves.
When your unit is not within the view range of any enemy unit, it is always invisible
to the enemy, with one exception:
Whenever a unit fires its weapon, it becomes visible to the enemy, even when no enemy
unit has it within its view range (muzzle flash and noise makes it visible over
greater distances).


The interface
-------------

Here is a quick explanation of the graphical interface:

The big area on the left is the map window. Position the mouse cursor at the edge
of the screen (not the edge of this window) to scroll across the map. Alternatively
you can use the arrow keys on the keyboard.

When you place the mouse cursor over a unit, some information about the unit will
be displayed in the lower of the two small windows on the right.
When you select one of your own units by left-clicking on it, information about this
selected unit is displayed in the upper of the two windows on the right.

When a unit is selected, a number of hexes are marked in blue. The blue hexes are
where the selected unit can move to.
If there are any enemy units within firing range of the selected unit, those enemy
units will be marked with a red crosshair.

To fire on an enemy unit which is within range, left-click on it.
Before firing, check you fire mode. You can switch between aimed and snap fire
by pressing the 'F' key on the keyboard. The choice is displayed just below the
second darkened info window.

Whenever an information window is displayed on top of the map, you can right-click to
close it.

Press the 'R' key to give the selected unit a reload order.

When you are done moving your units for this turn, press the 'F1' key.


Keyboard commands
-----------------

        F1 - End turn. Press this key when you have finished moving your units.
         F - Switch primary fire mode.
         R - Reload. Press this key to give a unit the reload order.
         N - Next unit. Selects one of your units which still has move points left.
Arrow keys - Move your view across the map. 
       ESC - Exit the game. The game will exit instantly, no warning is given, so
             do not press this key by mistake!

Bugs
----

Please report any bugs you find to purple@diku.dk.

There is one known bug:

1. When a unit is in a hex which is a least 50% covered by the left border of the
map window, the unit graphic may not be drawn on the map.


Notes on artificial intelligence (AI)
-------------------------------------

As this game is part of an AI project, I should tell you a bit about the system and
the AI techniques involved.

The basic idea here, was to create a flexible AI engine. Instead of writing an AI
program to one specific games, I have tried to create an AI engine that can play
a set of games. The (unlimited number of) games available within this set, follow
the same basic rules. However, the game designer can set up different types
of units, as well as modify some other parameters. That is the reason why there
are two Genetic Warfare games available (called A and B).

To be able to adapt to different game setups, the AI engine has a number of parameters
that can be modified. Some of these are simply numbers, while another is a program
called 'the officer program'. The AI system is two-layered. The officer layer gives
each unit an order to carry out. The soldier layer determines how each unit should
carry out this order exactly. While the officer layer looks at the battlefield in
its entirety, the soldier layer is concerned with its own single unit and its
immediate surroundings.

The number parameters and the officer program are adapted to each game setup
automatically by a program called GenSearch.
Now how does this all work? GenSearch uses something called genetic algorithms,
which is basically a search method. It starts by creating a number of randomly
generated number paramaters and officer programs. It then tests these parameters
by letting the setups play against each other. After some time, the worst setups
are killed, and some new are created by recombining (called crossing over in genetic
terminology) and mutating the numbers and programs. Then the new population is tested
and so on. After X number of hours, this process is stopped by the game designer,
who then picks out the setup to be used in the final game.
Is it magic? No it is just science.


AI cheating
-----------

In a lot of games the AI computer player cheats, by using information not available
to the human player, or by simply being made more lucky than the human player.

So you may ask if this AI system cheats?
Well it does in a very small way. While your units are set up automatically when you
start a new round, the computer player gets to set up its units the way it likes.
Apart from this, there is no cheating on the part of the computer player.


Advertisement
-------------

The animation running at the bottom-right of the screen is a BCS file.
If you are interested in video compression, please visit the BCS homepage:

  http://www.geocities.com/bcompshell