Commit graph

39 commits

Author SHA1 Message Date
BruceChen
8ec1ccd45d pathing: 0-replan on long Descend->Traverse + cold-start 5 c2c
Two complementary fixes for live-server "stuck on a step then replan"
on the 252.5,138,220.5 -> 244.5,122,188.5 route.

Search layer (ParkourFeasibility.HasRunUp): a long flat sprint parkour
(5 c2c, horiz~5) cannot launch from a cold start. Vanilla physics show
that gap=4 dy=0 reaches 5.1075m only with 12 momentum ticks of straight
sprint windup; a 0t standing jump tops out at gap=3 (=4 c2c). When the
previous move type is not Parkour/Descend (i.e. no carried airborne
momentum) we now require two aligned back-runway blocks instead of one
so the executor actually has room to spin sprint up.

Execution layer (GroundedSegmentController.ShouldComplete): the
LandingRecovery early-out used to live below the MinExitSpeed gate. A
Descend that landed inside the destination block but naturally settled
to zero speed (e.g. when the next segment is a fresh Traverse rather
than a chained Parkour) would fail the 0.03 MinExitSpeed check and idle
inside the target block until the per-segment timeout fired, triggering
an unnecessary replan. Move the LandingRecovery footprint check above
the speed gate so a fully-decelerated handoff is accepted.

Verified live on 1.21.11-Vanilla:
- 252.5,138,220.5 -> 244.5,122,188.5: 24 segments, 0 replans (was: 1)
- 244.5,122,188.5 -> 252.5,138,220.5: 48 segments, 0 replans
- 251.5,141,210.5 -> 252.5,138,220.5: 34 segments, 0 replans
- 252.5,138,220.5 -> 251.5,141,210.5: 24 segments, 0 replans

Test suite: 297 passed / 22 known pre-existing failures, no new
regressions vs 5de169db.

Made-with: Cursor
2026-04-25 18:08:08 +00:00
BruceChen
5de169db64 pathing: stabilize 0-replan round-trip on ledge/descend runs
Fix a cluster of execution-layer issues that caused replans and void
falls when traversing narrow ledges and multi-block descents between
(251.5,141,210.5) and (252.5,138,220.5):

- WalkTemplate / GroundedSegmentController: suppress the pre-rotation
  bias toward the next segment's exit heading on stable-footing Turn
  exits where the next segment is not a jump.  The next template
  snaps yaw on its first tick anyway, and pre-rotating mid-stride on
  a 1-block walkway pushes sprint drift perpendicular to the path and
  walks the bot off the edge.  Turn exits into a jump still get the
  bias so the takeoff direction stays aligned.

- GroundedSegmentController.ShouldComplete: relax the headingReady
  gate for Turn exits with stable footing so the segment can complete
  once yaw is aligned with either the current or the next segment
  heading (within 25/15 deg).  Without this the removed bias would
  leave the bot stuck at the end of a walkway waiting for a rotation
  that never happens.

- DescendTemplate: restrict the airborne exit-heading bias so it only
  kicks in when the footprint is inside the landing block, or on
  single-step drops where the fall is too short for lateral drift to
  miss the landing column.  On 2+ block drops the bot now keeps yaw
  pointed at the landing center for the whole fall.

- DescendTemplate: add a multi-block overshoot guard on PrepareJump
  exits.  Once airborne and past the landing end-plane on a 2+ Y
  drop, release forward/sprint and press back briefly so air drag
  pulls the bot back into the 1x1 landing column instead of sailing
  one block past it into the neighbouring void.

Live round-trip between the two goal coordinates now completes with
zero replans in three consecutive runs in each direction.  Full unit
test suite is unchanged from the pre-existing baseline (22 failing
tests, all orthogonal to this change).

Made-with: Cursor
2026-04-22 16:43:43 +00:00
BruceChen
d002930a6a pathing: unify jump moves into MoveJump + IMoveExpander
Replace seven hand-written IMove classes (MoveTraverse, MoveDiagonal,
MoveAscend, MoveDiagonalAscend, MoveDiagonalDescend, MoveParkour,
MoveSidewallParkour) with a single MoveJump driven by a JumpDescriptor
(XOffset, ZOffset, YDelta, JumpFlavor). JumpFeasibility is the single
source of truth for the physics/cost rules of every jump-family move.

