Kassle Protocol (Updated 20 April 2010)

Type Direction Payload Description
1 To server
  • 1 byte for name length = n, 0 ≤ n ≤ 255
  • n bytes, one per character, ASCII encoded
Player's name
2 To client No payload Wait, need another player
3 To clients
  • 1 byte = t
  • 1 byte = player number n, 0 or 1
Game on, with a time out value per turn of t seconds. If t=0, then there is no timeout. The receiving client is player n.

Player 0 starts the game, so it is now player 0's turn.

4 To server
  • 1 byte for r, 0 ≤ r < 5
  • 1 byte for c, 0 ≤ c < 5
Player places a piece at row r and column c
5 To server
  • 1 byte b, 0 ≤ b < 5
Player rotates row b left
6 To server
  • 1 byte b, 0 ≤ b < 5
Player rotates row b right
7 To server
  • 1 byte b, 0 ≤ b < 5
Player rotates column b up
8 To server
  • 1 byte b, 0 ≤ b < 5
Player rotates column b down
9 To client No payload False move, still your turn
10 To clients
  • 1 byte p, 0 or 1
  • 25 bytes, each 0, 1, or -1
It is now player p's turn.

Each subsequent byte corresponds to the contents of a board square. Row 0 is transmitted first, from column 0 to column 4. Row 1 is next, and so on. Each byte means the following:

  • -1 means the square is unoccupied
  • 0 means player 0 has a piece on the square
  • 1 means player 1 has a piece on the square
11 To server No payload Request that this client be sent message 10
14 To clients
  • 1 byte p, 0 or 1
  • 1 byte for r, 0 ≤ r < 5
  • 1 byte for c, 0 ≤ c < 5
Player p placed a piece at row r and column c

It is now player (1-p)'s turn.

15 To clients
  • 1 byte p, 0 or 1
  • 1 byte b, 0 ≤ b < 5
Player p rotates row b left

It is now player (1-p)'s turn.

16 To clients
  • 1 byte p, 0 or 1
  • 1 byte b, 0 ≤ b < 5
Player p rotates row b right

It is now player (1-p)'s turn.

17 To clients
  • 1 byte p, 0 or 1
  • 1 byte b, 0 ≤ b < 5
Player p rotates column b up

It is now player (1-p)'s turn.

18 To clients
  • 1 byte p, 0 or 1
  • 1 byte b, 0 ≤ b < 5
Player p rotates column b down

It is now player (1-p)'s turn.

99 To clients
  • 1 byte p, 0 or 1
Player p wins, game over
Timer messages
40 To server 1 byte b, interpreted in seconds:
  • b=0 means no timeout is desired
  • b ≥ 30 means a timeout of at b seconds is desired
The first player can send this message, if desired, but it must be received before the next player joins for it to have any effect. The message specifies the timeout value in seconds that will be enforced during the game. Players failing to provide a successful move with in the specified number of seconds will lose their turn.

A nonvalid value will be interpreted as if 30 seconds were specified, and 30 seconds is the default timeout value if no such message is received.

42 To clients 1 byte p, 0 or 1. Player p's turn is over due to time out. It is now player (1-p)'s turn.
43 To clients No payload Timer expires in 10 seconds
Chat Message
19 To clients
  • 1 byte=m, the number of players
  • For each player from 1 to m:
    • 1 byte=p, the player's number
    • 1 byte=n specifying length of player's name
    • n bytes, one per character, ASCII encoded
This message tells the clients the players' numbers and names. It can be sent at any time.
20 To server
  • 2 bytes=n specifying message length
  • n bytes, one per character, ASCII encoded
The transmitting player wants this message sent to everyone.
21 To clients
  • 1 byte, the player number sending this message
  • 2 bytes=n specifying message length
  • n bytes, one per character, ASCII encoded
The transmitting player wants this message sent to everyone.
22 To server
  • 1 byte=p, the player who should receive this message
  • 2 bytes=n specifying message length
  • n bytes, one per character, ASCII encoded
The transmitting player wants this message sent to player p.
23 To client
  • 1 byte, the player number sending this message
  • 2 bytes=n specifying message length
  • n bytes, one per character, ASCII encoded
The format of this message is identical to message 21, but this message was not broadcast. It was sent only to the receiving player

Dialog