I made a physics engine in C++!

Поділитися
Вставка
  • Опубліковано 5 лют 2025
  • My GPU physics engine: • How did I optimize my ... 😱
    My Game Engine: • Pika Game engine
    My Minecraft C++ Clone: • Adding my own sounds a...
    Join my Discord for cool resources 🤯😎:
    / discord
    Check out my Steam Game Midnight Arrow:
    store.steampow...
    Join this channel if you want to support me 😻:
    / @lowlevelgamedev9330
    Source Code 🧑‍💻:
    github.com/mee...
    Music:
    SoundMHz - Angry Birds "The Mighty League Anthem", Full Version [Darude - Sandstorm Remix]
    • Angry Birds "The Might...
    MDK - Jelly Castle
    Angry Birds 1 theme song.
    Evan King - HIGH ENERGY CHIPTUNE
    Evan King - o o g a
    Evan King - Invisible Walls
    Evan King - Let's Go
    !www.youtube.co...

КОМЕНТАРІ •

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

    Welcome to the world of physics simulations!
    I know your pain.
    Since I knew that solving rotations and stacks of objects would be an absolute pain, I decided to try and write a softbody simulation in my free time. It is slowly coming along. Currently working on constraints, quite more complicated than I expected.
    It's impressive you've done so well with so little prior knowledge and experience. Keep going!
    Wish you a lot of joy when it will finally works the way you want it to!

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

      What solver are you using for softbody?

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

    Your videos and editing are getting better and better

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

    I tried making a physics engine a little while ago. And it was absolutely AGONIZING! So much so that I gave up on it.
    Really looking forward to how your project will come out; maybe it will give me some motivation to try again :)))

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

      yeah it is hard ngl, try the respurces on my discord maybe they help 💪

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

      @@lowlevelgamedev9330 Will do, thanks :D

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

    I just started Building my first 2D Game Engine with C++ yesterday.
    Thanks for showing that this is achievable!!!
    My plan is to get good at C++ because I plan to create some games with Unreal Engine 5 in July 2025.

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

    This is the best! I have been thinking about making my own 2D physics engine too last summer. :D

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

      Go for it! definitely a mammoth challenge, but very rewarding and you learn a lot! I would suggest not implementing rotation until the end

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

    Absolute madlad

  • @ІгорАлієв
    @ІгорАлієв 2 місяці тому +6

    There is a book in German, named 'Numerische Physik', which is devoted to solving numerical problems by Gnu Scientific Library. One example there is like throwing cube in the air with resistance forces. Actually physics sooner or later transforms into solving systems of differential equations. Thus you may give it a try. However it's HolyC hardcore AF, but the book and examples from GSL docs are awesome. Just pick one you like and rewrite completely according to your needs.

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

      Numerically solving differential equations is only half the puzzle for a physics engine, and it's the easier half. The tricky part is numerically solving systems of equations for constraints

    • @ІгорАлієв
      @ІгорАлієв 2 місяці тому

      ​​@@mariovelez578Totally agree. Pile of breakdancing corpses in fps games is really funny. They can not lay in peace. Just a few changes to physics may solve it.

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

    angry birds and physics in the same sentence. i'm just like :D

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

    Hi Sir.
    Check out GJK and EPA algorithms.
    The GJK algorithm is an amazing, and fast way to detect collisions between any 2 convex polygon.
    Also with GJK you can implement specific colliders like sphere collider to fasten up the algorithm.
    EPA is an algorithm to detect the depth and normal vector of the collisions between any 2 convex polygon, and the algorithm uses the GJK output as an input.

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

      I agree. Although with 2D, there isn't much difference between GJK and using SAT if the only colliders are polygons and spheres. In 3D GJK is pretty much necessary

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

    Your videos are awesome honestly, really motivating too.

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

    My game only needs AABB/Circle collision, separation, broadphase, and velocity/acceleration, because it's all about world scalability. Not sure why I can't find a single existing library that covers that. Complex physics engines that can only handle 10,000 objects aren't going to cut it.

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

      hm I mean you can implement that yourself it isn't that much 💪

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

      I made a complex 2D physics engine that can handle 15,000 on one core, so it is possible.

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

      try a GPU implementation. A hash grid or dynamic BVH could speed up the collision detection. I know bepu physics can handle a lot of collisions

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

    Use ray casting for 2D collision detection and bouncing, it'll make it more accurate and you will get rid of the sinking issue. You can use the Runge-Kutta 4 integration method wich is a very accurate one. Also, you are not correctly modeling friction (or at least that's how I see it from your video). Dynamic friction is a force independent from velocity, but directly proportional to the normal force. Hope this helps!
    Edit: also implement static friction 7:36.

  • @Volt-Eye.
    @Volt-Eye. 2 місяці тому

    0:14 Easter Balls 😂😂😂

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

    Didn't expect that greenscreen not gonna lie

  • @firelabs-io
    @firelabs-io 2 місяці тому

    never in ever i could even get close, good work

  • @ІгорАлієв
    @ІгорАлієв 2 місяці тому

    Btw, you can improve your collision detection in the following way. Check each time if there is no collision on the next step using your integration. If yes, start some collision procedure, I mean instant velocity change of the collided bodies. Something similar was in quake3 hit detection.

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

    okeey, no one is gonna talk about the background? 0:13

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

    very cool comrade!

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

    Have you tried to add a minimal starting value? Like when you try to push a brick with your hand you can't push it with 0.5% of your strength you have to put in at least 5% to move it.

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

    sometimes , reinventing the wheel is beneficial for your mental health because only then u can blame your self and not another 3rd party :D

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

    Love the greenscreen

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

    Very interesting video!

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

    4:59 using _ as iterator is felony ☠️

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

    @5:43 those are actually the same formula.

  • @arl-t8d
    @arl-t8d 2 місяці тому +1

    Good topic m8

  • @omar-diab-dev
    @omar-diab-dev 2 місяці тому

    Angry Birds + Amogus????
    Funnily enough, I actually made exactly this except it's in Python and I used a physics library instead of making it from scratch.

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

    bro living my dreams.. good work
    👏👏👏👏

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

    Dude on your Minecraft clone can you add some ray tracing like stuff......😅😅

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

    I like the video style, but I think the ratio of information and jokes could be adjusted in the direction of information.

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

      agreed, I'm trying things out rn, thanks for the feedback 💪

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

    man is jacked

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

    You shouldn't hide information behind a Discord server. That sounds really dumb. The description exists for a reason. Discord isn't the Wiki.

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

    Can you go into a more detail about this stuff??

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

    how does hot reload work? do u recompile the changed file and inject as shared library or how does that work?

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

      I compile the game logic in a dll and the engine reloads it, the engine also needs to mamage the memory so that means custom allocator and using only thsmst one very careully

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

    Is there any good physics library for opengl

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

      Physics is completely separate from graphics. If you want, you can use OpenGL compute shaders to make a GPU implementation. The closest thing I know is NVIDIA's PhysX engine, which uses CUDA cores, so a compatible NVIDIA graphics card is necessary

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

    ❤❤🎉

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

    HELP! I added balls to my physics engine, but when I spawn too many of them, they start vibrating. Also my balls gain energy with every bounce and I changed the numerical integrator a couple of times to a better one.
    Please help 😭😭

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

    you might transform into the new jdh

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

    hows minecraft clone going

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

    PHYSICS

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

    what didn't you make in c++

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

    Can RTX 2050 run Pika?

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

    Isnt physics just checking if normals are colliding?

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

      Isn't graphics programming just making pixels different colors?

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

      @liambelh9556 thats what im saying dude its just... Things

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

      Isn't programming just writing text with a weird syntax?

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

      isn't thinking about physics just atoms interacting with eachother to understand other atoms ?

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

      i mean, you're right, but don't say that to engine developers please

  • @Benox-Dev
    @Benox-Dev 2 місяці тому +1

    Are you working in a game Industry?🤔

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

    why you angry bird

  • @dddddddddddddddadddddddddddddd
    @dddddddddddddddadddddddddddddd 29 днів тому +1

    why

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

    chatgpt wont help

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

    is it just me or his lips and voice don't sync

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

    Bro pls quit adding flash effect. It's torture to watch it like that.

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

      thanks for the feedback, I tuned them down for the next video

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

      @@lowlevelgamedev9330 Keep up to good work btw. Your knowledge and wise advices give me inspiration.