Skip to content

Fix mob chase reading a cleared path after checking in-range - #11906

Merged
sruon merged 1 commit into
LandSandBoat:basefrom
Frankie-hz:chasefix
Oct 30, 2026
Merged

sruon merged 1 commit into
LandSandBoat:basefrom
Frankie-hz:chasefix

Conversation

@Frankie-hz

Copy link
Copy Markdown
Contributor

I affirm:

  • I understand that if I do not agree to the following points by completing the checkboxes my PR will be ignored.
  • I understand I should leave resolving conversations to the LandSandBoat team so that reviewers won't miss what was said.
  • I have read and understood the Contributing Guide and the Code of Conduct.
  • I have tested my code and the things my code has changed since the last commit in the PR and will test after any later commits.

What does this pull request do?

This has been around for a little bit but our ASAN crash has picked it up. When a mob is chasing someone and is following a route and it getsd wtihin attack range its double checking the route by asking the navmesh for a new one. That means it throws the old check away -> looks for a new one but since the mob is now on top of the player the mesh returns nothing.

This fails in two spots:

  • The target is less than 1 yaml away. So if a player turns around and runs through the mob at the correct timing it will crash if that mob is chasing him.
  • If the navmesh cant connect the two spots so any ledge or stairs with a gap

Code wise CMobController::Move() saves the path before this actually hapens so its saying "i am following a route" but when it gets to where its being called and its on top of the player then that is no longer true which means the route is now empty...which is calling std::vector::back() on a now empty vector -> boom crash on ASAN and nowhere else. You wont see this crash even on a release linux build.

This fix I have is checking whether the mob is following a route after the double check instead of before it. So when the double check comes back empty the mob will just say hey im in range and i can see the target so stand and attack.

On any other build other than asan you wont actually see any change at all.

One thing I did not change and not sure how to go about this is when a mob is in attack range, can see its target but cant walk to it because the mesh doesnt allow it to (ledge, or gap) it will also crash on ASAN.

Steps to test these changes

Unless you have a linux box with ASAN enabled you wont actually see this. But if you do you can just simply run mobs around any which way you want and then double beck into them. It will eventually crash.

@sruon
sruon merged commit 2751e63 into LandSandBoat:base Oct 30, 2026
14 checks passed
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.

2 participants