- Client and server communicate via UDP (using UTF-8 encoded strings)
- Server opens a known port
- Clients register themselves as player and are -- from then on -- notified for each round
- Clients have to respond within in a narrow time frame (250 ms)
- Alternatively a client could register as a spectator. Spectators are not able to actively participate in the game. Yet they will receive all messages every other client would receive
- client->server:
REGISTER;name
- client->server:
REGISTER_SPECTATOR;name
Valid names need to satisfy the following criteria:
- no whitespace
- no colons, semicolons, or commas
- up to 20 characters
The server accepts the registration (server->client: REGISTERED
) if the name is valid and either
- a new client registers for the first time, or
- an existing client re-registers from the same client IP as before (but possibly with a different port; see below).
In case of a successful registration all spectators will be sent the latest score, 0 scores included:
- server->spectators:
SCORE;playerpoints*
(see below)
In all other cases, the server rejects the registration request (server->client: REJECTED
).
After a successful registration, the server will send messages to the client using the IP and the port from which the registration message was sent.
- client->server:
UNREGISTER
- server->client:
UNREGISTERED
Every 2 seconds each client will be sent a "heartbeat" signal from the server, so that it can react when the server (or the communication) dies:
- server->client:
HEARTBEAT
- server->clients:
ROUND STARTING;token
- client->server:
JOIN;token
If at least one player participates:
- the server shuffles the participating players
- server->clients:
ROUND STARTED;roundnumber;playernames
(whereplayernames
is a ordered, comma separated list of all participating players. The lists order corresponds to how the round is going to be played.)
Else:
- server->clients:
ROUND CANCELED;NO_PLAYERS
(a new round is started immediately)
Rounds with just one player are canceled right after their start: ROUND CANCELED;ONLY_ONE_PLAYER
In adherence to the previously announced order:
- server->client:
YOUR TURN;token
- client->server:
command;token
(wherecommand
has to be eitherROLL
orSEE
)
On ROLL
:
- server->clients:
PLAYER ROLLS;name
- server->client:
ROLLED;dice;token
- client->server:
ANNOUNCE;dice';token
- server->clients:
ANNOUNCED;name;dice
When Mia is announced, the round ends and the dice are shown. Given Mia was indeed rolled, all players but the announcer lose, otherwise the announcer loses.
- server -> clients:
PLAYER LOST;names;reason
(wherenames
is a comma separated list)
On SEE
:
- Server checks if last announced dice are valid and determines the losing players
- server->clients:
PLAYER WANTS TO SEE;name
- server->clients:
ACTUAL DICE;dice
- server->clients:
PLAYER LOST;name;reason
Whenever a players does not respond in time or does something wrong:
- server->clients:
PLAYER LOST;name;reason
Every player that has NOT LOST gets a point added to their score.
At the end of each round:
- server->clients:
SCORE;playerpoints
(whereplayerpoints
is a comma separated list with entries in the form ofname:points
)
SEE_BEFORE_FIRST_ROLL
: Player wanted toSEE
, but was first to act (no dice were announced before)LIED_ABOUT_MIA
: Player announced Mia without actually having rolled MiaANNOUNCED_LOSING_DICE
: Player announced dice that were lower than the previously announced onesDID_NOT_ANNOUNCE
: Player did not announce (in time)DID_NOT_TAKE_TURN
: Player did not announce turn (in time)INVALID_TURN
: Player commanded an invalid turnSEE_FAILED
: Player wanted toSEE
, but previous player announced dice correctlyCAUGHT_BLUFFING
: Player announced higher dice than actually given and the next player wanted toSEE
MIA
: Mia was announced