The title "I AM LOSING MY MIND" definitely sounds accurate when trying to build a physics engine from scratch
@object-official2 жыл бұрын
why are you here
@allanwernermusic2 жыл бұрын
@@object-official really isnt that weird
@dorkle90852 жыл бұрын
@@allanwernermusic yeah it's really not
@greg773892 жыл бұрын
No, just when doing it in C++. Physics engines in general are pretty easy to make conceptually.
@vincenzopanella27052 жыл бұрын
"they" actually say it takes a week to write a physics engine and one year to fine tune it
@cornelius6002 жыл бұрын
Sometimes you gotta do it to appreciate game engines even more
@bladefier19542 жыл бұрын
All the time*
@astroid-ws4py2 жыл бұрын
Game Engines too mostly just integrate some third party solution like PhysX, Bullet etc. They definitely do not make everything themselves.
@ivymuncher2 жыл бұрын
@@astroid-ws4py it's still great to have all those tools kindly bundled for you
@halfbakedproductions7887 Жыл бұрын
@astroid 5698 That's often why a lot of older games get open sourced and parts are still missing. They've used a third party library and don't have the rights to distribute that code. For that reason one of the old Civ games went open source but with no audio capabilities whatsoever.
@catsdontboot8735 Жыл бұрын
Unity doesn't need appreciation now
@unraveledultimatefate9 ай бұрын
Assuming you have yours that we can use now open source, the building blocks and the intricates of physics can really overwhelm a seasoned physicists head, and yours is blown but still in there clear headed giving upper cuts to procrastinating doing something requiring this kind of effort, congratulations, liked to watch your introduction!
@anannoyingsenseofnormalcy.56772 жыл бұрын
Your voice is sooooooooo calming
@nathans_codes2 жыл бұрын
"ParticleModel::ParticleModel::ParticleModel()" My brain is hurting
@kenan23862 жыл бұрын
I'm also making a physics engine, and I can say that the window title "I AM LOSING MY MIND" is in fact relatable
@D-ingus2 жыл бұрын
dude thats so freaking cool.
@mariovelez5782 жыл бұрын
I think you should try resolving collisions instead of pushing them or moving both apart. There are a few algorithms I would suggest like the Separating Axis Theorem or GJK. This will make it so objects don't intersect with each other. Another thing would be a spacial partitioning tree for faster collision detection. I could go on about physics engines as I made a 2D one myself and will make a 3D one in the future with all the features. For buoyancy you can check the volume of the intersection between the plane and sphere and add a buoyant force * volume.
@ZygerGFX2 жыл бұрын
I did do collision resolution. Just explained it differently in the video because I thought people would understand more easily. As for the spacial partitioning tree I'll check it put as I've never heard of it before. And that's awesome that you've made one before I might give a 2d on a go at some point 😄
@awillingham2 жыл бұрын
@@ZygerGFXwould definitely recommend doing a 2d one. The maths are mostly the same just quite a bit simpler, and everything is just nicer to work on. You get to do all the cool physicsy stuff without the pain of OpenGL. Also spatial partitioning is awesome! I’ve used quadtrees for collision detection in my particle simulations quite a few times
@ReasonMakes2 жыл бұрын
@@ZygerGFX Octrees!
@jackdavis7292 жыл бұрын
@@ZygerGFX You might have heard of a quadtree or an octtree instead. They're comparable to binary trees
@kayraegek18562 жыл бұрын
I like the works you do
@_jose_antonio_2 жыл бұрын
people doing this kind of thing from 0 is amazing, so I'm going to that side of the thing
@aldeezy12 жыл бұрын
i like the maple story sound effects, very nice. oh and the engine showcase was cool too I guess
@JC-jz6rx2 жыл бұрын
I really like this, been meaning to do the same. build out some more primitive functionality from scratch to see how game engines work. But alas, as a web developer all the maths go over my head. thank you for the video documenting your experience on this.
@Illmare2 жыл бұрын
lol same I'm an embedded systems eng and even tho I work with more obscure tech everything that goes into game dev is like arcane magic to me.
@poipoi3002 жыл бұрын
As long as you can subdivide the problem into small enough parts, you can probably manage. You also don't really need to know a formula to apply it, you just need to know which one to use. Approximations and substitutions are often good enough or even better too.
@orter40302 жыл бұрын
Same lol.
@nankinink4 ай бұрын
It's all about linear algebra and linear interpolation. It's not that complicated (let's ignore quaternions tho)
@LethalChicken772 жыл бұрын
Reasons to make your own physics engine: 1. Masochism 2. ???
@spacefishaviation2762 жыл бұрын
I keep making stuff like this, and its hilarious how all the engine devs are like 'No no but it doesnt help me!!!' its funny how you constantly justify when really, its fine to use libraries and stuff to do things
@Albileon2 жыл бұрын
Oh my god this gave me ptsd flashbacks. Back in the days in university we also had to create a physics engine in 3d. Have support for slopes, spheres, cubes, rectangles and then created a 'simple' pinball game to show that the engine works. We had a deadline of 6 weeks, and you were not allowed to use any libraries or whatsoever except for DirectX or equivalent, as long as you wrote all the math yourself, and collisions, responses, et cetera. No other sources or pre-finished things were allowed, you had to understand everything you wrote, document it and then have an exam on the mathematics. Worst thing I ever had in my life. Can't believe you'd just do this for fun 🤣 Edit: I failed the class hard and redid that class a year later, after 3 months of hardcore studying before it even begins. I thankfully passed.
@ZygerGFX2 жыл бұрын
Oh that's brutal
@jkf16m962 жыл бұрын
that's definitely brutal, 6 weeks???? and they wanted you to use the bare minimum, omg i wouldn't be able to do that, it sounds like a huge hassle.
@kubic-c3186 Жыл бұрын
Honestly I love this content, it may not be a super complicated physics engine, but it’s fun and simple
@shibii2 жыл бұрын
that mushroom death sound from maplestory at 0:45 hahaha that triggered some nostalgia :')
@fckyu54402 жыл бұрын
Glad I found your channel. Subbed!
@WezWesley2 жыл бұрын
Really good video, keep this style of content going!!
@CraizyMotion2 жыл бұрын
I feel good at code then I see these videos and I’m like “oh” 😂
@plasmarade2 жыл бұрын
Nice video, and nice narration.
@elshadshirinov16332 жыл бұрын
Writing your own physics engine is actually a lot of fun. But doing the rendering with DirectX 11 without libs. Oh my lordy -.-
@SmolRoachez2 жыл бұрын
this video is amazing...i love how good u explain the theory!
@papaveneti77592 жыл бұрын
I want to point out that if you neglect water friction, a body will oscillate if you put it in the water because of the boyancy. Maybe that is what's happening in your code
@tristanmisja2 жыл бұрын
Not only did you make a physics engine, you made a rendering engine. Nice.
@MegaXDBrasil2 жыл бұрын
So for what you made this? It's very hard and stressful...
@KaustavMajumder8 ай бұрын
Mad respect. You used the DirectX Logo from the DxDiag program. I do the same for my Win32 C++ DX applications as well.
@alighahremani46262 жыл бұрын
I didn't blink while seeing this video. That was sooooo interesting.
@KingJellyfishII2 жыл бұрын
"So I now have this and I'm never gonna use it" typical programmer things
@rocket0072 жыл бұрын
Amen brother
@RedstoneHair2 жыл бұрын
5:54 "I AM LOOSING MY MIND" cutee
@Will-Eves2 жыл бұрын
Epic engine! I made something similar for my game engine video, except mine was probably worse. Good job!
@ZygerGFX2 жыл бұрын
Oh cool I'll check out your video
@boersme2 жыл бұрын
Great video. It's interesting to see someone building physics engines from scratch. I also tried to make my own, however I never figured out how to calculate amount of torque applied to an object during collisions. I am still thinking about it from time to time...
@Ozown2 жыл бұрын
That's really cool, I've been interested in trying something simliar but haven't gotten around to it. Great video!
@ZygerGFX2 жыл бұрын
thanks a lot. yeah you definitely should its a lot of fun and stress at the same time :D
@dandymcgee Жыл бұрын
Nice work! You learned a lot in a short amount of time.
@horstschlawutzke66452 жыл бұрын
This hurts. A physics engine is quit a bit more than this baby stuff.
@AtomicCodeX8 ай бұрын
Actually that is exactly what Gravity is, Space is pushing us down. but any continue continue...
@romo33842 жыл бұрын
You definitely should collab with Gonkee! You guys would be amazing together!!
@idkidk-np8bn2 жыл бұрын
MapleStory sound effects I like :))
@GabrielAguiarProd2 жыл бұрын
Best. Particle. System. Ever! 😂
@benjaminmcmullen64182 жыл бұрын
I need to study this
@insanben072 жыл бұрын
Yeah you have some guts for sure
@Benjabenjaaaa2 жыл бұрын
Really Cool ("But WHY?") how do you have the time for this stuff
@ZygerGFX2 жыл бұрын
I don't know sometimes lol. Mind you I made this a few months back haha :D
@shadamethyst12582 жыл бұрын
It was quite interesting hearing you learning those concepts. It looks like your integrator isn't correct, though, which would explain why bouncing the spheres off of each other looked janky. When things fall, you should be able to see their velocity build up over time. A simple integrator would be the leap-frog algorithm. It assumes that acceleration is only a function of position and time, but it can be written in a few lines of code and it only has a quadratic error term.
@DynestiGTI2 жыл бұрын
Verlet integrator is also good probably better even
@reanimatedmanx2 жыл бұрын
Composition over inheritance
@BunchOfNerdsMakingGames2 жыл бұрын
I love how you just named the game "I am losing my mind"
@ZygerGFX2 жыл бұрын
haha :D
@MooImABunny2 жыл бұрын
"the first step of making this physics engine is rendering things on the screen" nah, that's a renderer. You've built both a 3D renderer and a physics engine. Two huge things. Don't undersell yourself my dude
@jenlifh28712 жыл бұрын
GG and underrated
@RickeyBowers2 жыл бұрын
Awe, I was hoping to see the typical chain, box pyramid, or cloth simulation - that physics engines seem to cut their teeth on.
@EduardVE3142 жыл бұрын
Finding this video after struggling all day with unity physics: Why?? How do you have so much free time? And I love math and code but...
@tallbright44962 жыл бұрын
Holy fuck, I love the comic sans
@cvspvr Жыл бұрын
pain simulator 2023
@SamarthCat Жыл бұрын
I'm pretty sure unity uses NVIDIA PhysX (At least on my PC)
@vrtex172 жыл бұрын
I have this and I'm never gonna use it again. I can relate.
@hikaroto27912 жыл бұрын
That was hard to hear after that humongus amount of work "Even tho i have this i am never going to use it again"
@judedavis922 жыл бұрын
Haha, I read the bio, and you are making a game called ‘Project Jude’. Thanks 4 using my name 😅
@victornas912 жыл бұрын
I will like and watch later for sure!
@emmettdja2 жыл бұрын
Sick.
@nickellis-gowland7982 Жыл бұрын
Great job!
@Amitkumar-dv1kk2 жыл бұрын
Tried to make a game engine in opengl and java before but soon gave up, I'll try again with rust and vulkan.
@ZygerGFX2 жыл бұрын
Oooh yeah it can be quite difficult. I heard vulkan can be hard too
@astroid-ws4py2 жыл бұрын
You can try with WGPU, It is a cross platform graphics abstraction library for Rust, Really a high quality one.
@iyziejane2 жыл бұрын
The correct model of collisions is to conserve the 3D momentum before and after, and to conserve X% of the kinetic energy incoming and outgoing to each collision (you could make X depend on the materials involved in the collision, or have some random element). Also you wrote a = v0 - v t but you probably meant v = v0 + at.
@Luredreier2 жыл бұрын
Thank you for sharing this. :-)
@spiritedaway31610 ай бұрын
So refreshing to see a woman doing this, makes me go on. Fellow girlie here trying to make a physics simulator, and got overwhelmed by all the manly men giving manly advice and being condescending. Love ya!
@jaysistar27112 жыл бұрын
By the way, I like the video style, and the material. Keep it up!
@kkololp Жыл бұрын
love the idea, but you should improve your physics's skill. you should devide the force by combined mess of objects, rather than applying the same acceleration to it.
@SkateTube2 жыл бұрын
Making Your self known or saying that You did something in life with this would be putting this information out there in most readable form on some sort of blog, with all known crack perspectives, such as operating system etc
@ZygerGFX2 жыл бұрын
You can do things in life without posting online to others about it. The only reason someone would do that is to make their work more known, and let other people learn from it. But not posting about it doesn't make you not accomplish great things in life. People spend their lives on passions and don't post about it, that doesn't mean they didn't do something in life. It just means it's only known to them and that's okay. I don't care if others don't know how I did this or simple don't know I've made something like this. It was fun and that's all the validation I need.
@SkateTube2 жыл бұрын
@@ZygerGFX this makes me do a phylosophy about purpose of our gadgets... everyday, till next century, if You are poor or have signs of not being productive or advanced in Your life, somebody will say to You to stop wasting Your time, and move on... when it's really unbelievably unimportant, unless the goal is material wealth or status... i really like that You found this as validation for Your time, as it could be an iQ point in general conversation, due to fact, artificial is based on all kinds of computer mechanics...
@samarthtandale91212 жыл бұрын
You are Awesome 😎🤠, really !
@SmolRoachez2 жыл бұрын
And i would love to see how you would continue with an game engine from the point where u ended your video.
@Thinzy Жыл бұрын
i remember having a uni unit on this, it killed me
@NickProkhorenko2 жыл бұрын
Girl made a physics engine in code... Awesome...
@cameleon57242 жыл бұрын
Endless enigmatic book in all languages. You can write a book with mirrors in all languages of the world. You can speak two languages at once, you just need to find the perfect reflection, same content, different translation. Infinite Mirrors. Pi 3.14 XBooks. Hybrid language!!!!! One content, two languages. What I have now written may have a perfect mirror in another language.!!!!!!!!!!!!
@jothamprince87652 жыл бұрын
Definitely the best Lady programmer on KZbin, I'm impressed, subscribed immediately
@AlexBlackfrost2 жыл бұрын
ngl I'd watch more of these. Did you implement continuous collision detection or just discrete? Is implementing continuous collision detection way harder than discrete?
@gommito2 жыл бұрын
I dont think she coded continous its just an unnecessary complexity that only has some benefits in very specific cases. Its just not worth it and there are more interesting things about physics engines than that to focus on.
@AlexBlackfrost2 жыл бұрын
@@gommito thanks for pointing it out! I'm very new when it comes to game engine developement
@ZygerGFX2 жыл бұрын
no unfortunately I didn't do continuous. Would probably give it a go next time but didn't think it was necessary here. also when I read into it it required a lot more work that I didn't really want to do lol. also thanks for the feedback.
@mariovelez5782 жыл бұрын
CCD (continuous collision detection) is very difficult to implement correctly. The simplest one might be a sweep algorithm, but it gets more complex when you add in rotation or want it accurate. Erin Catto, the creator of Box2D, did a GDC talk about his physics engine where he explained in depth how he did it with a kind of binary search. Also, it's only really worth it if you have very fast-moving objects, like projectiles, and at that point it's a lot better to use a ray cast. Most tunneling problems (when an object moves fast enough to pass through another object without touching) can be solved with substeps.
@AlexBlackfrost2 жыл бұрын
@@mariovelez578 Thanks! I will check that GDC talk. Do you know if implementing 3D collision detection is too hard compared to 2D collision detection? (I'm just curious about it, I don't plan to craft my own physics engine)
@alebud14033 ай бұрын
6:02 IM LOSING MY MIND try making a game engine
@ic64062 жыл бұрын
As well as 4:03 where you check collision of sphere against the cube. You can just check if the distance between sphere center and at least one of 8 points of the cube is less than the radius. If at least one is smaller or equal, consider it intersection and stop further processing check. IMO it's much simplier to understand than dot product stuff
@tomasdougan14192 жыл бұрын
Awesome video!!!
@ic64062 жыл бұрын
4:07 too complex to check if two spheres intersect. You can just check if the distance between centers is less than or equal the sum of both radii. If it's equal then there's only one point of intersection exact at both radii in the direction towards each other spheres Edit: There's an exact formula given at 3:16
@JonathanZigler2 жыл бұрын
Fantastic
@KilgoreTroutAsf2 жыл бұрын
question 1: does it conserve energy? question 2: no, seriously, how well does it conserve energy
@Edimartin Жыл бұрын
Good job. But if you know nothing in how about physics engines works maybe you wanna make a 2D physics engine like Box 2D. It's more easy.
@jebrax2 жыл бұрын
Great video! I do exactly the same stuff in my free time :) Wait, you said you're using DirectX, but then I saw a wikipedia page about VBOs in OpenGL. So which one did you pick?
@ZygerGFX2 жыл бұрын
I ended up using DirectX. If I got the wrong wiki page my bad 😂
@jazzling2 жыл бұрын
0:20 why is the S capitalised? is it just an accident?
@maxfun6797 Жыл бұрын
I am curious about the math level required and used to make this? Such as calculating the spin.
@enitalp2 жыл бұрын
Nice video; you should learn how to use reference for performance reasons, especially in a physic engine, like, bool CollisionHandler::CheckCollision(const BoundingBox &box1, const BoundingBox &box2) { const Vector3d &box1Min = box1.GetMin(); .... Ok, first, the reference, then learn the const; it's nice to have. ;) In c# class is a reference by default, and the struct is a copy. In c++, by default, class, and struct are passed as copy, which is helpful in some cases, but both class and struct should be given to another function (or returned, when possible) as a ref or pointer (ref has the advantage of having a friendlier interface . instead of ->) In the case of this function, you create (temporary) 2 copies of BoundingBox, then 4 more at the start. A lot of time is lost for a function that can be called millions of times per second ;p I hope that will help you; keep up the excellent work.
@meepwagon80312 жыл бұрын
how can you just do stuff involving quaternions and inertia and all this math stuff and youre also saying things like "the direct x helped me again" ITS A GRAPHICS API. Any criticism toward this comment will not tolerated im allowed to poke fun at youtubers without ever having programmed with any version of direct x
@noahhradek54262 жыл бұрын
Cool but physics is complicated lol. I wonder if you could add support for differential equations easily.
@Eta_Carinae__2 жыл бұрын
Bro all I wanna know is why VSCode refuses to acknowledge my g++ compiler man.
@balinthonvari77232 жыл бұрын
so cool!
@ITR2 жыл бұрын
Nice
@ChronicoOne2 жыл бұрын
Great visual explanations in this video! I found it interesting that you chose to use Direct X for this project. I haven't worked with it myself, but I put together a crappy little game engine in C with OpenGL. So I know how much work goes into building just the graphics side of things. Great work! I might take some notes from this for future videos.
@ZygerGFX2 жыл бұрын
thanks yeah I don't know much about graphics programming and got recommended DirectX by someone so just gave it a shot. I also tried OpenGL before and yeah it can take a lot of effort to get something working. also props to you for using C and OpenGl. :D
@ChronicoOne2 жыл бұрын
@@ZygerGFX Thanks. I started reading up on C++ after that project. Not fun in C lol
@mariovelez5782 жыл бұрын
@@ZygerGFX OpenGL is a lot easier to work with but DirectX is more powerful from what I've heard
@ZygerGFX2 жыл бұрын
@@mariovelez578 oh fair enough I had no idea.
@sehzadeselim8632 жыл бұрын
You should learn higher mathematics, too. Formulas you use don't let the movements of objects be soft enough But nice start, keep going 👏
@Momo-vy4xw2 жыл бұрын
Ok nice, now make Battlefields 6 please
@eric-jt2 жыл бұрын
You should try Raylib out. It’s a library that simplifies that process
@ZygerGFX2 жыл бұрын
Oh okay ill check it out thanks
@cerulity32k2 жыл бұрын
raylib is great
@azgamedev78522 жыл бұрын
Next video: "I hacked into NASA and made a game IRL using their rockets..."
@stickguy91092 жыл бұрын
Damn impressive stuff. How long did it take to make your engine
@ZygerGFX2 жыл бұрын
This one took like a month maybe slightly longer, but I wasn't working on it all the time and took time of in between so hard to tell how long it really took.
@stickguy91092 жыл бұрын
@@ZygerGFX Mine took just as much but I didn't even have textures or multiple objects
@kairu_b2 жыл бұрын
Interesting
@ellywithpluto1252 жыл бұрын
is that sound effect come from maple story snail die sound effect.
@ZygerGFX2 жыл бұрын
Maybe
@greg773892 жыл бұрын
Why not start making games instead of an engine you'll never use?
@ZygerGFX2 жыл бұрын
Because it'd enjoyable and I get to learn something new. I'm still making games this was just a little side project.
@thespontaneoustomato2676 Жыл бұрын
You're so cool!!! 😭😭😭
@xerzy2 жыл бұрын
Wait YOU'RE TELLING ME THE INFORMATION ON HOW TO MAKE COLLISION DETECTION WAS ON MDN THIS WHOLE TIME?????????????????????????
@hicoop2 жыл бұрын
Looks really cool. Is it on github?
@ZygerGFX2 жыл бұрын
No unfortunately not maybe I should at some point lol