Description
When the bot is following a path and the environment changes (blocks placed/destroyed by other players, mobs, or natural events), the path becomes invalid. PathingBehavior correctly cancels the invalid path and recalculates — but the new path may hit the SAME obstacle, creating a recalc loop where the bot continuously re-paths without making progress.
Root Cause
In PathingBehavior.tickPath():
if (current.failed() || current.finished()) {
current = null;
if (goal == null || goal.isInGoal(ctx.playerFeet())) {
// ... goal reached
return;
}
// ...
synchronized (pathCalcLock) {
if (inProgress != null) {
queuePathEvent(PathEvent.PATH_FINISHED_NEXT_STILL_CALCULATING);
return;
}
queuePathEvent(PathEvent.CALC_STARTED);
findPathInNewThread(expectedSegmentStart, true, context);
}
return;
}
findPathInNewThread starts a fresh path calculation from expectedSegmentStart, but there's no cooldown or backoff between recalculations. If the pathfinder repeatedly produces the same broken path, the bot enters a tight loop of: current.failed() → recalculation → same path → failure.
Expected Behavior
- Implement exponential backoff: wait longer between each consecutive path recalculation
- Track the number of consecutive path failures and escalate (e.g. fall back to explore mode after N failures)
- When path fails at the same position repeatedly, mark that position as temporarily avoided
Suggested Fix
Add a consecutivePathFailures counter and a backoff timer in PathingBehavior. After ~5 consecutive failures from the same position, switch to explore/wander mode instead of re-pathing.
Related
shredder/src/main/java/baritone/behavior/PathingBehavior.java
PathExecutor.failed() — triggers the recalc
Description
When the bot is following a path and the environment changes (blocks placed/destroyed by other players, mobs, or natural events), the path becomes invalid.
PathingBehaviorcorrectly cancels the invalid path and recalculates — but the new path may hit the SAME obstacle, creating a recalc loop where the bot continuously re-paths without making progress.Root Cause
In
PathingBehavior.tickPath():findPathInNewThreadstarts a fresh path calculation fromexpectedSegmentStart, but there's no cooldown or backoff between recalculations. If the pathfinder repeatedly produces the same broken path, the bot enters a tight loop of:current.failed() → recalculation → same path → failure.Expected Behavior
Suggested Fix
Add a
consecutivePathFailurescounter and a backoff timer inPathingBehavior. After ~5 consecutive failures from the same position, switch to explore/wander mode instead of re-pathing.Related
shredder/src/main/java/baritone/behavior/PathingBehavior.javaPathExecutor.failed()— triggers the recalc