question

Game Developer avatar image
Game Developer asked

how to save progress like gold and highscore with cloudscript in playfab

hi i already have a login system but i don't know how to store the progress of the player to the playerId or player created in the playfab server, is there a way of using cloudscript or any kind of things sorry I'm really new and i don't know a lot about java script @brendan

10 |1200

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

brendan avatar image
brendan answered

You can use any of the Server API endpoints from a Cloud Script to make changes to player accounts, though you'll obviously want to check any inputs coming from the client, to check for any signs of cheating by a compromised client. And since our Azure Functions integration allows you to use scripts written in C#, a lack of familiarity with JavaScript isn't an issue anymore. I'd recommend reviewing these docs on using Azure Functions Cloud Script in PlayFab:

https://docs.microsoft.com/en-us/gaming/playfab/features/automation/cloudscript-af/

10 |1200

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

Citrus Yan avatar image
Citrus Yan answered

You can save such info using Player Data, currently there are two models for storing it:

  • Entity: Allows you to store data in objects and files across Players, Characters, and Groups.
  • UserData: Allows you to store name/value pair data for players.

Please follow through the tutorial to decide which model suits your project best.

Taking Entity Objects from the Entity Model for instance, the commonly used APIs are SetObjects and GetObjects which can be accessed from CloudScript using entity.SetObjects(…) and entity.GetObjects(…). And, about writing custom CloudScript, please navigate to this tutorial to learn more: Writing custom CloudScript.

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.