Is there a limit to the number of variables stored in room custom properties?
Options
Hi , this is my first post on here so sorry if I am asking this question in the wrong category
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 ?
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 ?
0
Best Answers
-
As can I see there is no limits.
BUT!
The more data you trying to serialize - the harder for photon.5 -
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.6 -
I think it will work great. It is only 200 bytes. More info about size5
-
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.5
Answers
-
As can I see there is no limits.
BUT!
The more data you trying to serialize - the harder for photon.5 -
Great .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?0
-
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.6 -
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 round0
-
I think it will work great. It is only 200 bytes. More info about size5
-
Grear , thanks for the response man0
-
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.1
-
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?0
-
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.5