glTron Networking Protocol
This is the documentation of the gltron networking protocol.
Session Management
A typical session looks like this:
- Client connects to server
- Server acknowledges client and puts client into wait state
- Server sends client all information about the game rules and the
    connected players
- Server puts client into observer state. Client receives
    a snapshot of the game's data (i.e. the game history) and
    all further events related to that game.
- A game has ended. Server puts all clients into wait state.
- Server prepares new game. All participating clients go into
    pre-game state. All the others stay in wait state.
- Server starts new game. All participating clients go in to
    game state. All other clients go into observer state.
Client States
- wait
 The client sits and waits for the server to do something. If information
    is available, the client displays the last game's result and possibly,
    scenes from the action (can you say 'REPLAY'? :-)
- observer
 The client displays the game's progress.
- pre-game
 The client sits and waits for the server to do something.
- game
 The client displays the game's progress and sends user input to
    the server.
Server States
- pre-game
 The server has locked the game#s datastructure. No new players can join 
    this game. The server goes through a countdown sequence before starting the
    game.
- game
 The action takes place here.
- wait
 The game has ended or the server has just started, waiting for new
    players to join. When sufficient players are available, wait a specific
    amount of time and go into pre-game state.
Messages: Server to Client
- Session Events
  
  - Game starts
  
- Game ends
  
- New State assigned
  
- State information
  
 
- Game Events
  
  - A Player Turns left
  
- A Player Turns right
  
- A Player crashes
  
 
- Networking events
  
  - A Player connects
  
- A Player disconnects
  
 
- Misc Events
  
Messages: Client to Server
- Session Events
  
  - Client wants to join game
  
- Client wants to observer game
  
 
- Game Events
  
  - Player wants to turn left
  
- Player wants to turn right
  
 
- Misc Events