A 3D driving simulation game built with Three.js. Drive through a procedurally-generated mid-size American city, follow traffic laws, and keep your license.
Open index.html in any modern browser. No server or build step needed.
| Key | Action |
|---|---|
Space |
Start (Licensed mode) |
F |
Start (Free Roam mode) |
↑ / W |
Accelerate |
↓ / S |
Brake / Reverse |
← / A |
Steer left |
→ / D |
Steer right |
R |
Restart after game over |
Start with 12 license points. Violations deduct points — reach 0 and your license is revoked.
| Violation | Points |
|---|---|
| Ran red light | −3 |
| Blew stop sign | −2 |
| Speeding (minor) | −1 |
| Reckless speed | −2 |
| Hit pedestrian | −3 |
| Collision | −4 |
Clean driving for 120 seconds recovers 1 point.
No license deductions, no game over. Violation warnings still appear so you can learn the rules without consequences.
An organic 1200×1200 unit city with 8 districts, each with its own speed limit and character:
| District | Speed Limit |
|---|---|
| University | 25 km/h |
| Hospital | 30 km/h |
| Park | 30 km/h |
| Suburbs | 40 km/h |
| Downtown | 40 km/h |
| Midtown | 50 km/h |
| Industrial | 50 km/h |
| Airport | 50 km/h |
| Highway | 100 km/h |
- Main avenues — 6-lane with double yellow centre line, crosswalks, traffic lights
- Secondary streets — 4-lane with yellow dashes
- Side streets — 2-lane with white dashes
- Perimeter highway — high-speed outer ring
- AI cars follow waypoint routes and stop at red lights
- Pedestrians cross at main intersections on green
- Vienna Convention signs: STOP octagon, YIELD triangle, speed limit circles, street name boards
index.html — canvas, HUD, overlays
style.css — HUD layout, overlays, animations
js/
three.min.js — Three.js r160 (bundled locally)
constants.js — world dimensions, road network, districts, physics
world.js — ground, buildings, landmarks, highway
roads.js — road surfaces, curbs, sidewalks, lane markings
intersections.js — traffic light registry + update loop
signs.js — canvas-texture signs placed at every intersection
player.js — car model, input, physics, collision
ai.js — AI cars, pedestrians
rules.js — violation detection, license points, game over
hud.js — speed, points bar, minimap, zone label, popups
game.js — scene lifecycle, camera, boot
Complete rewrite from a single script.js to a full 11-module architecture.
- Organic city with 8 districts replacing the single straight road
- 3-tier road hierarchy with curbs, sidewalks, and lane markings
- Algorithmically-placed signs at every real intersection (no hardcoded positions)
- License points system replacing money/fine system
- Free Roam mode
- AI cars with lane discipline and red-light stopping
- Pedestrians at main intersections
- Minimap with district fills
- Traffic lights with emissive bulbs
Traffic light improvements, overhead housing, stop lines, fine system.
Initial version: straight road, obstacles, coins, score/speed/money UI.
