Browser open-world game: Three.js, Rapier physics, game loop

11 steps · about 6 h 15 min · Intermediate

  1. Getting Started (doc, Vite, 20 min)

    Vite is the build tool in the Leonida repo, so set up a project folder first.

  2. Introduction to Three.js (tutorial, Three.js Roadmap, 1 h 5 min)

    This free course gets a first scene, camera and animation loop running.

  3. 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.

  4. 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.

  5. Rigid-bodies (doc, Rapier, 25 min)

    Fixed, dynamic and kinematic bodies are the building blocks of buildings, cars and characters.

  6. RapierPhysics (doc, three.js docs, 15 min)

    Shows the official way to connect Rapier's simulation to three.js meshes.

  7. 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.

  8. 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.

  9. Controllers (doc, Rapier, 30 min)

    Character controllers let a player slide along walls and climb slopes, which an open-world game needs.

  10. 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.

  11. 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.