Common Patterns & Examples

Documentation Unreal Engine AI Patterns

Seven enemy archetypes as recipes: the numbers to type, and the field each one goes in.


Seven enemies you have fought before, each written out as the values to type and the field they go in.
Every recipe below starts from an enemy that already works: a pawn, an AI controller, a registered combat target, and an Enemy AI Config carrying both a Target Selector and an Awareness Config. Leave Awareness Config empty and every awareness state stays Unknown, so the brain never reaches its combat phase and the enemy stands still whatever you type into the assets. The same goes for the target: nothing selects one on its own, and the failure is silent. See Getting Started, Targeting and Awareness.
Each recipe names two assets: a Movement Behavior Profile for how it stands, and an Action Set for what it does. Point the enemy's Enemy AI Config at both, under Default Movement Profile and Default Action Set, and leave the two Manage ... Automatically boxes ticked.
Every action uses the Gameplay Ability execution method with Ability Class set to GA_SEC_MontageAbility and its own montage in the payload, unless a recipe says otherwise.
Distance and angle bands are written as four numbers, the Range on a scorer: Min Value / Optimal Min / Optimal Max / Max Value. The action scores 0 outside the first and last, and 1 across the middle pair.
An action ships with no scorers, so every Distance Scorer Range below needs a Distance Scorer added to that action's Scoring > Scorers list before the four numbers have anywhere to go. See Action System.

Pick a shape

ArchetypeFights atWhat makes it that
Grunt250 cmTwo swings and a chain link between them
Rusher120 cmTight far edge, no strafe rest, one-second cooldowns
Duellist350 cmA parry rule on a Reaction Set, and a recovery gap
Flanker300 cmAn Angle Preference Rule at 90 degrees
Archer600 cmA ranged scorer band, pinned to back-line roles
Guardits postTerritory posts, a leash, an awareness config
Boss300 cmElite role, and a second-phase moveset swap

The grunt

Circles at mid range, opens with a light swing, follows it with a heavy, and gives ground when you walk into it.
Movement Behavior Profile
FieldValue
Desired Distance250
Distance Tolerance0.2
Crowd Tolerance0.45
Enable Strafe Reston
Action Set, three actions:
Action IDDistance Scorer RangeCooldown DurationSelection Weight
LightAttack0 / 100 / 250 / 40021.0
HeavyAttack0 / 150 / 300 / 45040.8
Backstep0 / 0 / 100 / 18031.5
On LightAttack, add a Chain Link with Target Action ID HeavyAttack and Bonus Multiplier 1.5. The heavy scores half again as high for a moment after the light finishes, so the two read as a combo without being scripted. Roll out of range in between and the heavy's Distance Scorer drops it, and the enemy picks something else instead of swinging at air.
Backstep peaks at point blank and scores 0 past 180 cm, which is how the grunt answers being crowded rather than eating a hit.

Copy the shipped one

Turn on Show Plugin Content in the Content Browser settings, then open Showcase/AI/Data in plugin content. DA_MovementBehavior_Attacker under Movement and DA_ActionSet_Attacker under ActionSets are the pair the showcase enemy fights with. Duplicate them into your own content and retune from there.


The rusher

Closes fast, refuses to be pushed off you, and never stops to breathe.
Movement Behavior Profile
FieldValue
Desired Distance120
Distance Tolerance0.1
Crowd Tolerance0.8
Enable Strafe Restoff
The tight Distance Tolerance keeps it closing until it is on top of you. The high Crowd Tolerance stops it giving ground when you walk in. Enable Strafe Rest off removes the pause a circling enemy otherwise takes every 10 seconds.
Action Set
Action IDDistance Scorer RangeCooldown DurationSelection Weight
Lunge250 / 350 / 550 / 80011.5
Slash0 / 60 / 160 / 2601.51.0
Grab0 / 0 / 90 / 14061.0
Add a Chain Link on Lunge naming Slash with Bonus Multiplier 2.0, so the gap-closer flows into the follow-up.
On the Enemy AI Config, under Combat Role, set Preferred Role to SEC.Role.Attacker. The assignment pass scores every enemy for every role, by distance to the target out of the box, and a matching Preferred Role adds a small bonus on top, enough to settle a near-tie rather than reserve the slot. The rusher earns Attacker by closing first. Leave the Recovery fields at 0; anything above that puts a gap between its moves.

