Skip to main content
Version: Next (dev)

AI Agent and Archetype

The AI Agent component (plAiAgentComponent) turns an object into a utility AI agent. Its AI Archetype asset supplies behaviors, blackboard defaults, team, and perception tuning.

Set up an agent

  1. Create the behavior assets the character needs.
  2. Create an AI Archetype asset and use + Add Behavior to add them. Start with one simple idle behavior before adding navigation or combat.
  3. Add AI Agent to the character and assign the archetype.
  4. Add AI Navigation on the same owner if the behavior moves it.
  5. Add sensor components for sight and markers to detectable targets.
  6. Simulate with the agent's DebugInfo enabled. Verify behavior selection before adding animation or interaction logic.

An AI Agent component does not supply a character mesh, animation graph, weapon, or character controller. Add those to suit the selected behavior and movement mode.

Archetype editor

The editor groups its Behavior stack by the category declared in each behavior asset. Select a row to inspect its considerations in Perception & Peek; open the referenced behavior to edit those considerations.

AI Archetype editor showing combat, investigate, patrol, and idle behavior groups alongside a target-confidence preview

This archetype combines a behavior stack with team, sensor-object, and blackboard-template settings. The right-hand preview illustrates confidence gain, decay after losing sight, and target memory. The displayed values belong to this example; click the image to read them at full resolution.

PropertyPurpose
BehaviorsBehavior references, each with a WeightScale.
BlackboardTemplateDefaults for the agent's blackboard.
TeamDefault team, unless overridden on the component.
SensorObjectNameNamed descendant carrying the sensor to read. Empty uses the owner and its immediate children.
ConfidenceGainPerSecondHow quickly sight builds confidence.
ConfidenceDecayPerSecondHow quickly confidence decreases without new observations.
TargetMemoryDurationHow long a target may be remembered after its last stimulus.

The perception graph helps explain confidence gain and decay; it is an authoring preview rather than a live sensor display. A row's weight scale changes utility within the behavior's category, not its priority band.

Component properties

  • Archetype: the AI Archetype asset.
  • Team: an optional override of the archetype team.
  • SquadId: a nonempty identifier shared by cooperating agents; see squads.
  • DebugInfo: show this agent's score and history information.

The agent uses a blackboard found through the owner hierarchy, or creates a private one. When animation or gameplay components must share AI values, provide a Blackboard component that those components can find. A private AI board is not a replacement for that shared setup.

Perception and teams

Sensors provide visible targets. The agent keeps last-known position, velocity, confidence, and last-stimulus time, so losing sight does not necessarily erase a target immediately.

The perception system also accepts Sight, Sound, Damage, and Custom stimuli. Gameplay can submit plAiStimulus through plAiPerceptionWorldModule::PostStimulus, specifying the source, world position, radius, strength, and source team. plMsgAiStimulus is forwarded by an AI Agent component, using that agent as the stimulus source; sending it to an arbitrary object without a handler does not broadcast a noise.

Faction relations are defined through plAiFactionConfig, stored at RuntimeConfigs/AiFactionConfig.cfg. The current AI settings dialog has no faction-authoring tab. Equal nonempty teams are friendly; unknown pairs default to hostile. Configure team relationships deliberately when building perception behavior.

Update distance and performance

Add AI LOD Center (plAiLodCenterComponent) to the player or another point of interest to determine distance-based update tiers. Agent decisions are scheduled centrally rather than all evaluated on every frame.

The default distance bands are Hot below 25 m, Warm below 60 m, then Cold. Default decision rates are 5, 2, and 0.5 Hz respectively. Use AI.Agents.Lod.*, AI.Agents.DecisionHz, and AI.Agents.MaxDecisionsPerFrame to tune these budgets. Check debugging before increasing update rates to solve an apparent delay.

See also