About the project
Nairobilife is a 3D city simulation game built with Three.js and React: you can explore a living city with traffic, vehicles, people, and flights — including an airliner taking off at JKIA. I wanted a browser-based way to play with a city instead of just seeing it.
What inspired me
Exploring the repo showed the city has a rich set of features (vehicles, a real airplane, furnished homes, people with poses). I wanted to turn that into something you can walk into and drive around.
What I learned
@react-three/fibergives a real game loop (useFrame), which changes how you structure rendering compared to plain Three.js.- Keeping game state in
Zustandstores made adding authenticated feel ("people with sit/sleep poses", ride transitions) easy without prop drilling. - Deploying Next.js on Cloudflare Workers via OpenNext has its own build/runtime details.
Challenges
- Synchronizing the 3D engine with game state was the trickiest part (characters, vehicles and rides all moving together without breaking the city).
- Early versions had frame-rate issues in the browser — tuning the render loop was needed.
Built With
- 3d
- city-simulation
- cloudflare-workers
- driving
- next.js
- open-world
- people
- react
- react-three/fibre
- three.js
- typescript
- vehicles
- webgl
- zustand