Data structure recipe

Every game should have its own structure. Depending on the kind of game, you may need more items to describe it, a different hierarchy, and so on.

The following recipe shows a simple data structure for a turn-based game so it’s easy to understand.

Game Data Structure

Every game should have its own game data structure, because every game needs different items to describe a game.

    // ‘user1’: gamedonia_id_of_user1
    '1': 55448343d3655,
    '2': 33129821c1233
  'status': 'running',
  'currentturn': 3,
  'currentuser': '1',
  'movements': {
    '1': {‘user’: 55448343d3655, ‘position’:[0,0]},
    '2': {‘user’: 33129821c1233, ‘position’:[0,1]}

Hint: To reduce the data transfer load you may want to simplify the description of the keys in the key-value; structure of the game. For instance change, ‘users’ for ‘u’, ‘status’ for ‘s’, ‘currentturn’ for ‘ct’, ‘currentuser’ for ‘cu’, ‘movements’ for ‘m’, ‘position’ for ‘p’.