I'm developing a web-based networked game using HTML5 and Box2D as physics engine.
The network communication is by Web Sockets.
Player A can spawn objects in the world, while Player B controlls an actor that can interact with them (jumping on them and such).
But here's the problem I've come across:
How do I synchronize the spawning objects from Player A, to Player B?
I mean. Imagine if Player B is running across the screen, and Player A spawns an object that is falling to the ground.
Now, due to the latency, the actor is running a bit behind on Player A's screen, and therefore, the spawning object might collide with the actor on Player A's screen. But in reality, the actor on Player B's screen have already run pass that point, and therefore, no collission.
It's a very basic game, but now I just realized I'm stuck and don't know how to solve it really.
I guess I have to do something with the server.
At the moment, the server only relays the messages between the clients, no physics or so is ran at the server-side. All physics is on client-side.
Thanks in advance! :-)