question

thirtysix avatar image
thirtysix asked

About Leaderboard again

Hello.

We are trying to make game with Unity3d and we have chosen PlayFab as backend service. We hope it will work on any platform and even on WebGL isn't it?

We need to use the leaderboad.

To do this,

first - We login with LoginWithCustomID,

next - GetPlayerCombinedInfo to get DisplayName (if it exist),

next - GetLeaderboardAroundUser with MaxResultsCount = 1 (to get user position and score from LB),

next - GetLeaderboard with StartPosition = 0 and MaxResultsCount = 10 (to get 10 best results from LB).

That is 4 calls to the server - that's a lot. Is there a simpler way?

Thanks in advance

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.

1 Answer

·
brendan avatar image
brendan answered

Well, a client cannot make a call to the service without first logging in, so that call is necessary. However, the player display names can be returned in any leaderboard call via the profile, so the second call is not. If you want to get a leaderboard containing the player (to get the position), you would need to get the leaderboard around the current player. And if you want to get the top of the leaderboard, you would need to query that (unless the player is in the top 10, in which case you could skip that, as long as you're querying more than 1 in the "around" call). So yes, either 2 or 3 API calls, depending on whether the player is in the top 10.

1 comment
10 |1200

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

thirtysix avatar image thirtysix commented ·

Thank you.

Yes, I get it.

(1) Loggin + getplayerprofile with DisplayName and Statisticsinfo (2 in 1)

(2) Getleaderboard (Top 10) (3)

(3) and if (2) does not contain user playfabid -> Getleaderboardarounduser (4)

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.