(Rough) Newtonian Gravity Simulator

Hello! I have a new project again, a Newtonian gravity simulator made (almost entirely) from memory (because I made this in C# and Raylib yesterday). It is likely not perfect, I notice some issues that I can't quite work out, so please tell me how I can improve it if you can!

um what

It's super cool! Much better than anything I could do.
I have a question, though- is there a way to (how do I say this) time-lapse it? As in run the simulation faster? I would be interested in seeing the program run for a long time, but I don't have the time (haha).

Oddly enough, it runs the fastest for me when I have both turbo mode and visible stepping enabled. No idea why though

Hmm. I just tried it out, and that happens for me too. Thanks!

Single stepping, ?incidentally?, acts as the Live coding support (experimental)Shift, which usually speeds things up a bit by not copying the thread bodies.

Also this functions is twice as fast as original one (9-12 > 4 ms)
untitled script pic - 2022-05-11T213109.285

I just did scenario 1 with gravity 10, and they got slingshot-ed all over the stage.

That would compromise the accuracy of the simulation, also no sadly.

Thank you, it's been updated, I've been able to do this in C# but I wasn't sure if I was able to add lists together like that in Snap!.

Makes sense.

UPDATE
Planets can now collide and merge.

ANOTHER UPDATE
You can zoom in and out with + and -
You can pan using WASD.

Although the Snap! stage is two-dimensional, actual planets are three-dimensional, so shouldn't the size (the linear measure) of a planet be the cube root of its mass, not the square root?

Hello! I'm back.

That's true, I've just updated it.

Sorry for necroposting, but I can't do much about being unexpectedly absent due to the school year ending. My home situation doesn't accommodate.

Edit: I don't expect myself to be present during the latter half of 2023 and more than likely the first half of 2024, when I go to college I'll have more opportunities to go online.

Welcome back!

This is amazing! @mods feature???

(If this is not already featured, this is my first time seeing it)
(Also I’m talking about hte project)

I went back to the top of the thread, hit the green flag, hit ENTER (not typing anything into the ASK box), and it froze.

Should it just play a default selection if you don't enter anything? You're supposed to enter a scenario #.

Edit to the Edit: Nevermind, summer of 2023 is probably gonna be the last summer I'm not around, stuff changes fast.

It's good programming practice to deal gracefully with unexpected user input :slight_smile: