Lesson 7 - Saving and loading games

In this chapter we will learn how to Save and Load a game.

Saving a game

Every doStoreState that you make in the game is transferred to the entire set of users, and is saved in the server state as ServerEntries.
when the users choose to save the game, what happens is that the server state is saved into our database,there is no callback for this event.

Loading a game

The only difference between loading a game and starting a new game is in the gotMatchStarted callback.
Consider the serverEntries parameter in gotMatchStarted.
When starting a new game this parameter is an empty array because the state of the game is empty.
When loading a saved game, the array will contain the entire state of the game, i.e., all the state that was previously sent using doStoreState.