question

David Coombes avatar image
David Coombes asked

Size of entity data (how much can 500 bytes fit?)

Investigating the data model. I've an array of 5 bytes that I have uploaded as entity data to the player. In the Game Manager console, this appears as the data:

{"s":[161,121,41,65,65]}

How many bytes is that of the 500 allocation? Are any characters prohibited from being used, or is it safe for me to convert binary data to a character string, on char per byte?

Player Dataentitiesdata
10 |1200

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

David Coombes avatar image
David Coombes answered

I discovered that there's nothing forcing use of JSON; that's just the practice used in all the examples but the object itself is just a string. I used Convert.ToBase64String to store binary data. This way one can pack in a lot more info than using JSON formatting.

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.

Citrus Yan avatar image Citrus Yan commented ·

Yes, PlayFab doesn't force using JSON, you can choose your own way that suits you best.

0 Likes 0 ·
Citrus Yan avatar image
Citrus Yan answered

PlayFab uses UTF-8 encoding for Entity data (Json data), hence, the data {"s":[161,121,41,65,65]} accounts for 24 bytes of the total 500 bytes. You can refer to the utf-8 encoding table to check out not-supported characters.

You were saying “convert binary data to a character string”, did you mean that you want to save binary data directly in entity data, and convert it to character string in the clients?

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.

Michael E Ortiz avatar image Michael E Ortiz commented ·

Sounds like he wanted to convert to a string to prevent sending a large payload of binary data, and was worried that during the conversion, an unsupported character would be needed, but unable to be sent to PlayFab.

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.