Spent the week deciding on a physics engine for the game engine and landed on Rapier. It’s written in Rust and ships to the browser as WASM, which sounds like overkill for a 2D hobby engine until you watch the alternatives fall over.
PhysicsJS was the first I crossed off — last meaningful release was years ago, and I’m not building on something nobody’s touched since the previous decade. Matter.js was the real contender: pure JS, easy to drop in, lovely docs, and a big enough community that every problem I’d hit has already been answered. But the maintenance has gone quiet, and once I started pushing body counts the frame budget got tight in a way I couldn’t profile my way out of.
Rapier wins on the two things I actually care about. It’s fast — the WASM core doesn’t blink at the body counts that made Matter.js sweat — and it’s deterministic across platforms, which matters the moment you think about networking or replays. The cost is a heavier, less JS-native API and a WASM blob to load. Worth it. I’d rather pay that upfront than fight the physics layer every time the simulation needs to grow.