question

Michal Töpfer avatar image
Michal Töpfer asked

Player position on FRIEND leaderboard

Is there a way to get player position on FRIEND leaderboard? I mean I don't want player's overall position, but position only including his (Facebook) friends. According to the API (and a bit of testing) both GetFriendLeaderboardAroundCurrentUser and GetLeaderboardAroundCurrentUser return player's overall (global) position.

Example:

Overall Leaderboard:
0. A 
1. B
2. C
3. D

D is friend only with B, so he is the second (1st if indexing from 0) on his friend leaderboard (That is what I want to get), but he is fourth on global leaderboard (this is what GetFriendLeaderboardAroundCurrentUser returns).

Leaderboards and Statistics
10 |1200

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

brendan avatar image
brendan answered

From reviewing the code, the position is returned as you describe (relative to the friend list) for the non-"Around" versions of the leaderboard calls, so I believe that was the intent here, as well. I'll open a ticket on this, so that we can review usage by other titles (if someone's currently using this leaderboard and needs the positions to be as they are now, we can't change this on them) and determine the best course of action. We'll update here when we either post a fix for this or decide on another approach.

10 |1200

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

Michal Töpfer avatar image
Michal Töpfer answered

Thanks for a quick reply.

I have done a bit more testing on this and I think that the positions of players were always consecutive. I think that position of the first one was often his position on the global leaderboard, but I think it wasn't in some responses. I don't know why is it like that.

Anyway, I believe I found a workaround for this, but it is a bit of a brute force. I can simply call GetFriendLeaderboard by pages of 20 (MaxResultsCount = 20; incrementing StartPosition by 20 in each call) until I find the id of the player, whose position I want. This solution is bad because I have to keep calling the request until I find the user (this means I get a lot of useless data) and before each call, I have to wait for the previous response. To make it faster, I could call it from the server, but I am not sure if the GetFriendLeaderboard exists on the server (it has a page https://api.playfab.com/Documentation/Server/method/GetFriendLeaderboard, but it is not listed on server API page https://api.playfab.com/Documentation/Server). Thank you again.

10 |1200

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

brendan avatar image
brendan answered

Quite candidly, I expect we'll be updating the behavior of the GetFriendLeaderboardAroundCurrentUser API call, as the current numbering is incorrect. We're at GDC this week, but I expect we'll be putting in the fix for this shortly after. Calling an API repeatedly the way you describe is definitely not advisable, since a high frequency of calls could result in throttling of responses to the client.

10 |1200

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

Michal Töpfer avatar image
Michal Töpfer answered

Hi, I don't want to be annoying, but it's been almost a month since my request, so I wanted to know if you made any progress on this topic.

10 |1200

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

brendan avatar image
brendan answered

Apologies for the delay - as I said, it wasn't something we would be able to consider until post-GDC. Also, please note that it is a breaking change technically, which we're committed to avoiding whenever possible. I reviewed this with our CTO however, and while it is technically breaking, the existing functionality is clearly incorrect, in terms of the starting index for the leaderboard list, so he approved the change. I've checked that change in, so it should be rolled live in the service with our next update (next week - possibly as early as Monday).

10 |1200

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

brendan avatar image
brendan answered

We're rolling the change live tonight, so you should be good to go as of tomorrow. Thanks!

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.