Skip to content
This repository has been archived by the owner on Sep 28, 2023. It is now read-only.

Game Data #19

Open
Maelstromeous opened this issue Aug 16, 2021 · 0 comments
Open

Game Data #19

Maelstromeous opened this issue Aug 16, 2021 · 0 comments
Assignees
Labels
documentation Improvements or additions to documentation

Comments

@Maelstromeous
Copy link
Owner

Maelstromeous commented Aug 16, 2021

Proper thought needs to be applied to the game data / state. This needs to be a highly portable body of data in order to syncronise with clients quickly and efficently.

Data objects can be kept small by ensuring that card data (the text within the cards themeselves) is kept seperate from game data.

Full Game state

A lite version will be made available for the homepage game list. This is the full fat version.

 {
    "id": "magnum-detroit",
    "name": "Pigs DO fly!",
    "status": "playing",
    "locked": true, // Server still maintains authority on this. It will ignore the client when checking they can join the game.
    "validToJoin": true, // Denotes whether the game is accessible from the server itself to render for the client. Note the server has authority, it will ignore the client when joining the game.
    "roundCount": 1, // How many rounds this game has played

    "people": {  // Expanded array of player objects without their sessionIds
      "host": {
        "id": "UUID4",
        "name": "Maelstromeous",
        "score": 1,
        "ready": true // Denotes if the player has all cards loaded etc, reported from the client
        "chosenCard": "UUID4", // Player's card choice, if they have one yet
      },
      "players": [{
        "id": "UUID4",
        "name": "SomeAwesomeDude",
        "score": 2,
        "ready": true,
        "chosenCard": "UUID4",
      }],
      "spectators": [{}]
    },

    "options": {
      "gameType": "tsar", // Denotes game's type, quite important
      "scoreToWin": 5,
      "maxPlayers": 6, // Impose hard limit?
      "maxSpectators": 10, // Impose hard limit?
      "packs": [123, 1234, 12345] // Packs enabled for the game
      "chatEnabled": true,
      "roundTimer": 30, // Seconds to give players to make choices before random selection
      "idleTimer": 120 // Seconds before booting players from the session
    },

    "typeSpecificData": { // Made this mode specific as it depends on game type. Signifies who's the tsar.
      "tsar": {
        "currentTsar": "Player3 UUID",
        "previousTsars": [ // The updating of this has to be done carefully, otherwise a player might have tsar multiple times.
          "Player1 UUID",
          "Player2 UUID",
          "Player3 UUID"
        ],
        "nextTsar": "Player4 UUID"
      }
    },

    "cards": { // Holds state of cards in play, this'll be a bit tricky. Card text etc will be exposed via API calls
      "black": {
        "id": "UUID4"
      },
      "white": [{
        "player1 UUID": {
          "cards": ["UUID4", "UUID4"] // Array of 10 cards
        }
      }]
    },

    "serverSide": { // Details not to be exposed to the client to prevent cheating etc, could be done at API level rather than an object like this.
      "gamePassword": "foobar", // Stored as a hash obvs
      "bannedPlayers": [], // List of player IDs who are banned from the game
      "cards": {
        "played": { // List of card IDs already played so the server doesn't give players the same cards
          "white": ["UUID4"],
          "black": ["UUID4"]
        }
      }
    },
  }

Lite Game Data

Bare minimum needed to render the homepage, this will be requested via an API call with a certain flag.

{
          id: 'shark-tale',
          name: 'A medium game',
          status: 'lobby',
          locked: true,
          validToJoin: true,
          people: {
            host: {
              name: "Warcore"
            },
            players: [
              {name: "SomeAwesomeDude"},
              {name: "SomeAnnoyingDude"},
              {name: "A lady in red"},
              {name: "A dude in blue"},
              {name: "A gentlemen in blue"},
            ]
          },
          options: {
            pointsToWin: 5,
            maxPlayers: 7,
          },
          winConditions: {
            type: 'tsar',
          }
},

Player Data

{
    "id": "UUID4",
    "name": "Maelstromeous",
    "sessionId": "somerandomcookiestring",
}

Card Pack data

{
    "id": 123,
    "name": "PAX Prime 2014",
    "official": true
}

White card data

{
    "id": "UUID4",
    "type": "white",
    "text": "ADVENTURE!",
    "pack": 123
},

Black card data

Note here there's an extra pick attribute.

{
    "id": "UUID4",
    "type": "black",
    "text": "Aww babe, your burps smell like _!",
    "pick": 1, // Max 3?
    "pack": 123
}
@Maelstromeous Maelstromeous added the documentation Improvements or additions to documentation label Aug 16, 2021
@Maelstromeous Maelstromeous self-assigned this Aug 16, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

1 participant