Skip to content

About

Interactive cosmic physics sandbox for manipulating gravity, black holes, supernovas, and orbital systems in a living universe.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

EVENT HORIZON, an interactive cosmic physics sandbox. Decorative wordmark: a black hole with an accretion disc and an orbiting body.

Bend gravity. Shape orbits. Trigger supernovas.
Explore a universe in motion — and see what happens when you disturb it.

Enter the universe: play the live demo   Source code on GitHub

Interactive WebGL experience · runs in your browser · no account or backend required · event-horizon-teal.vercel.app


Production footage with the interface hidden: a black hole's accretion disc turns, dust drifts toward it, and a nearby supernova sends a shockwave across the field.
Captured from the live application. In The Hungry Singularity, matter is painted toward the accretion disc before a nearby supernova sends a shockwave through the scene.

A universe in your hands

Event Horizon is an interactive cosmic physics sandbox built around one simple idea: give people the tools to disturb a universe, then let gravity tell the rest of the story.

Drop a black hole into a spiral galaxy. Redirect a stream of matter. Launch a planet into orbit or detonate a star. Watch particles scatter, objects interact, and discoveries emerge from the simulation.

This is more than a space-themed screensaver. The simulation advances on a fixed clock, independently of rendering, with reproducible starting worlds and tools to pause, rewind, undo, checkpoint, save, and revisit experiments. Its discovery system detects meaningful events as they happen, including stable orbits, event-horizon captures, merges, shockwaves, and gravitational slingshots.

The application currently displays the in-app title GOD MODE. Event Horizon is the public project name for that same application.

Seven tools. One universe.

Key Tool What you can do
1 Observe Inspect bodies, select them, move them, and navigate the field.
2 Gravity Place and tune a gravity well to bend nearby trajectories.
3 Black Hole Create a singularity and watch matter approach and cross its event horizon.
4 Supernova Detonate a star and send an expanding shockwave through the system.
5 Repel Place a repulsor and push matter away from its influence.
6 Paint Stream particles into the universe; stroke speed affects how quickly matter is emitted.
7 Orbit Launch a body into an orbit around the nearest mass.

The Force Lab exposes the selected tool's parameters. Tune the gravitational constant and trail length to change how the universe behaves and how its motion is displayed.

Six starting worlds

Each world is a reproducible starting point generated from a fixed seed. Choose a setup, experiment, and return to the same initial conditions whenever you want.

The Hungry Singularity: a black hole wrapped in a spiral accretion disc.
The Hungry Singularity
A black hole and its swirling accretion disc. Send matter inward and watch the encounter unfold.
Stellar Collapse: a bright star inside a dense cloud of dust.
Stellar Collapse
A dense stellar environment poised for a dramatic release of energy.
Binary Dance: an amber star and a blue-white star in mutual orbit.
Binary Dance
Two stars in a mutual orbit, surrounded by drifting matter.
Total Chaos: stars and singularities with their influence rings drawn around them.
Total Chaos
Singularities, stars, and a repulsor sharing one unpredictable field.

The atlas also includes Prime Field, a spiral galaxy with a binary companion and three planets, and Slingshot, a high-velocity encounter shaped by a massive star's gravity.

These are frames captured from the production application, cropped with the interface hidden. The wordmark above is decorative artwork.

Inside the observatory

The full Event Horizon interface showing the tool rail, Force Lab, discovery notifications, and simulation transport controls.
The full instrument: tool rail, Force Lab, discovery feed, simulation transport, rewind, and reset.

  • Control time. Pause and resume, change simulation speed, rewind through captured states, create checkpoints, and undo or redo experiments.
  • Follow discoveries. Objectives and the live event feed surface detected events such as stable orbits, event-horizon captures, merges, shockwaves, and gravitational slingshots.
  • Keep your experiments. Store up to eight local saves, rename them, export JSON, and import validated experiments. Saves remain in your browser.
  • Hear the universe. Procedural audio responds to the simulation with ambient layers and event sounds. Mute it whenever you like.
  • Choose your visual quality. Cinematic, Balanced, Performance, and adaptive Auto quality options tune rendering without changing the underlying particle simulation.

Meet Orbito

Orbito, a small ringed creature with glowing eyes, shown in ten expressions: idle, curious, excited, surprised, confused, thinking, sleepy, amused, concerned and celebrating.

