Book Image

Learning Game AI Programming with Lua

By : David Young
Book Image

Learning Game AI Programming with Lua

By: David Young

Overview of this book

Table of Contents (16 chapters)
Learning Game AI Programming with Lua
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Free Chapter
1
Getting Started with AI Sandbox
Index

Blackboards


To easily access and store arbitrary knowledge that agents use, we can implement a well-known data structure called a blackboard. In essence, a blackboard is a centralized place that allows the reading and writing of any arbitrary data that our agent's systems can use. Sources of the blackboard's knowledge can be sent directly to the blackboard, or it can be provided by encapsulated knowledge sources added to the blackboard. For an in-depth overview of blackboard systems, see the paper Blackboard Systems by Daniel Corkill.

Creating a blackboard

Creating a blackboard is relatively simple, as the blackboard can be represented almost entirely by an associated array index by knowledge attribute names. One small caveat to simply storing attributes, though, is the use of knowledge sources that create read-only attributes within the blackboard:

Blackboard.lua:

Blackboard = {};

function Blackboard.new(userData)
    local blackboard = {};
    
    -- The Blackboard's data members.
    blackboard...