The sandbox
Loading the sandbox.
How this works
- Click or tap drops a body at rest. Drag before releasing to launch it instead — the dashed line shows the aim, the arrow shows the direction, and how far you drag sets the speed.
- Keyboard: focus the sandbox, then ←↑↓→ to move the gold crosshair, Enter / Space to arm a body there, arrows again to aim its velocity, Enter / Space to launch, Escape to cancel. Hold Shift for bigger steps.
- Pick a mass below before placing a body — heavier bodies pull harder on everything else, and win most mergers.
- Pause freezes the physics completely. Time scale only changes speed while it's running, from slow motion up to fast forward.
- Clear bodies wipes the sandbox and reseeds the default star system. It does not touch your saved stats below.
- The sandbox holds at most 40 live bodies at once, and anything that flies far enough off-frame is considered gone for good and stops being simulated, so a long session stays fast.
What this actually is: a genuine N-body gravity simulation, not an animation of one. Every pair of bodies attracts every frame, integrated with a stable step-by-step method (semi-implicit Euler, substepped for stability) rather than the naive approach that visibly spirals orbits outward over time. A small softening constant keeps the force from spiking to infinity when two bodies pass very close together; if they get closer still, they merge into one body instead of passing through each other or blowing up the math. None of that is faked — it's the same handful of equations, run honestly, over and over.
One honest limitation: the live simulation itself — every body's exact position and velocity — is not saved. Reload this page and you get a fresh default star system, not the mess you left behind. Serializing a running physics sim reliably across reloads is more trouble than a toy like this is worth. What this room does remember, in one localStorage key, is your last time-scale setting, your last chosen mass, how many bodies you've personally launched, and the longest single run you've kept a simulation going. Nothing here is ever sent anywhere.
The button below wipes this room's saved preferences and lifetime stats — total bodies launched, longest run — and resets the sandbox to its default star system, on this device only.