-
-
Notifications
You must be signed in to change notification settings - Fork 21.6k
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
NavigationServer3D::sync
can still be further optimized
#100759
Comments
NavigationServer3D::sync
stiil needs to be optimizedNavigationServer3D::sync
still needs to be optimized
NavigationServer3D::sync
still needs to be optimizedNavigationServer3D::sync
can still be further optimized
Hello. Could you amend the start of your issue so it doesn't needlessly come off abrasive and vindictive? You may have a point that the |
Not sure which part of that comes across as vindictive or abrasive to be honest. That was not my intent. Also the PR that was used to close the Issue clearly states that it does not actually optimize anything so I was quite surprised it was used to close the issue. |
|
Na it is ok. I even appreciated the meme. Everyone can chill. We have older issues open for the same thing like #68642 and we have proposals like godotengine/godot-proposals#5635 for the actual implementation details all tracking more or less the same stuff. Those are also linked in the navigation tracker #73566. I think with those links it should be clearer why that issue was closed. I would appreciate if you could add your implementation details and suggestions to that proposal that would be a good place for this so contributors can find those info when they might start working on that stuff. The reason why I linked that PR to close the issues is because it solved the immediate problem while what is left was either a duplicate already coved by other issues and proposals or too generic and open ended in the "make things faster" ballpark which I agree but that is not what issues are kept for. So even if the PR would have not closed the issue directly it would have been closed on the next clean up wave as an issue duplicate or consolidated because a proposal tracked the problem or feature already. |
Tested versions
4.x
System information
Godot 4
Issue description
I do not agree with #100497 closing #96483. The underlying issue is still the same.
This approach doesn’t resolve the root issue; it simply masks it. For example, with a single moving platform,
NavigationServer3D::sync
rebuilds the entire map every frame rather than just the affected parts. This is highly inefficient and needs to be addressed. Same for navigation links. Changing them will cause the whole map to be updated instead of just disconnecting the link and reconnecting it to the new position.I have started on optimizing the navigation module but I currently do not have the time to get it into a PR sate so here are a couple ideas that will greatly speed up
NavigationServer3D::sync
:Polygon
. This allows you to:NavRegion::update_polygons
and store the unconnected edges. Then only connect unconnected edges between regions inNavigationServer3D::sync
. [O(n²) -> O(k²) with k << n in practice]NavRegion
[O(n²) -> O(k)]NavRegion
[O(n²) -> O(~k)]NavLink
and not the whole map [O(n²) -> O(~1)]NavRegion
s to further reduce the amount of edges that need to be checked. A simple AABB tree should be enough. This could be further extended to also build a broad-phase for the polygons inside the region. Moving regions could be marked and excluded from the broad-phase to make it a bit simpler.For 1. there is also the option to store the external connections directly in the
NavRegion
this would have the added benefit of generating an implicit hierarchical graph which could be used to speed up path queries at the cost of precision on very large maps. The internal connections could also be computed ahead of time when building the navmesh. Recast already gives you the information it is currently just discarded. This would however require a breaking change to the navmesh structure.Steps to reproduce
Minimal reproduction project (MRP)
The text was updated successfully, but these errors were encountered: