Hi,
I have a zone extension and a room extension written in Java.
Inside my game room (in flash), my users send object messages to each other that describe their x & y co-ordinates, movement vectors and a timestamp.
I have now found that it would be useful to also store the x & y values as user variables, so that I can retrieve that information directly from a user object client side.
I would prefer not to stop using object messages to send the x & y, but I don't want to send user variable updates in addition to the object messages.
Is it possible for my room extension to intercept the object messages, and copy the x & y information into the user variables server side?
thanks,
Alex
Intercept object message within extension
Hello. No, extensions can't intercept object messages.
But why don't you use only UserVariables instead? When you update them, the update also is broadcasted to all the players in the same room
But why don't you use only UserVariables instead? When you update them, the update also is broadcasted to all the players in the same room
Skills: SFS Pro, SFS2X, AS2.0/AS3.0, Java, HTML5/CSS3/JS, C#
Portfolio: https://rjgtav.wordpress.com/
SFS Tutorials: http://sfs-tutor.blogspot.com/ - Discontinued. Some examples may be bugged.
Portfolio: https://rjgtav.wordpress.com/
SFS Tutorials: http://sfs-tutor.blogspot.com/ - Discontinued. Some examples may be bugged.
The reason I want to use object messages rather than user variables is that I want to send a timestamp with each message (the number of millliseconds since the start of the game) in order to help keep things synchronised as far as possible. I can then compare the remote time and local time with each incoming message, and consider the players x & y vectors to work out where they are likely to be now, rather than where they were when the message was sent. I then incorporate this into their existing motion to smoothly correct for lag.
This is working great with object messages, but leaves me with the problem that I can't query a client side User instance for its x & y position. So when a new player joins an existing game, he doesn't know where to initially position the players on screen.
Thinking about it though, if I use object messages to send x & y info and also set user variables then the information is going to be begin transmitted from the server to the client twice! I think that instead I'll probably have to create an extension that allows me to handle all of this somehow. Ideally I do want use user variables, but also bundle each update of them all into one message from the server that comes through with my custom time-stamp added. Provided it is possible to update a user variable on the server without automatically sending the update message (so that I can send my own custom one) then I think this could work.
cheers,
Alex
This is working great with object messages, but leaves me with the problem that I can't query a client side User instance for its x & y position. So when a new player joins an existing game, he doesn't know where to initially position the players on screen.
Thinking about it though, if I use object messages to send x & y info and also set user variables then the information is going to be begin transmitted from the server to the client twice! I think that instead I'll probably have to create an extension that allows me to handle all of this somehow. Ideally I do want use user variables, but also bundle each update of them all into one message from the server that comes through with my custom time-stamp added. Provided it is possible to update a user variable on the server without automatically sending the update message (so that I can send my own custom one) then I think this could work.
cheers,
Alex
Hi.
Yes, you can't listen to ObjectMessageRequests. In order to use the extension, you have to send an ExtensionRequest from the client and then the extension will do the job from there.
So, in this case, every time an user wants to update its position, it sends an ExtensionRequest with the timestamp and both x and y values. Then, the extension could send to all the other users an ExtensionResponse with all those parameters and could also update the user variables and not firing the client events.
Yes, you can't listen to ObjectMessageRequests. In order to use the extension, you have to send an ExtensionRequest from the client and then the extension will do the job from there.
So, in this case, every time an user wants to update its position, it sends an ExtensionRequest with the timestamp and both x and y values. Then, the extension could send to all the other users an ExtensionResponse with all those parameters and could also update the user variables and not firing the client events.
Skills: SFS Pro, SFS2X, AS2.0/AS3.0, Java, HTML5/CSS3/JS, C#
Portfolio: https://rjgtav.wordpress.com/
SFS Tutorials: http://sfs-tutor.blogspot.com/ - Discontinued. Some examples may be bugged.
Portfolio: https://rjgtav.wordpress.com/
SFS Tutorials: http://sfs-tutor.blogspot.com/ - Discontinued. Some examples may be bugged.