I was curious just how many celestial orbits I could simulate in real time. So, I started with a special little star called the Sun and its planets to make sure everything worked properly. Then I added stars and planetary systems until the simulation finally began to struggle. Turning to burst-compiled parallel jobs allowed me to push much further, eventually reaching 2 million simulated orbits running in real time at 60 frames per second. Not a Milky Way by any means, but a fun-sized pocket galaxy at least.
We will base our orbit simulations on the real world, or rather the real universe. We can’t have both realistic distance scales and realistic volume scales. If the Earth was scaled to a single pixel, the Sun would be 109 pixels wide, but would need to be almost 11 thousand pixels away from the Earth. So, we’ll have to oversize our smaller celestial bodies visually, but we’ll use the correct distance and mass values in the calculations, so that the orbits are realistic.
This is the story of implementing what I've learned into a gridless, interactive, world-building sandbox game called Minor Deity.
Minor Deity on Steam: https://store.steampowered.com/app/3876240/Minor_Deity/
Minor Deity Discord Server: https://discord.gg/2NEb4HxwhF
00:00 Introduction
00:35 Scale
01:00 Eccentric Orbits
03:13 Orientation in 3D Space
03:42 Axial Tilt and Spin
04:15 Implementation Summary
05:49 Comparing Simulation Options
07:43 Burst Results
08:14 Rendering - Meshes
09:55 Culling and LODs
11:06 Deterministic Order in Jobs
12:00 Outro