Qinzhu Xu avatar image
Qinzhu Xu asked

How to store frequently read/written shared data?


I am working on a game with Playfab. In the game, I need to store/moodify some shared data for all players. I check out title data and shared data but they are not suitable for my game according to the documents.(title data doesn't allow frequent write operations and shared data is only for a dozen of players). Does anyone know the solution?

Thanks in advance!

Title DataShared Group 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

Seth Du avatar image
Seth Du answered

May I ask what is the scenario?

If what you want to do is aggregate information across all users into a single row of data - that's not supported by the existing data systems. I'd have to recommend using a Redis Int per item (or similar) for this, so that you can do the aggregation there, and query it directly.

If you are looking for a public data that can be exposed to all players and you don't need to update it simultaneously, my suggestion is to use Player Data. Player Data can be a shared resources (actually it is by default) and it is feasible to query other players data. First you need to know the usage of Player Data: As the player data, including player read-only data and player internal data, has permission configurations, you can choose any of them as public so that those data can be seen by other users via GetUserData Client API call:

Just want you to know that title data is not designed for frequent changes because first it is a sharded resource as you know, which means the synchronous process of each shard is different after you update it, second, each time you query title data via GetTitleData, you cannot defined a specific shard so that you may get previous version of title data (you get response from a shard that hasn’t synced yet). However, it will only take few minutes until all shards are up-to-date.

10 |1200

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

Qinzhu Xu avatar image Qinzhu Xu commented ·

@SethDu Thanks for answering.

My scenario is like aggregating information across all users.

In my game, there are events players can join and they can also see the info of events(like number of participators). So every time a new player join the event, the info of event will be modified. I plan to use .json file to store events, so in this case, number of participators will be changed and the array of participators will be expanded. Simultaneous update will happen in my case. Will Redis work in my case?

0 Likes 0 ·
Seth Du avatar image Seth Du ♦ Qinzhu Xu commented ·

A redis cache could work, or maybe a persistent service that can keep the shared values in memory.

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.