If anyone wants to see the latest version of this simulation it looks like this: kzbin.info/www/bejne/h17HaKZsmLSVntk Also, if people are interested, I wouldn't mind doing a live stream on twitch some time going through my code and explaining things.
@tulpamedia2 жыл бұрын
Oh hell yes! I'm kind of an amateur physicist and I've been trying to simulate certain things like nbody sims, fluid motion, etc... but unfortunately I'm not the best programmer so it always comes out really unoptimized, slow and just not that good all around haha. I would love to see your process this simulation is impressive!
@justinanderson2672 жыл бұрын
Can you do this with a sphere (the sun)?
@Europa_Forever2 жыл бұрын
I like how eventually it ends up looking like many galaxies expanding away from the center of it all
@tulpamedia2 жыл бұрын
Wow this is amazing! I've built my own n-body simulation as well, but I haven't been able to get it this good yet hahaha
@VercilJuan2 жыл бұрын
Damn bro this is... beautiful.
@curb-e77362 жыл бұрын
We're just a millisecond long scene in the universe.
@notaninterestingperson57692 жыл бұрын
Then let’s make it one whoever’s watching would want to replay again
@Kill_God2 жыл бұрын
Not even that long, but as the wise sir above me said, we can make it the most beautiful instant in the history of everything
@anondude63612 жыл бұрын
Beautiful
@shubhsrivastava4417 Жыл бұрын
It became an elliptical galaxy!
@_LuisFernandes_2 жыл бұрын
this is based on a OneLoneCoder project ? And are the pixels projected or simply computed in 2d ? great video and project :)
@Spleeshmi2 жыл бұрын
I used the olcPixelGameEngine for this version of the project. I have since moved to OpenGL though. The pixels are computed in 2D (with OpenCL). The physics can get a little more complex in 3D and I'm less confident in my ability to make a realistic algorithm at that level. Here is the current github project if you're interested: github.com/Spleeshmicannon/50-000-Planets-OpenCL-glfw3. I'm considering rendering it to an mp4 directly with OpenGL so I can upload it but idk.
@_LuisFernandes_2 жыл бұрын
@@Spleeshmi I'm impressed by the fluidity of the simulation with so many particles, I'm trying to integrate barnes hut and do multithreading so I understand the difficulties you had to go through, even in 2d. I'll take a look at the github, thanks for sharing :)
@matejsteinhauser39742 жыл бұрын
Looks like a Galaxy ❤️✨🌀
@DescendDab2 жыл бұрын
I love it, good job :)
@reddrift30222 жыл бұрын
This is cool haha
@Spleeshmi2 жыл бұрын
thx
@halihammer2 жыл бұрын
Wow! 100,000 particles is quite a number. How long did it take to render? And do all particles act on all others, or is there a distance-dependent limit where forces from distant particles are not considered?
@Spleeshmi2 жыл бұрын
All particles act on all others, even if the leave the frame. Also, your watching a screen recording, so it took as long to render as it took you to watch it.
@halihammer2 жыл бұрын
@@Spleeshmi Very impressive speed. Have you written it in C?
@Spleeshmi Жыл бұрын
@@halihammer C++
@SumofluffyVIDS2 жыл бұрын
What is the music? It sounds so familiar.
@SumofluffyVIDS2 жыл бұрын
@saschava Thanks! And I realized it sounded familiar because it's in Godzilla! :D
@Adamzki555552 жыл бұрын
what programming olanguage do you use to make these simulations
@HoloDoctor902 жыл бұрын
c++ i guess
@Spleeshmi2 жыл бұрын
Yeah C++, and I used the OlcPixelGameEngine
@blissful49922 жыл бұрын
How are you able to get it this smooth and in real time of 100k particles with a brute-force approach?
@Spleeshmi2 жыл бұрын
tldr: parallelisation (on the GPU) OpenCL does computation on the graphics card. The data is then passed from OpenCL directly to OpenGL. My graphics card also has over 1500 cuda cores. So thats effectively 1500 planet positions that can be computed in parallel or 1500 parallel operations per clock cycle (although I think its a little more complicated than that). For anyone wanting to execute this approach, I'd recommend using OpenGL compute kernels or CUDA since OpenCL is really painful to use though. I should also mention that the video here, doesn't use OpenGL but the current version of the project does. The video here is still passing the data back to ram and then sending it to the GPU for rendering. If you have a solid clock speed and good SIMD support on your CPU you may have more speed with that approach. This is a lot harder than what I did though since you have to manually sort that data into arrays that fit in each SIMD register and such.
@b.s.76932 жыл бұрын
Why are some planets pushed out of the array initially?
@Bossman50.2 жыл бұрын
0:44 under armor
@enantiodromia Жыл бұрын
Reminds me of the game of life.
@blissful49922 жыл бұрын
Hello, for the physics, why do you do fx += (-F * rx), shouldn't it be fx += (rx/sqrt(rx^2 + ry^2)) * -F because first you normalize the vector's x dimension and then you multiply by the force? I guess I just don't get why you are multiplying by the differences in x
@Spleeshmi2 жыл бұрын
The honest answer is I wrote that specific algorithm over a year ago and so I don't remember super well. I did speak to someone with more physics knowledge than I and they referred me to some equations which would help me make it fast. The other thing is a square root is really slow. I'd frankly do anything to avoid it and may have overlooked a mistake as a result. Thanks for taking the time to look at my algorithm, I'll revisit this and double check everything. EDIT: also, if you want to change the algorithm and see what happens you should be able to edit the .cl file in the prebuilt binaries folder and then just run the exe. The exe will only work on windows though and your graphics card will have to support OpenCL which it should, but might not.
@blissful49922 жыл бұрын
@@Spleeshmi it’s true that just multiplying the force and the difference doesn’t give the same result but does vastly increase performance. Especially on the long term when you do ~n^2 force calculations for n bodies
@usptact2 жыл бұрын
100,000 rogue planets doing rogue planet things…
@scottbilger92942 жыл бұрын
That's an marvelous rendition of Clair de Lune. Who is playing, I wonder?
@charlizesakura4468 Жыл бұрын
I think they could eventually form a Sun cus all the mass and Density And solar systems between them
@delawarepilot2 жыл бұрын
What I expected when I bought universe sandbox.
@bobadingo2 жыл бұрын
So the model is based on a flat one dimension rectangle shape of 100,000 planets?
@Spleeshmi2 жыл бұрын
the planets are uniformly distributed across the shape but yeah, basically
@Lax3n2 жыл бұрын
with the general relativity theorem or the Newton one?
@Spleeshmi2 жыл бұрын
Newton, and not technically accurate as well, I need to normalize a vector apparently 🙄
@kazimierzmarkiel54002 жыл бұрын
Your galactic is not rotating- it is not naturally observed behaviour. Stary
@Spleeshmi2 жыл бұрын
If you want to take a look at the algorithm I use it's in the .cl file: github.com/Spleeshmicannon/50-000-Planets-OpenCL-glfw3
@davidstirling7992 Жыл бұрын
Are these simulations supposed to accurately to describe reality?
@augustusmd2 жыл бұрын
did they collide?
@Spleeshmi2 жыл бұрын
no I'm not taking collisions into account, just gravity
@Frydekilde2 жыл бұрын
They shape like X chromosomes and DNA. Interesting.
@sirave60172 жыл бұрын
It looks like chromosomes but not connected correctly.