Patrol / Chase
Two goals, four anti-flap configurations. Watch flap appear and disappear with each toggle. Drop-in C++ actor.
[ Example ]
Patrol / Chase — anti-flap A/B
AIntentForgePatrolChaseExample is the framework's showcase for the five-layer Anti-Flap Toolkit. An agent oscillates between Patrol and Chase based on player distance. Without anti-flap protection it visibly stutters every time the distance crosses the trigger threshold. This is the example that converts skeptics: the framework's core differentiator turned on and off in real-time.
The four toggle configurations
Each toggle maps to a distinct anti-flap configuration. Walk through all four and watch flap disappear layer-by-layer.
bEnableFactFiltering | bEnableLatchedBool | What it demonstrates |
|---|---|---|
false | false | No anti-flap (baseline) — direct PlayerNear from raw distance. Flaps visibly near the threshold. |
true | false | Family 4 only — EMA filter smooths distance; threshold still on raw output. |
false | true | Family 2 only — Schmitt latch on the raw distance; hysteresis band prevents flap. |
true | true | Families 2 + 4 — filter feeds latch; the recommended default. |
How to use it
false and set Goal Momentum Bonus to 0 for the cleanest baseline.NearThreshold default = 500u). You'll see the agent flap between Patrol and Chase every replan.Goal Momentum Bonus = 0.15 (Family 1, selection layer). Replay. Flap reduces.bEnableLatchedBool = true (Family 2). Replay. Flap essentially disappears — the Schmitt band absorbs the noise.bEnableFactFiltering = true (Family 4). The filtered value now feeds the latch — combined treatment.Which families are demonstrated
- Goal Momentum Bonus → Family 1 (score-domain biasing). Lives in the planner's goal scoring pass.
- Latched Bool → Family 2 (latched fact derivation). Lives in
FWorldState::SetScalar, runs on the way into the world state. - Fact Filtering → Family 4 (signal smoothing). EMA filter, also in the fact-derivation layer.
Family 3 (commit time floor) and Family 5 (structural plan reuse) are also live but harder to A/B in a single actor without a more elaborate scenario.
Where to find the source
| File | Path |
|---|---|
| Header | IntentForgeExamples/Public/PatrolChase/AIntentForgePatrolChaseExample.h |
| Implementation | IntentForgeExamples/Private/PatrolChase/AIntentForgePatrolChaseExample.cpp |
The implementation also ships a tiny UPatrolChaseBoolConsideration (goal
scoring) and UPatrolChaseDistanceSensor (custom sensor) — good references
for Cookbook recipes 20 and 21.
Try this next
The research-paper explanation of every layer you just toggled.
Three goals + interruption /Companion AIFollow / Help / Retreat with a Critical interruption on top of the anti-flap stack.
Production shape /GuardThe most production-shaped use of these toggles in combination.