Repository navigation
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
No actionable comments were generated in the recent review. WalkthroughThe pathfinding code delays candidate-cost and heuristic calculations until route checks require them. Neighbor evaluation also checks diagonal access before neighbor lookup and samples parent terrain height and ground-zone passability when needed. ChangesPathfinding evaluation
Estimated code review effort: 2 (Simple) | ~8 minutes Change: Refactor Possibly related issues
Possibly related PRs
Suggested reviewers: Merge Risk:
|
[Medium impact] The PR appears safe to merge; no actionable defects were found.
|
| if ( locomotorSet.isDownhillOnly() ) | ||
| { | ||
| if (!fromHeightValid) { | ||
| fromPos.z = TheTerrainLogic->getGroundHeight(fromPos.x, fromPos.y); |
There was a problem hiding this comment.
Could perhaps change Coord3D fromPos to Real fromPosZ = 0.0f, and do this:
fromPosZ = TheTerrainLogic->getGroundHeight(parentCell->getXIndex() * PATHFIND_CELL_SIZE_F, parentCell->getYIndex() * PATHFIND_CELL_SIZE_F);
There was a problem hiding this comment.
I don't think it's really necessary, the calculation is performed once anyway. And the code is a bit cleaner to understand as it is.
9250a2b to
1f91e15
Compare
|
Tested a mixture of local retail replays that i have and they all pass without mismatch so far. |
The sole caller already excludes tunneling before invoking line-of-sight expansion. Replace the repeated callback abort check with a debug assertion so normal release builds omit the redundant test.
…diagonal steps earlier in examineNeighboringCells()
The sole caller already excludes tunneling before invoking line-of-sight expansion. Replace the repeated callback abort check with a debug assertion so normal release builds omit the redundant test.
225e7d5 to
f9beb07
Compare
This PR was driven by me and reviewed locally,
Codex found a few instances where extra work could be removed.
The details are bellow.
Reduces redundant work during fine pathfinding:
Synthetic fine-search benchmarks on current `main` measured:
Results compare summed median search times across ten scenarios and seven paired rounds. Search traces, cell counts, and path costs remained unchanged. These are fine-search measurements, not full-game timings; replay testing so far has shown no determinism mismatches.
For some extra info;
TheTerrainLogic->getGroundHeighton every neighbour cell was a reasonably expensive call toTheTerrainRenderObject->getHeightMapHeightcostToGoalallows a cheaper execution path through the code: it can now return early when the existing route is equal or better, without calculatingcostToGoalWith the extra suggestions from Caball009:
we get some extra performance squeezed out as shown by Codex bellow.
These are the additional time reductions from the two reviewer changes, compared with the original three optimisations:
Synthetic fine-search benchmarks across ten scenarios and seven paired rounds. Search counts, path costs, search traces, and final state hashes remained unchanged. Results measure the two additional changes together, relative to the original three optimisations; individual timings varied.
This next change is more speculative, changing the tunneling early return for an assert could gain some extra performance, but this is likely to be less in a real game.
Additional improvement over the existing five optimisations, measured across ten synthetic fine-search scenarios and seven paired rounds per run. Search counts, path costs, search traces, and final state hashes remained unchanged. No meaningful Debug improvement was established. Release results assume debug crashing is disabled; these are not full-game timings.