UserVariable or ObjectMessage
Posted: 22 Nov 2011, 14:16
I have a game with 4 players. I want each of them to broadcast the following properties to the other players:
x position
y position
x motion vector
y motion vector
I intend for each player to broadcast updates on events (eg motion start / change direction) and also on a set interval (maybe 500ms).
Each broadcast should be time stamped, and I want to use the ping / lag tracker value compared against the time stamps to correct for network delays.
Currently I have built a working model of most of this by creating a UserVariable for each property (including a 'time' property).
But I've just noticed that there is an 'ObjectMessage' that might do the job just as well or even better than UserVariables.
Is there a preferred convention as to when to use UserVariables and when to use ObjectMessage?
What are the pros and cons of each approach? Does one carry more overhead in terms of bandwidth?
thanks
Alex
x position
y position
x motion vector
y motion vector
I intend for each player to broadcast updates on events (eg motion start / change direction) and also on a set interval (maybe 500ms).
Each broadcast should be time stamped, and I want to use the ping / lag tracker value compared against the time stamps to correct for network delays.
Currently I have built a working model of most of this by creating a UserVariable for each property (including a 'time' property).
But I've just noticed that there is an 'ObjectMessage' that might do the job just as well or even better than UserVariables.
Is there a preferred convention as to when to use UserVariables and when to use ObjectMessage?
What are the pros and cons of each approach? Does one carry more overhead in terms of bandwidth?
thanks
Alex