Published on

Replaying Physics Simulations



Here's a prototype I made when evaluating web-based physics run-times.

You can try the prototype out yourself. You can pause, play, scrub the timeline, and change the camera angle. Note that there are likely some layout issues if viewed on mobile devices.

I didn't add support for branching your timeline in this prototype, but this work has laid the foundation for that.

Technical Details of The Prototype

To make replaying/branching technically feasible all parts of the Convey's architecture must be deterministic. Determinism in regards to software, means that given the same user inputs, the app will output the same results. Without getting into the technical details, just know that this makes for more efficient recording/playback and simplifies the multiplayer implementation. Wanting to support physics simulations in Convey, I needed a physics engine that was deterministic and supported snapshots.

I evaluated many existing web-based physics libraries and most were not efficient or didn't support running in a mode that maintains determinism. The top solution ended up being Rapier.js, which supports determinism.

I'll leave the rest of implementation up to others to figure out.

Follow @seflless and @convey_it on Twitter, to see Convey's progress and more experiments.
Request Early Access to Convey