Replay
Box2D has gained a new replay system designed to make hard-to-reproduce physics bugs much easier to chase down. Instead of relying on a text dump of world setup, recordings now capture an initial snapshot plus the sequence of Box2D API calls that follow, including body creation/destruction, impulses, forces, ray casts, queries, and world steps.
The practical win is reproducibility. A developer can start recording at any point, run the game for a few seconds, then save a compact binary .b2rec file and hand it off for debugging. The replay viewer then rebuilds a live b2World from that recording, showing contact points, impulses, velocities, and other simulation data while preserving determinism checks through recorded hashes.
Key frames are generated on load to speed up scrubbing through long recordings. They’re stored as runtime-generated snapshots rather than baked into the file, with the system balancing memory budget against seek performance. That makes the viewer more usable on busy scenes, even if the recordings themselves can still get large for complex worlds.
The same work also exposes snapshot and restore APIs, which opens the door to rollback-style workflows. There are limits: full determinism still depends on deterministic game code, snapshots can be expensive for large worlds, and partial-world snapshots aren’t supported. Even so, this is a meaningful debugging and tooling upgrade for anyone shipping gameplay on Box2D.
“I wanted recording to be easy for a game to implement.”
- what
- Box2D adds a replay system that records a world snapshot plus API calls, queries, and step data for deterministic bug reproduction.
- who
- The system was developed for Box2D by its maintainer and is surfaced through the Box2D samples app replay viewer.
- when
- The feature is part of the push toward Box2D v3.2.
- impact
- Developers can capture compact recordings, replay live physics state, and share files to reproduce bugs without full game context.
Strong tooling upgrade for debugging and replay
Follow box2d updates
See relevant stories in your personalized news feed.
Discussion