question

theunknowndev avatar image
theunknowndev asked

GetFriendLeaderboardAroundPlayer doesnt work

Dear Guys,

If I want to get the Rank from friends in a Leaderboard via GetFriendLeaderboardAroundPlayer I dont get theexact Position from the Leaderboard. How can I fix this?

Im using the following Code:

 public void getFriendLeaderboardstats()
    {
        var request = new GetFriendLeaderboardAroundPlayerRequest();


        request.StatisticName = "Highscore";
        request.MaxResultsCount = 25;


        PlayFabClientAPI.GetFriendLeaderboardAroundPlayer(request, getfriendleaderboardsucceed, getfriendleaderboardfailure);
    }


    private void getfriendleaderboardfailure(PlayFabError obj)
    {
        throw new NotImplementedException();
    }


    private void getfriendleaderboardsucceed(GetFriendLeaderboardAroundPlayerResult obj)
    {
        foreach (PlayerLeaderboardEntry leaderboard in obj.Leaderboard)
        {
            if(GameObject.Find("FriendRank" + leaderboard.DisplayName))
            {
                Debug.Log(leaderboard.Position);
                GameObject.Find("FriendRank" + leaderboard.DisplayName).GetComponent<Text>().text = "#" + (leaderboard.Position + 1);
                GameObject.Find("FriendRank" + leaderboard.DisplayName).name = (leaderboard.Position + 1) + "FriendRank" + leaderboard.DisplayName;
                GameObject.Find("Friendcolumn" + leaderboard.DisplayName).name = (leaderboard.Position + 1) + "Friendcolumn";
            }


        }


        sortfriendlist();


    }
Leaderboards and Statistics
3 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.

Andy avatar image Andy ♦♦ commented ·

Can you provide more detail about what you get back from the call and what you expect? An example would help me better answer you question.

0 Likes 0 ·
theunknowndev avatar image theunknowndev Andy ♦♦ commented ·

From the Call I get wrong Positions. for example Player 1 is WorldRank 2 I get 2 from the Call but another Friend called Player 2 is WorldRank 5 but from the API Call I get 3 and Player 3 is WorldRank 8 and I get Rank 4 from the Call.

0 Likes 0 ·
theunknowndev avatar image theunknowndev theunknowndev commented ·

For me it seems like an internal Ranking between Friends. But I want the Ranks from the Leaderboard with all Players not only Friends.

0 Likes 0 ·

1 Answer

·
Andy avatar image
Andy answered

The behavior you're seeing is by design. If you want to get a player's ranking on the global leaderboard, you'd need to ask for the global leaderboard, not a friends leaderboard. I understand how that might be confusing, though. While I don't think the default behavior will be changing, I'll look into whether we can add additional options.

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.

theunknowndev avatar image theunknowndev commented ·

Do you know if there is another way to get the global Leaderboard Rank for each Player?

0 Likes 0 ·
brendan avatar image brendan theunknowndev commented ·

No, as Andy said, the design of the friends leaderboard is specifically to give you the position of the player relative to that list - the friends only. The global leaderboard is where you would have positions relative to all players in the world. But again, we'll file a backlog item to see about adding an option to allow for that positional information to be returned as well. We cannot change the existing behavior, as that could break existing titles, which we have a hard commitment against.

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.