A* no longer iterates a flat IMove[]. The Calculate loop now drives
an IMoveExpander[] that writes into a stackalloc Span<MoveNeighbor>,
eliminating per-iteration heap traffic. JumpExpander enumerates every
jump-family descriptor dynamically; LegacyMoveExpander wraps the
remaining dynamic-landing moves (MoveDescend, MoveSprintDescend,
MoveClimb, MoveFall) so callers that still pass a custom IMove[]
keep working.

Add two O(1) short-circuits at the top of JumpExpander.Expand:
- Hoist the per-node parkour preconditions (AllowParkour + CanSprint,
  standing block climbability, feet-liquid, head clearance at y+2)
  so ~170 SprintJump + Sidewall descriptors never call JumpFeasibility
  when the node cannot take off at all.
- Precompute an 8-way "first step has no floor" table indexed by
  (sign(dx), sign(dz)) so SprintJump descriptors in a direction that
  has a walkable floor underneath are dropped without Evaluate.
- Add a conservative "any cardinal wall at y or y+1" probe that skips
  all 112 Sidewall descriptors when no wall exists adjacent to the
  takeoff.

Move tests switch to the new MoveJump.* factory methods. Behavior is
verified by the existing test suite: the 21 pre-existing baseline
failures are preserved exactly, 0 regressions introduced.

Made-with: Cursor
2026-04-19 17:03:26 +00:00
BruceChen
da52aa5c3c pathing: sidewall runup precondition via EntryPreparation
Introduce an EntryPreparationState carried on PathNode + A* context so
sidewall parkour can explicitly request one or more runway traverses
before takeoff instead of silently dropping the move. ParkourFeasibility
gains TryGetRequiredStaticEntryRunupSteps + HasPreparedRunup helpers so
long descends (major=5, dy=-1) only remain feasible when the preceding
node proved the runup.

Widen HasDominantAxisRunUp to accept cold-start sprint-jumps within
~3.1-3.5 blocks horizontally so lone overhang / staircase takeoffs stay
feasible without a 2-block runway (matches Baritone's MomentumBehavior
.ALLOWED contract).

Add a runtime SidewallParkourController that implements the corner
commitment + wall-hug chain during execution.

Extend pathing test fixtures with InitialMomentumTicks, add sidewall
accepted/rejected scenarios, and refresh timing + contract baselines to
reflect the new planner shapes. Document the design in
docs/superpowers/specs and plans.

Made-with: Cursor
2026-04-19 17:03:03 +00:00
BruceChen
95b20d9d1c pathing: async replan + template success/failure alignment
Move PathSegmentManager's Replan to Task.Run so the main tick only reads
results and swaps executors, and introduce a _nextExecutor pre-planning
slot so upcoming segments can prepare while the current one finishes.

Relax per-tick yaw/pitch rate limiting: allow instantaneous snapping
before jump ticks (Baritone does this and servers do not kick for it).

Align jump-template success/failure contracts with Baritone:
- Success key shifts from "speed squared" to "feet-on-target block".
- Failure window widened to the ~200 tick range.
- AscendTemplate gets a headBonkClear + edge/side proximity
  precondition so launches only happen from a safe takeoff.

Expose an initialMomentumTicks option on TemplateSimulationRunner so
follow-up sidewall scenarios can warm up physics before a template
starts.

Made-with: Cursor
2026-04-19 17:02:41 +00:00
BruceChen
e23037a897 feat: add sidewall parkour planner support 2026-04-18 16:26:15 +00:00
BruceChen
724880f928 fix: propagate parkour profiles through astar 2026-04-18 16:14:04 +00:00
BruceChen
b4b0c6e8ed refactor: thread parkour profile into runtime segments 2026-04-18 16:04:45 +00:00
BruceChen
d919bff91f pathing: tighten linear parkour execution 2026-04-18 06:14:45 +00:00
BruceChen
891763602a pathing: align linear completion with live execution 2026-04-17 20:09:56 +00:00
BruceChen
418f17b4a1 pathing: add side-wall theory, full-coverage parkour test suite, and live test fixes
Theory simulator:
- Add 2D side-wall jump physics with yaw sweep for worst-case margin
- Generate sidewall theory cases (flat/ascend/descend, wall_offset 0/1)
- Add momentum-capabilities.json with band compression and max_reach
- Extend models, capabilities, canonical, and renderers for sidewall

Full-coverage parkour test suite (tools/test-parkour.py):
- Derive test matrix from momentum-capabilities.json
- Build linear/neo/ceiling courses via RCON with 7-block clear margin
- Use /goto for pathfinding, parse A* and PathMgr log output
- Stop-at-first-failure per (family, subfamily, dy, ceil, wo) group
- Hierarchical --filter (e.g. linear/flat, ceiling/headhitter/ceil2.5)
- Exclude sidewall from default matrix (identical max_reach to linear)

