Support Forum

Roguelike Rooms Graph

Hi,

Basically I’ve been making a roguelike that is procedurally generated with separate rooms that are connected together. For awhile now, I’ve not totally been sure how to create a graph that can somehow only confine to these rooms. My makeshift solution has been to create a massive grid graph that covers all kinds of new room layout generations. This just seems very inefficient, and bad for performance, and I feel there must be a better way. I’ve also ran into tons of “Couldn’t find a node close to the end/start point” errors, which seems to be causing issues which agents, and I think this could be related. Or maybe its just because of my code.

I tried to create multiple pathfinder objects, and place one with in each room prefab with the correct size, but was quickly reminded that there can only be one pathfinder object. In short, I was wondering if there was some way to create a graph that can adapt to the size of my room layout somehow. I’ve looked at the recast graph, but from what I can tell, it doesn’t support 2D. So if anyone has any ideas, that would be greatly appreciated.

Thanks :slight_smile:

Hi

On this page you can find out how to create (or just set the dimensions of) a grid graph during runtime: https://arongranberg.com/astar/docs/runtimegraphs.html. In your case I’d recommend just setting the dimensions of the graph during runtime and then scanning the graph.

Thank you so much! I’ll look into that.