Auto-Walk & Pathfinding
The auto-walk system allows players to click on any reachable tile and have their character automatically walk there using A* pathfinding. The server computes the optimal path, respecting walls, obstacles, and floor changes (stairs, ladders, holes).
How It Works
- Click to walk — Click on any tile on the map. The server runs A* pathfinding from your current position to the target tile.
- Path computation — The A* algorithm searches up to 500 nodes (200 for chase mode) to find the shortest walkable path.
- Step-by-step movement — The server moves your character one tile per step, respecting movement speed and step duration.
- Automatic cancellation — If the path becomes blocked (e.g. another creature moves into the way), the path is cleared and movement stops.
- Manual override — Pressing a movement key cancels auto-walk and resumes manual control.
Pathfinding Details
A* Algorithm
- 4-directional movement (no diagonal pathfinding; diagonal movement costs 3x normal step duration).
- Manhattan distance heuristic for efficient path estimation.
- If the target tile is not walkable, the algorithm searches for the nearest walkable tile in a 5-tile radius spiral.
- Paths are limited to the same floor (z-level). Floor changes are handled separately.
Floor Changes
When stepping onto a tile with a floor change attribute (stairs, ladders, holes, ramps), the server automatically moves the player to the destination floor:
- Down (holes, trapdoors) — Moves to z+1, with directional adjustments for adjacent stairs.
- North/South/East/West (stairs) — Moves to z-1 with a 1-tile offset in the corresponding direction.
- South Alt / East Alt (wide stairs) — Moves to z-1 with a 2-tile offset.
- Bidirectional stairs — Walking onto a tile that has stairs below it will move you down to that floor.
Queued Actions
Auto-walk supports queued actions — the player can click on a useable object (chest, door, lever, item) and the server will:
- Compute a path to a tile adjacent to the target object.
- Walk the player there automatically.
- Execute the queued action (use item, open chest, pull lever) upon arrival.
If the path is blocked or too long, the queued action is cancelled and an error message is displayed.
Chase Mode
During combat, chase mode (toggleable via combat stance settings) allows your character to automatically follow a target creature when it moves out of attack range:
- When chase mode is ON: If your target moves away, the server computes a path (200 node limit) and auto-walks toward it each tick.
- When chase mode is OFF: Your character stands still when the target is out of range (Canary: "stand while fighting").
- Chase mode re-paths every tick if the target continues moving.
Movement Speed
Step duration is calculated from the character's base speed and the ground tile's speed property:
- Formula: duration = ceil((1000 × groundSpeed / calculatedStepSpeed) / SERVER_BEAT) × SERVER_BEAT
- Server beat: 50ms (Canary standard).
- Calculated step speed: Derived from base speed using the logarithmic formula from Canary.
- Diagonal movement: 3× the normal step duration.
- Default ground speed: 150 (when tile has no speed property).
Protection Zone Restrictions
Players with an active skull (PvP combat) cannot auto-walk into protection zones. If a path would enter a PZ tile while the player is skull-locked, the path is immediately cleared and an error is displayed.