Pathing execution fixes:
- Align parkour contracts and timing budgets with live test results
- Fix jump-entry yaw snapping for grounded handoffs
- Template helper and sprint jump template refinements

Made-with: Cursor
2026-04-15 17:52:47 +00:00
BruceChen
cf8bf349db pathing: align parkour contracts with live budgets 2026-04-15 17:36:20 +00:00
BruceChen
aad6ad83d3 pathing: snap yaw only for grounded jump-entry walk states 2026-04-15 16:43:39 +00:00
BruceChen
8408a41398 pathing: snap yaw for jump-ready grounded handoffs 2026-04-15 16:37:12 +00:00
BruceChen
2be9b287a3 pathing: snap yaw for sprint jump approach 2026-04-15 16:29:11 +00:00
BruceChen
be6be4da36 test: surface path timing contracts in live harness 2026-04-14 10:51:13 +00:00
BruceChen
b9bff02107 Add path execution telemetry and scenario runner 2026-04-13 16:36:11 +00:00
BruceChen
360883acf3 feat: add transition-aware path execution core 2026-04-13 15:35:43 +00:00
BruceChen
6e4cf4a10e fix: stabilize descend landings after braking 2026-04-12 18:43:33 +00:00
BruceChen
4b92781d10 fix: brake landing recovery before turns 2026-04-12 18:43:33 +00:00
BruceChen
0e0fc06b72 feat: tighten parkour reliability checks 2026-04-12 18:43:33 +00:00
BruceChen
6b449cc72a feat: converge grounded path segment completion 2026-04-12 18:43:33 +00:00
BruceChen
3b4e552d70 feat: add transition-aware path execution braking 2026-04-12 18:43:33 +00:00
BruceChen
00494078df fix: parkour diagonal flight path, wall-adjacent parkour, sprint descend checks
- MoveParkour: replace full-rectangle intermediate check with diagonal
  strip check (CheckFlightPath) so walls outside the actual flight
  corridor no longer block valid parkour jumps.
- MoveParkour: require both cardinal neighbors passable for diagonal
  parkour takeoff; a wall on either side clips the AABB and prevents
  reaching the target.
- MoveSprintDescend: replace full-rectangle check with explicit
  per-axis intermediate column check.
- SprintJumpTemplate: track diagonal jumps and skip approach delay for
  short diagonal jumps to avoid overshooting small starting platforms.

Made-with: Cursor
2026-04-12 18:43:33 +00:00
BruceChen
9e6b689dd6 feat: add corner walk, sprint descend, and parkour descend moves
- MoveDiagonal: allow single-side-blocked diagonals (corner walk) so
  the bot can hug an open side to cut around a wall; both-sides-blocked
  remains impossible. Walk-speed cost when one side is blocked.
- MoveSprintDescend: sprint off a ledge covering 2 horizontal blocks
  while dropping 1-3 blocks. Registered for cardinal and diagonal
  offsets.
- MoveParkour: support negative yDelta (-1, -2) for descending parkour
  where the bot sprint-jumps across a gap and lands on a lower
  platform. Registered cardinal (dist 2-4, y-1/-2) and diagonal
  variants.
- DescendTemplate: sprint when horizontal distance > 1.5 blocks.
- SprintJumpTemplate: increase vertical landing tolerance for descend.

Made-with: Cursor
2026-04-12 18:43:32 +00:00
BruceChen
285c3000c3 feat: add diagonal ascend/descend moves, fix pitch, smooth look angles
- Add MoveDiagonalAscend and MoveDiagonalDescend for "corner" moves:
  step diagonally around a wall edge while ascending/descending 1 block.
  Requires at least one intermediate cardinal direction to be passable.

- Fix pitch calculation: look toward target's eye level (same height
  delta as feet delta) instead of subtracting eye height, which caused
  the player to stare at the ground during flat walks.

- Add Yaw/Pitch smoothing via SmoothYaw/SmoothPitch in TemplateHelper.
  Max 35 deg/tick for yaw, 25 deg/tick for pitch. Prevents instant
  camera snaps between path segments while still being responsive
  enough for sprint-jumps and tight maneuvers.

- Apply smoothing to all five action templates (Walk, Ascend, Descend,
  Climb, SprintJump).

Made-with: Cursor
2026-04-12 18:43:32 +00:00
BruceChen
399c8cdc79 fix: remove spurious jump on vines in WalkTemplate and add pitch tracking
- WalkTemplate: remove OnClimbable jump/sprint logic that caused the
  player to jump when walking past vine blocks during flat traversal
