Wall Damage and Patching, Pathfinding Improved

Hey Folks! Pretty productive day, today, as I spruced-up pathfinding a bit, as well as added damaged/patched walls.

The pathfinding fixes and improvements were a big chunk of the day, since there were several edge cases to sort out with all the recent changes. First, I had to add code to abort the current interaction if the goal became unreachable. Also, AI was getting caught in pathfinding loops when the target tile was unwalkable (such as when fixing a broken floor). I had to do some special handling for path calculations when that situation occurs.

I also added some code so that non-pathfinding items can still succeed on interactions that can be done remotely. Previously, they would always fail if not currently sitting in the destination tile. But now, they can succeed if they are within the interaction's prescribed tile range. And finally, I realized my pathfinding was ignoring diagonal tile directions, so I enabled those. And that seems to not only work, but really smooth out the walking experience.

Once that was done, I turned back to damage/repair game loop stuff, and added damaged walls. Since 90% of the ship's tiles are floors or walls, this makes a good chunk of the ship damageable. And with patching kits, they can be quickly jury-rigged to stop leaking precious atmo into space. Patched floors and walls won't stand much abuse, however, so it's best to get them fully repaired asap. And I'm not sure yet how that's going to work. It'd likely require moving heavy ship hull pieces around, and potentially prohibitive tools/processes. So for now, that might be only available in docks, until I get more game systems to support such heavy-lifting and rebuilding.

As it turns out, repairs aren't the only tricky question raised by this game feature. I also started encountering damage in hard-to-reach places, where even a handheld patching kit would be hard to install.

The first one was just crowded tiles. Like the HVAC or conduit tiles, where there is a wall, floor, and potentially other items all stacked up. Right-clicking such a tile didn't guarantee you got the context menu for the item you wanted. Usually, just whatever one was on top and had a valid interaction.

This, fortunately, turned out to be not too hard to solve. I just changed the context menu code to show all available options for all items in the tile. Let the player choose, and done.

But the next problem was a doozy: tiles far away from walkable areas.

For example, looking at today's image, there are two damaged wall sections around the fridge by Noah. And for the most part, those can be reached. But what if the damaged wall was in the corner behind the fridge? Or worse, a breached floor tile under the middle of a giant reactor? How does one reach something that far away from walkable tiles?

In the case of the fridge, you could probably move it if it weren't attached. But on the opposite wall, the toilet is a good example of something that wouldn't be movable (or, you know, same for a giant reactor). So there has to be some other way. And at first, I figured maybe the solution is to just make it possible to repair things, say, 3 tiles away.

However, that doesn't solve the reactor example, where the tile could be a dozen or more units away from the nearest accessible point. And besides, it looks a little hokey to wave one's arms and have a wall repaired far away.

Another solution that comes to mind is making access corridors. If you need access to a wall that's blocked by something, that should be designed into the ship's layout. Like a narrow mechanical corridor between rooms. Or even make that double as an air duct. I really like this idea, as it's an interesting design/planning challenge, fairly realistic, and it's reminiscent of Alien. Unfortunately, this also doesn't solve the reactor problem.

A third option is to allow for spacewalking (or a drone) to go outside and repair from the exterior. This one is a cool idea, realistic, and solves the reactor problem. But is likely a ton of work for me to build. It may also be work I need to do anyway, though.

A fourth option is to allow multi-floor ships. But this has pretty much the same pros and cons as the spacewalk option.

And finally, maybe there just isn't damage to unreachable tiles until I have systems to do that. This might be the preferred route for now. I can still do the access corridor thing without any other development effort, and just limit damage areas for now to places the AI can reach. And some day later, make systems to support unreachable fixes later.

Despite that hang-up, though, not a bad day! Some serious improvements to core systems, plus a new feature!


ra1's picture

You could make the "corridor" areas only accessible to bots (due to small duct size). The player could deploy bots to fix the areas in question. This would mean you could silo pathing for repair bots from players, while providing an interesting meta-game of bot management.

matsy's picture

I think for big irremovable objects it brings up the question of how do we know there is an issue if it is covered?

I think for simplicity of the game, I'd be happy for things not to break under big items like engines. Maybe you'd have a character to suit up and go outside to fix the hull which just happens in a timer of being away and you can't fly away while he is absent or you could and lose him...

I also like the idea of the AI getting stuck but indicating it can't do something which I don't think you've covered yet? If the fridge is blocking the AI path to the wall then I think it should get frustrated it can't do it and as a result their stats change and the job doesn't get done and the player gets frusted.

I feel like the players would have to give an order to move the fridge and then fix the wall then move back again. Obviously after a few times the player would learn to design the shipper in a more efficient way.

dcfedor's picture

@ra1, that's something to consider. Even if humans eventually can reach such areas, it might be worth keeping that in mind in case it's easier to build. Or less tedious to play.

@matsy, I like that frustrated AInidea. I hadn't thought of that, but it's a logical source of frustration that crew will have to deal with

Dan Fedor - Founder, Blue Bottle Games