Third programming contest – Receiving commands

Receiving commands

Eveything in angle brackets are placeholders. The NUMBER is an ID of a client/player and must not be negative. In most cases it refers to other players, but sometimes it will refer to the own ID.

For directions the following values are accepted: NORTH, NORTH_WEST, WEST, SOUTH_WEST, SOUTH, SOUTH_EAST, EAST, NORTH_EAST; and additionally NONE for movements only.

The first command from the server to the client will always be the ID of the client that has just connected.

ID <NUMBER>
Sets the own ID after the connection to the server. Without it the client cannot be part of the game. The ID must be acknowledged by the client by sending ID_OKAY or ID_NOT_OKAY (see below). This is the only command that needs a confirmation.
Example: ID 0

PING
Ping from the server to the client. No reaction required. The server will ping the client from time to time so do not be surprised.
Example: PING

CONNECTED <NUMBER>
A new client/player has connected with the NUMBER as ID. The NUMBER must not be the own ID.
Example: CONNECTED 1

DISCONNECTED <NUMBER>
A client/player with the ID NUMBER has left the game. The NUMBER must not be the own ID.
Example: DISCONNECTED 1

DISCONNECT
The client should disconnect itself because the game is over.
Example: DISCONNECT

SEE_PLAYER <X,Y> <VIEW> <NUMBER>
Tells the client which player is seen. X and Y marks the position on the map and must not be negative. VIEW is the direction the player is looking to and must not be NONE. The number must not be the own ID.
Example: SEE_PLAYER 10,4 NORTH_WEST 1

SET <X,Y> <VIEW>
Set the own data of position and viewing direction. The syntax is identical to SEE. The VIEW must not be NONE again.
Example: SET 10,4 NORTH_WEST

TOXIC <X,Y> <VALUE>
VALUE is the toxic value of a field (as double). X and Y mark the position on the map and must not be negative.
Example: TOXIC 10,4 0.2

LIFE <VALUE> <NUMBER>
VALUE is the current life energy (as double) of some player after his movement. Note: The NUMBER can also be the own ID.
Example: LIFE 95.6 0

TEAMCHANGE <TEAM> <NUMBER>
Informs the client that the player with the ID NUMBER has changed to TEAM. Currently there are only teams BLUE and RED. A new player will always begin with BLUE. Note: The NUMBER can also be the own ID.
Example: TEAMCHANGE RED 1

MAP <MAPNAME>
Load a new map with the given filename. The file extension must be .map. The .toxic-file (see below) is not known to you.
Example: MAP /tmp/board1.map

START <ROUND>
The next move should be calculated. The command must be acknowledged by a MOVE command (see below). The acknowledgement has to be made during a 5 second time span. If it comes too late or not at all the player will not move. ROUND is the current round number.
Example: START 10

previous page next page