alwekyerp

Education I wrote a Physics Engine and Articles for Beginners

Recommended Posts

I wrote a 3D Physics Engine in C++ that uses GJK, EPA, and a Sequential Constraint Solver. I wrote it with two goals in mind:

  1. Stacking blocks - it's stable at around 200, and a lot of fun to watch when they all fall down
  2. Education - I wanted to create a Physics Engine I could write about to help other people learn.

Point #2 is why I'm sharing today. I've written 11 posts that aim to teach the Physics Engine. I start from the beginning, Points and Vectors in 3D, and move up to the GJK algorithm for collision detection. There's a lot more I could cover, but I thought I'd share what I have so far to see if anyone is interested. 

The engine itself is on github: https://github.com/SaintDubious/DubiousEngine
And the articles are on my website: http://dubiousoft.com/2017/01/23/dubious-engine-table-of-contents/

If anyone is interested in learning how to make a Physics Engine, I hope you'll find this useful. I'd greatly appreciate feedback, discussion, questions, corrections, etc.

Thanks.

Share this post


Link to post
Share on other sites

Cloned the repo, had trouble building in 64bit, couldn't find your Utils.h include. Tried 32 bit and couldn't find SDL. Maybe you could try including the SDL headers into your project so people can just download and build without tinkering?

Share this post


Link to post
Share on other sites

Thank you for this. I'm not in need of one now (I'm working on 2D games atm and, coincidentally, using ^^^ that guy's ^^^ 2D collision library), but I've bookmarked it for when I move to 3D in the future.

I had a glance through some of the articles you wrote, and they seemed very clear and straightforward.

Share this post


Link to post
Share on other sites
On 10/6/2017 at 12:35 AM, Randy Gaul said:

Cloned the repo, had trouble building in 64bit, couldn't find your Utils.h include. Tried 32 bit and couldn't find SDL. Maybe you could try including the SDL headers into your project so people can just download and build without tinkering?

Thanks for the feedback, I really appreciate every extra set of eyes. You're right, the build is a mess, I haven't looked at it in ages. I've created an issue for myself to clean it up. I'm not sure if I'm allowed to include SDL within my own github repo, but I can certainly provide some clear build instructions so no one else has to flail.

Edit: I've finished with the cleanup. Now the 64 bit stuff seems to work as well. I hope everything has been sanitized. Unfortunately it's still a bit tough to figure out how to get OpenCL for your graphics card, I'm not sure how I can clean that bit up, but the SDL stuff it simpler.

Thank you.

Edited by alwekyerp

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


  • Announcements

  • Forum Statistics

    • Total Topics
      628349
    • Total Posts
      2982210
  • Similar Content

    • By noodleBowl
      I was wondering if someone could explain this to me
      I'm working on using the windows WIC apis to load in textures for DirectX 11. I see that sometimes the WIC Pixel Formats do not directly match a DXGI Format that is used in DirectX. I see that in cases like this the original WIC Pixel Format is converted into a WIC Pixel Format that does directly match a DXGI Format. And doing this conversion is easy, but I do not understand the reason behind 2 of the WIC Pixel Formats that are converted based on Microsoft's guide
      I was wondering if someone could tell me why Microsoft's guide on this topic says that GUID_WICPixelFormat40bppCMYKAlpha should be converted into GUID_WICPixelFormat64bppRGBA and why GUID_WICPixelFormat80bppCMYKAlpha should be converted into GUID_WICPixelFormat64bppRGBA
      In one case I would think that: 
      GUID_WICPixelFormat40bppCMYKAlpha would convert to GUID_WICPixelFormat32bppRGBA and that GUID_WICPixelFormat80bppCMYKAlpha would convert to GUID_WICPixelFormat64bppRGBA, because the black channel (k) values would get readded / "swallowed" into into the CMY channels
      In the second case I would think that:
      GUID_WICPixelFormat40bppCMYKAlpha would convert to GUID_WICPixelFormat64bppRGBA and that GUID_WICPixelFormat80bppCMYKAlpha would convert to GUID_WICPixelFormat128bppRGBA, because the black channel (k) bits would get redistributed amongst the remaining 4 channels (CYMA) and those "new bits" added to those channels would fit in the GUID_WICPixelFormat64bppRGBA and GUID_WICPixelFormat128bppRGBA formats. But also seeing as there is no GUID_WICPixelFormat128bppRGBA format this case is kind of null and void
      I basically do not understand why Microsoft says GUID_WICPixelFormat40bppCMYKAlpha and GUID_WICPixelFormat80bppCMYKAlpha should convert to GUID_WICPixelFormat64bppRGBA in the end
       
    • By HD86
      As far as I know, the size of XMMATRIX must be 64 bytes, which is way too big to be returned by a function. However, DirectXMath functions do return this struct. I suppose this has something to do with the SIMD optimization. Should I return this huge struct from my own functions or should I pass it by a reference or pointer?
      This question will look silly to you if you know how SIMD works, but I don't.
    • By pristondev
      Hey, Im using directx allocate hierarchy from dx9 to use a skinned mesh system.
      one mesh will be only the skeleton with all animations others meshes will be armor, head etc, already skinned with skeleton above. No animation, idle position with skin, thats all I want to use the animation from skeleton to other meshes, so this way I can customize character with different head, armor etc. What I was thinking its copy bone matrices from skeleton mesh to others meshes, but Im a bit confused yet what way I can do this.
       
      Thanks.
    • By mister345
      Does buffer number matter in ID3D11DeviceContext::PSSetConstantBuffers()? I added 5 or six constant buffers to my framework, and later realized I had set the buffer number parameter to either 0 or 1 in all of them - but they still all worked! Curious why that is, and should they be set up to correspond to the number of constant buffers?
      Similarly, inside the buffer structs used to pass info into the hlsl shader, I added padding inside the c++ struct to make a struct containing a float3 be 16 bytes, but in the declaration of the same struct inside the hlsl shader file, it was missing the padding value - and it still worked! Do they need to be consistent or not? Thanks.
          struct CameraBufferType
          {
              XMFLOAT3 cameraPosition;
              float padding;
          };
    • By esenthel
      Just finished making latest WebGL demo for my game engine:
      http://esenthel.com/?id=live_demo
      Let me know what you think,
      as of now only Chrome and Firefox can run it.
      Edge, Safari, Opera have some unresolved bugs at the moment.
  • Popular Now