Skip to content
Phrogz edited this page Oct 28, 2011 · 5 revisions

THIS PAGE IS OUTDATED BRAINSTORMING; IT HAS NOT YET BEEN UPDATED TO CURRENT THINKING

Because putting Things in CapitalLetters and CamelCase makes them Official.

    • A Game is a contest between n specific Players.
    • A Game has a current State.

    • The GameServer knows about many different GameTypes.

    • A GameType has a nice name.
  • A GameType has a unique identifier (string, for identifying).
  • A GameType specifies how many players are allowed in a Game.
  • A GameType knows how to serialize the State of a Game.
    • The State of a Game includes not only things like board state, but also score and stats.
  • A GameType knows how to serialize the Public State of a Game.
      • This is the subset of State information sent to Players.
  • A GameType knows how to determine which Player gets the next Move in a Game.
      • Some games/rules might have a player skip a turn.
  • A GameType knows how to deserialize a Move.
  • A GameType knows how to validate a Move for legality.
  • A GameType knows how to mutate the State of a Game based on a Move.
  • A GameType knows how to determine if a Game is finished.
  • A GameType knows how to provide a final Score for each Player in a Game.

  • The GameServer keeps track of multiple concurrent Games.
  • The GameServer is responsible for storing and retrieving Game States.
    • A Player should be able to break the connection to the server and then rejoin an existing game.
  • The GameServer accepts a Turn from a Player.
  • The GameServer is responsible for communicating between Players and a GameType about a Game.
    • Or more likely, a GameType is a class and a Game is an instance of that class, and so communication is made directly with a game instance.
  • A Turn combines a Game Move with Game and Player identifiers.
  • The GameServer is responsible for verifying that a Turn made by a Player was actually sent by that Player, and the Player is part of the described Game.
  • The GameServer is responsible for feeding Moves by Players to the GameType in the order it requests them.

  • The GameServer is eventually responsible for clearing out old games.
  • The GameServer keeps track of player and game statistics.

  • The client API knows how to talk to the GameServer for a Player.
    • (e.g. communicating with whatever unique identifiers and security are required for verification)
  • The client API facilitates in parsing GameServer responses (e.g. raising errors based on JSON).
  • The client API helps set up a Game (e.g. callbacks for when the game is on, when its your turn, asking for the game state)

Clone this wiki locally