Game settings

Game settings change the way the game is initialized. Player count is a setting that all games have. Two player games such as Tic-Tac-Toe always have two players, while some multiple player games like Uno supports between two to four players.

Some games have additional game settings. In Dots and Boxes, there is a Size setting that takes on the values 2x2, 3x3, 7x7, and Any. Bots do not have access to the game settings field because they can be implicitly derived from the game state. In this Dots and Boxes example, the game setting gets converted into the board_width and the board_height fields.

message State {
  // Required field to indicate the player who should be making the next move
  // Values = 0 or 1
  int32 player_turn_idx = 1;

  // The array is stored in row major order, so index 0 is the top left and 
  // last index is the bottom right. In a size 2x2 board, index 1 is the 
  // top right board. 
  repeated Box board = 2;

  // Number of horizontal boxes in the grid
  int32 board_width = 3;

  // Number of vertical boxes in the grid
  int32 board_height = 4;
}

Last updated