question

DreamTeam Mobile avatar image
DreamTeam Mobile asked

Friend list with extra user data

Friend list with extra user data In my game, every player can populate list of friends. Every friend has extra information like current map/server. As far as I understand I cannot fetch user data associated with every friend in bulk (single request) and have to pull user data for each friend in my list which can be pretty expensive with hundreds of friends.

What is the best way to store an extra player attribute (like current map/server) and then let his friends to pull that information about him in bulk (single request for list of players)?

,

In my game, every player can populate list of friends. Every friend has extra information like current map/server. As far as I understand I cannot fetch user data associated with every friend in bulk (single request) and have to pull user data for each friend in my list which can be pretty expensive with hundreds of friends.

What is the best way to store an extra player attribute (like current map/server) and then let his friends to pull that information about him in bulk (single request for list of players)?

dataFriends
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

Assuming that you’re using our Friend System to manage friend list in your game, for your case, it’s suggested that you store such data into objects on the player’s profile (title_player_account) using the Entity API SetObjects, and then use GetProfiles to retrieve those objects from a set of players’profiles in bulk (up to 25 profiles per request).And, in order for this flow to work, you also need to do the following:

  • Use GetTitlePlayersFromMasterPlayerAccountIds to retrieve the player’s title_player_account id in bulk when you only have their master_player_account/PlayFab Id returned from the GetFriendList call.
  • Each player should call SetProfilePolicy to set the policy for the specific object that they want their friends to be able to access, the request looks like the following:
{
  "Statements": [
    {
      "Resource": "pfrn:data--*!*/Profile/Objects/<name of the object, for instance: “map”>",
      "Action": "Read",
      "Effect": "Allow",
      "Principal": {
        "Friend": "true"
      },
      "Comment": "Allow my friend to read my map"
    }
  ],
  "Entity": {
    "Id": "xxxxx",
    "Type": "title_player_account",
    "TypeString": "title_player_account"
  }
}

Above is the basic flow for your scenario, if you have any specific question regarding the details, please let me know.

10 |1200

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

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.