question

Sergi Hidalgo Baliarda avatar image
Sergi Hidalgo Baliarda asked

Title Data values as "global variables"

I want to modify global variables once a day to modify the map daily according to these variables. I wonder what is the best option to save these variables with which the map will be created when players enter the game.

Is Title Data the best option?

Thanks

Title Datadata
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

·
Sarah Zhang avatar image
Sarah Zhang answered

As the doc Title Data said, 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. Title Data is best suited for "global constant/static data" and is not suitable or reliable as "global variables".

Considering your situation, you want to modify the “global variable” once a day, title data is able to be used for such usages. But, if you use title data to store this “global variable”, you should implement 15 minutes maintain time once a day and a data validation mechanism. Because after you update the title data K/V pairs and before the data is refreshed in all caches, "global variables" that different players get may be different from each other. Before the title data is refreshed completely, players should be unable to enter the corresponding game scene.

CloudScript variable can be an option, deploying a new CloudScript revision will take only several seconds, you can use Client API ExecuteCloudScript to get the “global variable” that you write in the CloudScript. The disadvantage is you can’t update the CloudScript variable via API, you need to modify the variables in ClouScript manually. You can choose the solution that most suits your case.

1 comment
10 |1200

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

Sergi Hidalgo Baliarda avatar image Sergi Hidalgo Baliarda commented ·

Thank you very much!

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.