First let me explain the game I'm currently working on real quick:
I'm working on a top-down shooter for mobile phones (they are quite rare), but also with vehicles (tanks/cars etc. that's why I use Box2D (and because its so much fun
Well, lets say that there are 20 players and 20 vehicles in the game, which makes 40 Body's total.
I think it is the smartest to just let the client send his input to the server, and the server sends that input to all clients, and it simulates it himself as well.
Why simulate it as well? Well, because if a new player joins, he needs all Body's (in current state).
Well, supposing that sending 40 Body's won't be a problem (has anybody better ideas, thanks), what do I do to keep all clients synchronized?
Sending input to all clients sounds fine to me, but what if a client has lagg and gets one packet 5 seconds later (which messes up his whole game).
Maybe there is some way to check if a client had 2+ seconds delay and if it had, 'refresh' the game??? I hope this doesn't overload the server?Edit:
Asynchronous clients (with Box2D) is inevitable? I think the best option I have then is simulating the game on the server and sending the positions to all clients via UDP