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

Updating agent behaviors


Now that we have a number of different senses, team-based communications, and knowledge about the environment, we can update our agent's blackboard selections to account for the additional information.

Enemy selection

With additional visibility information, we can update our enemy selection to take into account only agents that aren't teammates as well as ones that have been visible within the last second. As teammates send out enemy sightings and essentially share their visibility about the environment, the response time for our agents to pursue a newly spotted enemy is rather quick.

Tip

Currently, our agents share immediate knowledge with each other. With only a small amount of work, you can delay knowledge propagation or even preference agents in order to select enemies they've seen firsthand.

Creating a new function for choosing the best enemy will now only process known visible agents that are stored on the blackboard.

SoldierKnowledge.lua:

function SoldierKnowledge_ChooseBestVisibleEnemy...