question

shoti avatar image
shoti asked

Data modelling/relations

hey guys,

is it possible in Playfab to have data relations for player? Let's say each player in the game, can create a bag for items and put items into the different bags. In most database systems this would be easy to modell, however, I find it quite complicated doing it in Playfab.

My current solution is more like a work around, where I store on player data the bag name as a key and the itemIds as comma seperated values.

But, I don't like this approach that much though...

Thanks!

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

·
brendan avatar image
brendan answered

The User Data systems are designed to be as generic as possible, so that you can use them a variety of ways - they're simply string/string key/value pairs. We'll also be offering an update in the near future which will provide a more efficient way to manage lots of small keys. But yes, for your specific use case, I would recommend either using a JSON object to represent all the bags and their items, or else just an array per bag (if they contain a lot of things - less than 1KB in a Value isn't very efficient), and then stringify() to ToString() the object, depending on your language of choice.

10 |1200

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

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.