question

nalin avatar image
nalin asked

Is it possible to Post a stat and get PlayFab to immediately return the player position within the leaderboard?

Hi

At present in my game all I want to do is display the rank for the current score posted by the player.

However I noticed two issues:

1) posting and then retrieving the leaderboard in quick succession results in the player's position in the leaderboard not updating with the most recent score, possibly due to latency issues?

2) in order to retrieve the rank I have to get the leaderboard and then parse through at least 10 entries, find the player and then get the position / StatValue, which seems like overkill if all I want to do is display the rank?

....therefore I was wondering if it is possible to be able to Post a stat and get the player position (and the stat value in the leaderboard) upon return of the call? This might save some load on the server and it ought to be much quicker overall. The reason to return the stat value is that what is stored in the leaderboard on the server may or may not be the value just posted, depending on the Aggregation method for it.

Hope this makes sense.

Nalin

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

·
brendan avatar image
brendan answered

Correct - posting an updated statistic for a player triggers re-evaluation of the leaderboard. Since that takes non-trivial time, we do not wait on that re-evaluation to return. If you immediately request the leaderboard when you get the return from that update call, it's very possible that the leaderboard won't have that new score. You need to wait about a second before you query, to be assured that it'll be in there.

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.