So in this devlog I’ve done quite a few things to make the overall experience nicer:
ㅤ
- Added a way to pin one object to the center of the screen.
- Added the Moon and the rest of the planets in the solar system
- Switched from using light minutes to light seconds for distance measurements because the light minutes values were WAY too small
Another annoying bug I had to fix:
So there was this bug where the moon would pretty much always just fly out into the abyss as if there was zero gravity applied to it. It was pretty annoying to find out that it because I was using C++‘s float type instead of double.
ㅤ
What’s the difference? Well basically float gives about 7 decimal points of precision, while double gives about 15. I initially started with float because it is half the memory size of double and in my experience, float gets the job done like 99% of the time.
ㅤ
However, it turns out I did need more than 7 decimal points. This is because the gravitational force experienced by the Moon is very small, like around 10^-12 (thats 0.(eleven zeroes…)1). Since float can’t hold that value, it just rounded it to zero, causing the moon to fly out in a straight line forever. I’ll be honest, it wasn’t me who figured that out, it was Gemini who did, but pretty much everything else in this devlog was made by me.
ㅤ
It’s crazy how such a small difference of like 10^-12 can make on a physics engine like this! I hope I don’t have to then switch to C++‘s long double, which has even more precision, that would be insane if I had to go that extreme. I probably would have had to if I didn’t switch from light minutes to light seconds lol.
Comments 0
No comments yet. Be the first!
Sign in to join the conversation.