As of protocol version &protonum;, the following messages are defined.

Four types of data are exchanged between the client and the server:

- char: a 1-byte signed char.

- int: a 4-byte signed integer in network byte order.

- string: a multibyte null-terminated string preceded by its length (including null-termination) as an integer.

- varying: data format depends on the message type.

Interactions take one of three forms: server messages, client requests, and server responses. Each interaction is prefaced by an opcode identifying it (some interactions consist solely of the opcode). The opcode (stored as an enumerated value) is sent as an int. A minor opcode sometimes follows it.

# Client to server messages

These messages are sent by the client to the server. This section does not cover responses to messages generated by the server, since those are valid in both direction. Instead, messages generated by the client on its own are documented here.

OP_MOVE

OP_MOVE

Client moved character

## Synopsis

OP_MOVE [gen] [direction]
Data | Type | Example
gen | int | ...
direction | int | MOVE_UP MOVE_DOWN MOVE_LEFT MOVE_RIGHT

### Description

Client moved character

#### Message Data

gen

- Message counter.

direction

- The direction of the move.

#### Usage

Whenever a player moves on the map.

OP_ACTION

OP_ACTION

Client initiated some action

## Synopsis

OP_ACTION [action]
Data | Type | Example
action | int | ACTION_NEWBOMB

### Description

Client initiated some action

#### Message Data

action

- The action in question which was initiated by the player.

#### Usage

Whenever a player sets up a bomb or does similar work.

## Server to client messages

This section covers both broadcasts of player input messages and independent server messages which can occur at any time.

server.OP_MOVE

server.OP_MOVE

Broadcast of character move by client

## Synopsis

server.OP_MOVE [gen] [type] [id] [direction]
Data | Type | Example
gen | int | ...
id | int | ...
type | int | MOVE_PLAYER MOVE_MONSTER
direction | int | MOVE_UP MOVE_DOWN MOVE_LEFT MOVE_RIGHT

### Description

Broadcast of character move by client

#### Message Data

gen

- Message counter.

id

- ID of the player of origin.

type

- Can be either of move_player or move_monster.

direction

- The direction of the move.

#### Usage

The server sends this message whenever it receives a valid player move, and whenever a monster has been moved.

server.OP_CHEAT

server.OP_CHEAT

Player ban notification

## Synopsis

server.OP_CHEAT

### Description

Player ban notification

#### Usage

If a player tries to cheat or a game client runs snafu, it will be detected by the server. The offending player receives this message immediately, while all other players get notified of this ban via server.OP_ACTION.

server.OP_ACTION

server.OP_ACTION

Events of any kind

## Synopsis

server.OP_ACTION [minor] [data...]
Data | Type | Example
minor | int | ACTION_NEWPLAYER ACTION_NEWMONSTER ACTION_NEWITEM ACTION_NEWEXIT ACTION_NEWBLAST ACTION_NEWBOMB ACTION_ITEM ACTION_REMOVEPLAYER ACTION_REMOVEMONSTER ACTION_REMOVEITEM ACTION_REMOVEBOMB ACTION_REMOVEBLAST ACTION_ACTIVATEITEM ACTION_ACTIVATEEXIT ACTION_HIGHLIGHTITEM ACTION_HIGHLIGHTEXIT
data | varying | ...

### Description

Events of any kind

#### Message Data

minor

- Minor opcode for further determining the event.

data

- Event-specific data, outlined below.

#### Data formats

Data | Type | Example
ACTION_NEWPLAYER
player | int | ...
x | int | ...
y | int | ...
ACTION_NEWMONSTER
id | int | ...
x | int | ...
y | int | ...
ACTION_NEWITEM
type | int | ...
id | int | ...
x | int | ...
y | int | ...
ACTION_NEWEXIT
x | int | ...
y | int | ...
ACTION_NEWBOMB
type | int | ...
id | int | ...
x | int | ...
y | int | ...
ACTION_NEWBLAST
id | int | ...
x | int | ...
y | int | ...
ACTION_ITEM
id | int | ...
type | int | ...
change | int | ...
ACTION_REMOVEPLAYER
id | int | ...
ACTION_REMOVEMONSTER
id | int | ...
ACTION_REMOVEBOMB
id | int | ...
ACTION_REMOVEBLAST
id | int | ...
ACTION_REMOVEITEM
id | int | ...
ACTION_ACTIVATEITEM
id | int | ...
ACTION_HIGHLIGHTITEM
id | int | ...
ACTION_ACTIVATEEXIT
(none) |  |
ACTION_HIGHLIGHTEXIT
(none) |  |

#### Usage

All events such as map changes, player actions, item activations and so on are announced with this message.

server.OP_STATE

server.OP_STATE

Game state changes

## Synopsis

server.OP_STATE [state]
Data | Type | Example
state | int | STATE_START STATE_STOP

### Description

Game state changes

#### Message Data

state

- The new game state.

#### Usage

The game isn't started before all requirements are in place, and might be stopped anytime such a requirement is not fulfilled anymore. Requirements include the correct player configuration and a running game.

## Game message in both directions

The messages present in this section exist in two formats: sent by the client, and sent by the server. One of those is a request while the other one is a response to it. Currently, this kind of messages is not used during the gameplay itself.

OP_RULES

OP_RULES

Client selected a rule set

## Synopsis

OP_RULES [custom] [rulesetting...]
Data | Type | Example
custom | int | 0/1
rulesetting | int | ...

### Description

Client selected a rule set.

#### Message Data

custom

- Custom rules have been selected as opposed to default rules.

rulesetting

- This multi-value field defines each aspect of the rule set.

#### Usage

At the beginning of the game, when the rules have not been set yet, and before the actual gameplay starts, the client may transmit the rules to the server. Once the game starts, the same message is then broadcasted to all participating clients.

OP_MAP

OP_MAP

Client sent a map of choice

## Synopsis

OP_MAP [minor] [mapname] [numplayers]
Data | Type | Example
minor | int | MAP_SELECT MAP_SELECTED
mapname | string | ...
numplayers | int | ...

### Description

Client sent a map of choice.

#### Message Data

minor

- Minor opcode distinguishing all OP_MAP messages. Can be MAP_SELECTED in this case, meaning a map has been selected for the game, or MAP_SELECT (sent by server), meaning a map should be selected.

mapname

- The name of the chosen map (level). Only sent with MAP_SELECTED, not with MAP_SELECT.

numplayers

- Number of players expected to play with.

#### Usage

Similar to OP_RULES, this message is sent by the game host (usually the first player) to the server, and then broadcasted at the start of the game. Contrary to it however, the message is only sent after having received an OP_RULES with MAP_SELECT first. This message omits the mapname parameter.