A high-performance gravitational N-Body simulation written in pure HTML5, CSS, and Vanilla JavaScript.
- Custom Physics Engine: Built from scratch using a highly stable Runge-Kutta 4th Order (RK4) integrator, providing astronomically precise planetary orbits without standard Euler degeneration.
- Momentum Conservation: Bodies undergo perfect inelastic collisions, correctly calculating and inheriting new center-of-mass vectors and mass totals.
- Flawless UI Synchronization: A custom decoupled mathematical
Cameraclass handles true CSS-to-World coordinate mappings, allowing pixel-perfect orbit tracing and mouse-drag placements at any zoom level, immune to high-DPI scaling artifacts. - Sci-Fi Aesthetic: A "Digital Dossier" aesthetic featuring glassmorphism, glowing orbital paths, dynamic telemetry data, and bespoke cyberpunk control sliders.
Simply clone the repository and open web/index.html in your favorite web browser. No native build steps or package managers are required.
- Left Click & Drag: Slingshot a new planetary body into the system. The length and direction of your drag determine the resulting orbital velocity.
- Right Click & Drag: Pan the camera across the vacuum of space.
- Scroll Wheel: Zoom into the action or pan out to observe the entire solar system.
Version 2.0 represents a complete teardown and architectural rewrite to eliminate accumulated technological debt and UI inconsistencies from earlier iterations.
The application strictly separates responsibilities:
Vector2D.js- Immutable vector mathCamera.js- Pure Coordinate Transformation mapsPhysicsEngine.js- Heavy lifting math computationRenderer.js- Canvas2D Drawing instructionsUIManager.js- DOM Event Listeners & Glassmorphism UpdatesApp.js- The Master Orchestrator Tying it all together