Port: Racing game
site/media/lessons/ports-batch.lesson.ts (5 steps) racing-game (packages/editor/template/src/examples/racing-game/) is a port of
pmndrs/racing-game — proof that a real third-party
three.js game runs on vgai. Its React-Three-Fiber JSX became Object3D + GameComponents,
its cannon-es RaycastVehicle became vgai’s Rapier DynamicRayCastVehicleController, and its
zustand store became a RaceController component + a HUD closure.
Run it
Section titled “Run it”-
Open the racing-game scene. Load
examples/scenes/racing-game.vscn.json.
The ported racing circuit. -
Enter play mode. Press Play.
Play mode. -
Accelerate around the circuit with
W. The car uses the sameVehicleController+ChaseCamerathe Vehicle capstone ships — reused directly.
Driving the circuit. -
Steer through a corner with
AandD. Pass the checkpoint gates; lap times are tracked by theRaceController.
Cornering; checkpoints + lap timing. -
Stop play mode. Press Stop (or
Escape).
Why this matters
Section titled “Why this matters”The port reuses shipped engine capability rather than re-implementing it: the vehicle physics, chase camera, and scene format are all first-party. The porting work is mostly mapping the original’s structure onto vgai’s model — see the porting guides.
Recap
New functionality
- Ran a ported third-party game on vgai
- Drove the circuit and cornered
New concepts & skills
- R3F JSX maps to Object3D + GameComponents
- cannon-es RaycastVehicle maps to Rapier's raycast vehicle controller
- Ports reuse shipped engine capability, not re-implement it
Next lesson → Port: Ugh-Guys RTS
See also
Section titled “See also”- Capstone: Vehicle — the reused controller.
- Loading Existing Games — bringing games into vgai.