question

Le Giang Anh avatar image
Le Giang Anh asked

Best way to reset all players' data?

Hi,

We are going to finish the alpha stage and will need to reset all data of the players before we launch the game. So players will start the game with tutorial phase at level 1.

We haven't found any solution on the documents. Could you please guide us?

Player DataPlayer Inventorygame manager
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

JayZuo avatar image
JayZuo answered

One possible solution would be deleting these players' account with https://api.playfab.com/documentation/server/method/DeleteUsers. This will will unlink all accounts and remove all PII information, as well as reset any statistics and leaderboards and clear out any stored custom data for the user.

Another way for your scenario would be creating a new title and migrating all of your Title wide settings/data over to the new title. For more details, please see Best practice for resetting a user/player account.

2 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Le Giang Anh avatar image Le Giang Anh commented ·

So the first approach will eventually delete that user from publisher ID while the second one will not?

0 Likes 0 ·
brendan avatar image brendan ♦♦ Le Giang Anh commented ·

In the second approach, you'd be creating a new title, so none of the existing title-level player information would exist in it.

Using the Server API to delete all users would clear their title-level data. You could do this via a Scheduled Task that calls a Cloud Script that deletes the currentPlayerId, and yes, it would delete all players (with the time being dependent upon how many player accounts you have). Please note that this would not be a GDPR-compliant delete, however.

0 Likes 0 ·
dbubalo1987 avatar image
dbubalo1987 answered

Hi,

an easier, and in my opinion better way, is to Create a new Title-Data variable, something like "ServerResetNumber", with a start-Value of 0. When registering a new player, you set a Player Data called something like "ClientResetNumber" to also 0.

If you want clients to have to reset their accounts at some given points, you could easily just increase the ServerResetNumber, which will force players to reset, because they check those two values:

Every time you login, you check at app-startup, if ClientResetNumber < ServerResetNumber, and if so, you set all the Client's PlayerData back to the "startValues", whatever this is. At that point, you should increase ClientResetNumber on the client, so that this doesn't happen next time, he logs in. At least that's how I'm doing it, and I'm good to go with it.

Leaderboards can be reset server-wide anyway, so if you are making a reset, you should reset Leaderboards and just increase this number in your Title-Data.

Greetings

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.