Project Fairdice
[Home] [Docs] [Users] [Gaming] [Crypto] [Devel] [Download] [Help]

Fairdice Protocol v0.3 : Game Specific : Host-Server

[Definition]
GAME_MESSAGE = "G " GAME_STR " | P " PROTOCOL_STR
GAME_STR = GAME_ID
; this identifies the particular game instance being played
PROTOCOL_STR = GAME_INIT | GAME_RAND | GAME_GENR | GAME_VERI
; these stages must be played in order, each sequence (except RAND) happening once.
See also basic definitions and the definitions section of Game_CS.
Stage Initiator Description
GAME_INIT Host Initialise the game.
GAME_RAND Server A player asks to be allowed to play
GAME_GENR Varies When LIMIT is reached, generate the output
GAME_VERI Host Once we decide to announce the output, let clients verify it is fair

Stage : Initialisation

[Definition]
GAME_INIT = INIT_OPENING | INIT_OPENED | INIT_MODULO | INIT_LIMIT
INIT_OPENING = "opening"
INIT_OPENED = "opened"
INIT_MODULO = "modulo " MODULO
INIT_LIMIT = "limit " ( ("time " TIMESTAMP) | ("size " SMALLINT) | "host" )

[Sequence]
There is one general sequence.
  1. host to server : INIT_OPENING
  2. host to server : INIT_LIMIT
  3. host to server : INIT_MODULO
  4. server to host : INIT_OPENED
However step 2 may be repeated if limits on both size and starting time are required (in which case the game start as soon as either limit is met).

The host limit means that the host will tell the server when to start.

Stage : Randomisation

(The host's randomisation stage actually coincides with the player's initialisation stage.)
[Definition]
GAME_RAND = RAND_REQUEST | RAND_RESPONSE
RAND_REQUEST = "join request " USER_NAME
RAND_RESPONSE = "join respond " JOIN_ANSWER " " USER_NAME
JOIN_ANSWER = "yes" | "no"

[Sequence]
There is one valid sequences.
  1. server to host : RAND_REQUEST
  2. host to server : RAND_RESPONSE

Stage : Generation

[Definition]
GAME_GENR = GENR_START | GENR_SIZE | GENR_OUTCOME
GENR_START = "start"
GENR_SIZE = "size " GAME_SIZE
GENR_OUTCOME = "outcome " OUTCOME

[Sequence]
There are two valid sequences.
  1. host to server : GENR_START
  2. server to host : GENR_SIZE
  3. server to host : GENR_OUTCOME
or
  1. server to host : GENR_SIZE
  2. server to host : GENR_OUTCOME
Depending on whether the game not allowing any new players was initiated by the host, or by a time or size limit.

Stage : Verification

[Definition]
GAME_VERI = VERI_ANNOUNCE | VERI_FINISH | VERI_CLOSING | VERI_CLOSED
VERI_ANNOUNCE = "announce"
VERI_FINISH = "finish " ( "fair" | ("fail " DISPLAY_STR) | ("fraud " DISPLAY_STR) )
VERI_CLOSING = "closing"
VERI_CLOSED = "closed"

[Sequence]
There is one valid sequence.
  1. host to server : VERI_ANNOUNCE
  2. server to host : VERI_FINISH
  3. server to host : VERI_CLOSING
  4. host to server : VERI_CLOSED
however be aware:

Either side can send VERI_CLOSING at any stage of a game. If it is sent before stage VERI, it cancels the game, triggering a VERI_FINISH (fail) being sent to everyone.

VERI_FINISH can, thus, also be sent out of order.


(
TOP)(UP)