Home Combat Aggro, Home Leash & Click Targeting

Combat Aggro, Home Leash & Click Targeting

Wildlife chase limits, player targeting, threat tables, and ranged pursue bands.


Decisions

Topic Rule
Leash Home/spawn based. If the NPC or its focus is farther than leash_radius_m from home while in alert/chase/combat, drop threat and return to patrol.
Acquire aggro_radius_m is detection only (and soft return re-aggro near home).
Ranged min range Keep range_min_m as an ability dead zone (classic bow). Auto-pursue does not backpedal; it holds and auto-attack skips until in band.
Focus Highest threat among alive players wins. Tank foundation for parties.

Auto-pursue band

Slot-1 auto-attack with auto-pursue uses the mainhand weapon ability’s range band.

flowchart LR autoOn[T1 auto + pursue] --> band{dist vs weapon band} band -->|too far| advance[Advance] band -->|in band| hold[Hold] band -->|too close| holdSkip[Hold + skip shots]
  • Too far (dist > range_max_m − margin): advance toward target.
  • In band or inside range_min_m: hold. Geometry still rejects shots closer than range_min_m.
  • Forced backpedal is not used — player WASD / weapon swap own positioning.

Content: bow_shot / arrow_shot use range_min_m: 3.0 in assets/combat/abilities/ranged.yaml.

Home leash + return to patrol

Predator FSM (plugin_id: predator_fsm — wolf, goblin, shadow stalker, and similar):

stateDiagram-v2 [*] --> idle idle --> alert: see_prey alert --> chase: in_range chase --> combat: in_attack_range combat --> chase: out_of_melee alert --> return: home_leash chase --> return: home_leash_or_lost combat --> return: home_leash_or_dead return --> idle: arrived_home return --> alert: see_prey_near_home

Fields (npc.combat in YAML / content-admin NPCs tab):

Field Meaning
aggro_radius_m Acquire / see prey
leash_radius_m Max distance of NPC or focus from home while fighting. 0 → derive as max(aggro×2, 12)

Examples: wolf 14 / 28, goblin 12 / 24, shadow stalker 16 / 32.

On leash break: clear threat table, clear target, path to home_x/home_y, resume idle wander or path waypoints.

Click / SHIFT+click targeting (gfx)

Input Result
Left click on attackable NPC Set T1 (primary) target
SHIFT+left click on candidate Set T2 (secondary) target
Left click empty ground Auto-nav walk (unchanged)
Tab / Shift+Tab Cycle T1 / T2 (unchanged)

Pick radius ≈ 1.75 m world. HUD empty-slot hint: Tab / click · Shift+click T2.

Threat / aggro table

flowchart TD hit[Player hits NPC] --> add[Add threat] add --> formula["threat += damage * ability.aggro_modifier"] formula --> table[Npc threat map player_id to threat] table --> top[Highest threat alive in leash] top --> focus[ai.target = top] leash[Home leash / return] --> clear[Clear threat table] death[NPC or player death] --> prune[Prune entries]
  • Runtime: WildlifeAiState.threat: HashMap<EntityId, f32>.
  • On damaging hit: threat[attacker] += damage * aggro_modifier (floor tiny amount so zero-damage hooks can still register later).
  • Each predator tick: retarget to top_threat_target among alive players.
  • Pack assist: allies get a fraction of that threat toward the damaging player.
  • Full clear on reset_wildlife_combat / begin return.

Ability field aggro_modifier (default 1.0) in ability YAML / content-admin Abilities tab. Melee swords sample at 1.5 (short_sword.yaml) so tanks can out-aggro raw DPS with modifiers + sustained hits.

Healer threat from heals and full party hate UI are not in this revision.

Designer notes

  1. Set leash_radius_m on hostile NPCs (or leave 0 for 2× aggro default).
  2. Tune aggro_modifier on tank / taunt skills higher than 1; optional lower on glass-cannon skills.
  3. Keep bow range_min_m if you want a dead zone; players must step back or switch to melee — the client will not auto-kite for them.
  4. Edit via content-admin (http://127.0.0.1:7386) NPCs + Abilities tabs; publish content when ready.

Related pages