Pathfinding for both Player and NPC

Hello ,
Currently, I am using one grid graph for hunting Area(NPC) outside the town

But I need Pathfinding inside the town for the players

How NPC works is that game get the location from the server and check the location is walkable or not if it is it will spawn NPC(It used a random set of locations for patrol ) for inside the town no NPC should enter.

Questions

  1. Do I need to use 2 grid graph or there is a way to get it down with one?
  2. Currently, the grid graph doesn’t exclude the rocks on the terrain. How to add so that grid makes rock not walkable ??
  3. There will be 40 + NPC how I can make then avoid from getting stuck and find the way around?
    While search in the Docs I found
    GetPointsAroundPointWorld
    how to use it as all NPCs will be moving so the path around need to be placed inside OnControllerColliderHit or
    OnCollisionEnter correct?

So the only reason you are considering 2 graphs is because you want to check if the server’s random locations are on the graph? Correct? Or is there some other reason?

You will have to make sure that the rocks have colliders on them, otherwise it is not possible for my scripts to detect them. Make sure they are in a layer that is included in the ‘Obstacle Testing’ layer mask in the grid graph settings.

I’m not sure what you mean here. Getting stuck in what way?

Npc is I’m not allowed to enter the town so that’s why I needed to graphs

3., I am talking about local avoidance

Looking at your map, it looks like if you only make sure to keep the targets of each agent outside the town, then no NPC should have to enter the town to get to their target. So I would just try to do that. For example you could have a script which has a Bounds field which represents the hunting area and then just check if your target points are inside that bounds object.

For local avoidance, take a look at the documentation page about it: https://arongranberg.com/astar/docs/local-avoidance.php
You can also take a look at the 2 example scenes (Example11 RVO and Example 16 RVO 2D) which show local avoidance.