A small ringed creature lives in the bottom-left corner. Orbito watches the same events as the discovery feed: black holes you open, supernovas you detonate, stars that collapse on their own, mergers, bodies swallowed by a black hole, matter crossing a horizon, slingshots, discoveries, world changes, pause and resume. It reacts with one of ten expressions and, now and then, an opinion. It never repeats a line back to back, keeps quiet while you're paused, and goes to sleep if you leave it alone.

Click Orbito (or Tab to it and press Enter) to talk. Its answers come from the live universe: what's happening, why something was flung away, what doubling the selected body's mass would do, how black holes, mergers, orbits and shockwaves work here, and what to try next. The first time you pick each tool, it explains what that tool really does. When a question is beyond what the universe reports, it says so.

  • Voice, optional and off by default. VOICE speaks through your browser's own speech engine, choosing the lightest, youngest-sounding voice available (Microsoft Ana in Edge, then natural or Google voices, Samantha on Apple devices, Zira on Windows) and steering away from deep narrator voices. It follows M mute and the volume slider, never talks over itself, and stops when you close the panel. Available voices depend on your browser and operating system.
  • Quiet when you want. QUIET limits unprompted remarks to discoveries. Esc closes the conversation, H hides Orbito with the rest of the interface, and typing to Orbito never triggers simulation shortcuts.
  • No network, no keys. Conversation runs on a local, deterministic engine. Orbito remembers only a few counters and its two settings, in your browser.

Built as an instrument

Event Horizon combines a deterministic simulation core with a real-time Three.js/WebGL renderer. The visual language is designed around the physics: a black hole's photon ring and limb-darkened photosphere, Doppler-shifted accretion-disc lighting, stellar diffraction spikes, additive particle trails, shockwaves, and a world-anchored graticule that scales as you navigate.

The engineering is just as deliberate:

  • Fixed-step physics: a 1/60-second simulation step keeps physics independent of display frame rate.
  • Stable numerical behavior: semi-implicit (symplectic) Euler integration and Newtonian gravity with Plummer softening; matter is additionally bounded in acceleration and speed. A circular orbit drifts by about 0.001% in energy over ten revolutions.
  • Conservation where it counts: bodies pull on each other in equal and opposite pairs, mergers keep total momentum and land at the pair's centre of mass, and a black hole takes on the momentum of the matter it swallows. Each of these is covered by a regression test.
  • Deterministic particle recycling: particle storage is bounded, with a 24,000-particle ceiling.
  • Two-phase slingshot detection: a flyby is armed on inbound motion and counted only after outbound escape, avoiding false discoveries during scenario loading.
  • Rendering-only quality tiers: visual quality changes do not trim or otherwise mutate the simulation's target particle population.
  • Adaptive Auto quality: a measured P95 frame-time controller adjusts rendering quality with hysteresis and cooldown to avoid rapid oscillation.
  • Event-driven effects: merges, captures, stellar collapse, supernova shockwaves, and other simulation events drive visual and audio feedback.

The black-hole and relativistic-looking effects are visual approximations layered over the simulation; this is an interactive sandbox, not a general-purpose relativistic astrophysics solver.

What is modelled, and what is approximated
  • Modelled: Newtonian body–body gravity, particle motion in the bodies' field, inelastic mergers that conserve momentum, and circular-orbit launch speeds of √(GM/r).
  • Simplified: particles are tracers that feel bodies but don't pull on them; each grain a black hole swallows adds a nominal 2.5 mass units; a black hole's horizon is set by its drawn radius, not by its mass; gravity wells and repulsors act only inside their influence radius.
  • Artistic: accretion drag near a horizon (so matter spirals in instead of orbiting forever), the shockwave's outward push, stellar lifetimes, and every relativistic-looking visual.
Architecture and source layout

The application is a Vite and TypeScript single-page app. The physics core is independent of the Three.js/WebGL renderer; src/app.ts coordinates simulation, rendering, input, history, and persistence.

src/core/    physics, particles, worlds, scenarios, events, objectives, history, serialization
src/render/  Three.js renderer, shaders, camera
src/input/   pointer, mouse, and touch interactions
src/ui/      panels, controls, help, notifications
src/audio/   procedural Web Audio
src/orbito/  companion: brain (moods, reactions), knowledge (context, answers), voice, view
src/app.ts   application orchestration

Run it locally

