Vixen
caa30e12
csharp
public struct BehaviorNode

One node of a compiled tree: where it sits, what it is, and where its state lives.

Read the guide page for this →

Remarks

Its index is its priority. Nodes are laid out depth-first in pre-order, so node 4 outranks node 9 because it is earlier in the walk — which is exactly what "left to right, top to bottom" means to the person who drew the tree. There is no priority field, and therefore no way for the two to disagree.

And a subtree is a contiguous range. LastDescendant makes "is X inside Y's subtree" two comparisons rather than a walk, which is what makes the abort test in doc 37 § D6 affordable at a thousand agents.

Fields and properties (17)

  • public Symbol Name

    What it is called. For diagnostics and the editor; nothing in a step reads it.

  • public BehaviorNodeKind Kind

    Composite or task.

  • public BehaviorCompositeKind Composite

    How it walks its children, when it is a composite.

  • public ushort Action

    What it runs, when it is a task. An index into the agent's action registry.

  • public ParallelFinishMode FinishMode

    What a Parallel does when its main task ends.

  • public int Parent

    Its parent's index, or -1 for the root.

  • public int FirstChild

    Its first child's index, or -1.

  • public int ChildCount

    How many children it has.

  • public int LastDescendant

    The highest index in its subtree — itself, when it is a leaf.

  • public int DecoratorStart

    Where its decorators start in the template's decorator table.

  • public int DecoratorCount

    How many decorators are attached to it.

  • public int ServiceStart

    Where its services start in the template's service table.

  • public int ServiceCount

    How many services are attached to it.

  • public int MemoryOffset

    Where its state starts in an agent's memory block.

  • public int MemorySize

    How many bytes of that block are its own.

  • public float Weight

    Its share of a RandomSelector's draw.

  • public int NestedSlot

    Which nested-instance slot it owns, when it runs a tree named by a key.

Used by (11)

  • AiBreakpointsVixen.Ai
  • AiSnapshotsVixen.Ai
  • AiSystemTreeTestsVixen.Ai.Tests
  • AuthorableNodeTestsVixen.Ai.Tests
  • BehaviorTreeAbortOrderingTestsVixen.Ai.Tests
  • BehaviorTreeCompilerTestsVixen.Ai.Tests
  • BehaviorTreeDeterminismTestsVixen.Ai.Tests
  • BehaviorTreeInstanceVixen.Ai
  • BehaviorTreeTemplateVixen.Ai
  • CompileStateVixen.Ai
  • TreeHarnessVixen.Ai.Tests