The duellist

Holds a longer range, answers a telegraphed swing with a parry, and leaves a beat between its own attacks.
Movement Behavior Profile
FieldValue
Desired Distance350
Distance Tolerance0.2
Crowd Tolerance0.3
The low Crowd Tolerance makes it give ground sooner than most, so it keeps the space its parry needs.
Reaction Set
  1. Add a reaction with Reaction ID Parry, pointing at your parry montage.
  2. Add a trigger rule with On Stimulus SEC.Stimulus.AttackTelegraphed, Chance 0.4, and Min Interval 2.
  3. Under the rule's Conditions, add an Incoming Angle Gate with Half Angle Degrees 60, so a blow from behind goes unparried.
  4. Wire the rule to the reaction: add an entry to the rule's Reaction Links with Reaction ID Parry. In the Reaction Set editor the same link is the arrow drawn from the rule card to the Parry card.
  5. Put your unblockable tag in the rule's Block Context Tags so heavy attacks land.
  6. Point the Enemy AI Config at the asset under Default Reaction Set. See Reaction System.
Action Set
Action IDDistance Scorer RangeCooldown DurationSelection Weight
Counter0 / 100 / 250 / 40051.0
Poke0 / 150 / 300 / 4502.51.0
Under Tag Score Multipliers on Counter, add SEC.State.Staggered with a value of 2.5. Multipliers read tags on the enemy, on its target and on the world, so the counter is worth two and a half times as much while the player is reeling.
Set Action Recovery Time to 0.8 under Recovery on the Enemy AI Config. The duellist keeps strafing and parrying through that window and starts no new attack, which is what turns a pressure enemy into one you can read.
A parry needs something to parry. Add the SEC Attack Telegraph notify to the player's attack montage where the wind-up starts, or nothing reaches the enemy and the rule never runs. See Attack Telegraphs.

The flanker

Circles for your side instead of standing in front of you, and works as the second enemy in a pack.
Movement Behavior Profile
FieldValue
Desired Distance300
Distance Tolerance0.2
Crowd Tolerance0.45
Under Positioning Rules, add an Angle Preference Rule:
FieldValue
Preferred Angle90
Angle Tolerance30
Direction Commitment45
Weight1.0
The angle is measured from the target's facing, and it is unsigned, so 90 means either flank and the enemy settles on whichever it reaches first. Use 180 for one that wants your back, 0 for one that insists on your face. Direction Commitment stops it flip-flopping between the two ways round while it is roughly equidistant.
Action Set: the grunt's three actions work as they are. What makes this a flanker is where it stands.
Enemy AI Config: add an entry to Role Movement Profiles naming SEC.Role.Flanker and this profile, and leave Default Movement Profile pointing at the grunt's. One enemy then circles while it holds the Flanker role and fights straight when the pass moves it to Attacker. Two Flanker slots ship per target. See Combat Roles.

The archer

