Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve Navigation with multiple agents #1966

Closed
nathanfranke opened this issue Dec 10, 2020 · 2 comments · Fixed by godotengine/godot#69988
Closed

Improve Navigation with multiple agents #1966

nathanfranke opened this issue Dec 10, 2020 · 2 comments · Fixed by godotengine/godot#69988
Milestone

Comments

@nathanfranke
Copy link
Contributor

nathanfranke commented Dec 10, 2020

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.
    image
    image

  • Groups of >5 are inefficient navigating corners. They all navigate "single-file" instead of around each other.
    image

  • 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

  • Add an option to NavigationAgent to disallow exiting the navigation mesh.
  • Improve collision avoidance. If this is not possible to do performant, allow crowd simulation add-ons for the asset library.
  • This should be fixable by increasing path_max_distance, but the value 10 still hosts the same issue.

Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams

Stay on mesh flag:
image
image

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.

@barbaros83
Copy link

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.

@Killfrra
Copy link

Killfrra commented Jan 17, 2022

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants