🍊 Mikan Orbit — Gravity Playground
An interactive N-body gravity simulator that runs in your browser. Real Newtonian physics — no approximations, no game engine. Built as a single HTML file with zero dependencies.
What it is
Mikan Orbit simulates gravitational attraction between celestial bodies using Newton's law of universal gravitation (F = G·m₁·m₂/r²), integrated with a velocity Verlet scheme (symplectic, 10 substeps per frame). Energy drift stays under 1% in typical runs — you can watch the "Energy drift" counter in the stats bar to verify conservation in real time.
Features
- N-body simulation — every body attracts every other body (full O(n²) pairwise gravity)
- Velocity Verlet integration — symplectic, stable orbits; energy conservation displayed live
- Slingshot creation — drag on empty space to launch a new body with velocity
- Real-time controls — gravity strength, time speed, trail length
- Two systems — a planetary system and a random chaotic cluster
- Zoom & pan — scroll to zoom, drag bodies to pan
- Right-click to remove any body
Physics
| Component | Method |
|---|---|
| Gravity | Newtonian pairwise: a = G·m/r² |
| Integration | Velocity Verlet, 10 substeps/frame |
| Softening | ε² = 25 px² (prevents singularities) |
| Stability | Symplectic — energy drift < 1% typical |
The energy drift readout lets you watch conservation live: |ΔE/E₀|.
How to run
Open index.html in any modern browser. That's it — no build, no server, no dependencies.
Or visit the live demo.
How to use
- Watch the default planetary system orbit the star
- Drag on empty space to slingshot a new body (the dashed line shows your launch vector)
- Adjust gravity/time sliders to explore regimes — crank gravity up to watch orbits destabilize
- Right-click bodies to remove them; scroll to zoom in on close encounters
Tech
- Vanilla JavaScript + Canvas 2D
- Zero dependencies, single file (~11 KB)
- Float64Array inner loop for the force computation
License
MIT
Log in or sign up for Devpost to join the conversation.