Holds the back line, shoots, and steps away when you reach it.
Movement Behavior Profile
FieldValue
Desired Distance600
Distance Tolerance0.2
Crowd Tolerance0.45
Keep Desired Distance under 700. The enemy hands over to the pathfinding layer past 800 cm and takes direct input back only inside 700, so a range set between the two walks it in instead of holding it out. Distance Tolerance stretches the far side of the comfortable band, 0.2 out to 120 percent of Desired Distance, so leave room for that too.
Action Set
Action IDDistance Scorer RangeCooldown DurationSelection Weight
Shoot300 / 500 / 1000 / 180031.0
Kite0 / 0 / 250 / 40042.0
Tick Require Line Of Sight on Shoot so it holds fire through a pillar. Add a Combat Token Gate with Token Tag SEC.Token.Ranged, which caps how many archers fire at the same target at once, two out of the box. See Combat Tokens.
Kite is the panic button: it peaks at point blank and carries twice the weight of the shot. A backstep montage covers it. For a longer retreat, author a behavior tree around the Make Distance task and point a Behavior Tree Sequence execution method at that asset. Its list holds behavior tree assets, and the showcase ships none built around that task.
Enemy AI Config: set Allowed Roles (empty = any) to SEC.Role.Waiter and SEC.Role.Supporter. The assignment pass then never sends the archer to the front, whoever else is on the field.

The guard

Walks a route, notices you on its own, fights inside its ground, and goes home when you run.
  1. Drag a SEC Territory Post into the level for each stop on the route. One post is a guard station; three are a patrol.
  2. Select the placed enemy. On its SEC Territory component, add the posts to Posts in walking order, set Resting Behavior to Patrol Posts and Post Order to Sequential Loop.
  3. Tick Leash Enabled, set Leash Radius to 2000, and leave Leash Anchor on Self.
  4. On the Enemy AI Config, fill in Awareness Config and set Target Selector to Awareness Filtered Target Selector. Both are needed: the filter offers only what this enemy has perceived, and the config is what does the perceiving.
  5. Leave Default State Tree empty so the built-in brain runs the patrol, or point it at a StateTree carrying the territory tasks.
Any movement profile and action set work here. The grunt's numbers are a fine fight to come home from.
Only Fight Inside Leash ships on, so the guard ignores a target standing beyond its ring and engages the moment one steps inside. Turn it off for a guard that charges anything it notices and gets dragged home by the leash instead. See Territory & Patrols and Awareness.

The boss

One enemy the rest of the pack works around, with a second moveset for the back half of the fight.
Movement Behavior Profile: the grunt's numbers with Desired Distance at 300, which keeps a large pawn at the reach of its own weapon rather than inside your camera.
Enemy AI Config, under Combat Role:
FieldValue
Allowed Roles (empty = any)SEC.Role.Elite
Priority200
Ignore Target Redistributionon
Elite slots are unlimited out of the box, so the boss keeps its role whatever else joins. Priority 200 gives it first pick, and Ignore Target Redistribution pins it to the player it started on while the adds shuffle around.
Phase one Action Set: whatever the fight opens with, plus one action with Selection set to Manual Only, PhaseSlam for instance. A manual-only action never wins a poll and waits for a Blueprint to call Execute Action with its Action ID, so a scripted beat lands on your cue rather than the scorer's.
The phase swap, in the boss Blueprint at the health threshold you pick:
  1. Call Set Runtime Override on the pawn's SEC Action Set Component, passing the phase-two Action Set. That beats every other source, the config and any weapon included.
  2. Call Add World Tag with SEC.World.Boss.Phase2.
  3. Under Tag Score Multipliers on each phase-two opener, add that tag with a value of 2.0. Give a move that should retire an entry of 0 on the same tag, which drops it out of the running entirely.
Clear Runtime Override puts the config's set back, so a scripted retreat can hand the boss its opening moveset again.

Turn one number into a different enemy

What you seeWhat to change
It closes all the way inRaise Distance Tolerance on the profile
It backs off the moment you step toward itRaise Crowd Tolerance
It circles without a breakTick Enable Strafe Rest, and lower Strafe Rest Time Limit
It swings from across the roomAdd a Distance Scorer to that action
It spams one moveSet Max Consecutive Uses to 2
The pack attacks in lockstepRaise Randomization (%) on each cooldown, and set Spawn Cooldown Chance
Three of them swing at onceAdd a Combat Token Gate to every attack
It presses with no gap to punishSet Action Recovery Time on the Enemy AI Config
Staring at it changes nothingTick Adjust Distance By Threat, with a Threat Detection component on the controller
It opens with its heaviest hitSet Initial Cooldown on that action

