Hakolkal
Start a Project

Project

Learn to Drive

Creator & Solo Developer

Live Demo

Sixty cars learn to drive the JP Racing track in your browser. Each one is steered by a tiny neural network that starts out as random numbers, and nobody shows them how to drive: the cars that get furthest pass their network on to the next generation, with small random changes. The first generations crash within metres, a car usually reaches the finish within about ten generations, and from there the best time keeps dropping. The leading car shows its seven distance sensors and its network live, and you can run the simulation up to 64 times faster, watch the whole track or start over. The road is read from JP Racing's own 3D track model: a tool I wrote finds the edges of the road surface and walks it from the start gate to the finish gate, 1,137 m in all. The physics, the sensors, the network and the evolution loop are plain JavaScript with no machine-learning library, seeded so that an automated test replays a full run and checks that a car reaches the finish. Drawn with three.js.

Stack

  • Three.js
  • Neural Networks
  • Genetic Algorithm
  • Canvas 2D
  • Vite
  • GitHub Actions

See it

Want something like this?

Tell me what you are building, or what you are still doing by hand, and I will tell you how I would approach it. No commitment.

More projects