The code behind Particle Life

Поділитися
Вставка
  • Опубліковано 25 січ 2025

КОМЕНТАРІ • 70

  • @tom-mohr
    @tom-mohr  Рік тому +8

    For more in-depth discussions about Particle Life, join our discord server :) discord.gg/Fd64AhKzMD

  • @MrHichammohsen1
    @MrHichammohsen1 Рік тому +30

    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!

  • @phosphor1573
    @phosphor1573 2 місяці тому +4

    bro came out of nowhere, dropped 2 bangers and left

  • @victormultanen1981
    @victormultanen1981 Рік тому +8

    Thank you for the explanation of behind the scene of particles life software. I appressiate it.

  • @prietjepruck
    @prietjepruck Рік тому +5

    I did write my own code and it is very interesting to see how you wrote yours. Thanks for sharing it.

  • @creative_cooper
    @creative_cooper 11 місяців тому +3

    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.

    • @jumpstar9000
      @jumpstar9000 11 місяців тому

      protein folding was pretty much solved a few years ago by alphafold

    • @creative_cooper
      @creative_cooper 11 місяців тому +2

      @@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.

  • @Bubatu7
    @Bubatu7 3 місяці тому +2

    Great video, really nice editing!

  • @Zicrus
    @Zicrus Рік тому +21

    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 :)

    • @000pava
      @000pava Рік тому +1

      Wow! Do you have a video of that?

  • @pa0lo016
    @pa0lo016 Рік тому +3

    YES !! I've been waiting for something like this, thank you.

  • @jaisonveigas4998
    @jaisonveigas4998 Рік тому +8

    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

    • @darrennew8211
      @darrennew8211 11 місяців тому

      Alternately, draw it twice in perspective from two different angles and use cross-view to view the depth. :)

  • @CallmeSam00
    @CallmeSam00 10 місяців тому

    I love simulations like this! You rock

  • @PooperScooperTrooper
    @PooperScooperTrooper Рік тому +2

    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!

  • @gazsope
    @gazsope 2 місяці тому +1

    Cool video. Some thoughts: I think who know the equations in derivative forms, they don't need to be explained how to describe the velocity of a particle in 2 minutes, who don't, they don't understand the very basic concept of the project and they see random letters, points, arrows on top of eachother. Simple trigonometry, how to desribe forces, how to sum forces, etc. could have been useful and I think you should have expressed those equations in a form which requires less math. This way it is obsecured math for anyone not having a math related degree and barely useful for those who have.

    • @tom-mohr
      @tom-mohr  2 місяці тому

      Yes, I agree, next time it'll be simpler.

  • @korigamik
    @korigamik 11 місяців тому +2

    Broo could you share the source code for your animations? If love to learn from them

  • @そけつ
    @そけつ 11 місяців тому

    These are good times.
    I can find a study that I know nothing about, and I am free to research it further.

  • @k4rli_475
    @k4rli_475 7 місяців тому +1

    is there any way to make it in 3 dimensions or 4?❤

  • @theHiddenStone
    @theHiddenStone 8 місяців тому

    Have you tried giving each particle type different friction properties? Would be interesting to see how things interact.

  • @jaredf6205
    @jaredf6205 8 місяців тому +1

    I put the transcript of this video into ChatGPT and it was able to make this in html for me.

  • @RoySchl
    @RoySchl Рік тому +6

    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

    • @tom-mohr
      @tom-mohr  Рік тому +3

      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.

    • @RoySchl
      @RoySchl Рік тому +1

      @@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

    • @Zicrus
      @Zicrus Рік тому

      @@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.

    • @RoySchl
      @RoySchl Рік тому +1

      @@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

  • @dkm4470
    @dkm4470 10 місяців тому +1

    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?

    • @dkm4470
      @dkm4470 9 місяців тому

      ​@@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?

    • @vxqtw4531
      @vxqtw4531 2 місяці тому

      @@dkm4470 did you find any tips ?

  • @digit5911
    @digit5911 Рік тому +1

    Can you please tell me how you made it so the particles wrapped around easily

  • @josesantos2603
    @josesantos2603 Рік тому +1

    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...

  • @M1KEMEX
    @M1KEMEX 7 місяців тому

    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...

  • @Dunch0717
    @Dunch0717 Рік тому

    Watching this at 3 am and acting like I know the first thing about coding in python

  • @domahidipeter6092
    @domahidipeter6092 11 місяців тому

    There are collision detection?

  • @seanalexandertricks
    @seanalexandertricks Рік тому +1

    Can you do particle life with gravity?

    • @seanalexandertricks
      @seanalexandertricks Рік тому

      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.

  • @spinthesphere2746
    @spinthesphere2746 Рік тому

    I really like the world view‼

  • @js267
    @js267 Рік тому

    Thanks for sharing!

  • @AS-ws9pp
    @AS-ws9pp Рік тому

    Can this be done on CUDA or Vulcan?

  • @megauti
    @megauti 11 місяців тому

    Thank you very much.

  • @My_gatt_is_ballin
    @My_gatt_is_ballin Місяць тому

    Someone needs to make a 3-D version

  • @matthewe3813
    @matthewe3813 Рік тому +2

    Well if 3D is so easy, maybe its time for 4D particle life

    • @homelikebrick42
      @homelikebrick42 Рік тому +6

      upgrading to 4d would be just as trivial as doing 3d, you just add another component
      the slightly hard part would be rendering it

  • @dreamtutorials1015
    @dreamtutorials1015 11 місяців тому

    What about 3D?

  • @TheCaphits
    @TheCaphits 10 місяців тому

    Please for the love of god make a 3d version of this. Holy smokes.

  • @RabarberBarbar70
    @RabarberBarbar70 Рік тому +2

    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.

  • @alexandrubusuioc6800
    @alexandrubusuioc6800 Рік тому

    8:20 I'm trying to implement the "force" function in python WHERE CAN I FIND DOCUMENTATION

    • @tom-mohr
      @tom-mohr  Рік тому +1

      I might be able to help you if you pose a more precise question

    • @alexandrubusuioc6800
      @alexandrubusuioc6800 Рік тому

      you used a function called force when calculating the change in velocities at 8:20 and i cant find documentation

    • @alexandrubusuioc6800
      @alexandrubusuioc6800 Рік тому

      @@tom-mohr that is all i know

    • @tom-mohr
      @tom-mohr  Рік тому +2

      It's literally 20s after this in the video, and also a few minutes before that

    • @alexandrubusuioc6800
      @alexandrubusuioc6800 Рік тому

      @@tom-mohr sorry, i was really angry and i didnt think to check...

  • @SolathPrime
    @SolathPrime Рік тому

    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

  • @danielcezario2419
    @danielcezario2419 Рік тому

    Amazing!!!

  • @therealone0777
    @therealone0777 3 місяці тому

    7:04 ", expected"

  • @ratuadilFF
    @ratuadilFF Рік тому

    Gak Mbah, aku gak bakal kasih kucingku macam2 dia hanya bantu disini ngamanin dari tukis

  • @unveil7762
    @unveil7762 Рік тому

  • @FlooferLand
    @FlooferLand Рік тому

    this is how you know Rust is good. you can even make life and living organisms in it lmao

  • @ratuadilFF
    @ratuadilFF Рік тому

    Aku ngabisin uang ? Kerjaannya hanya ngabisin uang ga ngasilin uang?
    OOO gitu, mereka bingung?
    Kan aku kerja Mbah,

  • @PlayOfLifeOfficial
    @PlayOfLifeOfficial Рік тому

    Make more videos +1.

  • @ratuadilFF
    @ratuadilFF Рік тому +1

    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

  • @k4rli_475
    @k4rli_475 7 місяців тому +1

    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)❤