Authorization and player data

You can:

  • Save game data (completed levels, experience, in-app purchases, etc.) on the Yandex server using SDK methods or transfer it to your own server. Cloud saves allow users to continue playing on different devices.
  • Personalize the game using data from the user's Yandex profile, such as their name.

Player information

To start working with player data, use the Fetch player info action together with the trigger conditions Player info is successfully fetched and Failure to fetch player info.

To get player data use:

  • Player is authorized condition: Checks if the player is authorized in Yandex.
  • Player personal info access granted condition: Checks if the player's personal data has been obtained.
  • Player signature expression: A string containing user data from the Yandex profile and a signature. Consists of two strings encoded in Base64 format.
  • Player avatar expression: A string, link to the player's avatar.
  • Player name expression: A string, the player's name.
  • Player paying status expression: A string, the user's payment activity status on the platform.
  • Player unique id expression: A string, the player's unique identifier.

Screenshot of Construct 3: the screen for setting up user data using the YandexGamesSDK plugin. A table with three columns (each cell in the third column has the buttons "+ Add action" and "+ Add...") and 4 rows. Row 1 — "System", "Run once", "Yan… | Request player information. Personal data: False". Row 2 — "YandexGames…", "Player info loaded", the last cell is empty. Row 3 — "YandexGames…", "Player granted access to personal data", the settings icon "Sys... | Set username to YandexGamesSDK.Player name". Row 4 — "YandexGames…", "Error loading player info", the settings icon "Sys... | Set username to "Anonymous user"".

In-game data

To work with the user's in-game data, use the actions:

  • Get player data — requests the user's in-game data and writes it to a JSON object.
  • Set player data — sends the user's in-game data from a JSON object to Yandex Games.
  • Get player stats — requests the user's numerical data and writes it to a JSON object.
  • Set player stats — sends the user's numerical data from a JSON object to Yandex Games.
  • Increment player stats — increases the user's numerical data by the specified value.

Screenshot of Construct 3: the screen for setting up user data using the YandexGamesSDK plugin. Green label "Global number GameProgress = 0". Below is a table with three columns and two rows. Row 1 — "Function Load game", "YandexGamesSDK" and in the next two rows the settings icon "System"", "Get player data from keys "" and save to ( PlayerDataJSON., ", "Wait for previous actions to complete", "Set GameProgress to int(PlayerDataJSON.Get("levelprogress"))". Row 2 — "Function Save game", "PlayerDataJSON, YandexGamesSDK", "Set key "levelprogress" to GameProgress, Save player data using) PlayerDataJSON. Flush: True."

Warning

All these actions are asynchronous, and their execution takes some time. To avoid errors, use the action Wait for previous actions.


Repository