Building a Particle Simulation Physics Engine in C++ from Scratch

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

КОМЕНТАРІ • 88

  • @akdk-productions
    @akdk-productions 2 місяці тому +207

    I'm 110% sure m not understanding a single thing in this video but m still going to watch it

    • @Jack-so1hz
      @Jack-so1hz 2 місяці тому +2

      Same😂😂

    • @Rohit-cj6eb
      @Rohit-cj6eb 2 місяці тому +2

      Why not you understanding it?

    • @Brekstahkid
      @Brekstahkid Місяць тому +3

      It's like taking your vitamins. Its good for you.

    • @miftakhulhuda7743
      @miftakhulhuda7743 26 днів тому +1

      I stay here watching till the end due to the relaxing music

    • @AlexeyNapechkin
      @AlexeyNapechkin 22 дні тому

      @@Rohit-cj6eb ну типо, код перепечатать ещё можно, видимо в визуал студио, а где отображать напечатанное, а ну в ней наверное, раз визуал
      Формула ещё в начале надо по словам переводить,что он там описал

  • @goncalomarques7022
    @goncalomarques7022 2 місяці тому +46

    man that's impressive the math and coding skills

  • @lorenzocanepa9274
    @lorenzocanepa9274 Місяць тому +8

    Congrats !! An intuitive and very good spot of light when talking of physics and c/c++
    Thanks for sharing !
    Lorenzo

  • @gulyasgyorgy
    @gulyasgyorgy 4 місяці тому +37

    This video, and the whole channel is hidden gem. Absolutely amazing. And I'm proud to be one of 29 people who subscribe to this channel and understand this video and even enjoy it.
    Thank you very much!!

  • @felomleron.ml101
    @felomleron.ml101 24 дні тому +3

    In the middle of the video, I got distracted by another tab on the browser and forgot about this video at all, thinking that it's just another calm background sound I used to play meanwhile I work. I don't even know C++ or game/graphics development but still watched again till the end. Thanks anyways.

  • @ultsen96
    @ultsen96 2 місяці тому +56

    Man im jelous of your coding skills and understanding and amazed at the same time

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

      Try hard :)

    • @Dungeon_Synth_Enjoyer
      @Dungeon_Synth_Enjoyer 18 днів тому +5

      This person did NOT code that at the top of their head. It’s not how it works. He got all the code on second monitor and just typing it back on his main monitor for the video. Cool video though, but don’t be naive.

  • @SacherPunch
    @SacherPunch 2 місяці тому +9

    Please please please keep making videos like this, it's invaluable being able to see the whole process of making a program and the reasoning behind the choices made

  • @Andreas.r2
    @Andreas.r2 14 днів тому +1

    I'm jealous, as I'm not even started learning but find your skills are needed in unreal engine simulation. ❤

  • @preguica_net
    @preguica_net 3 місяці тому +8

    I've already had problems with the 4th order Rugge Kutta, and to this day I haven't found out why. It lowered the temperature of my Lennard-Jones gas. I didn't have this problem with the Verlet. Very nice video!

  • @vedantsingh1801
    @vedantsingh1801 Місяць тому +1

    I use to do leetcode with the c++ , after seeing this video i am encouraged to do high level object oriented programming with c++ while writing own header file and input stream handling .
    Hats off to this dude great work , very inspiring .
    ⚡⚡⚡⚡⚡⚡⚡⚡

  • @astokum7
    @astokum7 Місяць тому +1

    Really awesome!
    I understood form this video...
    that each of point (vertex) of cloth simulation respond to gravity individually. Constraints among points makes it attachable to each other.

  • @hodayfa000h
    @hodayfa000h 2 місяці тому +8

    That is cool!
    Edit: i actually just learnt how to solve a coding problem i had just from this!

  • @sama32lambda
    @sama32lambda 4 місяці тому +8

    Love the chill music

  • @alizohaibibn
    @alizohaibibn 17 днів тому +1

    This is impressive bro. Amazing channel.

  • @scubather
    @scubather 2 місяці тому +19

    I admire ppl who stick to c++ and a specially physics simulation
    every time I've tried to take a look to any c++ project I've faced enormous amount of compiling problem and environment issues with libraries and headers (skill issue)
    and I go back to my web dev routine :)
    thanks for sharing your great experience

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

      you know c++ has a bad module system when even web developers say it's bad lol
      deno masterrace

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

      take ur time and watch a cmake tutorial without skipping and figure out how to link libraries dynamically and statically and so on then everything will make sense hopefully

  • @SpinyDisk
    @SpinyDisk 6 днів тому

    1:19 the vertex knows where it is because it knows where it isn’t

  • @angquocvuong8534
    @angquocvuong8534 28 днів тому +1

    This project impressed me, thank you for sharing

  • @tosmanhype9419
    @tosmanhype9419 17 днів тому +1

    beautiful and soothing

  • @席郭亮
    @席郭亮 Місяць тому +2

    Thanks for sharing, your video really helped me

  • @BlyatifulButter
    @BlyatifulButter Місяць тому +1

    I'm trying to make a simulation engine in C++ as well, but from OpenGL. Thank you for these insights!

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

    I did a view on opengl but this simulation is great, gravity and interaction is very real feels so intuitive

  • @xanterrx9741
    @xanterrx9741 5 місяців тому +3

    Great video , I hope you will post more

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

    Amazing, learning differential equation by coding this

  • @kalukhan4676
    @kalukhan4676 23 дні тому

    So amazed yrrr lots of love hats offf

  • @HussainAli-zk6nk
    @HussainAli-zk6nk 2 місяці тому +1

    Very beautiful code!!!!

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

    Great video

  • @DiegoHinrichs
    @DiegoHinrichs 5 місяців тому +6

    Nice video, im working on a nbody simulation using the Barnes Hut algo.
    I suggest you explore that field, its very interesting :)

    • @FelipesCoding
      @FelipesCoding  5 місяців тому +4

      Yes, it's really nice. I'm looking forward to reading more about it and maybe implementing some cool stuff. Thanks for watching and your suggestion

  • @christiangualteros36
    @christiangualteros36 Місяць тому +1

    Great video buddy might you please used formulas that describe the movement of a object?

  • @robertmoore119
    @robertmoore119 9 днів тому

    I am one of the viewers that really has minimal idea what is going on at all. However, though the program did work just fine. Which was really cool to watch being created, there were spelling errors. I thought to myself, how did it function properly with spelling errors. But its your program, so a name is a name I suppose.

  • @theangriestcrusader
    @theangriestcrusader 15 днів тому

    any particular reason why the particles were able to bounce slightly along the X axis at 03:49? If GRAVITY is just a force of 10 on the Y axis, then how is there a bounce? also, at what point did the particles become bouncy?!?! I must've missed a few things!

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

    Awesome vid

  • @rfyorfyo5022
    @rfyorfyo5022 25 днів тому +1

    extreme iq required for this task

  • @AlexZyablov
    @AlexZyablov Місяць тому +1

    Inspiring.

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

    thats sick, makes me wanna make it myself as well but ill probably fail

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

    Very interesting ❤❤❤

  • @andremyszko
    @andremyszko 26 днів тому +1

    amazing

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

    makes me think of Pezza

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

    Background music made me fell asleep mid video

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

    5:03 how did you implement springs if the constraint code, apparently, didnt change?

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

    49 Star 8 folk, good

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

    bro why do i understand code better than math them selves

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

    6:27 you should have used == instead of = in the condition

  • @juanhurtado35
    @juanhurtado35 5 місяців тому +2

    Great!

  • @RealSiViX
    @RealSiViX 4 місяці тому +1

    How does the simulation still work when you misspelled distance on line 29 at 7:32?

    • @jkf16m96
      @jkf16m96 4 місяці тому +3

      because he kept misspelling it.
      as you can see, he doesn't use an already defined variable.
      He does define a new variable named "distatnce"
      and each time he used that variable, he kept using that name, never correcting it, but despite that, the variable is correct, because it exists.

    • @RealSiViX
      @RealSiViX 4 місяці тому +1

      @@jkf16m96 - I see my mi8stake now, I didn't realize he was calling a variable until I went back and looked at it again, I thought he was calling a function, sorry for the confusion...

  • @geopolitik-dunia
    @geopolitik-dunia Місяць тому

    7:33 float distatnce

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

    Nice very nice.

  • @ArIyan_yt
    @ArIyan_yt 7 днів тому

    Is it usable with game engines, such as Unity or Unreal?

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

    How do you get the star extension to appear while ur coding?

  • @TheDariosouza
    @TheDariosouza 25 днів тому +1

    incrível

  • @VulgoGS
    @VulgoGS 6 днів тому

    I am a beginner at C++ (my first programming language), I don't get it, how a language that only compares something, verifies something, and loops something could do almost everything ? Even when I see the code I don't understand it clearly.

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

    please serious question , did the ai help you in the different problems you faced or you build this from scratch

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

    DAMNNN cool

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

    Writing the implementations in a header file?

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

    damn i cant even make a simple 3d physics work

  • @parisrealife
    @parisrealife Місяць тому +1

    wow

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

    Honest question, is C++ better for coding this than python and why?

    • @FelipesCoding
      @FelipesCoding  4 місяці тому +12

      The reason behind it is that I like writing code in c++, but to be honest:
      C++ generally offers better performance than Python because it's a compiled language. In physics simulations (like Verlet integration), which involve a lot of mathematical calculations, performance is crucial. C++ gives you control over memory management, which can lead to optimized, faster code.

    • @allansmart5358
      @allansmart5358 4 місяці тому

      @@FelipesCoding thank you for your answer. I appreciate it. I tried learning c++. Do you have any tips or courses I could try to master the basics?

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

      What always worked for me was finding a project that interests you (one that's not too easy compared to your programming level but also not too hard) and learning programming (c++) while working on it.

    • @allansmart5358
      @allansmart5358 4 місяці тому +3

      @@FelipesCoding thank you for your recommendation. I will give it a go. I will think I will start with just a random number calculator project and then go from there. I mainly use Python for statistical analysis, but I am interested in getting more into programming and creating interesting things like you created.

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

      You can also try Rust, is a little faster than C++ and in my opinion is more enjoyable than C++

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

    idk if you enjoy it, you enjoy doing this ?

  • @varshneydevansh
    @varshneydevansh 26 днів тому +1

    sbbed

  • @ВладиславГришин-ш7ш
    @ВладиславГришин-ш7ш 2 місяці тому

    это невероятно сложно

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

    I don't agree 😃

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

    I use Rust btw

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

    I don't think SFML counts as "from scratch"... but great video!

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

      SFML is purely to draw the graphics primitives to the screen and handle input. The particle simulation physics engine code, the focus of the video, does not rely on this library. If you wanted him to use no graphics library, he would be using os-specific API to create the window, draw graphics, handle input, etc. I think that would have been silly and a waste of time since then only users on the OS he developed on would be able to run his code. But nice comment man.

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

      @@eternalnerd_
      that is one of the most Redditor replies I've ever seen... nice comment man

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

      ​@@DaBeanBro lol