Examples

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.

DIFFICULTY ▮▮▯ INTERMEDIATESHIPS AS DROP-IN C++ ACTORBUILD ~5 MIN

The four toggle configurations

Each toggle maps to a distinct anti-flap configuration. Walk through all four and watch flap disappear layer-by-layer.

bEnableFactFilteringbEnableLatchedBoolWhat it demonstrates
falsefalseNo anti-flap (baseline) — direct PlayerNear from raw distance. Flaps visibly near the threshold.
truefalseFamily 4 only — EMA filter smooths distance; threshold still on raw output.
falsetrueFamily 2 only — Schmitt latch on the raw distance; hysteresis band prevents flap.
truetrueFamilies 2 + 4 — filter feeds latch; the recommended default.

How to use it

Drop an Intent Forge Patrol/Chase Example actor in a level.
Place a pawn (Editor → Pawn or PlayerStart) within ~1000 units.
In the actor's Details panel under Intent Forge | Anti-Flap, start with both toggles false and set Goal Momentum Bonus to 0 for the cleanest baseline.
Hit Play. Move the player (WASD) around the trigger threshold (NearThreshold default = 500u). You'll see the agent flap between Patrol and Chase every replan.
Stop, enable Goal Momentum Bonus = 0.15 (Family 1, selection layer). Replay. Flap reduces.
Stop, enable bEnableLatchedBool = true (Family 2). Replay. Flap essentially disappears — the Schmitt band absorbs the noise.
Stop, enable 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

FilePath
HeaderIntentForgeExamples/Public/PatrolChase/AIntentForgePatrolChaseExample.h
ImplementationIntentForgeExamples/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.

◢ Next

Try this next

On this page