- TemplateHelper: add CalculatePitch() for computing the look angle
  toward a 3D target relative to eye height
- All templates (Walk, Ascend, Descend, Climb, SprintJump): set
  physics.Pitch each tick so the player visually looks toward the
  current path target direction
- McClient: sync playerPitch and set _yaw/_pitch after pathfinding
  ticks so rotation is included in position update packets sent to
  the server

Made-with: Cursor
2026-04-12 18:43:32 +00:00
BruceChen
9046c61f95 fix: improve vine/ladder climb-down and descent through climbable blocks
- ClimbTemplate: add explicit descent handling with horizontal drift
  correction instead of relying on no-input gravity alone
- DescendTemplate: on climbable blocks, suppress Forward input to
  prevent HorizontalCollision-triggered upward bumps, allowing gravity
  to slide the player down naturally
- MoveClimb: restrict climb-up past the top of a climbable column --
  only allow if there is solid ground to stand on at destination,
  preventing impossible vine-top exits where the player would fall back

Made-with: Cursor
2026-04-12 18:43:32 +00:00
BruceChen
fb30886756 fix: handle climbable blocks in WalkTemplate to prevent stuck on ladders
WalkTemplate now detects when physics.OnClimbable is true (player entering
a ladder/vine block) and switches from Sprint to Jump input, with extended
stuck detection thresholds. This prevents the template from failing when
the path walks through climbable blocks.

Tested on 1.21.11: all movement types pass (walk, diagonal, ascend, descend,
climb, parkour 2-4 gap, mixed courses with direction changes).

Made-with: Cursor
2026-04-12 18:43:32 +00:00
BruceChen
8ece75acc3 feat: complete Phase 4 McClient integration for A* pathfinding
- Fix MoveHelper.IsOpenGate: MangroveWood -> MangroveFenceGate
- Fix ResetStateForTransfer to cancel and clear pathSegmentManager
- Fix GetCurrentMovementGoal to return correct goal during A* navigation
- Fix SetMovementSpeed(Sneak) speed value consistency (2 -> 1)
- Migrate /pathfind command to use MoveToAStar + PathSegmentManager
- Add NavigateToGoal(IGoal) to McClient for flexible goal navigation
- Refactor MoveToAStar to delegate to NavigateToGoal
- Add ChatBot API: NavigateTo, CancelMovement, GetCurrentMovementGoal
- Expose PathSegmentManager.Goal property for external goal inspection

Made-with: Cursor
2026-04-12 18:43:32 +00:00
BruceChen
53082d387e feat: add 4-block jumps, diagonal parkour, high-fall water/ladder support
MoveParkour rewritten to support both cardinal and diagonal sprint jumps
with unified (xOff, zOff) interface. New capabilities:

- 4-block cardinal sprint jumps with edge-approach timing in template
- Diagonal parkour: (2,1), (1,2), (2,2), (3,1), (1,3) in all quadrants
- Ascending parkour extended to dist=3 (cardinal)
- Overshoot safety check after landing destination
- Block parkour from climbable starting blocks (vine/ladder)

MoveDescend/MoveFall enhanced with Baritone-style dynamic fall scanning:
- Water landing: accepts falls of any height into water
- Mid-fall ladder/vine grab: resets effective fall height (<=11 blocks)
- CalculationContext gains MaxFallHeightWater, AllowLadderGrabDuringFall

SprintJumpTemplate gains distance-based approach timing:
- Long jumps (>=3.5 blocks): delays jump until 0.5 blocks from center
- Medium jumps (>=2.5): 0.35 blocks approach
- Landing tolerance scales with jump distance

All movements verified on 1.21.11 local server.

Made-with: Cursor
2026-04-12 18:43:32 +00:00
BruceChen
a9c9a6a669 fix: set movement input before completion check to maintain sprint momentum
Templates now set Forward/Sprint input before checking completion
conditions. This prevents a 1-tick input gap during template transitions
that caused the player to lose sprint speed, making parkour jumps fail
due to insufficient horizontal velocity.

Made-with: Cursor
2026-04-12 18:43:32 +00:00
BruceChen
034c5d0cab fix: correct collision axis ordering and step-up threshold to match vanilla
Two bugs in CollisionDetector caused persistent Y-axis bouncing (0.6 block
oscillation) while walking on flat ground:

