question

kobgamesstudio avatar image
kobgamesstudio asked

PlayFabClientAPI.GetLeaderboardAroundPlayer returns incorrect result for a newly created user

Hi,

PlayFabClientAPI.GetLeaderboardAroundPlayer returns a wrong result.Leaderboard[0].Position for a newly created user (via LoginWithCustomIDRequest).

Even though the user is not in the Leaderboard, I get a result with its position set to the wrong value.

Koby

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

If you're specifically requesting the leaderboard around the player, you'll get a leaderboard with the player reported as having a score of zero. If you get the player profile (use the ShowStatistics profile constraint), you'll see that the player has no statistics, however. You can also get the profile back as part of any login call, so you could use that to check.

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.

kobgamesstudio avatar image kobgamesstudio commented ·

Thanks Brendan, I still think it doesn't make sense to return a wrong position number in the case where user has no leaderboard statistics (Leaderboard.Count+1). I understand I can have more logic to figure it out, but it would have been nice to just use the Position and have it return the correct value to reflect that.

0 Likes 0 ·
brendan avatar image brendan kobgamesstudio commented ·

The problem here is that you're asking for the leaderboard around a player who has no position on the leaderboard. So we return the leaderboard as if the player had a score of 0. Any change from this would be a breaking change, since existing titles may have logic that depends upon this, so we will not be changing this (we have a commitment to zero breaking changes).

0 Likes 0 ·

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.