The code behind Particle Life
Vložit
- čas přidán 14. 04. 2023
- Download (Windows 64-bit): particle-life.com
Source Code: github.com/tom-mohr/particle-...
Discord Server: / discord
Particle Life is a very simple particle system. This video explains the code behind this simulation, that shows the emergence of incredibly beautiful life-like structures from rudimentary rules. - Věda a technologie
For more in-depth discussions about Particle Life, join our discord server :) discord.gg/Fd64AhKzMD
The mind blowing thing is that for someone whom have never coded in their life, been able to copy the code and create life like movement! This is mind-blowing thank you!
9:42 Unless if that fast programming language runs on the GPU ;) I made my 6 year old laptop run 15k particles without space partitioning with over 60 fps. And on top of the simulation itself, it also runs a 1600x1600 wave simulation on the RGB color channels to create cool rainbow waves behind each particle when they move. And on top of all that it also calculates stereo sound for every particle. GPU's are so fun :)
Wow! Do you have a video of that?
Thank you for the explanation of behind the scene of particles life software. I appressiate it.
I did write my own code and it is very interesting to see how you wrote yours. Thanks for sharing it.
YES !! I've been waiting for something like this, thank you.
I put the transcript of this video into ChatGPT and it was able to make this in html for me.
I love simulations like this! You rock
Brilliant. I personally believe models like these are a stepping stone to fully understanding the protein folding problem. I particularly like the concept of the attraction vector, just need to figure out the attraction vector for all amino acids and water.
protein folding was pretty much solved a few years ago by alphafold
@@jumpstar9000 not true, alpha fold only got a 90% success rate, which allows room for improvement. Besides, Alphafold is a black box model, unlike this one which is derived from first principles, which makes it more interpretable.
This is really cool. I've been playing with my own hack of something similar so this will get me back into a reckon! Thank you!
Thanks for sharing!
One request for next video.
Can you relate the third dimension of the particles to its size. So that when the particles move around they appear large as if it's closer and smaller as if it's far. I really want to see how this would turn out.
Thanks in advance
Awesome content. Please keep doing such videos
Alternately, draw it twice in perspective from two different angles and use cross-view to view the depth. :)
Can you please tell me how you made it so the particles wrapped around easily
Have you tried giving each particle type different friction properties? Would be interesting to see how things interact.
Thank you very much.
I really like the world view‼
Broo could you share the source code for your animations? If love to learn from them
Amazing!!!
These are good times.
I can find a study that I know nothing about, and I am free to research it further.
There are collision detection?
Can this be done on CUDA or Vulcan?
is there any way to make it in 3 dimensions or 4?❤
Have been programming similar ideas myself but now I adopted some important insights from your take. Amazing man!
Thing is I can only render 800 particles fluently at max. Could you please elaborate or give me some hints on the space partioning thing?
@@Romenamath I'm currently using tensor operations, thinking that would be the fastest way to do it. This might need a workaround then but I'll try. Thanks!!
Also I feel like replotting the frame each iteration is what takes the most energy here since it needs to go through all particles in the storage vector anyway. While we're at it, any suggestions on the plotting part?
What if particle life be applied to search algorithms?🤔 Considering that ideas may be like theses particles, they can either be attracted to each other or not...
I already made my own just from seeing your tweets and videos that described whats happening, but damn mine is so so much slower when driving up the particle count.
I tried an octree as optimization, that did not help.
I made it into a compute shader to run it on the gpu, which helped a bunch, but it's still way slower than yours.
I think your math is simpler because you use a 1 to 1 attraction matrix and I use a list of attraction pairs.
The one advantage of that approach is that I can have 2 types of particles be attracted at one range and repulsed at another range and everything in between, which produces different results that are impossible to reproduce with your method.
But damn, that speed would be really nice to have :D
Cool! :) You could still pick the maximum possible distance of interaction from all your ranges and then do a space partitioning based on this. Don't use a quadtree, just use a grid with boxes of size r_max. That's way easier to implement (still might take some hours to debug until it's working) and actually better at improving speed than a quadtree.
@@tom-mohr yeah the quad tree might have been over kill and takes more time to recalculate than it would to not use it at all :D
@@RoySchl How fast was your compute shader? I was able to get it to run over 15k particles at 60 fps on a 1050 ti laptop. And I still have yet to try space partitioning, but I do have a plan for that.
@@Zicrus depending on how many rules I use, but with 10 rules I get maybe 4k particles at 60fps on a 3060Ti...
Guess my code is either terrible or the slight increase in complexity with my multi rule approach is enough to slow it all down.
I also used unity, so who knows
Still a fun project
What about 3D?
I don't understand what you changed in the code to make it render in 3D. Long time ago, when GPUs were not common, I tried to write a 3D engine and I remember that you had to make trigonometric stuff to make projections. But I don't see any of that in your code...
Can you do particle life with gravity?
I mean a gravity environment, like making them all fall to the bottom with a floor and seeing if they can form organisms on the ground.
Please for the love of god make a 3d version of this. Holy smokes.
Watching this at 3 am and acting like I know the first thing about coding in python
Well if 3D is so easy, maybe its time for 4D particle life
upgrading to 4d would be just as trivial as doing 3d, you just add another component
the slightly hard part would be rendering it
Actually JavaScript is brilliant cause of it's ability
To be embedded directly from you web browser
Meaning theoretically speaking someone can code
It on mobile I don't say it's efficient but it's possible
It would be great if you can share this code as a download. Copy the code from the video takes a lot of time and is buggy. I'm currently working on a p5.js version of a particle life script and looking for different methods of calculating the forces.
8:20 I'm trying to implement the "force" function in python WHERE CAN I FIND DOCUMENTATION
I might be able to help you if you pose a more precise question
you used a function called force when calculating the change in velocities at 8:20 and i cant find documentation
@@tom-mohr that is all i know
It's literally 20s after this in the video, and also a few minutes before that
@@tom-mohr sorry, i was really angry and i didnt think to check...
Gak Mbah, aku gak bakal kasih kucingku macam2 dia hanya bantu disini ngamanin dari tukis
Make more videos +1.
Aku ngabisin uang ? Kerjaannya hanya ngabisin uang ga ngasilin uang?
OOO gitu, mereka bingung?
Kan aku kerja Mbah,
this is how you know Rust is good. you can even make life and living organisms in it lmao
Kucingku ? Jangan kasih pil KB?
Aku ga pernah beli pil KB, buat apa ? Supaya kucingku ga bunting?
Aku sudah ngomong sama kucingku, ngewe aja sesuka kau! Asal jangan bunting dulu, kalo mau bunting taruh anaknya di rumah Bu Joko, kalo makan boleh disini
kenapa dah bang?
i don’t understand coding but i try to learn it with chat-gpt rn (i don’t need any teachers in my comments but u can write some tips)❤