public struct AiAgentAn entity that decides what to do.
As a component
- Size
- 48 bytes — 273 rows in a 16 KB chunk, alone on the archetype
Remarks
⚠ A handle and a few numbers, and nothing else — that is the rule this component exists to keep. Everything an agent thinks with is in its memory block and its blackboard, both of which the system owns and neither of which is here. A component that grew a list, a template or a plan would be a component whose size depended on its content, which is the thing an archetype ECS cannot have; it would also be per-agent state living somewhere a thousand agents' worth of it has to be copied on every archetype change.
[Component] without [DataContract], deliberately. A scene cannot place one of these, because Memory and ScheduleIndex are the system's own bookkeeping and a saved copy of them would name a block that does not exist in the process that loads it. The scene-placeable form is the authored one — an asset reference and a planner kind — and it arrives with the behaviour-tree asset in P2.
Nothing here is [Replicated], and nothing ever will be. AI runs on the authority: a client planning from an interest-filtered, interpolated view of the world would reach different conclusions, and reconciling two planners is not a thing anybody has made work. What crosses the wire is what the agent's actions write — a destination, a move intent, an animation state — all of which are replicated by their own subsystems.
Fields and properties (11)
public AiPlanner PlannerWhat decides. None runs Action and nothing else.
public ushort ActionWhich action it runs, when nothing is choosing for it. An index into the world's AgentActionRegistry.
public ushort AssetWhich asset its planner runs. An index into the system's library for that planner.
public AgentMemoryHandle MemoryIts state for that action. Owned by AiSystem.
public int ScheduleIndexIts slot with the governor, and the index every tie breaks on. Owned by AiSystem.
public uint SeedIts random stream. Assigned from the entity on join, so a replay reproduces it.
public ActionStatus StatusHow the current action is getting on.
public bool StartedWhether Start has been called for the current action.
public bool EnabledWhether this agent thinks at all. A stunned or scripted agent sets it false.
public ulong CapabilitiesWhich of a GOAP domain's actions this agent may use. Ignored by the other planners.
public float AccumulatedSeconds elapsed since this agent last ticked, waiting to be spent.
Methods (4)
public static AiAgent Running(ushort action)An agent that runs one action and has not joined a system yet.
public static AiAgent Thinking(int tree)An agent that runs a behaviour tree and has not joined a system yet.
public static AiAgent Scoring(int set)An agent that scores a utility set and has not joined a system yet.
public static AiAgent Planning(int domain, GoapCapabilities capabilities = default(GoapCapabilities))An agent that plans over a GOAP domain and has not joined a system yet.
Used by (28)
- AiDebugChannelTestsVixen.Ai.Tests
- AiDiagnosisExitCriteriaTestsVixen.Ai.Tests
- AiGameplayDebuggerVixen.Ai.Diagnostics
- AiLayeringTestsVixen.Ai.Tests
- AiOverlaySystemVixen.Ai.Diagnostics
- AiSchedulingTestsVixen.Ai.Tests
- AiSnapshotTestsVixen.Ai.Tests
- AiSnapshotsVixen.Ai
- AiSystemVixen.Ai
- AiSystemTestsVixen.Ai.Tests
- AiSystemTreeTestsVixen.Ai.Tests
- BehaviorTreeDeterminismTestsVixen.Ai.Tests
- BindingTestsVixen.Ai.Perception.Tests
- FleetVixen.Ai.Tests
- GoapAgentTestsVixen.Ai.Tests
- OverlayFixtureVixen.Ai.Diagnostics.Tests
- PatrolChaseGiveUpTestsVixen.Ai.Nodes.Tests
- PerceptionNodeTestsVixen.Ai.Perception.Tests
- PerceptionSystemVixen.Ai.Perception
- SeamTestsVixen.Ai.Nodes.Tests
- TypeRegistrationVixen.Ai
- 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