Vixen
caa30e12
csharp
public sealed class AgentActionRegistry

Every action a world's agents can run, by index, with the memory each one needs.

Read the guide page for this →

Remarks

A compiled asset names an action by index, not by type. A behaviour tree's task node, a utility set's row and a GOAP action all resolve to a UInt16 here at load, which is what keeps a node sixteen bytes and a dispatch an array index rather than a dictionary lookup on a string.

⚠ The state size belongs to the registration, not to the action. An action object is shared by every agent running it, so the only thing that can safely say how much room one costs is the table that hands the rooms out. Registering the same action twice with different sizes is legal and occasionally useful — the same Wait with and without a recorded start time — and each registration is its own index.

Built once, at load, and read-only afterwards: a registry that could grow during a frame would be a table an agent's index could outlive.

Fields and properties (3)

  • public int Count

    How many actions are registered.

  • public int MaximumStateSize

    The largest state any registered action asks for.

  • public IAgentAction this[ushort index]

    The action at an index.

Methods (5)

  • public ushort Register(string name, IAgentAction action, int stateSize = 0)

    Adds an action.

  • public ushort Register(Symbol name, IAgentAction action, int stateSize = 0)

    Adds an action under a name that is already interned.

  • public bool TryGetIndex(Symbol name, out ushort index)

    Looks an action up by name.

  • public int StateSize(ushort index)

    How much memory an action needs.

  • public Symbol NameOf(ushort index)

    What an action is called.

Used by (35)

  • AgentActionRegistryTestsVixen.Ai.Tests
  • AgentContextVixen.Ai
  • AiDebugChannelTestsVixen.Ai.Tests
  • AiDiagnosisExitCriteriaTestsVixen.Ai.Tests
  • AiSchedulingTestsVixen.Ai.Tests
  • AiSnapshotTestsVixen.Ai.Tests
  • AiSnapshotsVixen.Ai
  • AiSystemVixen.Ai
  • AiSystemTestsVixen.Ai.Tests
  • AiSystemTreeTestsVixen.Ai.Tests
  • AuthorableNodeTestsVixen.Ai.Tests
  • BehaviorTreeAbortTestsVixen.Ai.Tests
  • BehaviorTreeCompilerVixen.Ai
  • BehaviorTreeCompilerTestsVixen.Ai.Tests
  • BehaviorTreeContentCompilerVixen.Ai
  • BehaviorTreeCostTestsVixen.Ai.Tests
  • BehaviorTreeDeterminismTestsVixen.Ai.Tests
  • BehaviorTreeResolverVixen.Ai
  • BehaviorTreeResolverReuseTestsVixen.Ai.Tests
  • BehaviorTreeServiceTestsVixen.Ai.Tests
  • BehaviorTreeTaskTestsVixen.Ai.Tests
  • BindingTestsVixen.Ai.Perception.Tests
  • BuildStateVixen.Ai
  • CompileStateVixen.Ai
  • FleetVixen.Ai.Tests
  • GoapAgentTestsVixen.Ai.Tests
  • OverlayFixtureVixen.Ai.Diagnostics.Tests
  • RunQueryNodeTestsVixen.Ai.Nodes.Tests
  • RunUtilitySetTaskVixen.Ai
  • SeamTestsVixen.Ai.Nodes.Tests
  • TreeHarnessVixen.Ai.Tests
  • UtilityAgentTestsVixen.Ai.Tests
  • VillageVixen.Ai.Nodes.Tests
  • AgentFixtureVixen.Editor.AssetEditors.Tests
  • LiveAgentVixen.Editor.AssetEditors.Tests