Browser open-world game: Three.js, Rapier physics, game loop
11 steps · about 6 h 15 min · Intermediate
- Getting Started (doc, Vite, 20 min)
Vite is the build tool in the Leonida repo, so set up a project folder first.
- Introduction to Three.js (tutorial, Three.js Roadmap, 1 h 5 min)
This free course gets a first scene, camera and animation loop running.
- First Three.js Project (video, Three.js Journey (Bruno Simon), 1 h 20 min)
A longer free walkthrough of scene, camera, renderer and the Vite workflow, to reinforce the basics.
- Getting started (doc, Rapier, 25 min)
Rapier is the physics engine the project uses. This page shows how to load it and create a world.
- Rigid-bodies (doc, Rapier, 25 min)
Fixed, dynamic and kinematic bodies are the building blocks of buildings, cars and characters.
- RapierPhysics (doc, three.js docs, 15 min)
Shows the official way to connect Rapier's simulation to three.js meshes.
- Physics with Rapier (tutorial, Simon Bachmann (sbcode.net), 30 min)
A hands-on example that keeps simple physics shapes in sync with detailed meshes every frame.
- Fix Your Timestep! (article, Gaffer On Games, 25 min)
The classic explanation of why physics runs at a fixed step while rendering runs at a variable rate.
- Controllers (doc, Rapier, 30 min)
Character controllers let a player slide along walls and climb slopes, which an open-world game needs.
- When is InstancedMesh worth it in THREE? (article, three.js forum, 15 min)
Cities repeat buildings and props, so learn when instancing cuts draw calls and what it costs.
- bridge-mind/leonida (repo, GitHub (bridge-mind), 45 min)
Now read a real project that combines all of these pieces. Check its src, tests and GitHub Actions workflow.