question

vincentpiedeloup avatar image
vincentpiedeloup asked

Cloud script Friends GetPlayerStatistics vs GetFriendLeaderboard considering request limit

In our game, we use leaderboards to store multiple statistics (35/40)

When asking for results, I have some issues.

For the Friend ranking, i use a CloudScript function to process some stats, to make it simple, let's says I need to know how many friend are better and worst than us.
I tried 2 ways of implementing this, trying to minimize the server time.

- First I tried to get the GetFriendLeaderboard for each ranking, but after some, I got a "too many request" error.

- Then, I tried asking for friend list, then for each friend, getting the GetPlayerStatistics, filtering data and storing result in an array. It works, but what will append when the friend list grow.

Is there a way to get GetFriendLeaderboard but with a list of leaderboard, even without sort, to get all stats in one request.

Or anything else to minimize the requests (I need the value of all statistics for all friends)

CloudScriptLeaderboards and StatisticsFriends
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

·
Sarah Zhang avatar image
Sarah Zhang answered

>> Is there a way to get GetFriendLeaderboard but with a list of leaderboard, even without sort, to get all stats in one request?

Yes, there is a way to get the friends’ statistics in the GetFriendsList API call. You just need to use the request body like this.

{ "ProfileConstraints": { "ShowStatistics": true }}

Besides, as the API reference said. “If ProfileConstraints are non-null, this determines which properties of the resulting player profiles to return. For API calls from the client, only the allowed client profile properties for the title may be requested. These allowed properties are configured in the Game Manager "Client Profile Options" tab in the "Settings" section.”

So, if you want to request friends’ Profiles on clients, you need to do the corresponding settings before. You can navigate to [Game Manager]->[Settings]->[Client Profile Options] to check the [Statistics] option box to allow clients access Statistics.

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.

vincentpiedeloup avatar image vincentpiedeloup commented ·

Thanks, that's exactly what i need :)

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.