(December 2016) Monthly WIP screenshot thread

There were two reasons. And first, I recommend everyone to use someone else’s physics engine. Writing one has been one of the most painful experiences of my life but I started it about 5 years ago, hung some features on getting it working, and have been hacking at it ever since. Unless you understand the math 100% (and I don’t), say away: here be dragons.

Anyway, I did it because I wanted control over when physics ran. I desire to simulate hundreds of user-created objects across a whole “infinite” world. At the time, I wasn’t really sure how to make bullet do that… (nor was bullet native a viable thing back then, by the way). The irony is that after having finally started to add this feature to my own, I see how I might have done it. Bottom line: I always planned to build this in at the core. I’m finally getting to that.

The second reason was because I wanted mesh accurate object-to-object collisions. It seemed to me that I could get pretty close by doing optimized voxel-to-voxel projection. That part has worked out pretty well. Early tests of the engine were pretty encouraging… I could even nicely calculate center of gravity and the intertia tensors.

Here was an older video (from 2011) where I fixed some stability issues but hadn’t added back object-to-object collisions:

At the time, I wasn’t even sure I could have made bullet do even that much with fully custom game-runtime-defined meshes. After all, those tables and chairs models were created in game.

While it has been an incredibly frustrating journey, each new milestone is that much sweeter. Plus, debugging math you don’t understand helps work those problem solving parts of the brain… and each time I understand what’s going on a little more.

Here is an even earlier video that shows when object-to-object collisions were totally bonkers:

Note: even now object to world collisions are done as if the object’s voxels were full blocks. For object to object collisions, it picks the one of the objects to be in ‘full block mode’… the target of a collisions can have full partial block collisions just like the world does.

So I just wasn’t sure bullet was going to give me all of that control. Though if I never get this working, then that’s the route I will take and just cut about 15 features out of the final game.

Edit: and PS: I’m writing this as if I will open source it… which isn’t a promise but my track record is pretty good so far at least… so some day others might be able to learn properly from my mistakes. :slight_smile:

7 Likes