🪐 Loading Universe...

🌌 Tiny Universe

Click anywhere to spawn a planet.

Watch them orbit and merge.

šŸ”¬ How Universes Work

Gravity & Orbital Mechanics

In our simulation, planets are attracted to a central star via gravitational force. In reality, gravity follows Newton's law: F = G(m₁mā‚‚)/r², where the force between two objects depends on their masses and the square of the distance between them.

Our simplified model only accounts for star-planet attraction (not planet-planet), making it more stable and predictable than real n-body physics.

Planet Formation & Merging

In the early universe, planets formed through accretion—small particles colliding and sticking together. Our collision system mimics this: when two planets collide, the larger absorbs the smaller, growing in both size and mass.

The particle explosions you see represent ejected material during these cosmic impacts, similar to how Earth's moon likely formed from debris after a massive collision.

Black Holes & Stellar Death

When you click "Reset," our central star collapses into a black hole—an ultra-dense region where gravity is so strong that not even light can escape. The "event horizon" (the point of no return) is represented by the dark sphere that grows.

After consuming nearby matter, the black hole implodes in our simulation, triggering a "rebirth" similar to how stellar nurseries form from the remnants of dead stars.

The Technical Stack

Canvas API: All rendering happens on an HTML5 canvas using 2D context drawing methods.

Physics Loop: Each frame calculates gravitational acceleration (a = F/m), updates velocities, and moves objects accordingly.

Collision Detection: Uses simple distance checks: if distance between centers < sum of radii, objects collide.

Particle Systems: Explosions spawn particles with random velocities that decay over time for visual flair.

What We Simplified

  • Real gravity is much weaker (G ā‰ˆ 6.674Ɨ10⁻¹¹ m³/kgĀ·s²)
  • No relativistic effects near massive objects
  • No tidal forces or deformation
  • Planets don't attract each other
  • Instant, perfectly inelastic collisions
  • 2D universe (ours has at least 3 spatial dimensions!)

Real Universe Physics

The actual universe operates on scales both vastly larger and smaller than what we can simulate. From quantum foam at the Planck scale (10⁻³⁵ m) to the observable universe spanning 93 billion light-years, reality is far stranger and more wonderful than any simulation.

General relativity shows us that massive objects don't just exert force—they curve spacetime itself. Quantum mechanics reveals that at tiny scales, particles exist in superposition until observed. These phenomena are impossible to capture in a simple JavaScript canvas!