Tactical Enemy Movement: Strafing, Circling and Spacing
Documentation Unreal Engine AI Tutorial Movement Strafing
Make enemies strafe, circle the player and keep their distance instead of walking straight at them in Unreal Engine 5, set up in Blueprint with no C++.
An enemy that holds a range, circles the player, gives ground when crowded and closes in when the player backs away. Soulslike Enemy Combat does this from one data asset and one number to start.
The problem
Give an Unreal Engine enemy a Behavior Tree with Move To on the player and it does one thing: it walks in a straight line until it is next to them. Once there it stands still, or it stacks on top of every other enemy doing the same. Nothing in that loop circles, backs off or keeps a gap.
The usual fixes each cover part of the problem:
- Set Focus with a strafe blendspace. The enemy keeps facing the player and your blendspace plays side-step animations. That fixes how the enemy looks while it moves. Something else still has to decide where it moves and when.
- EQS. An Environment Query can score points on a ring around the player. It answers where a good spot is. You still write the logic that picks a spot, walks there, re-queries as the player moves, switches sides, rests and gives ground when the player charges.
- Move To on a point you compute. This is the same job, done by hand every tick.
Tactical movement in a souls-like or action game needs all of it together: a preferred range, circling around that range, a retreat when the player pushes in, and a side swap now and then so the enemy does not orbit one way forever. Soulslike Enemy Combat ships that as a Movement Behavior Profile data asset. You pick the numbers, and the plugin steers the enemy by scoring 16 directions around it each tick.
You need an enemy that already runs on SEC. If you have none, Getting Started builds one in a few minutes.
Set it up
1 minute- 1
Create a Movement Behavior Profile
Right-click in the Content Browser, SEC, AI, Movement Behavior Profile.Content Browser▸ ContentRight-click in the Content Browser, SEC, AI, Movement Behavior Profile. - 2
Set the range the enemy holds
Double-click the asset. Set Desired Distance to the range this enemy fights at, in centimeters.DA_Move_Attacker▾DistanceDesired Distance400.0Distance Tolerance0.2Crowd Tolerance0.45Desired Distance is the range. The two tolerances widen the band around it. - 3
Point the AI Config at it
Open the enemy's Enemy AI Config, and under Movement Profiles set Default Movement Profile to the asset. Leave Manage Movement Profiles Automatically ticked.EnemyConfig_Grunt▾Movement ProfilesManage Movement Profiles AutomaticallyDefault Movement ProfileNone▾Default Movement Profile covers every role, so one entry is enough to start. - 4
Play and watch it circle
Press Play and runSEC.Debug.Movement 1in the console. Each enemy gets a line above its head showing its movement layer, whether it is strafing and which way, and its heading.
An enemy only moves once it has something to fight. Movement reads the controller's focus actor, and nothing sets that until a combat target is registered. If the enemy stands still with everything above filled in, that is what is missing. See Targeting.
Shape the circling and the spacing
An enemy holds a band around Desired Distance. Inside the band it circles, closer than the near edge it gives ground, and past the far edge it closes in. The two tolerances set how wide each half of the band is.
Keep Desired Distance under 700 cm. Past that the enemy hands over to the pathfinding layer, where it walks toward the target and never circles.
The profile also sets how much the enemy prefers circling over closing in, whether it switches sides on its own, when it pauses for breath, and which angle it seeks (in front, on the flank, behind). Movement System lists each field.
Different behavior for different enemies
Add entries to Role Movement Profiles in the Enemy AI Config to give each combat role its own profile: an aggressive one for Attacker, a patient one for Waiter. A role you do not list falls back to Default Movement Profile, and the swap happens on its own when the role changes. The demo content ships
MovementProfile_SEC_Attacker through MovementProfile_SEC_Elite to start from.Roles also cap how many enemies press in at once. The Flanker role is the one that circles for an angle.
Leave no entry with an empty Movement Profile. An entry that names a role but no asset applies nothing, so the enemy keeps whatever the previous role gave it.
Common questions
Do I need EQS, Set Focus or Move To? No. The Movement Evaluator on the AI controller handles direction, range and side swaps. Past 800 cm it hands over to navmesh pathfinding by itself.
How do I make an enemy stop walking straight at the player? Set Desired Distance on its profile. The enemy closes to that range and circles there.
How do I make an enemy back off when the player gets close? Close range is the near half of the band, set by Crowd Tolerance. Inside it the enemy gives ground. Lower Crowd Tolerance for an enemy that insists on its space.
Can the player's stare change the movement? Yes. With a Threat Detection component on the controller, tick Swap Strafe on High Threat and Adjust Distance by Threat under Threat Response. Both ship off.
Can I drive the strafe with my own blendspace? Yes. Untick Apply Movement Input on the Movement Evaluator, then read Get Current Direction Angle or Get Current Direction Local each tick in your Anim Blueprint. See the root motion drawer on Movement System.
Do I need C++? No. Every step on this page is a data asset or a Blueprint value.
It moves, but it never circles. Check Desired Distance first (under 700 cm), then run
SEC.Debug.Movement 1. Movement System lists the other causes.Related
| Page | Why |
|---|---|
| Movement System | Every profile field, the Movement Evaluator settings, and the debug overlays |
| Combat Roles | Attackers, Waiters and Flankers, and a movement profile per role |
| Threat Detection | Make enemies swap sides or give ground under the player's stare |
| Enemies That Take Turns Attacking | One enemy swings while the rest circle and wait |