public sealed class BlackboardOne agent's data: a byte range over a compiled BlackboardLayout, a bit per key saying whether it has been set, a version per key, and the observers watching each one.
Remarks
A read is a span slice and a write is a store. There is no hashing, no boxing and no allocation once the instance exists — a thousand agents on one layout is a thousand small arrays, sized at load and never resized.
⚠ A key is set or unset independently of its value. "Is Set" is the single commonest decorator in every behaviour-tree implementation there is, and Null, 0 and Zero are all legal values somebody means. So the set-ness is a bit in a mask beside the values, and Clear is a write like any other — it bumps the version and notifies.
Both a version and an observer list, because they answer different questions. Observers drive aborts: a decorator that must interrupt a running branch cannot poll. Versions drive everything that only wants to recompute when something moved — a service on an interval, a cached path, a scorer — and they let it answer "has this changed since I last looked" without keeping a copy of the value.
⚠ A version bumps only when the value actually changes. Writing the same number is not a change, and treating it as one would make every service that writes its result every tick abort every decorator observing it, for ever. That is the difference between an event-driven tree and a tree that ticks itself to death.
One agent owns one blackboard. That is what makes a tree step parallelisable over chunks — a step touches this agent's memory and this agent's board and nothing else. Data two agents share is a SharedBlackboard, which is a distinct type precisely so that sharing is a decision somebody made rather than something that happened.
Fields and properties (2)
public BlackboardLayout LayoutThe shape this is an instance of.
public uint VersionHow many times anything on this board has changed.
Methods (21)
public Blackboard(BlackboardLayout layout)Creates an instance of a layout, with every key unset.
public bool IsSet(BlackboardKey key)Whether a key has ever been written and not since cleared.
public uint VersionOf(BlackboardKey key)How many times this key has changed.
public bool Clear(BlackboardKey key)Unsets a key.
public void Reset()Unsets every key.
public bool GetBool(BlackboardKey key)Reads a boolean.
public int GetInt(BlackboardKey key)Reads an integer.
public float GetFloat(BlackboardKey key)Reads a float.
public Vector3 GetVector3(BlackboardKey key)Reads a vector.
public Entity GetEntity(BlackboardKey key)Reads an entity.
public Symbol GetSymbol(BlackboardKey key)Reads a symbol.
public bool SetBool(BlackboardKey key, bool value)Writes a boolean.
public bool SetInt(BlackboardKey key, int value)Writes an integer.
public bool SetFloat(BlackboardKey key, float value)Writes a float.
public bool SetVector3(BlackboardKey key, Vector3 value)Writes a vector.
public bool SetEntity(BlackboardKey key, Entity value)Writes an entity.
public bool SetSymbol(BlackboardKey key, Symbol value)Writes a symbol.
public BlackboardObserverHandle AddObserver(BlackboardKey key, IBlackboardObserver observer)Starts telling something when a key changes.
public bool RemoveObserver(BlackboardObserverHandle handle)Stops telling it.
public int ObserverCount(BlackboardKey key)How many observers are registered on a key.
public Span<byte> AsBytes()The raw bytes, for a compiler, a serialiser or a test.
Used by (69, showing 40)
- AgentContextVixen.Ai
- AgentTargetVixen.Ai.Nodes
- AiSnapshotTestsVixen.Ai.Tests
- AiSnapshotsVixen.Ai
- AiSystemVixen.Ai
- AiSystemTestsVixen.Ai.Tests
- BehaviorContextVixen.Ai
- BehaviorTreeAbortOrderingTestsVixen.Ai.Tests
- BehaviorTreeAbortTestsVixen.Ai.Tests
- BehaviorTreeCompositeTestsVixen.Ai.Tests
- BehaviorTreeCostTestsVixen.Ai.Tests
- BehaviorTreeDecoratorTestsVixen.Ai.Tests
- BehaviorTreeDeterminismTestsVixen.Ai.Tests
- BehaviorTreeInstanceVixen.Ai
- BehaviorTreeServiceTestsVixen.Ai.Tests
- BehaviorTreeTaskTestsVixen.Ai.Tests
- BindingTestsVixen.Ai.Perception.Tests
- BlackboardDecoratorVixen.Ai
- BlackboardLayoutTestsVixen.Ai.Tests
- BlackboardTestsVixen.Ai.Tests
- BlackboardUtilityInputVixen.Ai
- BlackboardWorldSourceVixen.Ai
- BoardVixen.Ai.Nodes.Tests
- ClearBlackboardValueTaskVixen.Ai
- CompareEntriesDecoratorVixen.Ai
- ConeDecoratorVixen.Ai
- ConstantWorldSensorVixen.Ai
- CountingObserverVixen.Ai.Tests
- CountingSensorVixen.Ai.Tests
- DelegateObserverVixen.Ai.Tests
- DelegateWorldSensorVixen.Ai
- DistanceSensorVixen.Ai.Nodes
- DistanceUtilityInputVixen.Ai
- FocusTestsVixen.Ai.Nodes.Tests
- GoapDomainTestsVixen.Ai.Tests
- GoapHarnessVixen.Ai.Tests
- HarnessVixen.Ai.Tests
- IBlackboardBindingVixen.Ai.Perception
- IBlackboardObserverVixen.Ai
- IWorldSensorVixen.Ai