Lesson 8 gave you player-authored pressure on AI. This lesson answers what the mission is actually asking for: primary and secondary goals, soft failure that still moves time forward, and checkpoints that respect your Lesson 1 fantasy (non-lethal vs lethal, alarm rules, detection tolerance).

Lesson objective
By the end of this lesson you will have:
- A single authority (Blueprint actor or subsystem) that tracks mission state (not scattered booleans on every pickup).
- At least one primary objective and one optional secondary that can complete or fail without instantly ending the run—unless Lesson 1 says otherwise.
- Checkpoint logic that respawns the player (or rewinds soft state) at a designed point when they cross a volume or trigger a rest.
Step 1: Name states before Blueprints
Align with what you wrote in Lesson 1:
| State | Player-readable meaning |
|---|---|
| Intro | Tutorial gates, no fail-forward yet |
| Active | Primary goal in progress |
| OptionalOpen | Secondary available, skippable |
| Setback | Detected or alarmed—mission continues with penalty |
| Failed | Hard fail (only if your pillar demands it) |
| Complete | Slice win—ready for outro or menu |
If any detection is supposed to fail-forward into a harder route, encode that as Setback plus a branch (new patrol density, lights on), not as instant Failed.
Step 2: Objective manager actor
Create BP_MissionDirector (or BP_ObjectiveManager) placed once per map:
- Variables:
PrimaryObjectiveId(name or enum),bPrimaryComplete,SecondaryId,bSecondaryComplete,bSecondaryFailedSoftly,MissionPhase(byte/enum). - Functions:
RegisterPrimaryComplete,RegisterSecondaryComplete,ApplySetback,TriggerHardFail,TriggerMissionComplete. - No direct UI here—that is Lesson 10—but do call custom events or dispatchers (
OnObjectiveChanged,OnCheckpointActivated) the HUD will bind to later.
Pro tip: log phase transitions to the Output Log during playtests; ambiguous state bugs show up as “it felt done but nothing fired.”
Step 3: Primary goal with a clear spatial win
Pick one readable win for the slice:
- Reach an extraction volume
- Interact with a terminal for N seconds
- Acquire a key item and deliver it to a drop-off
Implementation sketch:
- Add a Box Collision
BP_PrimaryGoalVolumewith OnComponentBeginOverlap → cast to player → callMissionDirector.RegisterPrimaryComplete. - Guard the call: only accept overlap if
MissionPhase == Activeand any prerequisite flags you need (door unlocked, alarm not tripped—your design). - On success, optionally open a exit door or fade to a win map.
Step 4: Secondary objective (optional but teachable)
Secondaries reward explorers without blocking the main arc:
- Non-lethal takedown count, read all lore tablets, steal an optional macguffin.
- Track with counters or GameplayTags on the director.
- If the player fails the secondary (alarm locks the vault), mark
bSecondaryFailedSoftlyand mute related VO prompts—avoid dead-end UI later.
Step 5: Checkpoints that are fair
Checkpoint = saved transform, mission snapshot, and minimal world flags.
- Place
BP_CheckpointVolumeactors at natural beats (after first guard line, after gadget tutorial). - On overlap, call
MissionDirector.SaveCheckpoint(Index)storing player location/rotation and copy of critical bools (which doors unlocked, which guards permanently alerted if you allow that). - On soft reset (player chooses retry, or you auto-respawn on non-hard-fail), teleport pawn and restore flags.
Common mistake: checkpoint fires during combat and saves a guaranteed death spawn—debounce with a short cooldown or require out of combat (Blackboard Engaged false).
Step 6: Fail-forward vs hard fail
- Fail-forward: raise alert tier, lock secondary, add patrol injectors, but keep primary viable.
- Hard fail: use only for lethal fantasy, time limit blow, or story mandate from Lesson 1.
Expose TriggerHardFail as a single path (alarm console, death without retry) so QA can trace why the run ended.
Step 7: Level flow sanity pass
- Speedrun primary only—must finish under your target minute count.
- Ignore secondary—primary must still complete.
- Trip every checkpoint twice (forward and backward overlap).
- Die or trigger setback once—confirm respawn does not duplicate interactables or break AI authority.
Mini challenge
- Add one secondary that auto-fails if the player is Engaged for more than 15 seconds cumulative—teaches timers without a full scoring system.
- Document in a one-page design note: which states allow manual checkpoint save vs auto only.
Troubleshooting
| Symptom | Likely cause | Fix |
|---|---|---|
| Objective completes twice | Overlap spam | One-shot gate or disable collision after fire |
| Checkpoint restores wrong door | Saved bool missing | Serialize door state in director snapshot |
| AI ignores post-respawn world | Pawn not repossessed | Re-run possess / AI refresh on teleport |
| Secondary never shows | Never registered | MissionDirector begin-play register |
Summary
- MissionDirector is the spine—objectives and checkpoints hang off it.
- Fail-forward is a state, not an accident.
- Checkpoints save meaningful progress, not every frame.
Further reading
- AI and Behavior Trees in Unreal – tie Setback to tree branches or blackboard tiers.
- Unreal Live Coding help – if you promote
MissionDirectorto C++ mid-slice.
FAQ
Use GameplayTags or enums?
Enums are fine for a class project; GameplayTags scale better for DLC-sized missions.
Multiplayer later?
Replicate mission phase and checkpoint index on the server; clients only predict cosmetic feedback.
Next: Lesson 10: UI and Player Feedback adds detection meter, objective prompts, and contrast—bound to the same MissionDirector you built here. Finish Lesson 9 first: setback and complete should both show in Output Log with no duplicate objective spam.