question

racso avatar image
racso asked

Check if title data has been changed recently

Hello.

In our game, clients read the game's title data when they start running. However, given that the developer may change the title data at any moment, it's important to have some mechanism to detect that the data has been changed in the server so clients that are already running can restart the game, read the updated data and use it during gameplay.

I'm thinking in polling the server every X time (every minute, maybe?) to check if the data has changed. The question is how to know if the data has changed. A naive way would be to request the data JSON and see if it is different from the one read when the game was loaded. However, given that the JSON may be big, a better way (at least for bandwidth reasons) would be to ask PlayFab for *something* that I can use to know that the data has been changed.

Does PlayFab provide a way to check if a Title Data value has been changed recently without actually requesting the full data? For example, an API call that returns the "last modified time" of the Title Data value, or an API call that returns a hash value of the currently stored Title Data.

In case there isn't anything like that, Would it be wise/possible to create a CloudScript that returns that information (the hash of the stored data), or would that actually be more of a burden to PlayFab's infrastructure than the naive alternative of simply polling the data in the first place?

Thanks!

Title 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

·
Hernando avatar image
Hernando answered

I guess you're looking for a way to push arbitrary data down to connected clients, the PubSub feature we have in private preview may be what you need. And if you are in free tier,you can refer this thread: How to get notified when server change a data?

As you mentioned, polling the server will be not a best practice, and in the case of query it per client too frequent, cause an additional effect on the performance of Playfab service.

Besides. You seem like that updating the titledata of all clients in time when updating the titledata on the server side. If you have a need such this, have to be aware of is Title data is a cached data, so when you update Title data, there will bea delay before all endpoints are updated and it would be faster to serve that data from our Content service, which is called CDN.

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.

racso avatar image racso commented ·

Thanks for the answer.

As for the last part: I'm aware that TitleData updates may take some time to propagate. That's not an issue.

Are you sure that polling would cause performance issues? I've seen in answers to other questions that if a game makes "a few calls per minute", it will be fine. Of course, I would not poll the server every second or so; the "every minute" mark I mentioned would be a minimum. Given that TitleData may take up to 15 minutes to propagate (according to the documentation), it would even make sense to poll the server for changes every 15 minutes.

[1] https://community.playfab.com/questions/85/205460588-API-call-limits.html, https://community.playfab.com/questions/8387/are-there-limits-to-cloudscript-api-calls-in-free.html

0 Likes 0 ·
Hernando avatar image Hernando racso commented ·

Yes, if the polling interval is long, it will not have much impact on it.

-1 Like -1 ·

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.