I built Orbital, the all-in-one project that encompasses whatever you need from a 2D astronomical simulator.
When first loading it up, a window titled “Orbital” pops up, and you will see a star right at the center. You can change the window dimensions however you would like, whether fullscreen or resized small.
This is where the fun starts: I spent tireless hours implementing a slingshot mechanism where you can intuitively and easily launch “orbitals,” as I like to call them. You can think of these as small planets that you can send to orbit around each other and around bigger stars, masses, and objects that you create yourself. The starting star is just to get you going.
Controls and Features:
• Navigation: Use the WASD keys and/or arrow keys to navigate around this 2D world and find different orbits across the gigantic canvas. It does not have an end (unless you spend 10 hours of unemployment trying to find it, but I am sure you are not that stubborn).
• Mass Adjustment: Use the plus (+) and minus (-) keys to change the mass of the objects you throw into the simulation.
• Physics: It runs on full n-body physics; nothing is hard-coded and everything is dynamic. No matter how quirky and interesting your orbits are, they will be solely and originally yours.
• Visuals: The colors change up every once in a while. I really tried to make it as minimalist and physics-identifying as possible.
• Reset: Press the R key on your keyboard to reset the world and start from a fresh universe, marked by the reset star that kickstarts everything again.
I am really proud of the n-body physics because it was surprisingly manageable and cool to work on.
Where I really struggled was on advanced merging. Normally, if objects are touching, you can simply merge them. But when objects move super fast, one frame they are far away, and by the next frame, high velocity math teleports them right past or into the other object. If you slingshot a planet relatively fast, it could easily glitch and teleport through objects. To fix this, I had to calculate whether the path the object took from frame 0 to frame 1 intersected any other objects along its trajectory.
That was an especially hard, albeit depressing challenge, but nevertheless, it was encountered and defeated so you could enjoy astronomical bliss.
Thank you!
- 16 devlogs
- 17h
