Conversation
feat(actions): implement Pure Pursuit lookahead for smoother waypoint navigation
…navigation accuracy
- Replace single-panel text dump with 4-tab layout (Live Monsters, Patterns, Combat Stats, Scenario) — 560x500 window - Fix root cause of Patterns always showing None: inspector now reads MonsterAI.Patterns.knownMonsters (in-memory, always populated by persist()) as primary source, merging UnifiedStorage for cross-session entries. Storage-not-ready no longer silently drops all pattern data. - Add switchTab() with teal highlight on active button, hides inactive panels and scrollbars - refreshActiveTab() dispatches to the correct tab builder, throttled at 2500ms, reset correctly on manual Refresh and tab switch - EventBus monsterai:state_updated auto-refresh retained
…t mid-route stops When Pure Pursuit selects a lookahead waypoint, the regression detector was tracking progress toward the original destPos instead of the actual walk target. As the player moved past destPos toward the lookahead, curDist increased and triggered the stuck-detection logic, stopping autoWalk mid-route. Pass walkTarget (lookahead or destPos when fallback) to setWalkingToWaypoint so the detector measures movement toward where the walk is actually headed.
… layout monster_inspector.lua: - Add 3s schedule-based live update loop (startLiveUpdate/stopLiveUpdate) so the window refreshes even when monsterai:state_updated never fires (e.g. TargetBot is off or no wave attacks occur) - Add direct g_map.getSpectatorsInRange fallback in buildLiveTab() so Tab 1 always shows nearby creatures even when MonsterAI.Tracker is inactive - Reset lastRefreshMs=0 on manual Refresh click and on window show so the 2500ms throttle never silently blocks the first visible refresh - startLiveUpdate on window show, stopLiveUpdate on hide smart_hunt.otui: - Replace single-panel HuntAnalyzerWindow with 4-tab layout mirroring monster_inspector.otui: Session / Consumption / Loot & Combat / Insights smart_hunt.lua: - Add buildSessionTab / buildConsumptionTab / buildLootCombatTab / buildInsightsTab extracting content from buildSummary() per tab - Rewrite showAnalytics() / doLiveUpdate() to drive the new tabbed window using haFindChild / haUpdateWidgetRefs / haSwitchTab pattern - Simplify Monster Insights button to delegate to toggleWindow()
…rward declare refreshActiveTab function
…ker blacklist clearance
…vent blacklisted waypoints from being processed
…or-mismatched waypoints
…g and diagnostics for monsters and patterns
…sing for intentional and accidental floor transitions
…ssages for consistency
…nd wrap-around logic for waypoints
…ge tiles in lookahead
…n and improve fallback to smoothed direction
…d unreachable targets
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
📝 Coding Plan
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. Comment Tip CodeRabbit can generate a title for your PR based on the changes with custom instructions.Set the |
There was a problem hiding this comment.
Pull request overview
This PR refactors and extends navigation/walking and TargetBot analytics/UI to improve smooth waypoint traversal (Pure Pursuit lookahead), make recovery behavior more robust across floor changes, and connect hunt analytics to target priority scoring.
Changes:
- Added Pure Pursuit lookahead targeting for
goto, plus tuned walking precision and stuck/timeout heuristics for winding routes. - Refactored MonsterAI TargetBot integration to delegate scoring to
PriorityEngine, added HuntContext bridge signal, and revamped Monster Inspector + Hunt Analyzer UIs into tabbed layouts. - Improved floor-change handling, blacklist reset semantics, and some UI/runtime safety checks.
Reviewed changes
Copilot reviewed 15 out of 15 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| utils/waypoint_navigator.lua | Prevents wrap-around route segments when last goto is a floor-change tile to avoid backwards Pure Pursuit aims. |
| cavebot/actions.lua | Uses navigator lookahead target for smoother goto walking with reachability/stair guards. |
| cavebot/walking.lua | Tighter keyboard-step threshold and direction preference for close-range precision. |
| cavebot/cavebot.lua | Adjusted stuck detection/timeout logic; refined floor-change intent handling; updated recovery/blacklist behavior. |
| targetbot/priority_engine.lua | Adds HuntContext-based score component into the unified priority calculation. |
| targetbot/monster_tbi.lua | Large refactor: removes duplicated priority logic and delegates to PriorityEngine; updates danger/debug/EventBus wiring. |
| core/hunt_context.lua | New analytics→priority bridge module producing a cached normalized “hunt signal”. |
| core/smart_hunt.lua / core/smart_hunt.otui | Refactors Hunt Analyzer UI into tabs and exposes metrics for HuntContext. |
| targetbot/monster_inspector.lua / targetbot/monster_inspector.otui | Refactors Monster Inspector into tabbed UI and event-driven/live-refresh flow. |
| targetbot/monster_patterns.lua | Skips persisting empty/unknown monster names. |
| targetbot/monster_ai.lua | Consolidates safe-creature helpers into core helpers; improves projectile source attribution; adds state checksum event gating. |
| core/AttackBot.lua | Guards item-id widget access to avoid nil indexing. |
| _Loader.lua | Adds hunt_context to analytics load category. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| local cfg = TBI._defaultConfig | ||
| local pri = PriorityEngine and PriorityEngine.calculate(creature, cfg, nil) or 0 | ||
| callback(pri) |
| threats[#threats+1] = { | ||
| name = safeCreatureCall(cr, "getName", "unknown"), | ||
| level = tl, | ||
| imminent = td and td.wavePredicted or false, |
| local function findChild(parent, id) | ||
| if not parent or not id then return nil end | ||
| local ok, w = pcall(function() return parent[id] end) | ||
| if ok and w then return w end |
| print("[CaveBot] Z-change (" .. lastPlayerFloor .. "→" .. playerPos.z .. "): stair at WP" .. (focusedIdx or "?") .. ", advancing via Z-mismatch guard") | ||
| else | ||
| -- Accidental floor change: reset fully and snap to nearest same-floor WP. | ||
| clearWaypointBlacklist() |
| targets[#targets+1] = { creature = cr, priority = pri, distance = d, | ||
| breakdown = bk, id = safeGetId(cr), name = safeCreatureCall(cr, "getName", "unknown") } | ||
| if d <= maxRange then | ||
| local pri = PriorityEngine.calculate(cr, cfg, nil) |
…s for better usability
…ut for improved usability
- Implement oscillation and stuck detection in the goto action to prevent looping without progress. - Refactor waypoint handling to improve recovery from accidental floor changes and corridor breaches. - Adjust combat constants for reaffirmation retries and engagement backoff to optimize attack behavior. - Improve reachability checks for creatures, including dynamic cooldown adjustments based on previous reachability. - Enhance pathfinding logic to ensure smoother navigation through obstacles and better handling of floor changes.
This pull request introduces significant improvements to the CaveBot waypoint navigation and walking system, focusing on smoother movement through waypoints, more robust handling of floor changes, and improved stuck detection and recovery logic. The changes implement a "Pure Pursuit" lookahead strategy for walking, refine how the bot handles intentional versus accidental floor changes, and enhance blacklist and rescue logic for unreachable waypoints. Additionally, walking precision and stuck detection have been tuned for better reliability in complex map scenarios.
Waypoint Navigation and Walking Improvements:
gotoactions: the bot now targets a point ahead on the route for smoother, uninterrupted movement, with fallbacks for floor changes and blocked paths. [1] [2]Stuck Detection and Timeout Adjustments:
Floor Change and Recovery Logic:
Blacklist and Recovery State Management:
Other Minor Changes:
hunt_contextto the analytics tools category.AttackBot.luafor item ID display.These changes collectively make waypoint navigation smoother, more robust to edge cases, and less likely to get stuck, especially in complex or multi-floor cave routes.