question

luitelrubin avatar image
luitelrubin asked

Player data best practice

Is there a best practice on how to structure player data. The limit for player data single value is 300k bytes, so is it better to store all info about a character in a single player data key value pair or split them up.

The downside would be needing to rewrite the entire value when making updates, but if I split them up into multiple key-value then I can have more granular control.

I am having trouble understanding whats a good approach here from a design pov, should I be treating a single key value pair as a row in a sql table. And when we get multiple key value pairs, the time complexity is almost the same as getting a single key-value? Or does it matter if I store in a single key value and just rewrite the entire value again when making updates(which feels odd if i want to update a small part of the value but i need to rewrite the entire value)..

Player 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

·
Ronald Harding avatar image
Ronald Harding answered

Give this read and make sure you have an idea of what your request volume is going to be https://learn.microsoft.com/en-us/gaming/playfab/features/pricing/meters/meters#example-weighted-events-calculation profile reads/writes use the same weighted calculations as events.

I'd recommend grouping things together that you're likely to read/write at the same time as much as possible. Know that if you store all of your players data in a single key value pair, you'll be writing that whole key value pair every time. This can blow up your COGs quickly. On the other hand, any write regardless of size will always meter as at least 1 weighted write, so it's also not best to work in many small values. Getting the balance right can be tricky, and it depends a lot on your games structure.

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.