question

Thomas Brown avatar image
Thomas Brown asked

Getting Leaderboard Position Change Implementation Question

Hi guys, I had a question about retrieving a player's leaderboard position change via PlayFab. So given this question & answer, it seems like the below approach would be the best way to do what I'm after.


When posting a score I would need to use PlayFab cloud script to do the following.

1. UpdatePlayerStatistic (store new leaderboard score)

2. GetLeaderboardAroundPlayer (grab associated leaderboard to get player position)

3. GetUserInternalData (grab previously-stored leaderboard player position - if any)

4. UpdateUserInternalData (store new previous leaderboard position if position changed)


When grabbing a leaderboard I would need to use PlayFab cloud script to do the following.

1. GetUserInternalData (grab the previous leaderboard score for leaderboard we want - if any)

2. GetLeaderboardAroundPlayer( grab leaderboard )
3. return custom object with previous score & associated leaderboard entrys.



Does this seem like the right approach? Given this approach, would I only be charged for cloud script execution time? I'm trying to make sure I do this as efficiently as possible but it's looking like, just to post a score to get what I'm after I have to execute 4 PlayFab server functions.

Ultimately I'm looking to understand if my approach is correct and if there are any potential red flags here. Also, cost is a bit of a concern of mine, given that leaderboards will be quite a big often used feature of my game.

Thanks in advance!

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

·
Sarah Zhang avatar image
Sarah Zhang answered

>> Does this seem like the right approach?

If you would like to store the changes of the specific rankings over a period of time for players, this approach is correct.

>> Given this approach, would I only be charged for cloud script execution time? I'm trying to make sure I do this as efficiently as possible but it's looking like, just to post a score to get what I'm after I have to execute 4 PlayFab server functions.

For clarification, PlayFab's pricing is calculated from a set of consumption-based meters. Please check our documentation -- PlayFab Pricing Overview for more information about PlayFab price, and check this documentation -- Pricing Meters to learn more about how meters are measured and calculated. For your case, GetLeaderboardAroundPlayer, GetUserInternalData will increase Profile Reads meter, and UpdatePlayerStatistic, UpdateUserInternalData will increase the Profile Writes meter. For live title, you need to pay for the meter usage exceeded the base rate. Currently, there is still no such built-in features that can be used to retrieve the changes of player statistic values directly, this workaround you mentioned still work. If the feature retrieving the changes of players’ rankings is necessary for you, you can try to add a feature request for it.

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.