Is there a limit to the number of variables stored in room custom properties?
The whole answer can be found below.
Try Our
Documentation
Please check if you can find an answer in our extensive documentation on PUN.
Join Us
on Discord
Meet and talk to our staff and the entire Photon-Community via Discord.
Read More on
Stack Overflow
Find more information on Stack Overflow (for Circle members only).
Is there a limit to the number of variables stored in room custom properties?
RamyDergham
2017-08-07 13:44:48
Hi , this is my first post on here so sorry if I am asking this question in the wrong category :smile:
Me and my friend are starting to develop a Turn based game with unity and we found the custom room properties a great gift in photon because we can use it to sync game states ,turn etc.. , but we are just afraid if there is a limit for the number of variables we can store in room properties that are not available in the lobby. we plan to use short vars like {"t",1},{"c1","aa"} in the hashtable but we don't know if there is a limit for the number of values we can store . Any help :smile: ?
Comments
As can I see there is no limits.
BUT!
The more data you trying to serialize - the harder for photon.
RamyDergham
2017-08-08 11:11:39
Great :smiley: .Do you mean more data to change at a time or more data to be stored in general? Also what do you mean by harder for photon?
I mean more data to change or create. You can create custom properties at runtime.
Recently I tried to serialize byte array with lenght over 500 000. Photon kicked me from room and data has been not saved.
Then I tried to serialize this array by parts. It was better, but there was some lags and I don't use this method. Also Photon is checking which properties have been changed and he is rewriting just changed properties.
Custom properties made for "easy" data like as PlayersCount, Map, some positions of scene objects and similar.
In short - try to serialize less data and it will be good for you.
RamyDergham
2017-08-08 14:14:15
Actually in my game I would need like 100 boolean values to be stored , few of them change each turn and reset all of them at the end of each round
I think it will work great. It is only 200 bytes. More info about size
RamyDergham
2017-08-09 11:59:42
Grear :smiley: , thanks for the response man :smiley:
[Deleted User]
2017-08-09 12:30:37
Please also note that the more Custom Room Properties are set, the longer the clients load time will be because when joining the room, the clients also receive all of the properties. If you have too many of them and clients' load time exceed a certain amount of time, this might result in a disconnect for them.
RamyDergham
2017-08-11 12:56:59
Can you explain more how much props are considered as many? In terms of bytes maybe? Also what is the timeout for joining a room?
[Deleted User]
2017-08-14 09:04:56
I guess there is no 'fixed' threshold value, because this depends on the data you actually add to the room properties. For example a byte value requires less storage space than an int value. This furthermore means that nobody can give you an exact value or tells you 'when to stop adding further properties'. So I guess you have to play around and test things out.
Note: a desktop computer is better in handling this stuff than a mobile platform, so if you also develop on mobile platform you should test with actual devices to see if there are problems with too many properties while connecting.
Back to top