Third programming contest – Game cycle

General information about the commands

All commands have to end with a pipe symbol |, e.g. MOVE NORTH NORTH_WEST|. The commands are not allowed to have any line feeds like \n or \r.

It is possible and will probably happen that there are several commands inside one received string, e. g. LIFE 99.7 1|TOXIC 5,3 0.1|. You need to separate these commands by the pipe symbol | and interpret them separately.

If the buffer size is too small it is also possible that one command is separately sent in two packages. For instance, the first received string could be LIFE 99.7 1|TOXIC 5,3 0 and the next .1|. So you need to create a buffer for such occurences.

Game cycle

Using the language above the initialization of the game is the following:

  1. The server starts and waits for clients.
  2. A new client connects to the server.
  3. The server sends a new ID to the client, e.g. ID 0.
  4. The client needs to accept the ID via ID_OKAY.

If enough clients have connected the game starts. First the client will receive the map that should be loaded: MAP /tmp/contest.map. After this command your bot will have about 5 seconds time to prepare the map for later calculations.

Because you do not know the place of the .toxic-file, you cannot load it. Further it is not recommended to store the toxic values for a later game, because it is possible that the .toxic-file changes and the .map-file stays the same.

After this each round is the same:

  1. The server sends the current game data (see below).
  2. Each client receives the start command and the current round, e. g. START 4. The bots will have up to 5 seconds to calculate a movement and send it back to the server via MOVE EAST SOUTH_WEST.
  3. When all clients have moved the engine will calculate the new positions, the new life energy and possible team changes.

The server will send the following game data every time:

  1. Your own position via SET 4,3 NORTH.
  2. The position of other visible players, e. g. SEE_PLAYER 10,1 NORTH.
  3. The life energy of the player: LIFE 99.7 1.
  4. The toxic value of a field via TOXIC 4,3 0.06.
  5. All occuring team changes in this round after movement, e. g. TEAMCHANGE 3 BLUE.
previous page next page