Grid graph texture limit?

I would like to use a 2048x2048 texture to define static paths (it’s a river network). Is this too high? Should I be using something else for a system that large?

Hi

A 2048x2048 grid graph is very very large. It will use a lot of memory and be kinda slow too.
Usually for worlds that large you use a recast graph instead.

I’ve done a calculation on the map and I have less than 5000 grid points that are traversable. Since a river network is just like a maze, this should be even simpler since I really only need intersections and end points (about 500 grid points).

Maybe a point graph is better suited for this or maybe a “breadth first” search? I don’t know. If you have any advice for best method, that would be great but in the meantime I’ll keep working this out.

I’ve been doing tests with 1024x1024 grids and memory and speed is more than acceptable. I have a static and cached grid graph and only 5% of the grid is walkable. My target is high-end pc, so lots of power and ram.

However, I see there are hard coded limits on both the number of nodes and texture sizes. Can you confirm this is the case?

Yes, this is an artificial limit. You can remove it if you want, everything will work just fine, just keep track of your memory usage.

Well, speed is fast but memory hit 6GB which is maybe too high.

I would consider using a recast graph instead but I don’t understand how that applies to a 2D game. I don’t have any 3d geometry in the scene except a flat plane.

The recast graph can be rotated, but it does not support 2D colliders.

I don’t have 2D colliders either.

Thanks for your help but it’s obvious this is not the right solution for me. I just need to traverse a simple 2D array and write out the resulting path to Texture2D. I found some libraries on github so I’ll be going in that direction.

1 Like