General relativity is usually taught through equations, diagrams, and static simulations. Black holes are described as extraordinary places, but most educational tools make the learner feel like a technician adjusting sliders rather than a pilot entering a dangerous physical environment.

ERGO: FLIGHT began with a question:

What if the Kerr metric itself could become the level design?

We wanted players to experience a theorem physically before reading its explanation. Frame dragging should feel like a current they cannot resist. A Penrose extraction should produce a real recoil kick. Photon trajectories should visibly curve around the hole. When the engines switch off, conserved quantities should determine the ship’s future—and the game should draw that future directly into the world.

The name has several meanings. The ergosphere is the region around a spinning black hole where remaining stationary is impossible. “Ergo” also means “therefore,” connecting the game to mathematical reasoning. Together, the title means something like: fly through the consequences of the geometry.

What it does

ERGO: FLIGHT is a real-time 3D spaceflight and physics-learning game set around a rotating Kerr black hole called the Millstone.

The player operates a salvage tug and completes a set of scientific contracts while trying to clear a persistent guild debt. Three introductory flight lessons teach steering, thrust, braking, coasting, trajectory prediction, and docking. The main physics library then offers nine experiments covering:

  1. Frame dragging and the static limit
  2. Carter integrability and geodesic prediction
  3. Photon shells and black-hole shadows
  4. Penrose rotational-energy extraction
  5. Superradiance and cavity feedback
  6. The Kerr extremality bound
  7. The ISCO and accretion efficiency
  8. Ringdown spectroscopy and no-hair
  9. Horizons, mass inflation, and the limits of the ideal Kerr interior

Each contract is structured as:

Briefing → guided evidence → physical experiment → debrief → theorem card

The signature mechanic is the prediction trajectory. After the player stops thrusting, the game integrates a ghost copy of the ship hundreds of proper-time units into the future. If the predicted orbit plunges through the horizon, that part of the path turns red.

The campaign also maintains a live black-hole ledger showing mass, spin, surface gravity, angular velocity, and horizon area. Actions performed in earlier missions can change the physical environment encountered later.

How we built it

The project is built with React, TypeScript, Vite, Three.js, WebGL, GLSL, the Web Audio API, and Vitest.

The physics engine is isolated from the renderer and UI. It uses equatorial Boyer–Lindquist coordinates for a Kerr black hole with

[ \Delta(r) = r^2 - 2Mr + a^2. ]

Bodies are represented by the Hamiltonian state ((r,\phi,p_r,E,L,\mu)), with the super-Hamiltonian

[ H = \frac{1}{2} \left( g^{tt}E^2 -2g^{t\phi}EL +g^{\phi\phi}L^2 +g^{rr}p_r^2 \right). ]

Ships, cargo pods, projectiles, photons, and orbital buoys move using fixed-step RK4 integration. Nothing that flies follows a cosmetic scripted path. Thrust is applied as proper acceleration in the local ZAMO orthonormal frame and converted back into Kerr coordinates.

The physics layer continually verifies important invariants:

  • Coasting preserves (E) and (L).
  • Massive bodies remain on the shell (H=-1/2).
  • Captured particles satisfy

[ E-\Omega_H L \geq 0. ]

  • Every accepted interaction respects classical horizon-area monotonicity:

[ A=8\pi M r_+, \qquad \Delta A \geq 0. ]

The superradiance threshold

[ 0 < \omega < m\Omega_H ]

is exact. Its displayed gain magnitude is intentionally stylized and labeled accordingly.

Three.js and custom GLSL shaders render the spacecraft, star layers, accretion flow, black-hole lensing cues, mission objects, photon trails, prediction paths, bloom, crash debris, and other effects. React renders menus, briefings, mission guidance, accessibility surfaces, and scientific instruments without participating in the frame loop.

The Web Audio API synthesizes thrust, local frame-dragging hum, echoes, damage, and black-hole ringdown rather than relying on recorded sound effects.

Challenges we faced

Turning exact physics into playable controls

Relativistic motion does not behave like a conventional arcade spaceship. Velocity cannot simply be assigned, and gravity cannot be represented as a Newtonian force without undermining the lessons.

We solved this by applying thrust in the local ZAMO frame as proper acceleration while allowing the Kerr integrator to determine the resulting trajectory.

Numerical stability near the horizon

Boyer–Lindquist coordinates become increasingly difficult near the event horizon because (\Delta) approaches zero. Maintaining stable trajectories required a fixed integration cadence, analytic Hamiltonian derivatives, shell checks, and careful termination conditions.

Making difficulty educational rather than confusing

A player initially sees only that the black hole is pulling them somewhere unexpected. The real challenge was making the cause readable.

We added safe introductory lessons, large navigation targets, stage-based instructions, trajectory previews, reference-frame velocity instruments, contextual control hints, and debriefs that connect the observed behavior to the relevant concept.

Preserving honesty while improving presentation

The game needed cinematic visuals without implying that its schematic WebGL optics were full relativistic ray tracing. We keep the boundary explicit:

trajectory physics: exact · WebGL optics: schematic

Balancing information and immersion

Early versions exposed nearly every scientific measurement simultaneously. Although informative, the result looked like a wall of debugging panels.

The final interface shows only the current objective, ship status, navigation state, radar, and relevant controls. Deeper physics instruments remain available in a dedicated drawer.

Performance

The renderer must support the ship, prediction paths, multiple star layers, post-processing, mission effects, and hundreds of integrated particles while remaining responsive. We used fixed-size buffers, instancing, batched particle rendering, adaptive pixel density, and quality modes.

Accomplishments that we are proud of

  • Built a playable game around genuine Kerr dynamics rather than a Newtonian approximation.
  • Made conserved quantities into an intuitive flight mechanic.
  • Integrated massive particles and photons through the same physics architecture.
  • Turned theorem constraints into runtime assertions.
  • Created nine missions where the scientific concept is also the gameplay mechanic.
  • Added three accessible training levels without replacing the real simulation.
  • Built a persistent campaign economy and black-hole ledger.
  • Created a procedural spacecraft and space environment without requiring downloaded 3D assets.
  • Added keyboard-only play, reduced-motion behavior, quality settings, adjustable difficulty, and responsive layouts.
  • Maintained a suite of 80 automated physics, mission, campaign, rendering, and invariance tests.

What we learned

We learned that scientific accuracy and game design do not have to oppose each other. Exact physical constraints can generate memorable mechanics when the interface reveals their consequences clearly.

We also learned that correctness alone is not enough. A simulation may be numerically honest while remaining nearly impossible to understand. Good educational design requires carefully controlling when information appears, providing evidence before explanation, and helping the player distinguish between failure caused by their input and behavior enforced by nature.

Most importantly, we learned that advanced mathematics becomes approachable when players can develop physical intuition first. A theorem is easier to remember after it has pushed your spacecraft sideways, rejected your projectile, amplified your signal, or drawn your future trajectory in red.

What’s next for ERGO: FLIGHT

Future improvements could include:

  • Gamepad support and fully remappable controls
  • More extensive browser and hardware performance testing
  • Additional accessibility and localization work
  • A higher-fidelity optional optical ray-tracing mode
  • More spacecraft customization and visible damage states
  • Expanded guided explanations for advanced missions
  • Shareable flight telemetry and experiment results
  • Additional relativistic environments beyond the equatorial plane

Built With

  • chatgpt
  • claude
  • codex
Share this project:

Updates