question

drew avatar image
drew asked

Storing extra info with PlayerProfile?

hi,

Let's say I have some 'core' player data that I want to be tracked. I know I can use title data for this, but I'm wondering if there's a mechanism to store extra info inside PlayerProfile itself, so I can get it when they login every time? For example, let's say I track a players "Rank". I want this every time right away so I can display it on the main screen. Insteda of making a separate call to get Rank each time, is there a way to place this in the player profile itself? What about more complex json documents? Do you generally recommend to avoid this and just make my own PlayerProfileInfo that I store in title data and retrieve upon login? Thank you

Player 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

·
Neils Shi avatar image
Neils Shi answered

Please note that the Title data is suitable for storing global constant/static data instead of the data which changes frequently. Because Title data values are copied and distributed to potentially hundreds of machines in the PlayFab server cluster. As part of this process, Title Data is cached, and changes may take up to fifteen minutes to refresh in those caches. In your case, you want to get the player's Rank info when the player logs in, so that you can reduce the extra API calls to retrieve it. So, you can store the Rank info into the player read only data, and when players calls the login API, he can retrieve the specified player read only data via setting InfoRequestParameters. You can refer to my testing request body of login API below. In addition, if the player's ranking information is subject to change at any time, it may not be accurate to retrieve the previously stored rank information by retrieving player read only data when the player logs in. In this case, you may need to call an additional API to retrieve the real-time ranking of players after logging in.

 {
   "CustomId": "Yan",
   "CreateAccount": false,
   "TitleId": "   ",
   "InfoRequestParameters":{
     "GetUserReadOnlyData":true,
     "UserReadOnlyDataKeys":["Rank"]
     }
 }
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.

drew avatar image drew commented ·

@Neils Shi thank you for the reply. Sorry, I meant to say "User Data" when I accidentally wrote Title Data. Thanks for showing me InfoRequestParams, I didn't know about that. Why wouldn't I want to retrieve it at login time though? I didn't understand that part. I always want to know my rank when I login, and would like to avoid making a second API call unnecessarily.

0 Likes 0 ·
Neils Shi avatar image Neils Shi drew commented ·

As I mentioned before, you can store the Rank info into the player read only data, and when players call the login API (for example LoginWithCustomID), he can retrieve the ranking info (which stored in player read only data) at the same time as he logs in via setting InfoRequestParameters, and it doesn't need you to make a second API call.

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.