[Sigma Tau] Custom Physics Engine

Previously, I mentioned I was looking into some physics engines to use for Sigma Tau.  I do not prefer to make my own physics engine; it is a lot of work, for what benefit?  Well, no physics engine I have looked into appears to do what I am looking for, so the benefit may outway the work.  I am pursuing the option of making a new physics engine for Sigma Tau, I am optimistic, we will see how it goes.

Problems with other engines

Most physics engines are optimised for lots and lots of collisions, exemplified by every showcasing of these physics engines showing how many collisions they can handle.  Sigma Tau needs to be optimized for many, many objects, with comparatively few collisions.

Common physics engines expect objects to be within a narrow scope of size.  They will state outright, make sure you do not have objects smaller than e.g. a pen or bigger than e.g. a tree, or performance problems or strange behavior may occur.  I cannot work with this, I will have planets colliding with bullets (although smaller than real planets, and bigger than rifle bullets).  A primary cause of this, I believe, is how common physics engines handle a tolerance value.  Ideally I’d like to get rid of the tolerance value, but more practically, just somehow make it dynamic to the size of the objects in the collision.

Physics engines can give strange unexpected behaviors with interactions, which I do not really understand, and so I do not have the ability to configure the physics engine to mitigate the problems.  Making my own will at least give me insight into the quirky behaviors.

In-short the whole angle of attack of general purpose physics engines out there are totally different from what I want to achieve.


Because I expect few collisions, it opens up unique optimization opportunities.  I can have a longer tick time without often seeing multiple collisions in a tick, making the broad phase check for intermediate collisions.

I do not need a general purpose physics engine, I expect a very limited set of abilities, without configuration.  I will code a single broadphase; only a single collider shape (polygon).  No joints, etc, etc.


I will not be able to optimize as well as some of the big physics engines, it is just not feasible.  But, I will not need a highly optimized physics engine to achieve similar speed simply because it will be optimized for the correct things.

I am very mathematically minded, diving into this math is not outside my comfort zone, and I actually kind of enjoy it.  Edge cases haunt me less than most coders because of the way I think.  I am not saying I am awesomer than other people, but that this challenge is uniquely suited to my skills.

I am pursuing the option of making a new physics engine for Sigma Tau, I am optimistic, we will see how it goes.


  • Step 1: Don't.

    Step 2: Don't

    Step 3: Still don't.

    Really, you are just asking for troubles and bugs, the math isn't even the hardest part. Box2D works pretty well well beyond the specified "limits", as long as it has few contact points. EE uses it just fine at massive scales. And when that starts to break down, your home grown solution will break down as well. Unless you make "instances", where you have smaller pockets of physics in a certain area running independent of other areas. Which you can still do with a normal physics engine on top.

    Box2D boardphase is optimized for having many objects that do not collide at all. Even if you don't want to use the collision or physics of box2d, you can still use the broadphase. I do here for example: https://github.com/daid/SeriousProton2/blob/master/src/collision/simple2d/simple2dBackend.cpp

  • edited July 2020

    Lol, what prior experience do you have, to cause such a fear of physics engines?!

    I wouldn't be the first person to successfully make his own physics engine.

    Yeah, whatever I make will have limits too, and more of them, but I will be the one making the limits; and I will have the knowledge to dissect them, and power to change them.

    As you can see with the extense of my reasoning, I did not decide to look into my own physics engine lightly.

    Thanks for the warning of the minefield I am jumping into,

    I'll will have updates about it in the Dev Logs (:

Sign In or Register to comment.