question

Andraz Vene avatar image
Andraz Vene asked

Saving single player game date in Entity files?

Hey,

We have a live single player JS game, and we'd like to integrate it with PlayFab, to have liveops, do sales etc. Currently we are saving user files in localStorage but would like to offer a cloud save, and since we'll be using other features, ideally do that with PlayFab.

Our save files are up to 100kb in size, and are obfuscated, to prevent too easy player tinkering. For this reason, we also do not intend to rework our game save data to smaller keys/values or objects at this point. So ideally, we'd like to save this data in one file for each player, when player logs in load and de-obfuscate it.

Is the correct way to do this using Entity Files? i.e.:

https://docs.microsoft.com/en-us/gaming/playfab/features/data/playerdata/entity-files


I've read the docs and googled a bunch of replies around this topic, but unfortunately couldn't get a clear answer. Especially as in some there was mention that saving/loading to playfab from clientside would expose us to risk/players uploading anything... Possibly I got some things mixed up after all the reading, so would appreciate some help in making sure I use the right approach for this :)

Player Dataentities
10 |1200

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

Sarah Zhang avatar image
Sarah Zhang answered

Yes, it’s the correct way. But currently, PlayFab hasn’t natively supported verifying the entity files’ content from the back-end when they are uploaded. So if you worry about the risk that players uploading other files, a possible workaround is that let the clients call ExecuteCloudScript to update an item of Player read-only data when they upload a file every time. For example, this Player Read-Only data item can store some corresponding game state info. When clients download the file and get the valid data, you can let them get that data item and verify whether these data correspond. Besides, as you did, encrypt the save data files to prevent players from tinkering them. In addition, the count of entity files also has a limit. The free tier allows one player to upload 1 entity file on title_player_account and 1 file on master_player_account. If you are other tiers you can navigate to [GameManager]->[Title settings]->[Limits] to check it. The above measures can avoid such risks to some extent.

10 |1200

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

Andraz Vene avatar image
Andraz Vene answered

Sarah thank you for the clarification as well as for the extra suggestion on verification/security!

I'd consider the file limit a security precaution in itself, but will definitely look into your neat trick as well!

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.