Skip to content

Conversation

@AttackingOrDefending
Copy link

Fix pathfinding bug, where the algo would incorrectly choose the path if the two tiles were on the same axis.

The previous check not new_tile[0] == prev_best[0] (and it's equivalent for vertical movement) would always be true even when moving on the same axis (e.g. if prev_tile is [10, 10], prev_best is [9, 10], and new_tile is [11, 10]).

We now check if the difference is 1, which only happens if it moves on a different axis.

In the example above, if the direction was [1, 1] (top-right) the function would still return False as both if previous_move_direction == self.HORIZONTAL and abs(new_tile[0] - prev_best[0]) == 1: and if prev_tile[1] == new_tile[1]: would be true. Now the first if is correct;y evaluated to false, and the code uses the section that starts at direction = self._get_direction_from_endpoints(end_points) which would previously never be hit.

Also, updates the comments in this function to make it clear what this function does and how it does it.

Fix pathfinding bug, where the algo would incorrectly choose the path if the two tiles were on the same axis.
@AttackingOrDefending
Copy link
Author

This bug occured in https://terminal.c1games.com/watchLive/14167288 at round 14 frame 799, where the demolishers decided to go back in the direction they came from instead of forwards, as was the result of the pathfinding code.

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.

1 participant