# games.atplay.game.state

> Published by [atplay.games](https://lexicon.garden/identity/did:plc:xawtkr77srkxlwhxjf7whbml)

✓ This is the authoritative definition for this NSID.

## Links

- [View on Lexicon Garden](https://lexicon.garden/lexicon/did:plc:xawtkr77srkxlwhxjf7whbml/games.atplay.game.state)
- [Documentation](https://lexicon.garden/lexicon/did:plc:xawtkr77srkxlwhxjf7whbml/games.atplay.game.state/docs)
- [Examples](https://lexicon.garden/lexicon/did:plc:xawtkr77srkxlwhxjf7whbml/games.atplay.game.state/examples)

## Definitions

### `games.atplay.game.state`

**Type**: `object`

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

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `shared` | `object` | No | The state of shared aspects of the game (eg. a board) |
| `transient` | `array` | No | 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` | `array` | No | Per-player state of the game (eg. a player's secret hand, a player's piece colour/token) |
| `declarations` | `array` | No | 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). |

## Raw Schema

```json
{
  "id": "games.atplay.game.state",
  "defs": {
    "main": {
      "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"
    }
  },
  "$type": "com.atproto.lexicon.schema",
  "lexicon": 1
}
```
