class

FResidentSystem

FResidentSystem — the brain of every Resident, stepped at a fixed 10 Hz so the same session and the same stimuli land on the same bits at any frame rate (the Attention meter's rule).

Module
AINavigation
Header
#include "AINavigation/ResidentSystem.h"
Namespace
Mowo

Perception is stimulus-driven and needs no line of sight. A sound, a voice or a scan pulse on the bus is heard when it lies within its reach after the room graph has taken its share (FSoundPropagation, or whatever SetPropagation installs); how well it was heard sets how far the Resident's alertness rises and how exact the position it believes is. The belief — the last place the crew was sensed — loses confidence with a half-life and is given up below the profile's floor.

Stage is the alertness stage, lifted to the floor the Attention meter's stage allows. A Dormant Resident stands; the others walk the NavAgent to the belief and, Searching or Hunting, visit points sampled around it that sound could still reach from the belief.

Only the authority (the host, or an offline game) simulates. It replicates each Resident's stage and belief to the clients at 4 Hz; a client only shows what it was sent.

Type aliases

AliasDescription
using FPropagationFn = std::function<float(const Vec3& from, const Vec3& to)>

Properties

TypeNameDescription
static constexpr uint16_tkNetEventIdDefault 0xFE50.
static constexpr floatkStepSecondsDefault 0.1f.
static constexpr floatkSendSecondsDefault 0.25f.
static constexpr floatkScanHitRadiusDefault 0.9f.
static constexpr floatkScanHitHeightDefault 0.9f.

Constructors

SignatureNameDescription
FResidentSystem()FResidentSystem
~FResidentSystem() override~FResidentSystem
FResidentSystem(const FResidentSystem&) = deleteFResidentSystem

Public functions

ReturnsNameDescription
FResidentSystem&operator=
SystemPhaseGetPhase
boolDeclaresComponentAccess
ComponentMaskGetReadMask
ComponentMaskGetWriteMask
voidUpdate
voidSetStimulusBusThe bus Residents hear from; unset, the world's AIPerceptionSystem bus.
voidSetPropagationGain (0..1) a sound keeps travelling between two points; unset, the world's room and portal graph.
voidSetDefaultProfile
voidSetSessionSeedThe session seed every Resident's stream derives from; unset, the process seed (--seed=N pins it).
uint32_tGetSessionSeed
floatHearHears one stimulus as resident would from where it stands.
FScanResponseReactToScanA scan pulse struck the Resident (the S3 reaction table row): alarms it toward scannerPosition and returns the response the scan should apply to the points the Resident returns.
uint32_tReactToScanHitsThe scan service's hook: every Resident standing where a shot's rays landed reacts once.
voidInstallScanResponseFiles the Resident's response as an instance rule, so the scan service resolves it with every other rule.
voidRaiseAlertnessLifts alertness directly — a designer's or a script's push.
boolIsAuthority
int32_tGetStage
const std::vector<Vec3>*GetSearchPoints
TMulticastDelegate<EntityID, int32_t, int32_t>&OnStageChangedFired on the authority as it happens, on a client as replicated state arrives.
TMulticastDelegate<EntityID, int32_t, Vec3, float>&OnStimulusHeard
TMulticastDelegate<EntityID>&OnTargetLost
uint32_tGetEventSerialMonotone counters and the last event's kind for Visual Scripting, which polls rather than binds: 1 stage, 2 heard, 3 lost.
int32_tGetLastEventKind
EntityIDGetLastEventResident
voidDebugDrawResidents

Function details

FResidentSystem

C++
FResidentSystem()

~FResidentSystem

C++
~FResidentSystem() override

FResidentSystem

C++
FResidentSystem(const FResidentSystem&) = delete

operator=

C++
FResidentSystem& operator=(const FResidentSystem&) = delete

GetPhase

C++
SystemPhase GetPhase() const override

DeclaresComponentAccess

C++
bool DeclaresComponentAccess() const override

GetReadMask

C++
ComponentMask GetReadMask() const override

GetWriteMask

C++
ComponentMask GetWriteMask() const override

Update

C++
void Update(float deltaTime) override

SetStimulusBus

C++
void SetStimulusBus(const FAIStimulusBus* bus)

The bus Residents hear from; unset, the world's AIPerceptionSystem bus.

SetPropagation

C++
void SetPropagation(FPropagationFn propagation)

Gain (0..1) a sound keeps travelling between two points; unset, the world's room and portal graph.

SetDefaultProfile

C++
void SetDefaultProfile(const FResidentProfile& profile)

SetSessionSeed

C++
void SetSessionSeed(uint32_t seed)

The session seed every Resident's stream derives from; unset, the process seed (--seed=N pins it).

GetSessionSeed

C++
uint32_t GetSessionSeed() const

Hear

C++
float Hear(EntityID resident, const FAIStimulus& stimulus)

Hears one stimulus as resident would from where it stands. Returns how well it was heard, 0..1, 0 when it was out of reach.

ReactToScan

C++
FScanResponse ReactToScan(EntityID resident, const Vec3& scannerPosition, float shotRange = 0.0f)

A scan pulse struck the Resident (the S3 reaction table row): alarms it toward scannerPosition and returns the response the scan should apply to the points the Resident returns. shotRange (the scanner's range, 0 = unknown) scales the alarm by how near the Resident stood: a hit at the edge of the beam is a faint ping, one at the scanner's feet is a scream.

ReactToScanHits

C++
uint32_t ReactToScanHits(const Vec3& scannerPosition, float shotRange, const Vec3* hitPositions, uint32_t hitCount)

The scan service's hook: every Resident standing where a shot's rays landed reacts once. Returns how many did. Authority only.

InstallScanResponse

C++
void InstallScanResponse(FScanResponseTable& table, EntityID resident)

Files the Resident's response as an instance rule, so the scan service resolves it with every other rule.

RaiseAlertness

C++
void RaiseAlertness(EntityID resident, float amount)

Lifts alertness directly — a designer's or a script's push.

IsAuthority

C++
bool IsAuthority() const

GetStage

C++
int32_t GetStage(EntityID resident) const

GetSearchPoints

C++
const std::vector<Vec3>* GetSearchPoints(EntityID resident) const

OnStageChanged

C++
TMulticastDelegate<EntityID, int32_t, int32_t>& OnStageChanged()

Fired on the authority as it happens, on a client as replicated state arrives. Stage: resident, old, new. Heard: resident, stimulus type, position, how well. Lost: resident.

OnStimulusHeard

C++
TMulticastDelegate<EntityID, int32_t, Vec3, float>& OnStimulusHeard()

OnTargetLost

C++
TMulticastDelegate<EntityID>& OnTargetLost()

GetEventSerial

C++
uint32_t GetEventSerial() const

Monotone counters and the last event's kind for Visual Scripting, which polls rather than binds: 1 stage, 2 heard, 3 lost.

GetLastEventKind

C++
int32_t GetLastEventKind() const

GetLastEventResident

C++
EntityID GetLastEventResident() const

DebugDrawResidents

C++
static void DebugDrawResidents(World* world)
Generated from AINavigation/ResidentSystem.h via ainavigation.json · Dec 5, 2026Version 1.1.0