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

perf: Add path height correction on world load #1178

Merged
merged 5 commits into from
Aug 12, 2023
Merged

Conversation

EmosewaMC
Copy link
Collaborator

Because many waypoints for movement place the Y at some height far below the map, we need to correct this height to match that of the navmesh. Doing this at runtime is very expensive as some maps are very tall and so the halfExtents would need to be very large. Doing this at world load is a far more ideal place to take care of this as this only really needs to be done once so that at runtime, more approximate heights can be calculated with the same halfExtents as currently.

Tested that there are no changes aside from the height being changed at world startup. This may resolve issues with some AI being unable to find a close waypoint on the navmesh due to their waypoint height being far too low for the halfExtents to allow finding of the nearest poly.

@aronwk-aaron aronwk-aaron changed the title Add path height correction on world load perf: Add path height correction on world load Aug 7, 2023
aronwk-aaron
aronwk-aaron previously approved these changes Aug 7, 2023
Copy link
Member

@aronwk-aaron aronwk-aaron left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@aronwk-aaron aronwk-aaron requested a review from Jettford August 7, 2023 01:15
@EmosewaMC EmosewaMC marked this pull request as draft August 8, 2023 09:17
@EmosewaMC
Copy link
Collaborator Author

I am seeing more successful queries when using a X and Z halfExtents of zero. about 5% more successful queries from before.

@EmosewaMC EmosewaMC marked this pull request as ready for review August 9, 2023 05:25
@EmosewaMC
Copy link
Collaborator Author

This is resulting in 100% successful queries now.

@EmosewaMC
Copy link
Collaborator Author

ran around quite a bit in gnarled forest, crux prime, return to venture explorer and saw no issues with enemies teleporting.

@EmosewaMC
Copy link
Collaborator Author

The poly height always matching the one from rhe nearest reg is further reinforced by the lookup now being directly vertical with so variance in the x or z axis. This ensures you find the correct height or find nothing

- Only go up and down, do not deviate from the point you are on
- As a backup, use the nearestPoint on the nearestPoly, should detour be able to find one.
- Add a debug assert to fail the program should toReturn differ from nearestPoint[1].

Update dNavMesh.cpp

Update dNavMesh.cpp
@EmosewaMC
Copy link
Collaborator Author

Re-tested without capturing the res return from getPolyHeight and actually returning the correct value and no changes except from the expected path fixes.

DarwinAnim8or
DarwinAnim8or previously approved these changes Aug 10, 2023
Wincent01
Wincent01 previously approved these changes Aug 11, 2023
aronwk-aaron
aronwk-aaron previously approved these changes Aug 11, 2023
@aronwk-aaron aronwk-aaron dismissed stale reviews from Wincent01, DarwinAnim8or, and themself via 3277201 August 11, 2023 13:49
@aronwk-aaron aronwk-aaron merged commit c26086a into main Aug 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants