question

Roshaan avatar image
Roshaan asked

How to store a growing collection of data?

Hi, In my game of puzzle there are going to be N numbers of words and Players will generate N numbers of synonyms for each word that appears in the game. I intend to store this word-synonym data onto Playfab in order to grow my dictionary for my game. How should I do this?

Storing the data in JSON is not a great idea in my opinion as I would have to download whole JSON on client side and then append the new data into it and store it back on Playfab.

What is the best approach here to store a growing dictionary?

EDIT: This collection or data should/can be shared/accessed to/by all players

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

Roshaan avatar image Roshaan commented ·
0 Likes 0 ·

1 Answer

·
brendan avatar image
brendan answered

It sounds like you're describing having every player in the game - potentially millions - updating a single store of data that is to be read by all players. Is that correct? If so, then no, there is no system in PlayFab designed to let you do this. Operations in any backend service have a cost you can estimate by asking "how often does a single value change, and how large is that change". While the total size of the change for each player would be small in this case, you're talking about changing a single data value at a massive rate.

What you would need, in order to do that in a cost-effective manner, would be to have all the data stored in an in-memory system so that the data can be updated without a data table hit. While I'm sure we'll be providing something in that space in future, that's not how any of the legacy PlayFab services are defined today.

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.

Roshaan avatar image Roshaan commented ·

@Brendan Yes, it is correct that the data can be read and update or write by many players.

Is there any solution to the problem using current Playfab services? Because it's a major requirement of my game to build a database of words because there are some API restrictions from the API which I'm using to get those words and their synonyms.

0 Likes 0 ·
brendan avatar image brendan ♦♦ Roshaan commented ·

No, we do not currently provide an arbitrary data store where all players in the game can update a single key/value pair. Based on your description, what I would recommend is that you use custom game servers. When a session starts, the game server would query for the current set of words, which you would store in an Entity File. The session would track on any new words added by the players and, at the end of the session it would update the Entity File. In the case of a collision (two servers trying to update the file at the same time), the version numbering would prevent the server that tried "late". You could then re-try on the error, reading the updated file, merging in your changes, and then updating the data.

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.