Skip to content
GitLab
  • Menu
Projects Groups Snippets
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
    • Switch to GitLab Next
  • Sign in / Register
  • veloren veloren
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 426
    • Issues 426
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
    • Requirements
  • Merge requests 54
    • Merge requests 54
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
    • Test Cases
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages & Registries
    • Packages & Registries
    • Package Registry
    • Container Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Code review
    • Insights
    • Issue
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Veloren
  • velorenveloren
  • Merge requests
  • !3376

Fix path finding bugs

  • Review changes

  • Download
  • Email patches
  • Plain diff
Merged Hugo Peixoto requested to merge hugopeixoto/veloren:path-finding-fixes into master May 14, 2022
  • Overview 0
  • Commits 3
  • Pipelines 5
  • Changes 1
  • By opening this merge request, you agree to release your code and all other changes under the GPL 3 license and to abide by the terms set by this license.
  • Migrations have been added if applicable
  • Significant changes of this merge request have been added to the changelog.

We had an unnecessary unwrap_or_else() preceded by a question mark operator, which means that the or_else clause could never be called.

We had a random chance of restarting the route to avoid getting the chaser stuck. This didn't work properly because the rerouting code was only triggered if self.route.is_none() or if the target moved significantly, and the random chance branch only set bearing to None. This change sets self.route = None to trigger rerouting.

When a chaser's route finishes calculating, the chaser may already be a few blocks away from the starting position, thanks to movement inertia. The path finding code finds the point along the route closest to the chaser's position.

This calculation only considered the xy coordinates when finding the closest point. This caused issues whenever the calculated route goes below the chaser's position (for example, when the chaser is on top of a bridge and the route circled around to go under the bridge). In this case, there was a chance that the closest point was the one below the bridge. This caused the chaser to try to move directly to a directly inaccessible block.

The fix was to remove the xy() filter so that the closest point algorithm also considered the z coordinate.

Edited May 14, 2022 by Hugo Peixoto
Assignee
Assign to
Reviewer
Request review from
Time tracking
Source branch: path-finding-fixes