Lesson 5 gave your guard eyes and ears plus alert storage. This lesson makes the body move on purpose: patrol paths that players can learn, interrupt, and exploit. You are still avoiding full combat trees—only locomotion, waits, and hand-offs to suspicion that Lesson 7 will deepen.

Course illustration - character scene study from Dribbble


Lesson objective

By the end of this lesson you will have:

  1. A Blackboard shared by your guard AI Controller with keys for patrol index, next location, alert level, and stimulus location (matching or extending Lesson 5).
  2. A Behavior Tree that runs a patrol loop (move to point, optional wait) and interrupts when perception raises alert above Calm.
  3. A schedule stub—either time-sliced shifts or a simple phase bool set from your mission flow—so two guards do not stack into the same choke by accident.

Step 1: Blackboard keys you actually need

Create BB_Guard (or equivalent) with minimum keys:

Key Type Role
AlertLevel Byte or Enum Mirrors E_AlertLevel from Lesson 5
StimulusLocation Vector Last heard or seen location
PatrolIndex Int Current waypoint index
PatrolPoints Array of Vector or Actor refs Route data (actors are easier to tweak in-level)
CurrentPatrolTarget Vector Blackboard goal for Move To

Pro tip: keep patrol data either as placed Target Points in the sublevel or as an array exposed on the guard instance so designers drag-order the loop without opening the tree.


Step 2: Author the patrol spine in the greybox

  1. Reopen L_Mission01_Greybox and place Target Points (or editor-only markers) where guards should pause: door thresholds, window lines, desk corners.
  2. Order them in a ring or ping-pong list; document which style you chose in your Lesson 1 notes.
  3. Confirm nav mesh covers every segment at capsule size—preview path failures before you blame the tree.

Common mistake: patrol points float above the floor; Move To succeeds technically but animation roots look drunk. Snap Z to floor or use Project Point to Navigation.


Step 3: Behavior Tree skeleton (patrol first, react second)

Root structure that scales for Lessons 7–8:

  1. Selector at root (fallback priority top to bottom).
  2. First child: placeholder branch for high alert combat or search—for today, a Wait or Move To stimulus stub you will flesh out in Lesson 7.
  3. Second child: patrol sequenceMove To CurrentPatrolTarget, optional Wait (random range in seconds for idle shuffles), then increment index modulo route length.

Interrupt pattern: wrap patrol in a Decorator or run a parallel with cooldown only if you must hear noise while moving—but for a slice, abort patrol subtree when AlertLevel rises above Calm.

Use Blackboard-Based Conditions on selectors so Aware always wins over patrol.


Step 4: Wire Move To tasks cleanly

  1. Before each Move To, copy PatrolPoints[PatrolIndex] into CurrentPatrolTarget (Blueprint task or quick composite).
  2. Set acceptance radius wide enough for nav rounding errors, tight enough that door waits read deliberate (~40–90 cm for humanoids, tune to capsule).
  3. On arrival, increment PatrolIndex; wrap with modulo against array length.

Stuck guards: if Move To fails three times, log and advance index anyway—silent AI freeze reads like a bug, not difficulty.


Step 5: Schedules without building a clock app

Pick one schedule model for the slice:

Model Implementation sketch
Phase flag Mission Blueprint sets NightShift bool when lights change; tree decorator swaps patrol arrays.
Staggered start delay On BeginPlay, random float InitialWait before first Move To so guards desync.
Hand-authored time windows Optional Timeline or lightweight curve on a manager actor that writes Blackboard keys at mileposts—only if Lesson 1 fantasy demands it.

Stealth readability improves when beats do not sync every 30 seconds. A 4–8 second offset between two guards on similar loops often beats clever math.


Step 6: Hook Lesson 5 perception into tree flow

  1. Ensure On Target Perception Updated still writes AlertLevel and StimulusLocation.
  2. When Aware, patrol subtree should abort; run Move To StimulusLocation (or look-at + move) as a stopgap until Lesson 7 formalizes search.
  3. When Suspicious, optional slow patrol or look around animation cue—if animation is out of scope, longer waits at nodes sell hesitation.

Mini challenge

  1. Build two patrol loops that cross once per minute at a risky intersection.
  2. Add one wait variance (random 1.5–3.0 s) on a single node only.
  3. Record a 30-second capture: players should predict when the cross happens after two laps.

Troubleshooting

Symptom Likely cause Fix
Guard ignores perception Tree priority or decorator missing Put alert branch above patrol
Spins at waypoint Acceptance radius too small Widen radius; check nav projection
Skips points Index not clamped or wrapped Fix modulo; log index each tick once
Both guards stack Identical schedules Stagger delays or split arrays
Move To never ends Target off nav Project point; move marker

Summary

  • Patrol is a contract with the player—rhythm, not noise.
  • Blackboards carry state; trees carry priority.
  • Lesson 5 signals must preempt walk loops or stealth feels rigged.

Further reading


FAQ

Do I need EQS for patrol?
Not for this slice. Place points deliberately first; EQS is for scaling variety later.

C++ vs Blueprint trees?
Blueprint trees are fine through Lesson 10. Refactor hot paths only if profiling demands it.

What if I use State Trees instead?
Same mental model—states, transitions, and data on a shared context. This course names Behavior Trees for widest tutorial overlap.


When patrols breathe and yield to hearing and sight, continue to Lesson 7: Suspicion to Combat State Machine—search windows, cooldowns, and combat-adjacent responses your mission fantasy allows. Bookmark this lesson once both guards complete a full loop without nav errors.