We Put a Bullet in our Engine
That’s right! We took our engine back behind the barn, and… wait, no! That’s not what I meant! Last time I mentioned briefly that we had begun using the Bullet Physics engine for Exoverse, and this time I wanted to expand a little bit on what that means.
For those who don’t know, Wrack didn’t use a physics engine of any kind. No Bullet, no Havok – nothing! All of the collision detection, movement physics, etc. were all written by me. Part of the rationale for doing that (aside from not knowing that better options existed), was that I wanted complete control over the physics – the way objects slid against walls, the way gravity was calculated, etc. For the most part, it worked out. Collision detections were accurate, and everything moved around perfectly as intended.
But, there were… some problems.
- Complex geometry. For the most part, doing physics when everything at perfect 90 degree angles is extremely easy. When you have much more complex geometry though, things get much more difficult. Even when a simple box walks through some complex terrain, popping them back (so they don’t walk through the wall) and sliding them against the proper surface is extremely difficult and prone to errors (as demonstrated by the picture above).
- Complex hitboxes. Having more complicated hitboxes for enemies and whatnot was certainly doable, but difficult to pull off. Being able make a compound collision object made up of multiple boxes, spheres, etc. that moves and rotates (and scales!) along with your enemy is no easy task if you’re going it alone.
- Ragdolls. Similarly, letting these linked collision objects loose in the world, and sticking together (you don’t want the head to become detached and roll far away from the next – as hilarious as that would be), is very difficult to pull off without any sort of help from a physics engine.
Fortunately though, where my physics “engine” failed, Bullet succeeds! Once I got it up and running, doing all of the above became possible, and then some. Here’s a quick rundown of some of the improvements this has allowed for us.
- Movement on complex geometry
- Complex hitboxes (in Wrack, everything was a giant unrotating box)
- Better framerate
- Better gibs
- Interactable physics objects (crates, etc.)
- Automatic generation of world collision
So, we’re obviously quite pleased with how things are going so far. Had I discovered Bullet Physics earlier, many of you would have been spared trips through the floor in Wrack. Fortunately though, it’s been implemented into Exoverse, and it’s vastly improved things from a physics standpoint.
Now if you’ll excuse me, I have some ragdolls to go work on…