Summary

A blackboard is a shared memory structure that multiple AI subsystems — behaviours, planners, reasoners, or characters — can read from and write to. Rather than each component holding its own private copy of shared facts (“can I see the enemy?”, “what is the squad’s target?”, “is this cover point occupied?”), all components read from and write to a common store.

In academic AI, the blackboard is a specific problem-solving architecture in which multiple independent knowledge sources propose partial solutions, and a central scheduler selects which to apply. In game development the term is used more loosely: it simply means a shared data store used for coordination and caching. The distinction is important — game blackboards are architecturally simpler but practically very effective (Dill, Game AI Pro 360: Guide to Architecture, Ch. 2, see source-game-ai-pro-360-architecture).

Key Ideas

  • Centralised knowledge. Every character (or AI system) has access to one or more blackboards. A common split is a character blackboard (private to that NPC) and a global blackboard (accessible by all characters).
  • Caching expensive queries. Line-of-sight (LOS) checks and pathfinding queries are computationally expensive. If multiple BT nodes or utility scorers need the same LOS result in one frame, caching the result on the blackboard avoids redundant raycasts.
  • Coordination data. The blackboard enables multi-agent coordination without tight coupling:
    • Target assignments (e.g. “attack this enemy”) so multiple characters don’t pile onto the same target.
    • Cover reservation (so two characters don’t claim the same hiding spot).
    • Squad orders and formation data.
    • Movement plans (flanking direction, tank-in-front DPS-behind arrangement).
  • Reasoner-to-reasoner communication. When one reasoner’s output is another’s input (e.g. an emotion reasoner setting an “angry” flag that an animation reasoner reads), the blackboard is the natural bus.
  • Intelligent objects and terrain. Red Dead Redemption’s town hotspot system stores the available behaviour tree and occupancy data in the world itself, which is a form of environmental blackboard. The Sims’ object advertisement system works similarly — objects advertise what they can do on a shared channel the NPC reads (Dill, Ch. 2, see source-game-ai-pro-360-architecture).

In Practice

Minimal Unity C# Blackboard

A blackboard can start as a simple dictionary component attached to the AI agent or a singleton for global data:

// Per-character blackboard — attach to the NPC root GameObject
public class AIBlackboard : MonoBehaviour
{
    private Dictionary<string, object> _data = new();
 
    public void Set<T>(string key, T value) => _data[key] = value;
 
    public T Get<T>(string key)
    {
        if (_data.TryGetValue(key, out var value) && value is T typed)
            return typed;
        return default;
    }
 
    public bool Has(string key) => _data.ContainsKey(key);
    public void Clear(string key) => _data.Remove(key);
}
// Example usage inside a BT leaf node
public class CheckLineOfSight : BTLeafNode
{
    public override NodeStatus Tick()
    {
        var bb = owner.GetComponent<AIBlackboard>();
 
        // Return cached result if it was computed this frame
        if (bb.Has("los_cached_frame") && 
            bb.Get<int>("los_cached_frame") == Time.frameCount)
        {
            return bb.Get<bool>("can_see_player") ? NodeStatus.Success : NodeStatus.Failure;
        }
 
        // Compute fresh and cache
        bool visible = PerformLOSRaycast();
        bb.Set("can_see_player", visible);
        bb.Set("los_cached_frame", Time.frameCount);
        return visible ? NodeStatus.Success : NodeStatus.Failure;
    }
}

Typed Blackboard (Enum Keys)

For production code, string keys invite typos and magic strings. An enum-keyed approach is safer:

public enum BBKey
{
    CanSeePlayer,
    LastKnownPlayerPosition,
    CurrentTarget,
    IsCoverReserved,
    SquadRole,
}
 
public class TypedBlackboard : MonoBehaviour
{
    private Dictionary<BBKey, object> _data = new();
    public void Set(BBKey key, object value) => _data[key] = value;
    public T Get<T>(BBKey key) => _data.TryGetValue(key, out var v) ? (T)v : default;
}

Global Squad Blackboard

A static singleton or ScriptableObject works well as a squad-level global blackboard:

[CreateAssetMenu(menuName = "AI/Squad Blackboard")]
public class SquadBlackboard : ScriptableObject
{
    public GameObject primaryTarget;
    public List<GameObject> reservedCoverPoints = new();
    public string currentTactic;
 
    public bool ReserveCover(GameObject cover)
    {
        if (reservedCoverPoints.Contains(cover)) return false;
        reservedCoverPoints.Add(cover);
        return true;
    }
 
    public void ReleaseCover(GameObject cover) => reservedCoverPoints.Remove(cover);
}

Assign one SquadBlackboard asset per squad; each NPC in the squad holds a reference to it. This avoids singletons and works cleanly with Unity’s Inspector.

Trade-offs

ConcernNotes
Hidden couplingWhen many systems write to the same key, it becomes hard to trace cause and effect. Prefer read-mostly keys; limit writers per key.
No type safety with dictionaryTyped keys (enum or const string) and generic accessors reduce runtime errors.
StalenessCached values become stale. Tag each cache entry with a frame number or timestamp and invalidate on next read.
Thread safetyUnity’s main-thread model mostly avoids this, but AI systems using the Unity Jobs System or Burst need explicit synchronisation.
SizeLarge blackboards with hundreds of keys slow dictionary lookups. For performance-critical NPCs, a struct-of-fields is faster than a dictionary.

Evidence

The Halo series was an early high-profile user of blackboard architecture in game AI, popularised by Damián Isla (see Isla’s Halo Inspired Blackboard Architectures interview on AIGameDev.com, referenced in Dill, Game AI Pro 360: Guide to Architecture, Ch. 2).

Dill’s GAIA architecture, which was applied to games including Red Dead Redemption and Zoo Tycoon 2, uses two blackboards per character (personal + global) as a core infrastructure component, with modular targets also storable on the blackboard for character-to-character communication.

Millington’s treatment (Artificial Intelligence for Games, see source-artificial-intelligence-for-games) covers the academic blackboard system (multiple knowledge sources + scheduler) and notes that game implementations simplify this to a shared data store.

Implications

  • Prefer a per-character + global pair as the default structure. It clearly separates private NPC knowledge from multi-character coordination data.
  • Cache expensive queries (LOS, paths, distance) with a frame-count stamp rather than recomputing every tick.
  • Coordinate spatial resources (cover, formation slots, targets) via the shared blackboard rather than through direct inter-agent method calls — this keeps agents decoupled.
  • For a BT-based AI, the blackboard is the natural companion: BT nodes query it for preconditions and write results back to it. This keeps nodes stateless and reusable.
  • For utility AI, store expensive input values on the blackboard so multiple scorers can reuse them without re-computing.

Open Questions

  • When the game supports save/load, does the blackboard need to be serialised? What’s the lightest approach in Unity?
  • How should the blackboard interact with Unity’s ECS (DOTS)? Dictionaries are GC-heavy — a NativeHashMap equivalent might be needed for Burst-compatible AI.
  • At what point does a growing blackboard become a design smell that signals the need for a proper shared-world-state object (closer to the HTN world-state model)?