> For the complete documentation index, see [llms.txt](https://sniveler-code.gitbook.io/dots/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://sniveler-code.gitbook.io/dots/project-ai-behavior-architect/section-4/the-blackboard-system.md).

# 🧠 The Blackboard System

In Behavior Trees, nodes need a way to share data with one another. For instance, a "Find" node might locate an enemy, and a "Move" node needs to know where that enemy is.

`AI Behavior Architect` handles this using a `Blackboard`—a shared memory space accessible by all nodes within a tree.

> ⚡ **DOTS Performance Note**\
> In object-oriented systems, Blackboards are usually dictionaries containing objects, which causes massive Garbage Collection. AI Behavior Architect stores Blackboard variables internally inside a 16-byte unmanaged wrapper (`BtBlackboardEntry`) attached directly to your Entity's chunk as a `DynamicBuffer`. This guarantees rapid, cache-friendly memory access during Burst jobs with zero allocations.

#### ➕ Creating Variables

1. Open the Behavior Editor and select your `Graph Asset`.
2. In the left-hand Settings Panel, click the **Variables** tab.
3. Click the **Add Variable** button.
4. Configure your variable:
   * **Name:** Give it a readable name (e.g., `TargetPosition` or `Health`).
   * **Type:** Select between `Float`, `Int`, or `Bool`. (Note: For advanced DOTS data like Entity or `float3`, you will pass these via `Data Ports`, which we cover below).
   * **Value:** Set the default starting value.

#### 🔌 Connecting Variables via Data Ports

Some nodes (like **Find** or **Create Entity**) explicitly require complex data types like an Entity ID or a `float3` position.\
These nodes feature **Horizontal Data Ports** (on the left for Inputs, and on the right for Outputs).

1. Left-click and drag from a `Data Port` to another compatible `Data Port` to create a link.
2. The framework will automatically assign a hidden `Blackboard hash` to transfer this unmanaged data from the outputting node directly into the receiving node during runtime.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://sniveler-code.gitbook.io/dots/project-ai-behavior-architect/section-4/the-blackboard-system.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
