I've been working on (and sometimes avoiding) physics improvements in AoG. I wanted to start turning on physics for more entities. I've had physics implemented for material blocks and the terrain for a while using the Bullet Physics library. Turning on physics for other entities showed me more issues with my physics that needed fixing and so the list of things to do grew.
One issue that showed up was ramps and stairs were not properly implemented in the terrain physics. After some drawn out attempts to get ramps and stairs working with my previous strategy. I found that my previous strategy for terrain physics wasn't cutting it. It was a bit too "hacky" to get consistent good results for terrain shapes that weren't cubes. So, I changed the terrain physics to use the BvhTriangleMeshShape in Bullet Physics. This has the benefit of using the same triangles that visually represent the terrain to also physically represent the terrain.
The yellow triangles represent the physics shape. More details on the implementation of that over on the gamedev stackexchange.
Now that I had an accurate (and fast!) representation of the world in physics, I needed to implement some other features:
Collision filtering- I wanted Goblins to be able to pass through some entities, or the player will be left watching their Goblins bump into everything (which makes me think of Supreme Commander when you're trying to get your commander to run away from the approaching Spiderbot and he's just bumping into the engineers around him and now the Spiderbot's Heavy Microwave Laser is cooking your commander and nuclear explosion, gah!). Now Goblins can pass through each other but still collide with structures and terrain.
Soft collisions- I wanted Goblins to pass through each other, but I also wanted them to avoid each other. I don't want them all stopping in the same place and stacking up. This was kind of simple with collision filtering already implemented. Since collision filters still detect collisions but don't react, this was just doing some further filtering to react differently to some collisions. Now a small force is applied to entities that are soft colliding.
Ray casting- I use rays to cast out in front of entities when they're moving to detect objects in front of them. I can use these rays to get repel vectors for steering away from obstacles before running into them. The neat thing is the rays can use the same filtering information from above, so entities can hard steer away from objects they collide with, and soft steer away from soft collisions.
Along with new features I've been working on fixing weird physics bugs. Objects falling through the terrain, entities suddenly getting extreme velocity... regular stuff?
So progress continues. It's been a little slower lately since other things have come up. Such is the progress of a "in my free time" game I suppose. Thanks for reading.