Closed nathanfranke closed 1 year ago
yes this is something im struggling with because the astar and navigation node in 3.2 doesnt provide support for calculating multiple paths at once. and i played around with the navigation agent in 4.0 and that also doesnt seem to work with multiple units, maybe its possible to code around that limitation but it would be very nice to have support build in for an rts like scenario where you need to move lots of units around at the same time.
The problem is that the avoidance library doesn't know what's going on with the navigation mesh, it works separately from building the path in its own little world. But while browsing the net, I came across this demo (turn on the obstacle checkbox). That is, it is theoretically possible to inform lib about the boundaries of the NavMesh, saying that these are obstacles and yes it will probably affect performance.
It turns out that others do this:
If you are using a navmesh based graph, it is very likely that you want your agents to not go outside, and perhaps even avoid the border of the graph. Fortunately for you, there is a simple script written just to do just that. It is called RVONavmesh and can be found at Components -> Local Avoidance -> RVO Navmesh. Add that to any GameObject in your scene and it will, when a graph is scanned or loaded add it's border as an RVO obstacle. Source: A* Pathfinding Project -> Local Avoidance
And as for multiple paths... I don’t know (yet)
Describe the project you are working on
Prototyping an RTS game in Godot 4.0
Describe the problem or limitation you are having in your project
Agents can exit the navigation mesh. This can lead to invalid states such as hanging off the edge of a cliff and phasing inside walls.
Groups of >5 are inefficient navigating corners. They all navigate "single-file" instead of around each other.
Similar to as seen above, all agents try to reach the exact same point which leads to "mushing" and inefficient motions.
Describe the feature / enhancement and how it helps to overcome the problem or limitation
NavigationAgent
to disallow exiting the navigation mesh.path_max_distance
, but the value10
still hosts the same issue.Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams
Stay on mesh flag:
If this enhancement will not be used often, can it be worked around with a few lines of script?
Most of these issues cannot be worked around easily. The only alternative would be to make a new pathfinding system from scratch, or use a custom module.
Is there a reason why this should be core and not an add-on in the asset library?
NavigationServer is already part of core.