P2P physics

Hello



This is a mixed post so maybe I will post it also in Networked forum.

Seems I have encountered a hard and obvious problem while testing a simple game over a P2P net and using JME physics 2 (with ODE impl) .

When a peer generates an event, firstly applies it to himself and then it sends to the other peers connected.

To avoid desync I could multiply message network delay with body force and obtain the same effect on all peers, but this doesn't solve the problem since all the messages arrived after timestep computation should be discarded also on the peer who generated them…

has anyone already faced this?

I read through a lot of items, and other than the brute force method, one of harder methods but one that gave the best results was to record all actions for the engine within a certain period of time.  Then if you get an update that is behind time, you rewind the physics engine, process the update, then rewind it forward.  Obviously you have to run your physics at a set timestep so that its deterministic otherwise you'd run into lots of problems.

…which I don't believe is possible with jME-Physics, or ODE for that matter…

maybe you can't believe it, but it's possible :)  (already done that) - but it uses quite a lot of computing power, obviously

I stand corrected.  :-o



I would expect it would take quite a bit of power to do that.  Is it better on other engines…like, I don't know…PhysX? :wink:

not that I know of

I started using the newton game dynamics engine for a .NET game framework… its free, but not open-source.  However, I found it had a problem with really large values where ODE did not.  I.e. I wrote a basic demonstration of the solar system using gravitational effects.  ODE handled it but NGD didn't.  Can't speak of PhysX… not really sure its viable for small developers, of course they've changed their licenses, etc. a couple of times now.



But irrisor, could you maybe give a short synopsis on how you did the roll-back?

rollbacking physics engine seems  good  but you could run rollbacks too often due to too small step size in ODE (needed for sim accuracy)

. So in my P2P test with client events this results in a disaster 

 

thzero said:

But irrisor, could you maybe give a short synopsis on how you did the roll-back?

well, remember position, velocity and force history and set an old state for the spatials - nothing special