Page 1 of 1

More questions about userVariables!

Posted: 16 Apr 2005, 07:38
by fonager
I have a few questions about uservariables :

1) Why isnt there a "setVariable()" function, so I can set/change a single uservariable instead of collecting all uservariables in total and post them using "setUserVariables()" function ? It seems like "overkill" that I have to send all variables each time one of my variables has changed ...

2) When I change the uservariables using "setUserVariables()", what actually happens "on the TCP socket" ? Is a notification send to each user about the uservariables changes, or are ALL uservariables actually sent "down the wire" to each user ? I mean, if a heavy user has 100 uservariables, all being a long string, and one of these are changed, will each user in the room then recieve 100 * strings "downloaded" from the server into their client ?

Thanks for making a great product :D


-
Regards from Copenhagen,

Tony Fonager

Posted: 20 Apr 2005, 14:57
by Lapo
Again, sorry for the delay in responding. For some reason I did not receive notifications about the new topic.

Back to your questions:

1)
Setting server variables (UserVars, RoomVars) is already optimized. You don't have to send all the data every time and you receive only variables that where changed.

If you take a look to the Avatar Chat example you will notice that we're updating only the data we need (px, py and init) but we don't send the color of the avatar each time. The color is created once and never sent again.

Also by using the setUserVariables() method you can decide to update one single variable only or a group of variables in one shot, making it pretty flexible.


2)
As I said before only variables that where changed are broadcasted to the other users in the room.
It is obviously important to optimize the type of data you're using: if you end up having 100 long strings you should rethink your application because that would be very heavy in terms of bandwidth usage.

In other words the data sent through the TCP socket is only representing the updated variables.

Let me know if you have more questions.

:)

Posted: 21 Apr 2005, 07:04
by fonager
So If I have users with 10 variables each, and I make a new object and add only one of the variables and send that using setUserVariables(), that is the only variable being updated.

Thats nice!

Posted: 21 Apr 2005, 08:19
by Lapo
Of course :)