Reader small image

You're reading from  Learning Game AI Programming with Lua

Product typeBook
Published inNov 2014
Reading LevelBeginner
PublisherPackt
ISBN-139781783281336
Edition1st Edition
Languages
Right arrow
Author (1)
David Young
David Young
Right arrow

Creating evaluators


Creating evaluators relies on simple functions that perform isolated operations on the agent's userData table. Typically, most evaluators will only perform calculations based on userData instead of modifying the data itself, although there is no limitation on doing this. As the same evaluator might appear within a decision structure, care must be taken to create consistent decision choices.

Tip

Evaluators that modify userData can easily become a source of bugs; try to avoid this if at all possible. Actions should modify the agent's state, when evaluators begin to modify the agent's state as a decision structure is processed; it becomes very difficult to tell how and why any eventual action was chosen, as the order of operations will affect the outcome.

Constant evaluators

First, we'll need to create the two most basic evaluators; one that always returns true, and another that always returns false. These evaluators come in handy as a means of enabling or disabling actions...

lock icon
The rest of the page is locked
Previous PageNext Page
You have been reading a chapter from
Learning Game AI Programming with Lua
Published in: Nov 2014Publisher: PacktISBN-13: 9781783281336

Author (1)