System Fault Devlog 4

No post last week, because I decided to prioritize having something to report over consistency. Fortunately, the migration to a real physics engine is mostly complete. Unfortunately, what remains has my brain leaking out through my ears.

Thus far I’ve found two physics bugs and fixed one. More is done than undone, and System Fault is more or less playable with the new physics engine.

Two challenges remain. Pathfinding is proving to be particularly tricky. My previous pathfinding system worked well enough, though it occasionally got hung up on small distances and corners. My workaround was to teleport stuck entities over short distances, with code to minimize the size of the jumps. If you listen to advancing robots in Rampage, you’ll occasionally hear moments when they appear to take two steps in rapid succession. This happens when a robot teleports, and the footstep system notices the jump in distance and plays a footstep sound sooner than it should.

The new system tries to be as physically accurate as possible. Unfortunately, the paths I generate don’t take into account whether a given volume can even fit along the path, and my teleport hacks no longer work. I’m trying to add physics knowledge into the pathfinding layer such that paths along which a shape cannot move aren’t even generated. But because this code takes more than a frame to run, I need to move physics data off of the main thread, and this is proving challenging. I’m sure there’s a quick and easy fix, and I’ve gotten lots of support thus far, so resolution is just a matter of time.

Second, I have a few other nasty corners that should really get cleaned up. I have a simple system for tracking areas of a map. Many other systems locate entities within these areas, and use those calculations for optimization and other benefits. This code should continue to work fine alongside the new physics engine, but while I’ve got the thing cracked open, I might as well unify as much as possible. Area containment and tracking should be easy enough to migrate. The dozen or so different places and ways in which area data is used might be a bit more so.

My hope is to spend another week on the physics engine transition, then I’ll return to working on System Fault itself. Fortunately, many features will become easier to implement once this is done. In particular, I’m hoping to beef up robot AI a bit by having them notice when they’re being aimed at. Without physics, getting this right would be challenging. The physics engine allows me to attach a collision sensor to players that corresponds roughly with their firing arc, then have robots detect when they’re within that volume. I’ll also have an easier time experimenting with accessible mechanisms for throwing grenades or other powerups.

Exciting changes are on the horizon. If only the path beyond it wasn’t so difficult.