question

brendan avatar image
brendan asked

Client Trusted Statistics and Virtual Currency Modification

In the Settings->General tab of the Game Manager, there are options to enable posting statistics from the client, as well as adding and subtracting virtual currency. Why do those options exist?

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

We designed the PlayFab services to be a secure, reliable backend for games. As part of that, we initially ensured that key updates, such as adding virtual currency to the user account and updating user statistics, could only be made by an authoritative server, to prevent cheating. For some titles however, that’s not really a concern. As an example, players cheating their scores or currency balances could be something which keeps them playing longer, potentially increasing the player lifetime value (LTV) due to in-game advertising.

Because of this, we’ve enabled several new options for titles in the PlayFab Game Manager:

  • Enable Client User Statistics Update API - Allows the client to update statistics for the signed in user, via the UpdateUserStatistics API call
  • Enable Client Add Virtual Currency API - Allows the client to add any virtual currency defined for the title to the totals for the currently signed-in user, via the AddUserVirtualCurrency API call
  • Enable Client Subtract Virtual Currency API - Allows the client to subtract any virtual currency defined for the title from the totals for the currently signed-in user, via the SubtractUserVirtualCurrency API call
  • Enable User Display Names - Allows the client to change the user’s currently defined Title Display Name using the UpdateUserTitleDisplayName API call

All of these options can be found on the General tab of the title Properties, available under Settings in the Game Manager. In all cases, the default is that these features are disabled.

10 |1200

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

Daniel Kiefer avatar image
Daniel Kiefer answered

Hi, so i am still trying to figure out how this would be working with the server calls?

Is there any example on how to Add Virtual Currency with this server logic?

What functions do i have to call from the client side to make this happen?

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 would do this either from a hosted game server or via Cloud Script. For the latter, we do have an example of doing exactly that in our Cloud Script Samples repo, in GitHub: https://github.com/PlayFab/CloudScriptSamples/tree/master/Rewards. You would call the Cloud Script from the client with ExecuteCloudScript, and in the script, you'll want to add any checks you need to help prevent cheating (checking maximum scores, time since last score reported, etc.).

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.