Visualizations
291 / 500

291 · Games

Rendezvous

Dock a capsule with a station, where thrusting toward it sends you backward.

The chaser flies in the station's rotating local frame, where the Clohessy-Wiltshire equations rule: radial offsets drift along track, and any velocity error curls the path into loops. Flight is integrated with RK4 at a fixed one second step, while the dashed prediction of two orbits of free drift and all the targeting use the closed-form CW solution: to reach a point after time T the needed velocity is the inverse of the transition matrix's velocity block applied to the position error, a two-impulse transfer. The autopilot hops to holding points on the V-bar (points directly ahead or behind are equilibria), then flies a closed-loop straight-line approach, nulling the Coriolis push with small radial jets and slowing as range shrinks to dock at a few centimeters per second. A range versus closing-rate chart checks it against the 0.1 percent rule, and a centerline camera lines up the final meters.

Try it. Take over with the arrow keys (up and down fire radially, left and right along the V-bar) or press and hold to thrust toward the pointer, and watch the predicted path rise and fall behind when you push toward the station. Tap any point to have the computer fly a two-impulse hop there. A or Enter hands back to the autopilot from wherever you are, R starts a new approach.

  • Clohessy-Wiltshire equations
  • Two-impulse CW targeting
  • RK4 integration
  • Closed-loop V-bar approach

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 an orbital docking game that shows why rendezvous in orbit is counterintuitive, 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. Draw the station at the center of a local frame: horizontal is along the orbit (the V-bar, direction of flight to the right), vertical is radial (up is away from Earth).
- Put a chaser a few kilometers behind and below. Move it with the Clohessy-Wiltshire equations for a 400 km orbit (n = mean motion, about 0.00113 rad/s): x'' = 3 n^2 x + 2 n y' and y'' = -2 n x', with x radial and y along track. Integrate with RK4 at a fixed one second step and a time warp of about 100x.
- Arrow keys fire small thrusters that change the velocity directly.
- Draw the predicted free-drift path for the next orbit or two as a dashed line, using the closed-form CW solution, so every burn instantly shows where it leads.
- Scale the view with the distance (zoom in as you approach) and draw a grid with distance labels.

Once that works, make it beautiful:
- A dark navy space backdrop with a soft blue glow of Earth's limb at the bottom, a glowing amber prediction and a cyan flown track.
- Draw a simple modular station and capsule when close, with thruster puffs.
- Add docking: success when the capsule meets the port slowly and lined up, a bounce when it hits too fast.

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 a click-to-target two-impulse transfer solved from the CW state transition matrix, an autopilot that flies a V-bar approach, or a range versus closing-rate chart.
PreviousNeuron GrowthA Golgi-stained circuit grows its dendrites and axons, wires up, then fires. NextLeniaSmooth artificial life: glowing creatures that glide, spin and divide.

Related visualizations

  • Grand TourGames Plan a probe's slingshot route past Jupiter, Saturn, Uranus and Neptune.
  • Gravity TurnPhysics A two-stage rocket flies pad to orbit on a live blueprint, max-Q and all.
  • Ground TracksAstronomy The snakes, loops and figure eights real orbits trace over a turning world.
  • Moon LanderRetro Vector-line lunar descent on a green phosphor tube, with a suicide-burn autopilot.
  • Drift RacerGames Pacejka tire physics on a generated circuit, with a drifting AI that plans ahead.
  • BreakoutGames The arcade classic, with sparks, screen shake and an autopilot.
  • AsteroidsGames The arcade classic with glowing vector lines and an AI pilot.
  • Aperture ProblemIllusions One grating, one true motion, three holes that each report a different direction.
  • Rebound RobotsAlgorithms Robots slide until they hit something. A* finds the fewest moves to the target.

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

← More from Emergent Mind Labs