question

DANIEL MARQUES PEREIRA avatar image
DANIEL MARQUES PEREIRA asked

List of Friends with custom data for each

Hi,

when a user asks for a friends list, I want to return specific data about that each friend accessing their statistics data and readonly data. But there is a limit of how much calls I can do during cloud code (I believe it's 25?)

So, is there any optimised way to have this custom friends list or anything else I can do bypass this limit? I'm in Indie tier now.

limitsdataFriendsCharacter Data
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

·
Citrus Yan avatar image
Citrus Yan answered

Hi,

So, looks like you are using Cloud Script to do the “getting friend list” logic, and you need the statistics and read-only data of each player to perform some kind of logic to calculate the specific data and return it to the client, is that right? If that’s the case, please note that iterating across all players returned by friend list to access the statistics and read-only data isn’t a valid use case, as it generates a very high level of API calls. Increasing the limit won’t help much because the number of friends in the list will increase without limits. Therefore, a possible way to do this would be:

1)Return the friend list using GetFriendsList with “ShowStatistics” property specified and show it to the client.

2)When the players click “view custom data” button on a specific player, call ExecuteCloudScript using PlayFabId and statistics data returned in the previous call as the parameters , in the Cloud Script function call GetUserReadOnlyData (You only need this one API call in Cloud Script ) to retrieve the read-only data of that player, perform the logic, return the specific data to the client.

In this way, you will only need to do additional operations when the player clicks on an entry of a specific player.

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.

DANIEL MARQUES PEREIRA avatar image DANIEL MARQUES PEREIRA commented ·

Actually this will not serve me. I show the last character played by hi/her friend and the last character's color too. I show this in a small square as a "profile" picture. (right next to rank and name values of this friend)

0 Likes 0 ·
brendan avatar image brendan DANIEL MARQUES PEREIRA commented ·

Currently, we provide a number of elements in the profile, as Citrus called out. You can find a tutorial on how to use those elements here: https://docs.microsoft.com/en-us/gaming/playfab/features/social/tournaments-leaderboards/using-the-profile-for-advanced-leaderboards. We do have a backlog item to be able to have a small amount of arbitrary data stored per leaderboard entry, but that's not something we can provide today. And as Citrus highlighted, attempting to loop on all players in a leaderboard and request additional data for each of them is not supported, as it would generate an excessive number of requests on a per-player basis.

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.