1. GetAxisStepOrder used a complex 6-branch sorting that often placed
   horizontal axes before Y. Vanilla's Direction.Axis.axisStepOrder always
   resolves Y first, then the larger horizontal axis. Replaced with the
   simple two-case vanilla logic.

2. The horizontal-blocked checks (blockedX/blockedZ) used exact != which
   triggered on floating-point noise (~1e-15) from sin/cos in movement
   input. Vanilla uses Mth.equal (1e-5 threshold). This false positive
   caused step-up to fire every few ticks on flat terrain.

Also includes DescendTemplate robustness fixes from the previous session
(fail on unintended climbing, suppress forward input on climbable blocks).

Made-with: Cursor
2026-04-12 18:43:32 +00:00
BruceChen
4b49135107 feat: add parkour moves and template-based path execution system
Phase 2.2: MoveParkour for sprint-jump across 1-2 block gaps (distance 2-3)
and ascending parkour (distance 2, +1Y). Registered in BuildDefaultMoves
with CalculationContext.AllowParkour gating.

Phase 3.1-3.2: Template execution engine replacing the waypoint queue system.
- IActionTemplate interface with per-tick state machine pattern
- Templates: Walk, Ascend, Descend, Climb, Fall, SprintJump
- ActionTemplateFactory maps MoveType to the correct template
- PathExecutor drives sequential template execution with logging
- PathSegmentManager handles replanning on failure (up to 5 retries)
- McClient integration: MoveToAStar now creates PathSegmentManager,
  UpdatePathfindingInput delegates to it, CancelMovement/ClientIsMoving
  updated for both old and new systems.

Tested on 1.21.11: straight walk, zigzag maze, stair ascent,
1-gap and 2-gap sprint jumps all pass.

Made-with: Cursor
2026-04-12 18:43:32 +00:00
BruceChen
a6261e4019 fix: improve pathfinding execution for climbing and block classification
- Fix MoveHelper.CanWalkThrough to treat climbable blocks (ladders, vines)
  as passable, not solid -- MCC's IsSolid() incorrectly classifies them
- Fix MoveHelper.CanWalkOn to exclude climbable blocks from ground check
- Add fence gate passability in MoveHelper
- Fix start position calculation in MoveToAStar to handle solid-block
  floor rounding (player at y=79.9 → floor y=79 inside solid)
- Fix ReachedWaypoint to require vertical proximity for climb waypoints,
  preventing premature waypoint consumption during ladder ascent
- Fix SetInputToward to handle ladder climbing with Jump input and proper
  wall-facing when OnClimbable

Made-with: Cursor
2026-04-12 18:43:32 +00:00
BruceChen
77c5f88168 feat: add /goto command with A* pathfinder integration and MoveFall
- Add MoveFall move for straight-down falls beyond MoveDescend range
- Register MoveFall in default move set
- Create /goto command using new A* pathfinder
- Add MoveToAStar() method to McClient bridging A* results to existing
  path execution system (Queue<Location> + UpdatePathfindingInput)
- Add translation entries for goto command

Made-with: Cursor
2026-04-12 18:43:32 +00:00
BruceChen
deb1bc47cc refactor: clean up debug logging in pathfinder and pathfind command
Remove verbose per-node insertion tracking from A*. Keep essential
logging: start, goal reached, partial/failed results. Clean up
pathfind command with exception handling and cleaner output.

Made-with: Cursor
2026-04-12 18:43:32 +00:00
BruceChen
e9b19d3cbb fix: correct PathNode.Pack bit overlap causing hash collisions
The X and Z fields shared bit 36, causing nodes like (1,80,0)
and (0,80,0) to hash to the same value. Fixed by using proper
non-overlapping bit allocation: X in bits 38-63, Z in bits 12-37,
Y in bits 0-11. Added diagnostic logging to pathfind command.

Made-with: Cursor
2026-04-12 18:43:32 +00:00
BruceChen
1abab20f17 feat: add Phase 1 core pathfinding architecture
Implements the new Baritone-inspired A* pathfinding system:
- Core types: PathNode, PathResult, MoveResult, MoveType, ActionCosts
- BinaryHeapOpenSet min-heap for A* open set
- AStarPathFinder with timeout, cancellation, partial path support
- CalculationContext for thread-safe world state snapshots
- MoveHelper for block passability checks
- IGoal interface + GoalBlock, GoalXZ, GoalNear, GoalComposite
- IMove interface + MoveTraverse, MoveDiagonal, MoveAscend, MoveDescend, MoveClimb
- /pathfind command for testing the new pathfinder

Made-with: Cursor
2026-04-12 18:43:32 +00:00