O'Reilly logo

Programming Game AI by Example by Mat Buckland

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Examples of Goals Used by Raven Bots
The Raven bots utilize the goals listed in Table 9.1 to define their behavior.
Table 9.1 Goals used by Raven bots
Composite Goals Atomic Goals
Goal_Think Goal_Wander
Goal_GetItem Goal_SeekToPosition
Goal_MoveToPosition Goal_TraverseEdge
Goal_FollowPath Goal_DodgeSideToSide
Goal_AttackTarget
Goal_Explore
Goal_HuntTarget
Goal_Think is the highest-level goal of all. Each bot instantiates a copy of
this goal, which persists until the bot is destroyed. Its task is to select
between other high-level (strategy) goals according to their suitability to
the current game state. We’ll be taking a closer look at
Goal_Think shortly,
but first I think it will be a good idea to examine the code of a few of the
other goals so you get a feel for how they work.
Goal_Wander
This is the easiest goal to understand and the simplest in a Raven bot’s pal
-
ette. It is an atomic goal that activates the wander steering behavior. Here
is its declaration.
class Goal_Wander : public Goal<Raven_Bot>
{
public:
Goal_Wander(Raven_Bot* pBot):Goal<Raven_Bot>(pBot, goal_wander){}
//must be implemented
void Activate();
int Process();
void Terminate();
};
As you can see, the declaration is very straightforward. The class inherits
from
Goal and has methods that implement Goals interface. Let’s take a
look at each method in turn.
void Goal_Wander::Activate()
{
m_Status = active;
Goal-Driven Agent Behavior | 387
Examples of Goals Used by Raven Bots

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required