You are browsing as a guest. Sign up (or log in) to start making projects!

Perihelion

  • 6 Devlogs
  • 13 Total hours

This is basically going to be the game Universe Sandbox, but on the web! Basically you can play around with a simulated solar system, seeing what happens if you replace the sun with a black hole, or anything you want! It will simulate gravity using real physics defined by Newton himself!

Open comments for this post

1h 36m 55s logged

For this update, I have done 3 things:

  • Added a small outline circle to distant objects so that they are more visible.
  • made it so you can click inside of these circles or on the planet to zoom into it
  • Added a trail behind each planet.
2
0
12
Open comments for this post

2h 29m 11s logged

These past ~2.5 hours have been spent on some quality of life features for the app. Mainly these 3:

  1. Made every object 5x bigger than its real life size because it turns out the solar system is such a big place, that you kind of have to. Otherwise everything looks too small.
  2. Made it so when you switch between planet it has a quick transition period.
  3. Added textures to every planet and the sun. This was actually the hardest part, I had to play around with the settings because it would usually apply the texture sideways, or distort it but I got it working anyways.
0
0
2
Open comments for this post

3h 34m 36s logged

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.

0
0
3
Open comments for this post

3h 0m 44s logged

I got gravity simulation working! Now the Earth is spinning around the Sun!

I know you can’t see it in the video I posted, but the Earth is there, it’s just that this simulation is drawn to scale, the Earth would actually barely be visible if you were looking from a spacecraft that far away.

This took quite a while because of this one really stupid bug: basically I store all the distance values in light minutes rather than kilometers or miles because otherwise those values would be too big. However, the physics equations that I’m using expect the values to be in meters, not light minutes.

So basically, I forgot to convert from light minutes to meters when calculating the gravity acceleration, so those values were too small to change the velocity of the Earth, causing it to go in a straight line forever.

But now that that is done, I will start adding the rest of the planets and maybe their moons as well to this simulation, then I can look purely at quality of life improvements to improve the interactivity of it.

This project is turning out to be easier than I expected! Hopefully another challenge doesn’t pop up…

0
0
7
Open comments for this post

31m 7s logged

So I got this cool C library called adjust.h setup for hot code reloading. This means that I can update the code while it’s running, and the changes show up in real time! I know that I am making this a web app, but because the module doesn’t work on web, I will prototype the app on desktop for now.

0
0
3
Open comments for this post

1h 28m 31s logged

So in this devlog, I have set up the project with all of its dependencies, it really can take that long when you’re using C++! Right now I just have a basic testing window, but I will quickly fill it in with a preset of the solar system soon, then I’ll be writing physics code for a while.

0
0
3

Delete project?

Are you sure you want to permanently delete this project? This action cannot be undone.

All devlogs, followers, and associated data will be removed.

Followers

Loading…