Perfect reversibility with negative time updates

Hi Erin and fellow phys2D people,

My name's Keith and I'm from over at the javagaming.org forums. I've used Phys2D, the port by Kevin Glass, and I was impressed by it. So thanks to Erin for making the code and Kev for porting it to java.

I just wanted to raise an issue: I wanted to use the engine for a networked game and a feature that I needed was to be able to give negative time updates to the engine so that physics would be reversed. It does work, but it is not perfectly symmetrical. I looked thru the code and I believe that it is because the order of how the collision detection is done is in the same order whether the time update is positive or negative.

By the way, I need to go backwards in time when a key press from a lagging client is recieved by the server, and the server's game world needs to be reversed to when the key press happened, and then applied. But that 1 second of movement before the key press was recieved on the server needs to be re-wound.

Are symmetrical positive and negative time updates possible? 🙂

Thanks,
Keith

PS: these things are cool 🤓 🤓
In principle the integrator is reversible, but all the constraint solver stuff blows it.

Did you ever play Prince of Persia: Sands of Time? In that game you could reverse time for a short bit. I think the trick is to buffer everything for a short amount of time. Then you can roll back.

I know this might seem like a lot of data, but you can probably find a minimal set of data to represent the "state" of your world. Even then, you could use compression on your buffer (delta compression perhaps).
Yes good idea, I'll have to do something like that. Thanks for the quick reply!

By the way, is this project very related to Phys2D? Kevin Glass and another guy made a lot of good improvements to Phys2D such as polygons and much else, are they worked into this project or is it different?

Cheers,
Keith
Oh cool, I didn't know he added polygons. Since my '06 presentation a lot of people asked me how to implement polygons. I finally got around to doing it myself. It is essentially a generalization of the box-box code.

You can find more links to Box2D ports/spin-offs (among other engines) here:
http://www.gphysics.com/physics-engines

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