question

WiLL avatar image
WiLL asked

I`m with dificulties with playfab server sync with construct 3

Good afternoon, I am logging in my app by google play to use achievements and highscore, and saved the information in the localstorage, until then all right, but when the user reinstalls the application, it loses all the information, because the localstorage is deleted .. I implemented then the playfab plugin to get the information when the user logs in and save to a bank when he reinstalls the app( IMAGE 1), he takes the data from the playfab database and places it in an array. And then this Array becomes the variables. The biggest difficulty I'm having is the following: When the user closes the game, the data is saved on the playfab server ( IMAGE2) ... But when he reopens the app, the server data gets 0, (they reset) both in server as in the game. What is happening is probably the following by logic ... The database has X information, the local storage has Y, when it opens, is overlapping the information, or some conflict ... I know the difficulty is in the code logic and not in the playfab server ... But i need some help me please, because I can not make it work ... Thank you

I know i need to VERIFY its exists, But how do I validate if something exists, if that's what I need to get it in the database?

Player Data
playfab.png (69.0 KiB)
playfab1.png (14.9 KiB)
10 |1200

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

1 Answer

·
Seth Du avatar image
Seth Du answered

Since the only data that need to be stored locally as files is game asserts and configuration data, users’ data such as Statistics and Player Data should be dynamically retrieved from PlayFab server or Google Play server. Surely, when user closes the app, those data will be deleted but next time user login successfully, those data can be retrieved again.

Data on the server always has the higher priority than the local data, if verification failed, server data will overwrite the local data. When a user closes the game, those dynamic data should not be uploaded/synced, which means the closing action should not trigger any sync process because sometimes the that action is by accident (unless it is on purpose, for example, user presses the close button) . Instead, it will be better to perform that action only when a game/match/fight ends or player reaches a checkpoint. Syncing data every specific time is also a feasible solution.

According to your screenshots, you can write some print out sentences that trace the variable changes in order to locate the step that resets the variable to 0.

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.

WiLL avatar image WiLL commented ·

Good morning, thanks for the reply, but I still do not know how I can do this procedure, on line 21, it waits 10 seconds and saves Mygamedata to DataCollectoin.AsJSON (it's an array with the information.)

When the user closes the game, the information stays in the PlayFabServer, I already checked, and they really stay there ... But when the user reopens the game, they return to 0. Both in game and in playfabServer, everything is 0. As if they were reset every time the user closes and opens the game ... But when it goes only to the MENU, and back to the MAIN, the data remains.

How can I perform this validation? To see where the variable reset occurs ...

0 Likes 0 ·
Seth Du avatar image Seth Du ♦ WiLL commented ·

    Sorry about the previous reply, the proper place to validate/verify data to check for cheating would be in Cloud Script or a custom game server.

    the data on PlayFab server becomes zero can only be cause by the API calls from your client, as you have mention it occurs only when closing and reopening the game. I assume that when you open the game, an API like 'Update.....' is called. Please make sure the APIs you are using are for retrieving data instead of uploading them because obviously player data can be 0 when the game initially starts

    0 Likes 0 ·

    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.