Skip to content

fix: reduce combat separation to SC2-level tightness#1382

Merged
braedonsaunders merged 1 commit into
mainfrom
claude/fix-ai-unit-engagement-lzsHo
Feb 5, 2026
Merged

fix: reduce combat separation to SC2-level tightness#1382
braedonsaunders merged 1 commit into
mainfrom
claude/fix-ai-unit-engagement-lzsHo

Conversation

@braedonsaunders

Copy link
Copy Markdown
Owner

In-range attacking units were still spreading because processAttackingUnit applies separation at combatSpreadSpeedMultiplier * maxSpeed when force exceeds combatSeparationThreshold. With strength 0.3 and 8+ tightly-packed allies, force easily exceeded the 0.3 threshold, moving units at 0.75 units/sec - accumulating to 3.75 units of drift over 5 seconds of fighting.

Changes:

  • strengthCombat: 0.3 → 0.1 (near-zero per-neighbor separation force)
  • spreadSpeedMultiplier: 0.25 → 0.1 (much slower combat spreading)
  • separationThreshold: 0.3 → 0.8 (only move when severely overlapping)

With these values, 8 neighbors at typical combat distance generate ~0.39 force - well below the 0.8 threshold. Units effectively stay put while fighting, matching SC2 behavior where attacking units stack tightly.

https://claude.ai/code/session_012Sc49F3UHGXxttLJpBPggB

In-range attacking units were still spreading because processAttackingUnit
applies separation at combatSpreadSpeedMultiplier * maxSpeed when force
exceeds combatSeparationThreshold. With strength 0.3 and 8+ tightly-packed
allies, force easily exceeded the 0.3 threshold, moving units at 0.75
units/sec - accumulating to 3.75 units of drift over 5 seconds of fighting.

Changes:
- strengthCombat: 0.3 → 0.1 (near-zero per-neighbor separation force)
- spreadSpeedMultiplier: 0.25 → 0.1 (much slower combat spreading)
- separationThreshold: 0.3 → 0.8 (only move when severely overlapping)

With these values, 8 neighbors at typical combat distance generate ~0.39
force - well below the 0.8 threshold. Units effectively stay put while
fighting, matching SC2 behavior where attacking units stack tightly.

https://claude.ai/code/session_012Sc49F3UHGXxttLJpBPggB
@braedonsaunders braedonsaunders merged commit 15a0f4a into main Feb 5, 2026
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