Backend Account Linking

Guidlines and expected behavior of the database account linking in the game backend.

Linking accounts and user progress in the game backend will always be unique for each game. Here, Pley provides what behavior is expected.


This process begins when the web game starts with a link_code.

1) The game backend has a link_code mapped to a mobile game user (from QR or game UI code).

2) The game backend receives the same link_code from a web game user (from web game account linking).

3) Verify that the two accounts are not already connected. If they already are linked to each other, simply return to the web game client that account linking is completed (step 7). If one of the two is account-linked, continue anyway.

Here, you either automatically resolve the account linking using logic, or let the player choose which progress to keep.


Automatically resolving with Logic

4) Set a progress threshold. This should be some progress data that represents a maximum of 5-15 minutes of gameplay, such as level, experience, or #missions completed.

5) Compare the progress of both accounts. Check which user (web or mobile) has lower progress. If the lower-progress user is above the progress threshold, return an error to the client, and stop account linking.

6) Map the lower-progress user to the higher-progress user.

7) (Optional but preferable) Keep the now-deleted user progress around by changing the ID with a specific marker so it is recoverable in case of an error. Example: GameUserID --> GameUserID_deleted.

8) Inform the web game client that account linking is Ok (if an error occurred in step 5, instead return that it failed). Web game client will then call Pley.ConnectionKit.SetAccountLinkResult with the response (read more).

πŸ“˜

What is the Progress Threshold?

There should be a maximum progress threshold for overwriting users - a safeguard against users deleting valuable progress accidentally. We recommend using a specific value to measure progress, such as game level or #missions completed. What value to use will be unique depending on your game.

Web User: Level 8
Mobile User: Level 2
Threshold: Level 3

In this case, the mobile user is the lower-progress user. Therefore, if it is below the progress threshold, it will be deleted and become mapped to the web user progress.

Web User: Level 8
Mobile User: Mapped to Web User
Mobile User_deleted: Level 2

If the Mobile User is level 4 (too high for the threshold), return an error and do not link the accounts.

🚧

How to decide Progress Threshold?

Pick a progress value appropriate for your game (like "Level #" or "Mission #").
Pick a value that represents ~5-15 minutes of gameplay.

This prevents meaningful progress from being lost for the user but works perfectly for an overwhelming percentage of users linking accounts. Pley's interface also makes it difficult for users to accidentally delete progress, but the threshold is a final safety to prevent unintended progress loss.

Progress Data<- Mobile Game User<- Pley Game User ID
currentProgress13.savUser13xxxxx-xxxx-xxxx-xxxxxxxxxx
currentProgress14.savUser14yyyyy-yyyy-yyyy-yyyyyyyy

If Pley Game User xxxxx-xxxx-xxxx-xxxxxxxxxx connects to the game, they'll be authenticated as User13. The game then starts with the progress of User2193113 (in this example currentProgress13.sav).


Resolve Account Linking with UI

Instead of automatically resolving the account linking, you can instead let the user decide.

4) In the web game, show the conflict resolution screen.

Example from Homesteads: Dream Farm

Example from Homesteads: Dream Farm

5) User selects which progress to keep. Link the two accounts.

6) Inform the web game client that account linking is Ok (if an error occurred in step 5, instead return that it failed). Web game client will then call Pley.ConnectionKit.SetAccountLinkResult with the response (read more).