question

belkovandrew avatar image
belkovandrew asked

Sorting Algorithm of Liderboards

Hello! Just some trouble with leaderboard. Framework - unity 5.4.3.

I get number position of current player by PlayFabClientAPI.GetLeaderboardAroundCurrentUser. Leaderboard get PlayFabClientAPI.GetLeaderboard. Start position is number which I get in prev function. All players show normal. But players with same statistic value is show wrong. PlayFabClientAPI.GetLeaderboardAroundCurrentUser show number of player with that statistic value, and PlayFabClientAPI.GetLeaderboard - the last. Maybe in you side work not correct algoritm?

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

For any game with a non-trivial number of players, you should expect that the leaderboard may change between any two given calls, given that players will be updating scores constantly. The recommendation would be to only use the values from the first call to get the leaderboard, for purposes of displaying consistent information to the player.

Also, while it is not relevant to the specific results you're working with in this case, it's worth noting that positions beyond 1,000 in the leaderboard have deterministic estimated positions for the GetLeaderboardAround... API calls, as recalculating the full leaderboard on every call isn't feasible. The first 1,000 positions will always be accurate for the current values, however.

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.