Debug it

SEC.Debug.All 1                  // Every overlay at once
SEC.Debug.Scoring 1              // What each action scored, highest first
SEC.Debug.Actions 1              // Cooldowns above each enemy
SEC.Debug.Movement 1             // Layer, strafe side and heading
SEC.Debug.Territory 1            // Posts, leash ring and route
SEC.Debug.Reactions 1            // Reaction list with priorities and cooldowns
SEC.Debug.LogActionDecisions 1   // Why each action scored what it did
SEC.Debug.LogReactions 1         // Which rule answered, and with what
SEC.Debug.WatchPawn <name> narrows every overlay to one enemy, which is what you want the moment two of these archetypes share a room. Run it with no argument to list the pawns it can watch.
AlternativeOne pawn that plays several of these
Rather than a Blueprint per archetype, give one enemy a different profile and moveset per combat role and let the assignment pass decide which it is at any moment.
On the Enemy AI Config, add entries to Role Movement Profiles, Role Action Sets and Role Reaction Sets:
RoleProfileAction Set
SEC.Role.Attackerthe grunt'sthe grunt's
SEC.Role.Flankerthe flanker'sthe grunt's
SEC.Role.Waiterthe archer'sthe archer's
Fill in Default Movement Profile and Default Action Set as well. An enemy holding a role you did not list, or holding none yet, takes the default; leave it empty and it gets nothing.
Three enemies on one Blueprint then read as three enemy types, and the pack rotates between them as the fight moves.
AdvancedStop a pack swinging all at once
Two caps stack, and they answer different questions.
Role Limits, in Project Settings, Plugins, Soulslike Enemy Combat, cap how many enemies hold a role per target. Attacker ships at 3, Flanker and Supporter at 2. Lower Attacker to 1 and only one enemy at a time takes the front-line profile and moveset.
A Combat Token Gate on each attack caps how many swing at the same moment, whatever role they hold. Add one with Token Tag SEC.Token.Attack to every offensive action in every set, and set Cost to 2 on a heavy so it occupies two slots and fewer enemies come in alongside it.
Roles change slowly and read as positioning. Tokens are claimed and released per swing and read as timing. Most fights want both. See Combat Roles and Combat Tokens.
AlternativeGive an archetype its own weapon instead
A weapon carries its own moveset, so arming an enemy changes what it is without touching its config. Set Weapon Action Set and Weapon Reaction Set on the weapon Blueprint, and while the enemy holds it those beat the config's role entries and defaults alike.
The same grunt with a bow fights the archer's fight, and drops back to its config's moveset when the bow leaves its hand. See Weapons.
AdvancedThe recipe reads wrong in play
  • The rusher will not lunge. A Combat Token Gate on the gap-closer holds it behind the pack while the pool is full. Take the gate off the opener and leave it on the swing that follows.
  • The archer strolls into melee. Desired Distance sits past 800, or its tolerance band reaches there, which hands it to the pathfinding layer; the layer gives way again only inside 700.
  • The flanker stands in front of you. The Angle Preference Rule reads the target's forward vector, so a target with no meaningful facing gives it nothing to orbit. Check Weight is above 0, and that the profile with the rule is the one the enemy's current role resolves to.
  • The guard patrols but never fights. Only Fight Inside Leash with a tight Leash Radius keeps it ignoring you. Widen the radius or untick the box.
  • The duellist never parries. No SEC Attack Telegraph notify on the incoming montage. SEC.Debug.Stimulus.Draw 1 shows whether anything is going out at all.
  • The boss keeps its phase-one moves. Set Runtime Override belongs on the pawn's SEC Action Set Component. Check the node's target pin holds that component rather than the controller.
  • Nothing in any recipe fires. No registered combat target. It logs nothing, and from the outside it looks the same as everything else on this list.