Skip to content

fix(webwalker): improve gate handling and path tile selection#1676

Open
mzarglis wants to merge 2 commits intochsami:developmentfrom
mzarglis:fix/walker-gate-animation-and-path-selection
Open

fix(webwalker): improve gate handling and path tile selection#1676
mzarglis wants to merge 2 commits intochsami:developmentfrom
mzarglis:fix/walker-gate-animation-and-path-selection

Conversation

@mzarglis
Copy link

@mzarglis mzarglis commented Feb 6, 2026

Summary

This PR fixes two critical issues in Rs2Walker that were causing navigation problems:

  1. Reliable gate/door traversal with longer animations (e.g., Gnome Fortress gates)
  2. Prevent walker from selecting tiles behind or off to the side of the intended path

Problem 1: Gate/Door Animation Handling

Issue: The walker would try to select tiles inside gated area that are not reachable before completely through the gate causing path to be push back outside the gate. This was especially problematic the Gnome Fortress gate, causing the bot to get stuck walking back and forth through the gate repeatedly.

Root Cause: Rs2Player.waitForWalking() only waits for the walking animation to stop, not for the player to actually reach the destination side of the gate.

Solution:

  • Replaced simple waitForWalking() with position-based completion check using sleepUntil()
  • Walker now waits until the player is either:
    • At or adjacent to the destination tile (within 1 tile), OR
    • Closer to destination than start point and has stopped moving
  • Added proximity check to skip door handling if the player has already passed through
  • Updates minPathIndex after successfully passing through to prevent re-attempting the same door

Problem 2: Off-Path Tile Selection

Issue: The walker sometimes selected tiles behind the player or off to the side of the intended path, causing inefficient or erratic movement patterns.

Root Cause:

  • getPointWithWallDistance() would select any adjacent walkable tile without considering path direction
  • getClosestTileIndex() could select tiles behind the player's current progress, causing backtracking

Solution:

  • Added path progress tracking with minPathIndex and lastPath static fields
  • Enhanced getPointWithWallDistance() to accept path context and prefer tiles that are:
    1. On the actual path (checks up to 3 tiles ahead)
    2. Adjacent path tiles if target is blocked
    3. Falls back to closest tile toward destination if no path tiles work
  • Modified getClosestTileIndex() to:
    • Only consider tiles from minPathIndex onwards (with small 3-tile lookback window for recovery)
    • Apply a penalty to backward movement (only go back if significantly closer)
    • Update minPathIndex only when moving forward
  • Added pathsMatch() helper to detect path changes and reset progress tracking

Technical Changes

  • handleDoors(): Position-based gate traversal with proper completion detection
  • getPointWithWallDistance(): New overload with path context, prefers on-path tiles
  • getClosestTileIndex(): Forward-biased tile selection with backtracking prevention
  • New fields: minPathIndex, lastPath for progress tracking
  • New helper: pathsMatch() for path change detection

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 6, 2026

Important

Review skipped

Auto incremental reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

  • 🔍 Trigger a full review

Walkthrough

The pull request removes the deprecated Applet-based startup architecture and replaces it with direct client initialization. RuneLiteDebug is refactored to call client.initialize() instead of creating an Applet instance. MicrobotClientLoader switches from casting to Applet and calling setStub() to invoking rs.setConfiguration(). MicrobotRSAppletStub is converted from implementing AppletStub to implementing ClientConfiguration with a simplified onError() method for error handling. Additionally, Rs2Walker is enhanced with path-aware point selection for wall-distance calculations, improved door and portal traversal logic, and path progress tracking to prevent backtracking.

Possibly related PRs

  • 2.0.6 #1511: Modifies the same MicrobotClientLoader and MicrobotRSAppletStub classes to transition from AppletStub to ClientConfiguration-based configuration, alongside overlapping Rs2Walker enhancements.
  • 2.0.15 #1541: Includes modifications to Rs2Walker pathing logic and other Microbot plugin components in the same codebase areas.
  • Web Walker Fixes #1419: Updates the Rs2Walker class with changes to door handling and path-related logic in the same utility class.
🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 35.71% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main changes: improving gate/door handling and path tile selection in the Rs2Walker, which are the two primary fixes in this PR.
Description check ✅ Passed The description is well-detailed and directly related to the changeset, explaining both problems, root causes, and solutions with technical specificity that matches the actual code changes.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In
`@runelite-client/src/main/java/net/runelite/client/plugins/microbot/util/walker/Rs2Walker.java`:
- Around line 1208-1235: The code unconditionally advances minPathIndex even
when passedThrough is false; change the logic so minPathIndex is only updated
when the door/gate traversal was actually successful. Refactor the block around
handleDoorException(object, action), Rs2GameObject.interact(...) and the
sleepUntil(...) check to produce a boolean like doorHandled (true if
handleDoorException returned true OR if interact + sleepUntil returned
passedThrough true), log the timeout when passedThrough is false, and only
execute the minPathIndex = Math.max(minPathIndex, index + 1) and the "Door/gate
handled" debug message when doorHandled is true (use symbols:
handleDoorException, Rs2GameObject.interact, sleepUntil, passedThrough,
minPathIndex).

@mzarglis mzarglis force-pushed the fix/walker-gate-animation-and-path-selection branch 2 times, most recently from d4b5de2 to 2b6e845 Compare February 6, 2026 17:56
Michael Zarglis and others added 2 commits February 6, 2026 13:00
This commit addresses two issues i have experienced with the webwalker:

1. Reliable gate/door traversal with longer animations
   - Replaced simple waitForWalking() with position-based completion check
   - Walker now waits until player reaches destination side of gate/door
   - Handles any gate animation length (e.g., Gnome Fortress gates)
   - Prevents premature continuation that caused stuck/retry loops
   - Added proximity check to skip door handling if already passed through

2. Prevent off-path tile selection
   - Added path progress tracking (minPathIndex, lastPath)
   - Enhanced getPointWithWallDistance() to prefer tiles on the intended path
   - getClosestTileIndex() now prevents backtracking with forward bias
   - Walker no longer clicks tiles behind or to the side of the path
   - Path progress resets only when target or path changes

Technical details:
- Door handling now uses sleepUntil with dual conditions: reach destination
  or get closer to destination than start and stop moving
- minPathIndex tracks committed progress through path
- getPointWithWallDistance() checks path context before falling back to
  arbitrary adjacent tiles, scoring by distance to destination
- Added pathsMatch() to detect path changes and reset progress tracking

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
When sleepUntil times out waiting for the player to pass through a
door/gate, return false instead of advancing minPathIndex and reporting
success. This lets the next loop iteration retry the same door.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@mzarglis mzarglis force-pushed the fix/walker-gate-animation-and-path-selection branch from 2b6e845 to 33cc822 Compare February 6, 2026 18:00
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