
I'm working on a simple top-down 2D action-RPG-style dungeon crawler, and I'm a bit stuck.
As things currently are, when the hero steps into their aggro range, enemies will move towards him in a beeline, regardless of obstacles. Well, the answer to that is simple, right? I just need to make some navigation grids and add pathfinding.
Not so simple, and this is probably a very common problem. The rooms in my dungeons are not always going to be laid out the same way. There may be movable obstacles, such as pushable blocks, and the dungeon is semi-procedurally-generated, so there may be obstacles placed into a room as the dungeon is built.
This of course complicates creating navmeshes, as the floor plan of a given room is not always guaranteed to be the same.
I've been exploring navigation tutorials, for both 360-degree movement and grid-based movement, linear and A*, but they all seem to make the assumption that the floor will always be the same. The pathfinding they present would work for a static map, but not a dynamic one. When their example game's movement isn't grid-based (which it isn't in mine, I should add), they always instruct the viewer to make sure to leave a gap between the edge of the navigable space and the edge of the navmesh itself, so that the nagivating creature doesn't get snagged on edges, et cetera. I can't even begin to wrap my head around modifying meshes like that on the fly without running into problems. Sure, adding a random column into the middle of an open space would be simple. Just cut out a hole in the navmesh in the middle of the floor. But what about if two columns got placed side-by-side? The vertices in the navmesh would be a complete mess without some complicated detection that I'm nowhere near experienced enough to create.
At the very least, the map layouts are grid-based, and I'm sure I can add navigation to the tilemaps and manipulate that somehow as things change in a room. But the tileset navigation meshes omit the aforementioned gap, so creatures will get snagged on edges and corners, since their movement isn't grid-based.
This whole situation has me stumped, and I'm really not sure how to proceed. I might be able to just muddle it out, but I thought it'd save a lot of wasted effort to come and ask here first. How would you do this?
(As a side note, I'm aware of the upcoming Godot 4's new navigation features, and that they would probably solve a lot of these problems. But Godot 4 isn't here yet. I need to know how to do this in Godot 3.X.)