Course contentsShow
← Unreal Engine Game Development
Lesson 415 of 8806. AI, Navigation, and Decision MakingFree lesson

Defining Blackboard Data Structures

Learners will configure Blackboard assets to store persistent AI state variables like target actors, current locations, and boolean flags.

In this lesson, you will learn how to configure Blackboard assets to serve as the "shared memory" for your AI, allowing them to store and track persistent state variables.

The Brain’s Workspace

While your AI Controller acts as the decision-maker and the Behavior Tree acts as the logic flow, the Blackboard is the data container. Think of it as a blackboard hanging in a room where the AI writes down what it knows. If the AI sees an enemy, it doesn't just "feel" it; it writes the enemy's reference onto the blackboard so the Behavior Tree can read it later to decide whether to attack or flee.

Configuring Blackboard Keys

To set up a Blackboard, you create a Blackboard Data asset in the Content Browser. When you open it, you define Keys. These keys are the specific pieces of information your AI needs to persist across different states.

Common key types include:

  • Object: Stores references to actors (e.g., TargetActor).
  • Vector: Stores coordinates (e.g., LastKnownLocation).
  • Boolean: Stores binary states (e.g., bIsAlerted).
  • Enum/Float: Stores specific thresholds or category data.

When you add a key, you are creating a named entry that your Behavior Tree tasks will either "Set" (write to) or "Get" (read from).

Practical Example

If your AI is patrolling, you might have a key named TargetLocation (Vector type).

  1. Perception: Your Pawn Sensing (from lesson 9) detects a player.
  2. Logic: An AI Task runs a node to "Set Blackboard Value as Vector" using the player's location.
  3. Persistence: Even if the player hides behind a wall and the AI loses sight, the TargetLocation remains on the Blackboard. The AI can then use that stored coordinate to navigate toward the last spot it saw the player.

By keeping this data external to your code, you ensure that the AI’s memory is decoupled from its movement or animation logic, making it easier to debug when your AI "forgets" why it is doing something.

Key Takeaway: The Blackboard is the central repository for persistent AI state, allowing your Behavior Tree to make informed, context-aware decisions based on stored actor references, locations, and status flags.