Best graph type for grid game with node + edge obstacles (runtime updates)

Hi, I want to ask which graph type is best for my case.

My game is a grid-based game with:

  • node obstacles (blocked tiles)

  • edge obstacles (walls between tiles)

  • both can be added/removed at runtime

I wonder if a grid graph is still the best choice, or if another graph type would perform better.

Performance is my main priority.

Any suggestions?

I was gonna suggest Grid but this makes me want to suggest Recast instead. However, if you’re planning on trying to make your units move in a more angular way across these tiles of your game I’d use a Grid Graph.

For edge obstacles (walls) in a grid graph, how should they be represented in code? Is removing the connection between adjacent nodes sufficient?
For the final path, I want to apply string pulling to shorten it. Does string pulling on grids support edge obstacles?

That’s the more advanced option I was gonna suggest, yes. You may also be able to get away with just making your grid graph more dense, by, say, a multiple of 1.5 (not sure if this is the correct multiple, just off the top of my head) or something, so that obstacles/walls line up on the grid.

Which movement script are you using, if any?

The wall is just a thin line between two grids and cannot be converted into a grid by increasing the grid density. Also increasing the grid density would also raise the total number of grids, worsening performance.

I’m currently using AIPath, and it works with node obstacles only.

Then yeah you’re totally fine removing connections AFAIK to get the behavior you’re aiming for.

For finding a path, I can do it by removing the connection. For smoothing the path, can you confirm whether the string pull (grid version) supports edge obstacles? I only got it working with node obstacles.

It is in Utilities/GridStringPull. I’m not sure how to make it support edge obstacles.

If you’re using AIPath, are you able to just use the FunnelModifier? If not, when/where are you trying to use the GridStringPull where it’s only working on node obstacles?