Vixen
c7401864
csharp
public sealed class AiSystem

Joins the entities that have an AiAgent to their memory and their blackboard, asks the governor who may think, and steps the ones it named.

Read the guide page for this →

As a system

Phase
Update
Writes
AiAgent

Remarks

One system for all three planners. A behaviour-tree step, a utility score and a GOAP plan's current action are three ways of arriving at one IAgentAction, so there is one join, one governor, one memory pool, one debug record and one place where an agent's delta is worked out. What the planners add is how the action index is chosen; everything around that is here.

The blackboard is a side table, not a component. An agent's board is a managed object with observer lists in it, which is not a thing that belongs in a column — and keeping it here is also what makes "one agent owns one blackboard" enforceable rather than merely stated. It is indexed by ScheduleIndex, which is the same number the governor schedules on, so an agent's data and its turn are one lookup apart.

Membership is a query, not a list. An entity that gains the component joins and one that loses it or is destroyed leaves, with nobody calling anything — NavigationSystem's arrangement, and for its reason. Departure is detected by absence, because an entity can leave a query by being destroyed, by having a component removed, or by moving to another world, and the ECS calls nobody about any of the three.

Runs in Update, before animation and before the transform pass, so that whatever an action writes this frame is resolved in the same frame.

Fields and properties (20)

  • public AgentActionRegistry Actions

    The actions its agents may run.

  • public BlackboardLayout Layout

    The shape of every agent's blackboard.

  • public AgentMemoryPool Memory

    Where per-agent state comes from.

  • public GoapDomainLibrary Domains

    The GOAP domains its agents may plan over, by index.

  • public GoapSettings Goap

    What bounds a GOAP search.

  • public int ResolvesPerStep

    How many GOAP resolves may run per step, across every domain.

  • public GoapTargetSensors? Targets

    Where a GOAP action happens, and where the agent asking is.

  • public IActionCostModel? Costs

    What a GOAP action costs to reach, or null for the straight-line model.

  • public IReplanPolicy ReplanPolicy

    When a GOAP agent thinks again.

  • public UtilitySetLibrary Sets

    The utility sets its agents may score, by index.

  • public BehaviorTreeLibrary Trees

    The trees its agents may run, by index.

  • public IAgentGovernor Governor

    Who gets to think. Replaceable, because who is worth a tick is a game's decision.

  • public SharedBlackboard? Shared

    The board this world's agents share, if they share one.

  • public AgentDebugRecorder Debug

    The last decisions, when it is turned on.

  • public AgentSchedule LastSchedule

    What the governor decided last step.

  • public long Steps

    How many steps this system has run, which is what a record is stamped with.

  • public SensorSet? Sensors

    The sensors its agents read the world through, when a game has any.

  • public AiBreakpoints? Breakpoints

    Node breakpoints, when a debugger has set any.

  • public int Population

    How many agents have joined.

  • public SystemAccess Access

Methods (8)

Used by (27)

  • AiDebugChannelVixen.Ai
  • AiDebugChannelTestsVixen.Ai.Tests
  • AiDiagnosisExitCriteriaTestsVixen.Ai.Tests
  • AiGameplayDebuggerVixen.Ai.Diagnostics
  • AiOverlaySystemVixen.Ai.Diagnostics
  • AiSchedulingTestsVixen.Ai.Tests
  • AiSnapshotTestsVixen.Ai.Tests
  • AiSnapshotsVixen.Ai
  • AiSystemTestsVixen.Ai.Tests
  • AiSystemTreeTestsVixen.Ai.Tests
  • BehaviorTreeDeterminismTestsVixen.Ai.Tests
  • BindingTestsVixen.Ai.Perception.Tests
  • FleetVixen.Ai.Tests
  • GoapAgentTestsVixen.Ai.Tests
  • LevelVixen.Ai.Nodes.Tests
  • OverlayFixtureVixen.Ai.Diagnostics.Tests
  • PatrolChaseGiveUpTestsVixen.Ai.Nodes.Tests
  • PerceptionNodeTestsVixen.Ai.Perception.Tests
  • PerceptionSystemVixen.Ai.Perception
  • SeamTestsVixen.Ai.Nodes.Tests
  • UtilityAgentTestsVixen.Ai.Tests
  • VillageVixen.Ai.Nodes.Tests
  • VillageSampleTestsVixen.Ai.Nodes.Tests
  • AgentDebugModelVixen.Editor.Ai
  • AgentFixtureVixen.Editor.AssetEditors.Tests
  • LiveAgentVixen.Editor.AssetEditors.Tests
  • LiveTreeCanvasTestsVixen.Editor.AssetEditors.Tests