Documentation
LiveGame

LiveGame

⚠️

This page is under construction.

LiveGame is the main class that represents the game's current state.

Public Properties

game

The Game instance

Public Methods

getStorable

Returns the Storable instance

newGame

Starts a new game

  • return this

deserialize

Load a saved game

After calling this method, the current game state will be lost, and the stage will trigger force reset

**Note: **Even if you change just a single line of script, the saved game might not be compatible with the new version

Example:

const savedGame = {
    // ...saved game data
};
 
// use hook inside a component
const {game} = useGame();
 
// pass the saved game data to the game instance
game.getLiveGame().deserialize(savedGame);

serialize

Serialize the current game state

You can use this to save the game state to a file or a database

**Note: **Even if you change just a single line of script, the saved game might not be compatible with the new version