question

xinliu avatar image
xinliu asked

What's the point of adding a statistics item manually in Game Manager?

Hi, I'm kinda new to PlayFab. I followed the Getting Start guide (https://api.playfab.com/docs/general-getting-started) and the section of adding a basic leaderboard confuses me. In the tutorial we have added a statistics called "XP" to the player manually in the Game Manager, and yes we can call in the client to retrieve this value. But what about other players? Do we have to create an XP statistic for each player manually in the Game Manger? Isn't the player statistics definitions supposed to be defined on the game level instead of player level? Please help.

Leaderboards and Statistics
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

You don’t have to create it in the game manager. No matter you are trying to create or update players’ statistics, the only API you use should be UpdatePlayerStatistics, which means if the current player does not have the statistics you want to update, they will be automatically created by PlayFab. Hence you may not have to worry about it.

Statistics are “player-level” because it needs quick responses according to player’s actions and it is a data that is frequently changing. Besides, please try to avoid using Client API UpdatePlayerStatistics and disable it in [Game manager] -> [Settings] -> [API Feature] because enabling players to post statistics will cause abusive uses and cheats. It will be better to implement UpdatePlayerStatistics in the cloud script where you can also verify the data.

1 comment
10 |1200

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

xinliu avatar image xinliu commented ·

Thank you for your explanation, it makes sense to me now :)

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.