Gravity Simulator
- 2 Devlogs
- 5 Total hours
An interactive 3D gravity simulator where you can create solar systems, launch planets, collide galaxies, and watch real Newtonian physics in action. Built with p5.js and vanilla JavaScript.
An interactive 3D gravity simulator where you can create solar systems, launch planets, collide galaxies, and watch real Newtonian physics in action. Built with p5.js and vanilla JavaScript.
Following up on the initial interface layout, Devlog #2 focuses on environment staging, repository restructuring, and preparing the deployment pipeline for production.
Hosting Architecture: Migrated the project layout to sit directly at the root directory level of the GitHub repository.
Vercel Integration: Successfully configured automated continuous integration (CI/CD) pipelines. Pushes to the main branch now trigger zero-config production deployments instantly.
Live Endpoint: The public facing interactive staging URL is officially live.
Asset Integration: Implemented an optimized, dark-matter cosmic background asset behind the primary UI layout.
Contrast Tuning: Applied a dual-layer black alpha overlay linear-gradient to the background source image. This preserves interface element legibility while allowing planetary orbital paths to pop visually.
Layout Cleanup: Stripped out temporary branding elements from the baseline visual wrapper to ensure a minimalist, simulator-first presentation.
🌌 Project Overview
Stardance is an interactive, browser-based gravity simulator built using p5.js.
The goal is to simulate orbital mechanics, planetary mass interactions, and cosmic chaotic systems through a clean, modern dashboard interface.
🛠️ Tech Stack
Frontend : HTML5, CSS3
Graphics/Simulation Engine : p5.js
Fonts : Orbitron & Inter
📅 Current Progress
What’s Working:
Core UI Layout : Implemented a sleek, responsive sidebar control panel using frosted glass visual effects (backdrop-filter).
Dashboard Telemetry: Real-time tracking elements ready for planet count, total mass, simulation runtime, and FPS.
Simulation Controls:Fully configured range sliders for dynamic adjustments to Spawn Mass, Simulation Speed, and camera settings (Zoom and Rotation).
Preset Engine Architecture: Buttons configured to swap between pre-calculated gravity scenarios: Solar System, Binary Stars, Galaxy Spirals, Planetary Rings, Black Holes, and Chaos.
Data Persistence: Hooks added for exporting state to JSON/PNG and importing custom orbital systems.
Recent Changes:
Applied a deep-space galaxy background across the canvas space to contrast against the bright orbital trajectories.
Structured modular JavaScript engine architecture (planet.js , presets.js,physics.js, sketch.js) to decouple physics math from render routines.
🛑 Current Challenges & Next Steps
Orbital Physics : Fine-tuning the gravitational constant in physics.js so planets don’t immediately sling out of bounds or collapse into the central mass on spawn.
Performance Tuning: Optimizing the $O(N^2)$ particle-to-particle attraction loops when the Chaos preset spawns high planet counts.
Tail rendering: Ensuring the p5.js canvas buffer correctly handles alpha-blended paths for smooth planetary trails.
💡 Lessons Learned
When building canvas-heavy overlay interfaces, keeping a strict coordinate distinction between screen space (UI) and world space (simulation physics) is essential to keep zoom and pan gestures functioning correctly.