Requires Node.js 20.19 or newer and npm.

npm ci
npm run dev

Open the local URL printed by Vite (normally http://localhost:5173).

Build and preview the production bundle:

npm run build
npm run preview

Controls

Input Action
1–7 Select Observe, Gravity, Black Hole, Supernova, Repel, Paint, or Orbit
Left click / drag Use the selected tool; drag selected bodies to move them
Left drag on empty space with Observe Pan the camera
Right / middle drag Pan with any tool
Wheel / pinch Zoom
Z / Y (Ctrl+Z / Ctrl+Shift+Z) Undo / redo
Space Pause / resume
+ / - Change simulation speed
F / Delete / R Focus selection / delete selection / reset world
M / P / L / H Mute / performance display / labels / hide interface
? Open the help overlay
Tab to Orbito, then Enter / Esc Open / close the conversation with Orbito

On touch devices, tap and drag to use tools, use two fingers to pan, and pinch to zoom. The panel toggle keeps controls reachable on smaller screens.

Accessibility and comfort. The application responds to prefers-reduced-motion, provides visible keyboard focus, and labels toolbar and transport controls for assistive technology. Sound can be muted with M or the volume control. The Performance and Auto quality options help adapt rendering to available hardware.

Performance and benchmarks

The release benchmark was measured on an RTX 3050 Laptop GPU (6 GB) using ANGLE over Vulkan, at 1280×800. The recorded final run reported:

Metric Result
P50 frame time 6.9 ms
P95 frame time 7.0 ms
P99 frame time 7.1 ms
Worst frame time 7.1 ms
Reported frame rate 144.1 FPS

These measurements were display-refresh-bound at 144 Hz; they do not establish maximum GPU throughput. The benchmark report documents the methodology, quality tiers, environment, and limitations. See docs/BENCHMARKS.md.

Tests and release verification

This release (Orbito, event feed and conservation fixes) recorded:

Check Result
Unit tests (Vitest) 105/105 passed
Local browser smoke 18/18 passed
Orbito browser checks (Chromium, Firefox, WebKit) 16/16 passed in each
npm audit 0 vulnerabilities

Typecheck and production build completed cleanly. The previous release's wider campaign (QA smoke 6/6, 10/10 seeded personas, 100/100 fuzz cases, 12/12 user acceptance checks, a 600.8-second extended session) was not rerun for this release.

Run the core checks locally:

npm run typecheck
npm test
npm run build
npm run preview            # then, in another terminal:
npm run smoke
node scripts/orbito-check.mjs                          # Chrome
ORBITO_BROWSER=firefox node scripts/orbito-check.mjs   # or webkit; needs `npx playwright-core install firefox webkit`
Verification scope and limitations

The release campaign exercised seeded scenarios, tool interactions, quality switching, save/restore, responsive layouts, focus behavior, and an extended session. The campaign is seeded and finite, not an exhaustive proof of correctness.

The RTX 3050 benchmark is refresh-bound at the tested resolution; higher-resolution GPU-bound benchmarking remains useful future work. Orbito's voice was checked through physical speakers in Chrome on Windows: its median pitch rose from 111 Hz (the deep default voice it used to pick) to 232 Hz. Edge's online natural voices are not exposed to automated browsers, so the preferred Edge voice was not measured. Other audio checks validate code paths, not subjective sound quality. Touch emulation does not replace testing on physical touch hardware. Browser zoom edge cases and WebGL context-loss recovery have not been fully verified.

Detailed benchmark methodology and defect history are retained in docs/BENCHMARKS.md and docs/DEFECTS.md.

Deploy to Vercel

Event Horizon is a static Vite application. Use the Vite preset, npm ci for installation, npm run build as the build command, and dist as the output directory. No backend or environment variables are required.

Production: event-horizon-teal.vercel.app.

Contributing

Bug reports and ideas are welcome through GitHub Issues. Before opening a pull request, describe the proposed change and run the relevant typecheck, test, and build commands. Include screenshots for visual changes and benchmark evidence for performance-sensitive changes.

License

Event Horizon is licensed under the MIT License. You may use, modify, and distribute the software under its terms; retain the copyright and license notice in copies or substantial portions of the software.


Enter the universe →

About

Interactive cosmic physics sandbox for manipulating gravity, black holes, supernovas, and orbital systems in a living universe.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages