question

Darius Vu avatar image
Darius Vu asked

How do we store game data that all players can access?

Dear Team,

I want to store an active key list with around 10,000 to 100,000 keys for my app as below:

Key 1: ANKFIENBL

Key 2: KLFEISFKJ

.......

So how do we store it in the Playfab in order that all new players can compare their keys with the key list above and activate the app if they have the right key in the list?

Or do we have any function like this in Playfab?

Thank you so much.

Player Datadatagame manager
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

You can use Title Internal Data for this, store the key list in it and have the player compare their keys with the ones in the list:

  1. Players pass their keys to a CloudScript/Azure Function (or any other server side logic you self-hosted).
  2. Server side logic calls Server/GetTitleInternalData to retrieve the key list and identify whether the one the player provided is in it or not. If it’s in it, return true, else return false.
  3. If the result from the server side is true, activate the app, else, don’t.

And, please also note:

“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.“

Therefore It’s suggested not to update it very frequently and sometimes it takes a while before all the players can access the same data.

3 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.

Darius Vu avatar image Darius Vu commented ·

Thank you so much for your comment. But I see that we have Title Data and Title Internal Data. So what is the different between them? Will I use Title Internal Data, not Title Data?

And If I store the key list in Title Internal Data then do you know the maximum size of value data? It is enough to store 100,000 keys as above?

Thank you again,

0 Likes 0 ·
Citrus Yan avatar image Citrus Yan Darius Vu commented ·

Title Internal Data can only be accessed from the server side and the client side have no access to it. You wouldn't want the players to know the content of the key list, therefore you should use Title Internal Data.

The default size of a Title data value is 1,000,000 bytes, if on average, each key consumes less than 10 bytes, then you should be able to store 100,000 keys in a single value, or else you'd need more entries to store this.

1 Like 1 ·
Darius Vu avatar image Darius Vu Citrus Yan commented ·

Thank you so much for your help. It is really clear for me.

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.