question

smumair06 avatar image
smumair06 asked

All entries in a leaderboard

2 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.

smumair06 avatar image smumair06 commented ·

I would like to get PlayFab IDs of all the entries inside a specific leaderboard. Can we do that via segments? If yes, can anyone guide me how to do that ?

0 Likes 0 ·
smumair06 avatar image smumair06 commented ·

ok, I can get PlayFab IDs via this call: https://docs.microsoft.com/en-us/rest/api/playfab/server/play-stream/get-players-in-segment?view=playfab-rest

But, what if I also want to get rank/score posted ?

0 Likes 0 ·

1 Answer

·
Xiao Zha avatar image
Xiao Zha answered

The get players in segment API can give you the playfab ids, but you can't get scores and rankings for all players in this way, you can only call Get Leaderboard Around User API with PlayFab ID to get the rank and score of a specified player.

In addition, you can call GetLeaderboard API in cloud script to get PlayFab IDs of the entries inside a specitic leaderboard. The rank and score can also be found in the PlayerLeaderboardEntry in the API result. However, the get leaderboard API has a limit on the number of players. You can only get the accurate ranking and data of the first 1000 players. The ranking of players beyond 1000 is not completely accurate.

4 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.

smumair06 avatar image smumair06 commented ·

Thanks for your suggestion.
I had solution in my mind, but don't know if that's the correct way:
Can we implement our own leaderboards, like saving user's scores in TitleData as json and then fetching and sorting it on client end to get the ranks, though it will invoke UpdateTitleData calls multiple times but that would be called via azure function. What are your thoughts on this ?

0 Likes 0 ·
Xiao Zha avatar image Xiao Zha smumair06 commented ·

Title Data is best suited for Global Constant/Static Data and is not suitable or reliable as Global Variables. So we do not recommend using Title Data to implement a custom leaderboard.

0 Likes 0 ·
smumair06 avatar image smumair06 Xiao Zha commented ·

ok, got the point. But, most of the games can require to save/update data that would be shared among users (global variables), let alone custom leaderboard. What's the best way to implement such storage, that can be updated frequently and accessed across users?

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.