SPECIMEN  ·  002  ·  § IV  ·  RUNTIME  ·  RAPIER PROJECT LAVOS · THE STACK

RAPIER · WASM · 60FPS · UNTIL IT ISN'T

the ceiling.

Rust physics, compiled to WebAssembly, running live in this page. Watch the chamber fill. The ceiling is the engine, not the architecture.

Loading WASM physics

What you're seeing.

Each box and circle in the chamber is a rigid body simulated by Rapier. Gravity acts on every one of them every frame. When two bodies touch, Rapier resolves the collision — restitution, friction, angular momentum. There is no animation here. Every position you see is the engine integrating forces in real time, sixty times per second, in your browser.

Rapier is written in Rust and compiled to WebAssembly. WASM is the reason it can run this many bodies at this speed inside the browser at all — JavaScript physics engines (Cannon-es, ammo.js) ship the same kind of sim but run perceptibly slower under the same load.

The page auto-spawns bodies. The HUD shows the count, the frame rate, and how long each physics step takes. When the FPS drops below 30, you have found the engine's ceiling on this device. Press + 50 to short-circuit to it.

Two ceilings, one demonstration.

The first is the architectural one — the top edge of the chamber. Bodies fall, settle, pile up, and eventually fill the chamber to the top. That ceiling is geometric. It always exists.

The second is the performance ceiling — the body count past which the simulation can no longer maintain 60 FPS. That ceiling is computational. It varies by hardware. It is what Rapier is engineered to push higher than its peers.

Everything else in Stage IV (Runtime) of The Stack sits beneath one ceiling or the other. Rapier's claim is that its computational ceiling is high enough that the architectural one usually arrives first.

Lineage.

  • 2008Bullet Physics · Erwin Coumans. C++ rigid-body engine. The reference for everything that follows. Used in Grand Theft Auto, every Pixar production, Boston Dynamics simulations.
  • 2014ammo.js · Bullet ported to JavaScript via Emscripten. The first capable browser physics. Heavy bundle, mature feature set.
  • 2015cannon-es · Schteppe. Native JS physics, smaller and simpler than ammo. The lightweight default for years.
  • 2018Rust + WASM matures. WebAssembly becomes a serious browser target. Rust toolchain produces small, fast, predictable bundles.
  • 2020Rapier · Sébastien Crozet (Dimforge). Rust-native physics from the ground up. Compiled to WASM for the browser, native binaries for Bevy and other Rust engines.
  • 2024Default for new browser physics work. Smaller bundle than ammo, faster than cannon-es, mature 2D and 3D APIs, deterministic stepping for networked simulation.

When to reach for it.

Reach for Rapier when you need real physical simulation — bodies that fall, stack, collide, slide, bounce, and react. Game prototypes, scroll-driven editorial pieces with physical feedback, interactive product demos with weight and momentum, and most things that benefit from "the world has rules that aren't suspended."

Reach elsewhere when you need cloth, fluid, soft-body, or character-rigged simulation — Rapier is rigid-body. For cloth/soft, look at PhysX (Unity/Unreal) or commercial. For character rigs, animation libraries (Mixamo, GSAP) get you closer than physics.

Stack neighbors: ammo.js (Bullet via Emscripten — heavier, more features), Cannon-es (lightweight JS), Bevy (Rust game engine using Rapier), Three.js / R3F (rendering layer above Rapier), wgpu (Rust GPU layer underneath).