games.atplay.game.state

atplay.games

Documentation

The state of a game at a moment in time. Managed and interpreted entirely by a given game's logic blob

main object

The state of a game at a moment in time. Managed and interpreted entirely by a given game's logic blob

Properties

declarations array of object Optional

Declarations about the game and/or players. Used for declaring the end of the game (and the winner(s)/loser(s)). *All* applicable declarations should be applied whenever they're applicable (eg. in a simple game, a game.end declaration should be present in addition to a result.win and a result.loss).

individual array of object Optional

Per-player state of the game (eg. a player's secret hand, a player's piece colour/token)

shared object Optional

The state of shared aspects of the game (eg. a board)

transient array of union Optional

Per-player short-lived information needed to perform and validate calculations within the game (eg. agreeing on what card is drawn from the deck next). Per-player means 'for the attention of' that player (not 'produced by' that player).

View raw schema
{
  "type": "object",
  "properties": {
    "shared": {
      "type": "object",
      "properties": {},
      "description": "The state of shared aspects of the game (eg. a board)"
    },
    "transient": {
      "type": "array",
      "items": {
        "refs": [
          "games.atplay.game.calculation"
        ],
        "type": "union"
      },
      "description": "Per-player short-lived information needed to perform and validate calculations within the game (eg. agreeing on what card is drawn from the deck next). Per-player means 'for the attention of' that player (not 'produced by' that player)."
    },
    "individual": {
      "type": "array",
      "items": {
        "type": "object",
        "required": [
          "player"
        ],
        "properties": {
          "active": {
            "type": "boolean",
            "default": false,
            "description": "Whether this player can take actions on top of this state. In turn-based games, this will be true for the player whose turn it is."
          },
          "player": {
            "type": "string",
            "format": "did"
          }
        }
      },
      "description": "Per-player state of the game (eg. a player's secret hand, a player's piece colour/token)"
    },
    "declarations": {
      "type": "array",
      "items": {
        "type": "object",
        "required": [
          "kind"
        ],
        "properties": {
          "kind": {
            "type": "string",
            "maxLength": 128,
            "minLength": 1,
            "description": "The record's creator is declaring that they believe the associated player (or the game) must be described in this way (eg. a won/loss, resignation; also things like check in chess). Use the known values where reasonable (eg. chess' checkmate would be a result.win/result.loss, but check would need it's own value)",
            "knownValues": [
              "games.atplay.result.win",
              "games.atplay.result.loss",
              "games.atplay.result.draw",
              "games.atplay.result.resignation",
              "games.atplay.game.end"
            ]
          },
          "player": {
            "type": "string",
            "format": "did",
            "description": "The player to which this declaration applies. May be empty if the declaration is about the game, rather than a player."
          }
        }
      },
      "description": "Declarations about the game and/or players. Used for declaring the end of the game (and the winner(s)/loser(s)). *All* applicable declarations should be applied whenever they're applicable (eg. in a simple game, a game.end declaration should be present in addition to a result.win and a result.loss)."
    }
  },
  "description": "The state of a game at a moment in time. Managed and interpreted entirely by a given game's logic blob"
}

Lexicon Garden

@