Common Patterns & Examples

Documentation Unreal Engine AI Patterns

Ready-to-use patterns for melee, defensive, and aggressive enemy types.


The distance bands below (for example 100-250cm) describe the Range of a Distance Scorer. Distance is opt-in: an action only reacts to range once you add a Distance Scorer to its Scoring list and tune that scorer's Range. Movement values map to UMovementBehaviorProfile fields (DesiredDistance, DistanceTolerance, and the strafe-rest / threat-response toggles).

Pattern 1: Basic Melee Enemy

ActionSet:
  • 2-3 melee attacks at close range (100-300cm)
  • Quick retreat when too close (under 100cm)
Movement:
  • DesiredDistance: 200
  • DistanceTolerance: 0.2 (holds roughly 160-240cm, prefers strafing inside it)
  • bEnableStrafeRest: true
Actions:
LightAttack:  100-250cm, 2s cooldown, weight 1.0
HeavyAttack:  150-300cm, 4s cooldown, weight 0.8, chains from LightAttack
QuickRetreat: 0-100cm,   3s cooldown, weight 1.5 (defensive)

Pattern 2: Defensive Enemy

ActionSet:
  • Defensive actions score higher
  • Longer cooldowns, stays at distance
Movement:
  • DesiredDistance: 350
  • DistanceTolerance: 0.2 (holds roughly 280-420cm)
  • bAdjustDistanceByThreat: true, ThreatDistanceScale: 1.0 (backs off further as threat rises)
Actions:
CounterAttack: 150-250cm, only when Player.Attacking tag (2x multiplier)
Block:         100-300cm, BehaviorTree sequence with shield raise
Retreat:       0-200cm,   high weight, moves away

Pattern 3: Aggressive Rusher

ActionSet:
  • Close-range focused
  • Short cooldowns
Movement:
  • DesiredDistance: 100
  • DistanceTolerance: 0.1 (tight band, closes in fast)
  • bEnableStrafeRest: false (no forced breaks, relentless pressure)
Actions:
LungeAttack:   200-400cm, 1s cooldown, high weight (initiator)
RapidSlash:    50-150cm,  1.5s cooldown, chains from LungeAttack
Grapple:       0-100cm,   3s cooldown, BehaviorTree with special animation