Visualizations
328 / 500

328 · Retro

Moon Lander

Vector-line lunar descent on a green phosphor tube, with a suicide-burn autopilot.

A vector arcade descent over procedural terrain: wrapping fractal noise plus dozens of craters, each a parabolic bowl with a raised Gaussian rim, and flat pads pressed in where narrow pads pay more. The lander has real lunar gravity, a throttleable engine whose acceleration climbs as propellant burns off, and attitude jets, stepped with semi-implicit Euler at a fixed 1/240 second. Every scene line goes into a phosphor buffer that is only partly erased each frame (with a color-burn black-point shift so 8-bit rounding never strands ghost trails) and is bloomed by adding back two downsampled copies under scan lines, while the readouts sit on a fresh layer so they stay crisp. The autopilot picks a pad, flies toward it with a braking-limited speed profile by tilting the thrust vector, then stands upright and free-falls until the stopping distance v squared over 2(a minus g) equals its height, lighting the engine at the last moment, while the landing radar plots the unpowered ballistic arc to where it would hit.

Try it. Press an arrow key to take over: left and right rotate, up (or space) throttles up, down throttles down. On a touch screen, hold to fire the engine and the lander leans toward your finger. Land slowly, upright, on a pad. A toggles the autopilot, R starts a new landing site.

  • Semi-implicit Euler integration
  • Suicide burn guidance
  • Procedural crater terrain
  • Phosphor persistence and bloom

View the source · one module, plus a small shared runtime for sizing, the animation loop and input

Build your own

Paste this into Claude Code, Codex or any coding agent to get a simple version running, then take it wherever you like.

Build a lunar lander arcade game with glowing green vector graphics, using JavaScript and the HTML canvas element. Put everything in a single index.html file with no libraries or build step, so I can open it directly in a browser.

Start simple:
- Make a full-window canvas that stays sharp on high-DPI screens, with a black background and everything drawn as thin green lines.
- Generate terrain as a height array: a few octaves of 1D noise you write yourself, plus craters (a parabolic bowl with a raised rim around it) and two or three flattened landing pads.
- Model the lander in meters: lunar gravity 1.62 m/s^2, a main engine whose acceleration is thrust divided by the current mass, fuel that burns while thrusting, and rotation from small jets. Step the physics at a fixed small timestep with semi-implicit Euler (update velocity, then position).
- Left and right rotate, up thrusts. Detect touchdown with the two footpads: land if vertical speed is under about 2 m/s, sideways speed is small and the lander is nearly upright, otherwise crash.
- Show altitude, horizontal and vertical speed, and fuel.

Once that works, make it beautiful:
- Fake a phosphor tube: draw into an offscreen canvas that you only partly clear each frame, so moving lines leave a short glow, then add a blurred, downscaled copy on top for bloom, plus faint scan lines and a vignette.
- Zoom the camera in as the ground gets close, and kick up dust when the exhaust reaches the surface.
- Draw a flickering engine flame and make pads show score multipliers.

Explain the key ideas in short code comments. When you're done, tell me how to open it and suggest three directions I could take it next, such as an autopilot that flies a suicide burn (free fall until the stopping distance equals the altitude), a landing radar showing the unpowered ballistic arc, or a crash that breaks the lander into flying line segments.
PreviousSound of MandelbrotHover the Mandelbrot set to see and hear orbits: each bulb's period plays as a loop. NextColor ConstancyStrawberries under cyan light: not a single red pixel, and they still look red.

Related visualizations

  • AsteroidsGames The arcade classic with glowing vector lines and an AI pilot.
  • Evolution Strategy LandersMachine learning Fifty ghost landers learn soft touchdowns by natural evolution strategies.
  • CRT MonitorRetro An emulated electron beam, decaying phosphors and a shadow mask, under a 7x loupe.
  • Synthwave FlyoverRetro An endless neon wireframe landscape under a striped sunset.
  • Gravity TurnPhysics A two-stage rocket flies pad to orbit on a live blueprint, max-Q and all.
  • Voxel SpaceRetro Fly low over a mountain valley with the 1992 Comanche terrain trick.
  • Oscilloscope MusicRetro A phosphor XY scope draws a 4D tesseract, knots and text from the stereo sound you hear.
  • Pseudo 3D RoadRetro A sunset coastal highway faked the 80s arcade way, from flat segments and sprites.
  • Roguelike ExplorerRetro An amber-terminal dungeon crawl that explores itself, cat in tow, by rolling down a Dijkstra map.

Use ← and → to move between demos. While the canvas has focus, keys go to the demo instead.

← More from Emergent Mind Labs