Skip to content

In development. Expect rough edges and changes. The source code is not public yet.

Box2D 8 min read Deep dive mediumAdept

Determinism

Box2D v3 achieves algorithmic, multithreaded and cross-platform determinism by default with no noticeable performance cost, verified in CI by a 'Falling Hinges' test that checks the sleep step count and a transform hash across MSVC, Clang, GCC, x64 and ARM. Multithreaded determinism comes from per-thread bit arrays merged with bitwise OR rather than atomic appends or sorting, keeping contact order tied to creation order. Cross-platform determinism works without fixed-point math by avoiding fast-math, disabling FMA (-ffp-contract=off) and using custom trig approximations, since atan2f differs across platforms while sqrtf is consistent. Roll-back determinism for client-side prediction in multiplayer is not yet supported because of the engine's internal state.

Assumes: floating-point arithmeticmultithreading basicsrigid body physics engines

Related posts

  • Box2D 3.2

    Box2D easyNovice

    Box2D 3.2 runs roughly three times faster than 3.1, with the speedup broken down by source: contact recycling (~40%), solver algorithm refinement (~20%), AVX2 runtime dispatch (~15%), solver optimization (~10%) and broad-phase optimization (~10%), which compound multiplicatively. Following Jolt, body positions now use double precision while heavy math stays single-precision, raising the usable world size from about 16km to 1000km with little performance or memory cost. The release also adds recording and replay for debugging, which lays groundwork for snapshot/restore features such as rewind and networking, plus a new dynamic character mover.

  • Replay

    Box2D mediumAdept

    Box2D's new Replay system records a full binary snapshot of world state followed by opcodes and arguments for every API call, including steps, forces, impulses, body creation and queries with their callback results. Because the engine is deterministic across platforms and thread counts, a single snapshot plus the call log is enough to reproduce a user's bug in a live simulation. Per-step transform hashes validate that determinism. The Replay Viewer generates key frames at load time within a memory budget for fast scrubbing, and the snapshot/restore API is now exposed for rollback. Index-based handles, POD data in arrays and events instead of callbacks make serialization cheap, though friction mixing, filter and pre-solve callbacks are not yet recorded.

  • Box2D 3.1

    Box2D mediumAdept

    Box2D 3.1 fixes most bugs and build problems from 3.0 and adds an experimental geometric character mover built from collision queries and a specialized solver that runs outside the physics world. A rewritten sensor system no longer piggybacks on contacts: it ignores body type and sleep state, runs at the end of the step for undelayed, deterministic, multithreaded begin/end events, and exposes current overlaps. Rolling resistance and tangent speed (conveyor belts) are new shape surface properties using the SIMD contact solver. SSE2 is now the default on x64 instead of AVX2, Neon is optimized for Apple Silicon, continuous collision is about twice as fast, and GJK is 20% faster.

  • Turbocharging V8 with mutable heap numbers

    V8 hardMaster

    V8 eliminated a performance cliff in JetStream2's async-fs benchmark caused by a custom Math.random whose `seed` lives in a ScriptContext slot. Every update to the seed allocated a new immutable HeapNumber, and the integer bitwise math was compiled as floating-point. V8 now tracks slot types (constant, SMI, HeapNumber, Int32, other) and lets a context slot own a mutable HeapNumber that is updated in place, storing raw Int32 values when they stay in range. Optimized code depends on the slot type staying stable and deoptimizes if it changes, and the change gives about a 2.5x speedup on async-fs and about 1.6% on the overall JetStream2 score.

  • This Month in Ladybird - August 2026

    Ladybird hardMaster

    Ladybird's August 2026 progress centres on a sustained engine performance push. A new incremental style engine treats DOM mutations as typed deltas routed to dependent selectors, and is checked against a cache-free reference evaluator and replayed session recordings. Layout results are now cached by formatting-context input constraints, and opacity and transform CSS animations run on the compositor. Together these lifted StyleBench from about 3.5 to 83 and Speedometer 2 from about 47 to 64. Other changes include CSS parsing and painting moving to Rust behind A/B equivalence checks, caging of NaN-boxed JS cell pointers into a reserved heap region, a single sandboxed WasmCompiler service, MSE support for fMP4/H.264/HEVC/AV1, CSS scroll snap, and JS debugging in DevTools.

The quest for software engineering knowledge.

Look:
Layout: