Best Solution for '2D Top Down'?

Hi. First of all, I am using AStar Project and it is so powerful, satisfying asset.

However, I got some problem these days.

My game’s maps are looks like above. I am managing maps by seperated scenes.
the problem is, how am I gonna create a pathfinding graph for each, efficiently?

Current Status
Right now I am doing like this, just add new graph for each map. This isn’t too bad, But things will get ugly if I want to enable pathfinding for whole map.

The Problems

  1. Managing graph like this is ineifficient. If I move my map, I also need to move my graph. I hope graph can be child of map but looks like it is impossible because we cannot have more than one AStar.
  2. I have more than 32+ maps. But Seeker component seems only support 32 maps.

In Conclusion
A. How do you think about the problems I asked above?
B. Do you have any other solution or example similar with mine? I think my game is similar with most top down RPGs. So there could be some way, I hope so. :stuck_out_tongue:


I’m assuming each map is separate so that you do not need connections between them.
In that case I think the more maintainable solution for you is to just re-scan the graph whenever the player moves to a different map.

and (you wouldn’t need to actually create a new graph from scratch, but you could configure one in the inspector and then just move it to wherever your level is, and finally scan it).

Since your maps are tiny I don’t think performance will be a problem.

  • I have more than 32+ maps. But Seeker component seems only support 32 maps.

The package actually supports 255 graphs, but graph masks (which tells the agent which graphs it can use or cannot use) is limited to 32 graphs. The ones with a higher index will always be treated as walkable.

1 Like

I have checked your answer long time ago but I didn’t say anythings about that. sorry for late!
Yes, I think your solution is actually good for maintain.
Even now we need to open whole maps in the game due to scan even only one graph… haha.

My plan is scan the map when player enters, as you said. And level designers only need to define map’s width and height.

I will share the result when its possible. cheers! :heart_eyes:

1 Like