question

troutapps avatar image
troutapps asked

UpdatePlayerStatistics best practice

So I'm new to PlayFab and I'm trying to post some score for the leaderboards.

The only way I've seen for players to submit scores is by using PlayFabClientAPI.UpdatePlayerStatistics, but this requires enabling a "dangerous" feature that allows the player to possible cheat.

Since this method is frowned upon, what is the preferred method for players to submit scores to leaderboards that won't allow them to cheat?

Thanks in advance

sdks
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

·
pfnathan avatar image
pfnathan answered

There's a detailed method of anti-cheat in our tutorial on statistics and leaderboards here: https://api.playfab.com/docs/tutorials/landing-players/player-statistics

The players can cheat their scores because when you enable to allow the client to post statistics (in Settings->API). This is off by default for all titles so that players cannot post whatever score they want to. You can prevent this by have your clients using Cloud Script where you can use server authoritative code to check things you need to, like min/max score, time since the last score posted, etc.

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.

troutapps avatar image troutapps commented ·

That guide doesn't really have a whole lot there about how to post scores without enabling User Statistic, which the API calls are telling me to avoid doing.

Going by the information in your comment I guess the best was is to send statistics via a cloud script and sanity check the results to make sure players aren't posting excessively large / negative scores.

0 Likes 0 ·
brendan avatar image brendan troutapps commented ·

Yes, that's specifically our recommendation (ex: https://community.playfab.com/questions/8637/security-on-updating-statistics-from-client-cloud.html). Those checks are likely to be game-specific, but min/max and time since last score report would be good places to start.

1 Like 1 ·

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.