Skip to content

fix: AI units now engage nearby enemies instead of ignoring them in FFA#1412

Merged
braedonsaunders merged 1 commit intomainfrom
claude/ai-unit-variety-I9upy
Feb 10, 2026
Merged

fix: AI units now engage nearby enemies instead of ignoring them in FFA#1412
braedonsaunders merged 1 commit intomainfrom
claude/ai-unit-variety-I9upy

Conversation

@braedonsaunders
Copy link
Owner

Previously, AI armies attacking a base would ignore other players' armies standing right next to them because units with active building targets never re-evaluated for higher-priority threats.

Four fixes working together for SC2-style combat behavior:

  1. CombatSystem threat retarget: Units attacking buildings periodically check for enemy combat units within attack range and switch targets (every 15 ticks)
  2. findThreatRetarget: New method searches attack range for units only (not buildings), using existing TargetAcquisition with includeBuildingsInSearch=false
  3. AITacticsManager near-army threat detection: During attack operations, idle units are redirected toward nearby enemy combat units (2+ within 25 units) instead of being re-commanded to the committed enemy's buildings
  4. Engagement buffer widened from attackRange+3 to attackRange+5 for more responsive target acquisition during attack-move marches

https://claude.ai/code/session_01DmLGJRBv2EMiF95WJXKABz

Previously, AI armies attacking a base would ignore other players' armies
standing right next to them because units with active building targets never
re-evaluated for higher-priority threats.

Four fixes working together for SC2-style combat behavior:

1. CombatSystem threat retarget: Units attacking buildings periodically check
   for enemy combat units within attack range and switch targets (every 15 ticks)
2. findThreatRetarget: New method searches attack range for units only (not
   buildings), using existing TargetAcquisition with includeBuildingsInSearch=false
3. AITacticsManager near-army threat detection: During attack operations, idle
   units are redirected toward nearby enemy combat units (2+ within 25 units)
   instead of being re-commanded to the committed enemy's buildings
4. Engagement buffer widened from attackRange+3 to attackRange+5 for more
   responsive target acquisition during attack-move marches

https://claude.ai/code/session_01DmLGJRBv2EMiF95WJXKABz
@braedonsaunders braedonsaunders merged commit 1ced402 into main Feb 10, 2026
4 checks passed
@braedonsaunders braedonsaunders deleted the claude/ai-unit-variety-I9upy branch February 10, 2026 14:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants