question

Anh Le avatar image
Anh Le asked

Realtime leaderboard solution?

Hi,

I'd like to let the user see the leaderboard realtime. It means that when user win a match, then he opens the leaderboard, he will see his new ranking immediately. It's similar with Clash of Clans, Clash Royale or CATS: Crash Arena Turbo Stars

  • Is it possible with using Playfab? If yes, what's the solution?
  • If we have to use a custom server, is it too heavy for the server?
Leaderboards and StatisticsCustom Game Servers
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

Yes, our leaderboards are updated when you send a new score for the player. Since it's not technically possible for the leaderboard to be updated in the same millisecond that the new score has been reported, it's a good idea to put in a delay of a second or two before you query for the updated leaderboard, but that should work fine.

5 comments
10 |1200

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

Anh Le avatar image Anh Le commented ·

Thank you @Brendan

For the second question, currently, we use a custom server. And when a user requests the update of the leaderboard, he will request to our custom server. Because besides the UserID, RankPoint, Rank and DisplayName, we also need to pull other data such as User Level, Clan Name, ect. for every user.

So we have to use a custom server and follow the flow: Get data -> Cache -> Monitor user rank point change, level change, clan change, etc. So it's quite heavy. That's why we ask for your assist.

Is that a correct approach?

0 Likes 0 ·
brendan avatar image brendan Anh Le commented ·

If I understand your design correctly, then no, that will not work. What it sounds like you're saying is that you query the leaderboard, and then iteratively make a call for every single user on the leaderboard, to get more data. That would generate an excessive number of calls to the service, which would result in your title being throttled or even blocked. What I would recommend is that you use the ProfileConstraints on the leaderboard call to get additional data from the player profile. Any numeric value could be stored as a statistic, which can be returned from the profile data. As to Clan Name, you could potentially use a Tag for that, depending on the specifics of your game.

0 Likes 0 ·
Anh Le avatar image Anh Le brendan commented ·

1. If I use ProfileConstraints on the leaderboard call to get additional data from the player profile, Can I get the user level as well?

PlayFabServerAPI.GetLeaderboard (new GetLeaderboardRequest () {
    MaxResultsCount     = 100,
    StartPosition        = 0,
    StatisticName         = PFConstants.STAT_RANK_POINT,
    ProfileConstraints     = new PlayerProfileViewConstraints(){
        ShowStatistics  = true, -> get StatValue = rankPoint
        ShowDisplayName = true, -> get DisplayName
        //How to get level or more from statistic if call this api???
    }
}

2. We only query the Leaderboards one time when the game launch (it takes around 10s to get the data and it's quite ok) and only get Top 100. Is it still possible to use your method?

3. For Clan name, should we get the data from Groups, then update to tag? It seems not reasonable to us.

0 Likes 0 ·
Show more comments

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.