Artificial Intelligence Core Interface Document

advertisement
Artificial Intelligence Core Interface Document
GSP 420
Team E:
Kellen Dunkelberger
Patrick Morales
Greg Osborne
Egdar Valbuena
Manuel Vasquez
The AI Core interface was designed to be simple to
implement into our games. It provides an easy to implement set
of steering behaviors to the programmers.
There are two classes to know about for the users of the
core; AIManager and AIObject.
AIObject is a class which can be
composed into other objects in order to grant them AI controlled
behaviors.
The AIManager updates and keeps track of all members
of the AIObject class.
AIObject
Build an AIObject into a class that you want to have AI
controlled movement.
Each class can have its own set of AI
behaviors turned on and off using the methods provided by a
class that is a member of AIObject.
This member is called
AIBehavior when designing your class simply call the functions
of AIBehavior in the class constructor to define which steering
behaviors it will have.
EXAMPLE:
//inside my class for an AI character that should run away
I composed an AIObject named coward into it like so.
AIObject Coward;
In the class constructor for the class that I added this
behavior the way to setup the flags for this class would be like
this.
Coward.AIBehavior.FleeOn();
Coward.AIBehavior.EvadeOn();
This will set him to use the Flee and Evade behaviors.
The list of behaviors for our class should include

Wander

Seek

Flee

Pursue

Evade

AvoidWalls
These can all be turned on and off through the AIBehavior member
of the AIObject class.
The other thing you’ll need to set for your AIObject class
are the Wander radius which will tell us how far the object will
wander from its current location and the detection radius which
will tell us how far away the AI Object can detect other
objects.
You can set those values with the functions
setDetectionradius(double) and setWanderRadius(double). For our
coward example as before it would be
Coward.setDetectionRadius(HowfarIwantitToDetect) and
Coward.setWanderRadius(HowFarIwantItToWander)as doubles.
When you want the AIObjects to move, you can get the vector
for their steering behaviors through
GetSteering()
This function will return a 3D vector as defined by the
physics core team. This allows the AIObjects steering vectors to
be implemented regardless of the method of an object’s movement.
Simply call whatever movement function your object has and use
the Vector3D values passed on by the GetSteering() function.
EXAMPLE:
MoveObject(Coward.GetSteering);
AIManager
The AI manager is the core interface Object.
It’s a
singleton that assigns a unique ID number to all AIObjects and
manages their update schedules and removes them when they are
destroyed.
To initialize the AIManager you simply need to call its
startup function.
The syntax looks like this.
AIManager::get().StartUp();
To call the update routines for all the AIObjects in the game
call the AIManager’s update function.
AIManager::get().Update();
Here’s a chart for the functions currently exposed to users with
their inputs and outputs.
Function Call
Inputs
Outputs
AIManager::get().StartUp();
none
none
AIManager::get().Update();
none
none
AIBehavior.WanderOn();
none
none
AIBehavior.WanderOff();
none
none
AIBehavior.SeekOn();
none
none
AIBehavior.SeekOff();
None
none
AIBehavior.FleekOn();
none
none
AIBehavior.FleeOff();
none
none
AIBehavior.EvadeOn();
None
None
AIBehavior.EvadeOff();
None
None
AIBehavior.PursueOn();
None
None
AIBehavior.PursueOff();
None
None
AIBehavior. AvoidWallsON();
None
None
AIBehavior.AvoidWallsOff();
None
none
SetDetectionRadius(double)
double
none
setWanderRadius(double)
Double
None
getSteering()
none
Vector3D
Download