I am using
GridGraphs for enemy pathfinding in a top-down action game. I’ve chosen to use
GridGraph because I need to make fairly frequent graph updates (such as destroying walls, opening doors, moving crates, etc –
DynamicGridObstacle is fantastic ) and because I am procedurally generating levels in a similarly grid-based fashion.
However, I have noticed that I am generally building levels that have large chunks of unwalkable area in them. I understand that this is one of the trade-offs of using a
GridGraph because it’s fundamentally square (while interesting levels are often irregularly shaped), but I am curious – since I know (as a level designer) that some areas of the level are unwalkable and will never become walkable, would it be possible to manually delete all the “unused” nodes in these areas to improve performance?
- Is it possible to delete nodes from a GridGraph? Would it break everything forever?
- Would there even be any (noticeable) performance improvement in doing so? (Maybe on larger graphs? Currently looking at 240x240 with node size 1 and about 20 seekers floating around, but dreaming bigger in the long term.)
- If yes to both of the above, what would be the best/safest way to go about it?