Skip to content

Commit

Permalink
English protocol description improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
conradthukral committed Mar 13, 2013
1 parent 37ac054 commit a9b202c
Showing 1 changed file with 21 additions and 17 deletions.
38 changes: 21 additions & 17 deletions protokoll.en.markdown
Expand Up @@ -3,7 +3,7 @@ Mia protocol

Preliminaries
-------------
- Communication row vise per UDP (utf8-encoded Strings)
- 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)
Expand All @@ -15,16 +15,18 @@ Registration
- client->server: `REGISTER_SPECTATOR;name`

Valid names need to satisfy the following criteria:
- contains no whitespaces
- contains no colon, semicolons, or commas
- consist of up to 20 characters
- no whitespace
- no colons, semicolons, or commas
- up to 20 characters

To receive a positive response (server->client: `REGISTERED`) from the server:
- the name has to be valid and new
- the initial registration for that name originated from the same client IP address
Given a positive response, the server continues its client communication only through the originating IP and the port used for the registration message.
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 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.

When the above criteria are not satisfied, the server negatively responds with server->client: `REJECTED`.

Round start
-----------
Expand All @@ -34,13 +36,14 @@ Round start

If at least one player participates:
- the server shuffles the participating players
- server->clients: `ROUND STARTED;roundnumber;playernames` (wheras `playernames` is a ordered, comma separated list of all participating players. The lists order corresponds to how the round is going to be played.)
- server->clients: `ROUND STARTED;roundnumber;playernames` (where `playernames` 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`


Round actions
-------------
In adherence to the previously announced order:
Expand All @@ -53,11 +56,11 @@ On `ROLL`:
- client->server: `ANNOUNCE;dice';token`
- server->clients: `ANNOUNCED;name;dice`

When Mia is announced, the round ends and dies are shown. Given Mia was indeed rolled, all player but the announcer lose, otherwise the announcer loses.
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` (where `names` is a comma separated list)

On `SEE`:
- Server checks if last announced dies are valid and determines the losing players
- 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`
Expand All @@ -70,12 +73,13 @@ At the end of each round:

Reasons for losing a round
--------------------------
- `SEE_BEFORE_FIRST_ROLL`: Player wanted to `SEE`, but was first to act (no dies were announced before)
- `LIED_ABOUT_MIA`: Player announced Mia without actually having Mia
- `ANNOUNCED_LOSING_DICE`: Player announced dies that were lower than the previously announced ones
- `SEE_BEFORE_FIRST_ROLL`: Player wanted to `SEE`, but was first to act (no dice were announced before)
- `LIED_ABOUT_MIA`: Player announced Mia without actually having rolled Mia
- `ANNOUNCED_LOSING_DICE`: Player announced dice that were lower than the previously announced ones
- `DID_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 turn
- `SEE_FAILED`: Player wanted to `SEE`, but previous player announced dies correctly
- `CAUGHT_BLUFFING`: Player announced higher dies than actually given and the succeeding player wanted to `SEE`
- `SEE_FAILED`: Player wanted to `SEE`, but previous player announced dice correctly
- `CAUGHT_BLUFFING`: Player announced higher dice than actually given and the next player wanted to `SEE`
- `MIA`: Mia was announced

0 comments on commit a9b202c

Please sign in to comment.