question

Ozan Yilmaz avatar image
Ozan Yilmaz asked

Order some players by date?

Hello,

I want to make an UI that shows which players has reached the max level in the game, but I need to order the max level players by the date when they maxed out their levels. I don't have any complete ideas in my mind for this.

First thing came to my mind is that adding the players to a leaderboard when they max out their levels, so that I can get the max level players on the client-side easily, but I couldn't find any way to get the entry date (data update date) in the leaderboard.

How can I do this with PlayFab?

EDIT: I have another solution for this, but I don't know how PlayFab would react when a concurrency happens in this scenario.

I will use a leaderboard, and for the statistic values, I will give every player a unique number. For example; when someone reaches the max level and the player is the first one who reached the max level, I will update the player's statistic value to 1. When someone else reaches the max level, their statistic value will be updated to 2 and so on. In this scenario, I need to track the numbers somewhere in PlayFab. I cannot use Title Data because changing Title Data takes time to update. So I thought, I can create a fake player and save the number in the fake player's read only data. The fake player will be like a Singleton. In cloudscript, when I need to update the statistic value, I will read the fake player's read only data to get the next number and update the number. There is only 1 problem for this. What happens when 2 or more players reach the max level at the same time and try to read and update the fake player's read only data?

Also, if this solution is possible, what else can I use to save the next number and to solve the concurrency problem rather than using a fake player?

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

·
Citrus Yan avatar image
Citrus Yan answered

Currently, showing the update date for each entry is not supported in the leaderboard system. And, for the solution you mentioned above, using a fake player is not recommended either as that will definitely cause a concurrency issue when there are multiple players trying to read & write the same data. A possible workaround for this would be using a separate leaderboard to track the update time for the previous leaderboard, as discussed in this thread: Leaderboard with dates of each score - Playfab Community

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.