Skip to content

Playerbot survival: healing, retreat, and recovery #38

Description

@adrunkhuman

Survival and healing

Build a reusable playerbot healing and survival subsystem. It must observe health independently of the current objective, choose legal recovery, verify the effect, and coordinate with combat, navigation, service, and future safe-region planning.

Healing is a global maintenance interrupt. Hunting is only one source of damage; PvP, raids, environmental damage, scripted encounters, and world events use the same mechanism.

First milestone

  • Observe current and maximum health on every normal decision cycle.
  • At a configured health percentage, interrupt the current action and use a carried small health potion on self through normal item-use APIs.
  • Respect action and potion cooldowns. Issue no more than one healing action at a time.
  • Verify from observed item-count and health changes. Distinguish successful use, unverified use, missing supplies, and ineffective recovery.
  • Do not acquire a combat target while critically low.
  • If no supported healing action is available, cancel attack/follow and emit an explicit bounded survival outcome. Do not continue combat blindly.
  • Resume the interrupted objective when the immediate healing condition clears.
  • Emit stable telemetry with trigger reason, health before/after, selected method, resource before/after, result, and failure reason.

This milestone excludes safe-place discovery, kiting, spell healing, predictive damage modeling, and automatic selection across every potion item.

Recovery methods

  • Discover or expose healing effects from authoritative loaded item, action, rune, and spell data. Do not maintain a permanent hardcoded playerbot list.
  • Support health potions, healing runes/items, and vocation/level-appropriate healing spells.
  • Represent level, vocation, magic level, mana, soul, charges, inventory, range, target, exhaustion group, cooldown, and applicable-condition requirements.
  • Compare legal methods by expected recovery, overheal, action delay, resource cost, scarcity, and current danger.
  • Reserve supplies for the current objective and trigger service/refill before required resources run out where practical.
  • Treat regeneration and other passive effects as observed state, not immediate active healing actions.

Survival policy

  • Separate health assessment, method selection, action execution, and retreat planning.
  • Let urgent healing preempt hunting, looting, service, travel, quests, and idle behavior without duplicating healing logic in each subsystem.
  • Define health bands and hysteresis to prevent oscillation between normal and emergency behavior.
  • Use incoming damage rate, nearby attackers, conditions, cooldown readiness, available healing throughput, and route risk to choose continuation, disengagement, or retreat.
  • Resume an interrupted objective only when it is still valid.
  • Death is a playerbot-manager lifecycle outcome. Healing telemetry must retain enough context to explain a failed survival decision.

Retreat

Retreat is a global survival mode that any objective can enter. Trigger it when low health and available healing cannot cover expected damage; weigh health, recent damage, attackers, conditions, healing stock, and cooldowns. A level-1 soak lost Bot One to rats after healing ran out while it kept fighting — the concrete failure this behavior prevents.

While retreating:

  • Stop hunting, chasing, and looting; move toward the safe destination.
  • Fight only creatures that block the escape route (Build reusable playerbot combat targeting and tactics #54 owns blocker target selection).
  • Replan when the route or destination becomes unsafe. A no-spawn tile is not necessarily safe; check live creatures and route danger too.
  • Go to service if recovery remains impossible; resume the old objective only when it is still valid and health is safe.

Choose the destination dynamically while the bot moves: for PvE, a reachable area with fewer or weaker spawns or no spawn pressure; for PvP, a reachable protection zone (if PZ lock blocks entry, survive until entry is legal); otherwise a suitable temple, service point, PZ, or low-risk area.

Scale: do not run whole-map pathfinding per bot per tick. Share static topology, PZ, spawn, transition, and service data; keep a few candidate anchors per bot, re-score on bounded intervals or state changes, and route only when retreat starts or the route becomes invalid.

Add deterministic PvE and non-hunt retreat cases covering destination selection, blocker combat, replanning, arrival or bounded failure, and clear telemetry. #51 and #28 own region and route data.

Hunting and safe regions

  • Integrate with future map/spawn-derived hunting regions without manually authored safe coordinates.
  • Let region analysis expose escape transitions, nearby lower-danger connected regions, service distance, spawn pressure, and recovery suitability.
  • During a hunt, use this data to choose healing in place, kiting, leaving the immediate spawn area, returning to service, or abandoning the hunt.
  • Do not require safe-region knowledge to react to PvP, raids, scripted encounters, or damage during travel outside a hunt.
  • Revalidate dynamic danger and reachability while retreating. A nominally safe destination can become blocked or hostile.

Constraints

  • Use normal player item-use, spell, movement, cooldown, mana, inventory, and condition APIs.
  • Do not directly mutate health, mana, conditions, inventory, or position.
  • Do not parse Lua/XML source text in playerbot code.
  • Keep decisions bounded on the dispatcher/scheduler model for eventual multi-bot scale.
  • Treat missing supplies, cooldowns, and unsupported methods as expected policy outcomes, not generic action failures.

Completion checks

  • A damaged bot below the initial threshold uses a carried small health potion on itself and verifies resource and health effects.
  • Healing interrupts combat and non-combat objectives, then resumes the still-valid objective.
  • Cooldown and action timing prevent duplicate or spammed healing requests.
  • Missing, unverified, and ineffective healing have distinct bounded outcomes.
  • A critically low bot does not acquire a new target when no supported recovery action is ready.
  • Deterministic coverage includes combat damage, non-combat damage, successful healing, cooldown, no supplies, rejected use, and objective resumption.
  • Later spell support selects only legally castable spells and verifies mana, cooldown, and health effects.
  • Later retreat support chooses a reachable lower-risk region from discovered world and hunting-region data, not a hardcoded escape coordinate.

Delivered in PR #45

PR #45 delivers the small-health-potion milestone:

  • Health is observed globally on every normal playerbot decision cycle.
  • At or below 60% health, carried small health potions interrupt the current objective and are used one at a time through normal use-with-creature handling.
  • Potion-count and net-health deltas distinguish success, missing supply, unverified use, and ineffective recovery.
  • Action timing prevents duplicate requests. A still-valid objective resumes after recovery.
  • Missing stock redirects to the existing service loop. Newly purchased potions are not consumed until purchase verification and stage advancement finish.
  • Deterministic supplied-stock and zero-stock scenarios verify healing, refill, transaction safety, and objective resumption.

Spell/rune capability discovery, mana policy, conditions, predictive survival assessment, and map-derived retreat remain open. #46 indexes broader health, mana, regeneration, and recovery coordination.

Related work

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew or improved behaviorplayerbotServer-controlled player behavior and infrastructure

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions