-
-
Notifications
You must be signed in to change notification settings - Fork 22.1k
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
Replace some distance checks with square distance checks in NavMap #93005
Replace some distance checks with square distance checks in NavMap #93005
Conversation
Would like to see some performance tests, the change looks sound on paper. Tried with this PR and master and to my surprise I get 2-3 fps on average less with 1000 agents on an unoptimized dev build with this PR and I have no explanation why. |
819d8fe
to
621fbc9
Compare
I just did a test with this project: Results:
There definitely is an improvement, but it's also tiny. Based on these results, I see no reason not to merge this, but at the same time, it's not a super compelling reason to merge either. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approve for the change in general. This still needs someone code review and a rebase.
Rebase because some of the query functions have been moved to the nav_mesh_queries_3d.h
file.
I had time to test this PR more thoroughly with current master. Running 1000 iterations the results are on average at least the same, but for the more important hot paths like the main path function always better, even if only for a tiny amount. So I guess this is good.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code seems good to me.
Needs rebase. Be sure to notify us once it's done, as GitHub doesn't always send notifications for rebases for some reason.
@MajorMcDoom Would you be available to rebase your PR? If not np, just let us know. |
Hi! I will do it today. Thanks for the reminder. |
…wherever the purpose is only to find the nearest element.
621fbc9
to
db194f0
Compare
@smix8 @akien-mga |
Thank you! |
Replaced some distance checks with square distance checks in NavMap, wherever the purpose is only to find the nearest element. Some of these checks can be made thousands of times a frame for path finding, so this should cut down on some math costs. Places where the distance is actually used in some sort of scoring formula were left alone.