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

Constructing a soldier blackboard


Previously, we stored any data from evaluators and actions on the userData structure. We can now move all this data to our blackboard. The following is the list of attribute values we'll be storing within the blackboard:

Blackboard attributes

Description

alive

Whether the agent is considered alive or dead

ammo

The current amount of ammunition the soldier's rifle has left

maxAmmo

The clip size of the soldier's rifle

maxHealth

The starting health of the agent

enemy

The best enemy agent that can be attacked

bestFleePosition

The best strategic position to avoid enemy agents

Constructing a blackboard requires you to set the initial attribute values we previously stored on the soldierUserData table directly. At this point, we can create KnowledgeSource instance implementations for enemy selection and flee position calculations. To allow access of the blackboard to all our agent systems, we can store the blackboard itself on soldierUserData...