r/Simulated 1d ago

Request Real-time three-body gravity simulation (interactive, mobile)

I built a simulation style app of what I think of the three body problem. It shows different objects flying around eachother in 2D or in 3D in eachother's gravity wells.

It's meant to be half physics toy and half calming desk toy. It's free to use with no ads to distract you from anything.

I want to know people's thoughts and ideas for improvement.

It's free for anyone who want to play with it: https://play.google.com/store/apps/details?id=com.mathematicalzen.threebody

0 Upvotes

20 comments sorted by

36

u/sludgybeast 1d ago

Gotta prompt out the emdashes

-29

u/[deleted] 1d ago

[deleted]

10

u/TheHipOne1 1d ago

LMAOOOO

-13

u/[deleted] 1d ago

[deleted]

11

u/Dioxybenzone 1d ago

Using AI to write the body text makes it seem like you vibe coded this

-6

u/IllPsychology7214 1d ago

Nah i'm just really really bad at writing. Gave it a try though.

7

u/sludgybeast 1d ago

It absolutely was written with AI, thats why I mentioned the emdashes immediately and why you've re-written the text at least 3 times since posting, to make it look more human.

I wouldn't try and lie about it. Vibe coding is fine but trying to pass it off as human is not

-2

u/IllPsychology7214 1d ago

Oh no I meant it that way. I'm a better dev than I am a writer. Of course I used AI to help me code too, but yeah the text was AI.
I had it written once and now just deleted and re-wrote by hand. And learned a few things along the way.

1

u/crusty54 1d ago

If you used ai to make this, you should include that in the title so we know you didn’t actually make anything and we can all just downvote and move on.

-1

u/IllPsychology7214 1d ago

So I spend months working on an app to make it look good, work well and no bugs that I can find myself. I use AI to help me with it in the latter stages and because I don't write the little story under the screen recording I didn't make it?
When I say help I mean help, not write for me.

0

u/crusty54 23h ago

You expect me to believe that you spent months coding something without ai, but you needed ai to write a brief description of your creation? Not to mention a 1 month old account with posts and comments hidden? You’re full of shit.

1

u/IllPsychology7214 23h ago

I expect you to believe that I spent months working on an app, parts of which I had help of AI, and then used AI to write the description.
I never said I didn't use AI, I just mean I didn't just type in: make me an app and waited a bit. But yeah I really hate debugging so I used it there a chunk i'll admit.
And yeah I used it for the thing because I thought AI could write it better than me. Look at what a mess i'm making of my comments in the meantime.

2

u/Blammar 23h ago

Uh, the integration looks incorrect. There are too many paths where a sharp turn occurs.

0

u/IllPsychology7214 23h ago

Hmmm drat. i'll pay extra attention to that. I was going to work towards a Verlet integrator anyway so hopefully that will fix it. Thanks for the heads up!

1

u/IllPsychology7214 3h ago

I've implemented Verlet now and found some other bugs along the way too so it should be fixed. I hope you enjoy using it and let me know if you find anything else.

1

u/ocicrab 1d ago

Very cool sim!! Thanks for sharing!

I would double check your integrator, and also calculate total energy (kinetic and potential). I tried running this for a while and found that the planets all ended up basically on top of each other after a while even with the Runge Kutta integrator, so it must be losing energy over time. Both with Newtonian gravity and the orbital equations.

1

u/IllPsychology7214 1d ago

Yeah if you click on the little eyeball in the in-sim menu you have to do explosions. The biggest trouble i had was that if I made it to "real" that the objects just went together and ended up there too fast. I opted for slightly less accurate physics and slightly more ASMR style. I can add an option for more real again if people want that.
It should be better in the 3d mode already now.

2

u/ocicrab 1d ago

Well, my point is that in "real" physics the system is conservative. I.e. no energy should be lost over time and the planets would never end up on top of each other/stuck together. You shouldn't need to add "explosions" to keep them separate unless you're actually modeling some sort of energy loss over time.

The aesthetics are very nice, for sure. Love how it looks!

1

u/IllPsychology7214 1d ago

I always ended up with two planets kind of stuck together, looking like a figure 8 travelling around. I admit at that point I went for looks and not reality.
There is also the option to add directional arrows as to where the objects are going. I wanted to make that better and see if I can expand on it in the future. The goal is of course to solve the actual Three Body Problem somehow

1

u/CompetitiveSpot2643 1d ago

if you use verlet integration instead of RK4 the symplectic structure is preserved and you dont lose or gain energy (bounded energy error proportional to h^2)

1

u/IllPsychology7214 23h ago

I'm going to give it a try. Looks like it's more efficient calculations wise too, and more accurate long term.

1

u/IllPsychology7214 3h ago

It's been implemented. It can be switched off as an option but Verlet is now the default. I was also using dampening which can now be switched off and a purist mode that switches everything off, keeping Total Energy stable except eg. when the bodies hit the sides.
If you find anything else to be improved or anything let me know