Control of box2d from red5 server

Hi,
in order to continue my game, I want to make it playable online.
So I have my world box2d, with my car and others cars from each one whose connected to my server. And I was wondering what the best to make it work:
-Each time the position of others player's car is update, it is send to all players and we can update our world like this, the inconvenient will be that the others cars would move jerky.
-Each time a player press or release a key on his keyboard, it is send to all players.

What is the best for you?Any better idea?
And if anyone has done such thing I would be happy to hear how.
i don't have a lot of experience with this. but some.

i send keyboard info through asap.
and send position/velocity updates through less often

it may be better to send all keyboard events through on enter frame, only when they have changed. rather than any time the key is pressed. because users could slow down the server by mashing. when its being sent asap. also only send the keys you need obviously.


position and velocity are updated by using the keys events received... but they are potentially off due to lag... so sending the correctional data of position and velocity every second or so, will jerk them back into place to keep things consistent for everyone.

when using keyboard events to control other cars, you can simplify how you code otherCar.as or what ever you call it... by using the data received through your connection to manufacture your own real keyboard event.
just don't have the otherCar listen to your local keyboard, but it can still use events exactly like your own car.

whatOtherCarListensTo.dispatchEvent( new KeyboardEvent( ... fill out all fields you require));

good luck with your game, hope its as fun as it sounds so far. also look into tensor damping class borris made. for realistic top view car physics.
Hi and thanks a lot for those precious elements you just gave me. I will definetly do it this way, it seems to be the best.

And about the tensor damping, I used it but I don't see very much difference with the android exemple he made, I'm surely not using it in the good way. But for the moment I'm happy with what I got.

For my game, I can show it to you at any time, I'm working on the chat right now. I have so many ideas and so less time to work on it, I wish I could split me in two!!

Do you have any swf to show, based on multiplayer networked? And do you know red5 and redsandy?

Thank a lot

Original thread: https://box2d.org/forum/viewtopic.php?t=3067