Tutorial 08 - Perception-driven tactical AI
TL;DR: Add an LCM Nav3D AI Perception
Bridge next to your agent's UAIPerceptionComponent
→ its perceived threats auto-feed the LCM Nav3D | Threats From
AI Perception EQS context → a true-3D LCM Nav3D EQS query
(volumetric candidate points + 3D-LOS / cover / threat-exposure tests)
picks a flanking or cover position → your BT/StateTree moves the agent
there. Mass crowds get the same via the LCM Nav3D Mass
Perception Agent trait, which writes a perceived-threats
fragment.
Why this exists
Stock UE tactical AI flows through EQS, but the stock generators/tests are 2.5D (navmesh-projected). A flying or multi-level NPC can't reason about cover, line-of-sight, or flanking in true 3D with them. LCM Nav3D ships true-3D EQS - candidate points anywhere in the navigable volume, scored by volumetric SVO line-of-sight, cover, and threat exposure - and a one-click bridge so the threats those tests score against come straight from UE's own perception system.
Prerequisites
- LCMNav3D plugin enabled, an
ALcmNavigationManagerSVOwith a built SVO in the level. - An AI agent with an
AAIControllerand aUAIPerceptionComponentconfigured with an AISense_Sight config (the standard UE setup - LCM Nav3D doesn't change this). - Threats set up so perception can sense them (registered stimuli source / pawns on a hostile team), per your normal UE perception configuration.
Part A - UActor agent (BT / StateTree)
Step 1 - Add the perception bridge
On your agent (the pawn or its controller - wherever the
UAIPerceptionComponent lives), Add Component → "LCM
Nav3D AI Perception Bridge"
(ULcmAIPerceptionBridge).
- It auto-finds the owner's
UAIPerceptionComponenton BeginPlay and subscribes toOnTargetPerceptionUpdated. DecayWindowSeconds(default5) - how long a lost-sight threat stays queryable before it fades. Tune to taste.- No other wiring: successfully-sensed actors are tracked; lost ones decay out.
That's the entire perception-to-LCM Nav3D link.
Step 2 - Build the tactical EQS query
Create an EQS query (e.g. EQS_FindFlankingApproach) and
assemble it from these nodes:
Generator (pick one):
| Node | Use it for |
|---|---|
| LCM Nav3D | Points In SVO Volume | general 3D candidate cloud around the agent |
| LCM Nav3D | Hemispherical Ring 3D | sniper-perch / high-ground / orbit candidates (set Upper Hemisphere Only) |
| LCM Nav3D | Points Along Path | candidates strung along the LCM Nav3D path to a goal |
Tests (add several; set each one's Context to LCM Nav3D | Threats From AI Perception where it scores against threats):
| Node | Purpose | Typical setup |
|---|---|---|
| LCM Nav3D | Threat Exposure | prefer low summed danger toward threats | Score, prefer less |
| LCM Nav3D | Cover Score 3D | prefer positions occluded from threats | Score, prefer greater |
| LCM Nav3D | Line Of Sight 3D | filter to (or away from) visible-to-threat | Filter |
| LCM Nav3D | Reachability 3D | drop positions the agent can't path to | Filter (Context = Querier) |
| LCM Nav3D | Path Distance 3D | prefer near / far by LCM Nav3D path length | Score (Context = Querier) |
| LCM Nav3D | Height Advantage | favour high ground over threats | Score, prefer greater |
A solid "flank to cover" query: Points In SVO Volume → Reachability 3D (filter) → Cover Score 3D (score↑) → Threat Exposure (score↓) → Path Distance 3D (score↓, mild weight).
The threats every threat-scoring test sees come from the bridge via LCM Nav3D | Threats From AI Perception - no manual tagging. (For non-perception workflows, LCM Nav3D | Known Threats returns actors tagged
ApexThreatinstead.)
Step 3 - Wire it into BT or StateTree, then verify
- Behavior Tree: add a
Run EQS Queryservice/task that runs your query and writes the resultVector/Actorto the blackboard, then aMoveTo(or an LCM Nav3DFlyTo) to that key. - StateTree: run the query from a task that stores the chosen location, then transition into your LCM Nav3D move task (see Tutorial 05).
Verify in PIE: the agent should pick positions that are reachable, in cover from, and low-exposure toward the threats it currently perceives - and should stop reacting to a threat ~5 s after losing sight of it (the decay window). Walk a threat out of the sight cone and watch the chosen position shift once it decays.
Part B - Mass crowd variant
For crowd-scale tactical perception, use the native LCM Nav3D Mass perception (Tutorial 06 covers Mass setup):
- Add the LCM Nav3D Mass Perception Agent trait
(
ULcmMassPerceptionTrait) to your Mass entity config - setFactionId,SightRadius,FOVDegrees. Agents perceive different-faction agents within range + FOV + true-3D SVO line of sight. - The
ULcmMassPerceptionProcessorwrites each agent's closest visible hostile into itsFLcmMassPerceivedThreatsFragment(ClosestThreatPos,bHasThreat,VisibleCount,LastSeenSeconds). - Read that fragment in your Mass logic (a StateTree task via
UMassStateTreeProcessor, a steering processor, etc.) to drive evade / engage / regroup behaviour.
Mass agents consume the perceived-threats fragment
directly - they don't issue EQS queries (there is no
Mass-native EQS querier). EQS tactical queries are the UActor path (Part
A). A hero-NPC-as-UActor querying with Apex: Known Threats
can include crowd-relevant threats by tagging, giving a practical
hybrid.
What you build by hand
The nodes above are all shipped and usable. What is not shipped is prebuilt query assets - you author your own from the generators and tests, which Tutorial 07 walks through end to end.
Four nodes need live flow-field or macro-graph state and are not available: the flow-field-directed generator, the flow-field-alignment test, the active-flow-field context, and the portal-proximity generator.
Related
- Tutorial 04 - StateTree, the move-task side of step 3.
- Tutorial 06 - Mass Entity, for the Part B agent setup.
- Tutorial 07 - Tactical EQS, authoring queries from these nodes.
ULcmTacticalQueryLibrary- the Blueprint tactical primitives (Is Segment LOS Clear,Find Best Cover, ...) the EQS tests wrap.