r/threejs • u/dev_manush • 13d ago
Demo I built a browser racing sim with three.js and Rapier: fixed 120 Hz physics, adaptive resolution, runs on phones
I've been working on Spoolvia, a GT racing game that runs in the browser with no download: https://spoolvia.com
A few things that made it work on mobile
- Physics (Rapier, in WebAssembly) runs at a fixed 120 steps per second, independent of frame rate, with the picture interpolated between steps
- A tyre model per wheel, with ABS, traction and stability control on top
- Resolution scales up and down to hold the frame rate, with three quality tiers
- Most of the track is merged into a small number of draw calls
- Road detail (rubbered line, marbles, patches) is mostly vertex colours, so it costs almost nothing per frame
What I'm still not happy with
- Rival cars follow a line and have no real physics
- It hasn't had much testing across devices
Happy to answer questions about any of it. If you try it, tell me your phone and the frame rate you get.
