Skip to main content

Player manager

The manager rules over the player state and his synchronization with the server. After SDK initialization, there starts the process of player’s synchronization with the server. Upon completion, the ready event will be called.


Player manager properties FREE:

// The player is logged in
// The player uses one of the login methods (authorization, secret code)
// Player waiting promise

The player is initialized automatically; you can wait for readiness:

await gp.player.ready;
// The player is ready

// The player is ready
gp.player.on('ready', () => {});


+1 Request

After player model changes, they can be sent to the server and saved locally on the device. It is recommended to sync the player after completing a level and receiving rewards, as well as immediately after an important action, for example, purchasing an item.

// Synchronize, returns the promise
// Overwrite the character on the server (local in priority)
gp.player.sync({ override: true });

// The player is synchronized (success === true)
gp.player.on('sync', (success) => {});

Storage limit: no more than 1 MB per player.


+1 Request

You can load the player by force from the server (by overwriting the local one).

// Load, returns the promise

// The player is loaded (success === true)
gp.player.on('load', (success) => {});


+0-1 Request

Show the overlay with login options. This is currently the platform login (if it is supported) and login by secret code.

// Login, returns the promise

// The player is logged in (success === true)
gp.player.on('login', (success) => {});


+0-1 Request

Logout player. If supported logout on platform.

// Logout, returns the promise

// The player is logged in (success === true)
gp.player.on('logout', (success) => {});

Fetching the fields

+1 Request

See below what player fields are.
You can fetch the player fields using the following method:

// Fetch fields list, returns the promise

// Fields are fetched (success === true)
gp.player.on('fetchFields', (success) => {});

Notification of other windows


If the player opens another window with the game at the same time as the other open windows of the game - all other windows will receive event:connect. You can subscribe to it like this:

// will be triggered when the player opens another window with the game
gp.on('event:connect', () => {});

Stay in Touch

Other documents of this chapter available Here. To get started, welcome to the Tutorials chapter.

GamePush Community Telegram: @gs_community.

For your suggestions e-mail: [email protected]

We Wish you Success!