I vibe coded a mars rover simulator as an experiment. You can try it out here: https://lab.nightlybuilds.co/rover.
Give the little guy a drive!
The Rover
Is named Ares. It is a six-wheeled rover with rocker-bogie-style suspension. The standard NASA set-up. After some fiddling the rover now tilts and rolls realistically on uneven terrain.
The Terrain
- Infinite procedurally generated landscape using chunked Simplex noise
- Multi-octave terrain: distant mountains, rolling hills, fine surface detail
- Procedural impact craters with raised rims
- Scattered rock clusters and lone stones
Technology
Built from scratch in a single HTML file (~2500 lines) using:
- [WebGL2](https://developer.mozilla.org/en-USIs /docs/Web/API/WebGL_API) — raw API, no libraries. Five shader programs (terrain, rover, sky, particles, trails)
- GLSL ES 3.0 — height-based terrain coloring, directional lighting, distance fog, alpha-blended trails and particles
- Simplex noise — custom implementation with fractal Brownian motion for terrain generation
- Chunked infinite terrain — 65×65 vertex chunks that load/unload dynamically around the rover
- Deterministic seeded RNG — consistent crater and stone placement across chunks
- Per-wheel physics — 6-point terrain sampling, least-squares plane fit (Cramer’s rule), individual suspension offsets
- Dynamic trail mesh — quad strips built from recorded wheel positions, updated every frame
- Dual viewport rendering — main camera and PiP mastcam rendered in a single pass using gl.viewport and gl.scissor
- Touch input — multi-touch virtual joystick with analog control, separate camera orbit zone
- Zero dependencies — no Three.js, no npm, no bundler. Works offline.