What it does

Our project simulates gravity and collisions between planets, stars, asteroids, etc. It's written in the Godot engine.

Inspiration

We were inspired by the game Outer Wilds, which has a built-in planet gravity simulation similar to ours. We wanted to make our own version, and make it open source and available to the public.

How we built it

Simulating gravity precisely between more than 2 planets is an unsolved (potentially unsolvable?) problem, so instead we approximated planetary orbits. Each frame, we calculate the gravitational forces on each planet at that moment and add it to the planet's velocity. It isn't exact, but it gets really close (arbitrarily close, depending on how slowly you're willing to simulate it).

Challenges we ran into

We were both new to the Godot engine, so figuring out how it works was challenging. Also, getting moons with stable orbits around planets was really hard at first, and we had to use pencil-and-paper math to figure out the right initial velocities and positions to give them so that they would stay stable.

Accomplishments that we're proud of

We're proud of how polished our end result turned out; we mostly finished the physics simulation part on the first day, so we had all of the second day to make sure everything looked good and to add good user controls (arrow keys to switch which planet you're viewing from).

What we learned

We learned a lot about how orbits and planetary motion works. For example, we found out why Mercury and Venus don't have moons: any planets that are too close to the Sun will have their moon pulled away by the Sun's gravity; we found this out firsthand when we figured out how to give our planets moons.

What's next for Space Simulator

We think our space simulator would make a really aesthetic screensaver or desktop picture, so we'd like to try that out. Additionally, there's the very doable potential to add planets on the fly given a starting position and velocity. Using this with our modified gravity system could lead to interesting results to the rest of the planets.

Built With

  • godot
Share this project:

Updates