Vixen
caa30e12
csharp
public sealed class PerceptionSystem

Works out what every listener can notice, as cheaply as the three bounds allow.

Read the guide page for this →

As a system

Phase
Update
Runs before
AiSystem

Remarks

The order of the tests is the design, and doc 37 § D15 makes all three mandatory rather than tuning: a StimuliGrid instead of a scan, a per-listener update rate with a random deviation, and distance-based rate reduction. Within a pass the cheapest test comes first — the filter, then the radius, then the cone, then the trace — because the last one is a raycast and everything above it exists to stop it happening.

Runs in Update and before AiSystem, so a behaviour tree steps on this frame's perception rather than last frame's. That matters more than it sounds: the two systems are the abort loop — a sense writes a key, the key has observers, and an observer interrupts a branch — and running them the other way round puts a frame of lag inside it.

⚠ A listener is not required to be an AiAgent. The blackboard binding is the only part that needs one, and it is skipped when Agents is unset or the entity has no agent — so a camera, a trap or a trigger can perceive without deciding.

Fields and properties (11)

  • public PerceptionLibrary Configs

    What its listeners sense with, by index.

  • public IPerceptionGovernor Governor

    How often each listener senses. Replaceable, because what an agent is worth is a game's decision.

  • public IOcclusionTester Occlusion

    What stops sight. OpenSightlines until a game hands it a physics world.

  • public Vector3? Focus

    Where the agents that matter are — usually the player.

  • public AiSystem? Agents

    Where the blackboards are, for Binding.

  • public bool BroadPhase

    Whether to use the StimuliGrid.

  • public float EventMemory

    How long an event stays available for a listener that has not sensed yet, in seconds.

  • public PerceptionStats LastStats

    What the last frame cost.

  • public int Population

    How many listeners have joined.

  • public float Clock

    The clock the stamps and ages are against, in seconds since the system started.

  • public SystemAccess Access

    What this system reads and writes.

Methods (8)

Used by (26)

  • AiGameplayDebuggerVixen.Ai.Diagnostics
  • BindingTestsVixen.Ai.Perception.Tests
  • EventSenseTestsVixen.Ai.Perception.Tests
  • FilterTestsVixen.Ai.Perception.Tests
  • FleetVixen.Ai.Perception.Tests
  • MakeNoiseTaskVixen.Ai.Perception
  • NearestPerceivedInputVixen.Ai.Perception
  • NearestPerceivedSensorVixen.Ai.Perception
  • NearestPerceivedServiceVixen.Ai.Perception
  • OverlayFixtureVixen.Ai.Diagnostics.Tests
  • PatrolChaseGiveUpTestsVixen.Ai.Nodes.Tests
  • PerceivedCountInputVixen.Ai.Perception
  • PerceivedCountSensorVixen.Ai.Perception
  • PerceivedTargetDecoratorVixen.Ai.Perception
  • PerceptionCostTestsVixen.Ai.Perception.Tests
  • PerceptionInputsVixen.Ai.Perception
  • PerceptionLayeringTestsVixen.Ai.Perception.Tests
  • PerceptionNodeTestsVixen.Ai.Perception.Tests
  • PerceptionNodesVixen.Ai.Perception
  • PerceptionSnapshotsVixen.Ai.Perception
  • ScheduleTestsVixen.Ai.Perception.Tests
  • SeamTestsVixen.Ai.Nodes.Tests
  • SightOcclusionTestsVixen.Ai.Perception.Tests
  • SightTestsVixen.Ai.Perception.Tests
  • VillageVixen.Ai.Nodes.Tests
  • VillageSampleTestsVixen.Ai.Nodes.Tests