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)
Answer by Sarah Zhang · Sep 18, 2020 at 06:22 AM
>> 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.