AIBehaviors Class Reference

#include <aiBehaviors.h>

Collaboration diagram for AIBehaviors:
Collaboration graph
[legend]

List of all members.

Public Types

enum  _behavior_type {
  _none = 0x00000, _seek = 0x00002, _flee = 0x00004, _flee_activate = 0x00100,
  _arrival = 0x00008, _arrival_activate = 0x01000, _wander = 0x00010, _pursue = 0x00040,
  _evade = 0x00080, _evade_activate = 0x00800, _flock = 0x00200, _flock_activate = 0x00400
}

Public Member Functions

 AIBehaviors ()
 ~AIBehaviors ()
bool On (_behavior_type bt)
bool Off (_behavior_type bt)
void seek_on ()
void flee_on ()
void flee_activate_on ()
void arrival_on ()
void arrival_activate_on ()
void pursue_on ()
void evade_on ()
void evade_activate_on ()
void flock_on ()
void flock_activate_on ()
void wander_on ()
void seek_off ()
void flee_off ()
void flee_activate_off ()
void arrival_off ()
void arrival_activate_off ()
void pursue_off ()
void evade_off ()
void evade_activate_off ()
void flock_off ()
void flock_activate_off ()
void wander_off ()
bool is_off ()
bool is_seek_on ()
bool is_flee_on ()
bool is_flee_activate_on ()
bool is_arrival_on ()
bool is_arrival_activate_on ()
bool is_pursue_on ()
bool is_evade_on ()
bool is_evade_activate_on ()
bool is_flock_on ()
bool is_flock_activate_on ()
bool is_wander_on ()
bool is_conflict ()
void accumulate_force (string force_type, LVecBase3f force)
LVecBase3f calculate_prioritized ()
void flock_activate ()
LVecBase3f do_flock ()
int char_to_int (string ai_type)
void seek (LVecBase3f pos, float seek_wt=1.0)
bool seek_status ()
void flee (NodePath target_object, double panic_distance=10.0, double relax_distance=10.0, float flee_wt=1.0)
void flee (LVecBase3f pos, double panic_distance=10.0, double relax_distance=10.0, float flee_wt=1.0)
bool flee_status ()
void pursue (NodePath target_object, float pursue_wt=1.0)
bool pursue_status ()
void evade (NodePath target_object, double panic_distance=10.0, double relax_distance=10.0, float evade_wt=1.0)
bool evade_status ()
void arrival (NodePath target_object, double distance=10.0)
bool arrival_status ()
void flock (float flock_wt)
bool flock_status ()
void wander (double wander_radius=5.0, bool flag_3D=false, double aoe=0.0, float wander_weight=1.0)
bool wander_status ()
void remove_ai (string ai_type)
void pause_ai (string ai_type)
void resume_ai (string ai_type)

Public Attributes

AICharacter_ai_char
Flock_flock_group
int _behaviors_flags
LVecBase3f _steering_force
Seek_seek_obj
LVecBase3f _seek_force
Flee_flee_obj
LVecBase3f _flee_force
ListFlee _flee_list
 This list is used if the ai character needs to flee from multiple onjects.
ListFlee::iterator _flee_itr
Pursue_pursue_obj
LVecBase3f _pursue_force
Evade_evade_obj
LVecBase3f _evade_force
ListEvade _evade_list
 This list is used if the ai character needs to evade from multiple onjects.
ListEvade::iterator _evade_itr
Arrival_arrival_obj
LVecBase3f _arrival_force
float _flock_weight
 Since Flock is a collective behavior the variables are declared within the AIBehaviors class.
LVecBase3f _flock_force
bool _flock_done
Wander_wander_obj
LVecBase3f _wander_force
bool _conflict
bool _previous_conflict
PUBLISHED __pad0__: void seek(NodePath target_object
PUBLISHED float seek_wt = 1.0)

Detailed Description

Definition at line 58 of file aiBehaviors.h.


Member Enumeration Documentation

Enumerator:
_none 
_seek 
_flee 
_flee_activate 
_arrival 
_arrival_activate 
_wander 
_pursue 
_evade 
_evade_activate 
_flock 
_flock_activate 

Definition at line 61 of file aiBehaviors.h.


Constructor & Destructor Documentation

AIBehaviors::AIBehaviors (  ) 

Definition at line 19 of file aiBehaviors.cxx.

Here is the call graph for this function:

AIBehaviors::~AIBehaviors (  )  [inline]

Definition at line 116 of file aiBehaviors.h.


Member Function Documentation

void AIBehaviors::accumulate_force ( string  force_type,
LVecBase3f  force 
)

Function : accumulate_force Description : This function updates the individual steering forces for each of the ai characters. These accumulated forces are eventually what comprise the resultant steering force of the character.

Definition at line 107 of file aiBehaviors.cxx.

Here is the caller graph for this function:

void AIBehaviors::arrival ( NodePath  target_object,
double  distance = 10.0 
)

Function : arrival Description : This function activates arrival. This is the function we want the user to call for arrival to be done.

Definition at line 667 of file aiBehaviors.cxx.

Here is the call graph for this function:

void AIBehaviors::arrival_activate_off (  )  [inline]

Definition at line 166 of file aiBehaviors.h.

Here is the call graph for this function:

Here is the caller graph for this function:

void AIBehaviors::arrival_activate_on (  )  [inline]

Definition at line 138 of file aiBehaviors.h.

Here is the caller graph for this function:

void AIBehaviors::arrival_off (  ) 

Definition at line 871 of file aiBehaviors.cxx.

Here is the call graph for this function:

Here is the caller graph for this function:

void AIBehaviors::arrival_on (  )  [inline]

Definition at line 135 of file aiBehaviors.h.

Here is the caller graph for this function:

bool AIBehaviors::arrival_status (  ) 

Function : arrival_status Description : This function returns the current status of arrival.

Definition at line 680 of file aiBehaviors.cxx.

LVecBase3f AIBehaviors::calculate_prioritized (  ) 

Function : calculate_prioritized Description : This function updates the main steering force for the ai character using the accumulate function and checks for max force and arrival force. It finally returns this steering force which is accessed by the update function in the AICharacter class.

Definition at line 160 of file aiBehaviors.cxx.

Here is the call graph for this function:

int AIBehaviors::char_to_int ( string  ai_type  ) 

Function : char_to_int Description : This function is used to derive int values from the ai types strings. Returns -1 if an invalid string is passed.

Definition at line 900 of file aiBehaviors.cxx.

Here is the caller graph for this function:

LVecBase3f AIBehaviors::do_flock (  ) 

Function : do_flock Description : This function contains the logic for flocking behavior. This is an emergent behavior and is obtained by combining three other behaviors which are separation, cohesion and alignment based on Craig Reynold's algorithm. Also, this behavior does not work by itself. It works only when combined with other steering behaviors such as wander, pursue, evade, seek and flee.

Initialize variables required to compute the flocking force on the ai char.

Loop through all the other AI units in the flock to check if they are neigbours.

Using visibilty cone to detect neighbors.

Check if the current unit is a neighbor.

Separation force calculation.

Calculating the total heading and center of mass of all the neighbors.

Update the neighbor count.

Alignment force calculation

Cohesion force calculation

Calculate the resultant force on the ai character by taking into account the separation, alignment and cohesion forces along with their corresponding weights.

Definition at line 737 of file aiBehaviors.cxx.

Here is the call graph for this function:

Here is the caller graph for this function:

void AIBehaviors::evade ( NodePath  target_object,
double  panic_distance = 10.0,
double  relax_distance = 10.0,
float  evade_wt = 1.0 
)

Function : evade Description : This function activates evade_activate.

Definition at line 629 of file aiBehaviors.cxx.

Here is the call graph for this function:

void AIBehaviors::evade_activate_off (  )  [inline]

Definition at line 171 of file aiBehaviors.h.

Here is the call graph for this function:

Here is the caller graph for this function:

void AIBehaviors::evade_activate_on (  )  [inline]

Definition at line 147 of file aiBehaviors.h.

Here is the caller graph for this function:

void AIBehaviors::evade_off (  ) 

Definition at line 864 of file aiBehaviors.cxx.

Here is the call graph for this function:

Here is the caller graph for this function:

void AIBehaviors::evade_on (  )  [inline]

Definition at line 144 of file aiBehaviors.h.

Here is the caller graph for this function:

bool AIBehaviors::evade_status (  ) 

Function : evade_status Description : This function returns the current status of evade.

Definition at line 644 of file aiBehaviors.cxx.

void AIBehaviors::flee ( LVecBase3f  pos,
double  panic_distance = 10.0,
double  relax_distance = 10.0,
float  flee_wt = 1.0 
)

Definition at line 568 of file aiBehaviors.cxx.

Here is the call graph for this function:

void AIBehaviors::flee ( NodePath  target_object,
double  panic_distance = 10.0,
double  relax_distance = 10.0,
float  flee_wt = 1.0 
)

Function : flee Description : This function activates flee_activate and creates an object of the Flee class. This function is overloaded to accept a NodePath or an LVecBase3f.

Definition at line 561 of file aiBehaviors.cxx.

Here is the call graph for this function:

void AIBehaviors::flee_activate_off (  )  [inline]

Definition at line 162 of file aiBehaviors.h.

Here is the call graph for this function:

Here is the caller graph for this function:

void AIBehaviors::flee_activate_on (  )  [inline]

Definition at line 132 of file aiBehaviors.h.

Here is the caller graph for this function:

void AIBehaviors::flee_off (  ) 

Definition at line 850 of file aiBehaviors.cxx.

Here is the call graph for this function:

Here is the caller graph for this function:

void AIBehaviors::flee_on (  )  [inline]

Definition at line 129 of file aiBehaviors.h.

Here is the caller graph for this function:

bool AIBehaviors::flee_status (  ) 

Function : flee_status Description : This function returns the current status of flee.

Definition at line 582 of file aiBehaviors.cxx.

void AIBehaviors::flock ( float  flock_wt  ) 

Function : flock Description : This function activates flock. This is the function we want the user to call for flock to be done.

Definition at line 692 of file aiBehaviors.cxx.

Here is the call graph for this function:

void AIBehaviors::flock_activate (  ) 

Function : flock_activate Description : This function checks whether any other behavior exists to work with flock. When this is true, it calls the do_flock function.

Definition at line 718 of file aiBehaviors.cxx.

Here is the call graph for this function:

Here is the caller graph for this function:

void AIBehaviors::flock_activate_off (  )  [inline]

Definition at line 175 of file aiBehaviors.h.

Here is the call graph for this function:

Here is the caller graph for this function:

void AIBehaviors::flock_activate_on (  )  [inline]

Definition at line 153 of file aiBehaviors.h.

Here is the caller graph for this function:

void AIBehaviors::flock_off (  ) 

Definition at line 878 of file aiBehaviors.cxx.

Here is the call graph for this function:

Here is the caller graph for this function:

void AIBehaviors::flock_on (  )  [inline]

Definition at line 150 of file aiBehaviors.h.

Here is the caller graph for this function:

bool AIBehaviors::flock_status (  ) 

Function : flock_status Description : This function returns the current status of flock.

Definition at line 706 of file aiBehaviors.cxx.

bool AIBehaviors::is_arrival_activate_on (  )  [inline]

Definition at line 195 of file aiBehaviors.h.

Here is the call graph for this function:

Here is the caller graph for this function:

bool AIBehaviors::is_arrival_on (  )  [inline]

Definition at line 192 of file aiBehaviors.h.

Here is the call graph for this function:

Here is the caller graph for this function:

bool AIBehaviors::is_conflict (  ) 

Function : is_conflict Description : Checks for conflict between steering forces. If there is a conflict it returns 'true' and sets _conflict to 'true'. If there is no conflict it returns 'false' and sets _conflict to 'false'.

Definition at line 52 of file aiBehaviors.cxx.

Here is the call graph for this function:

Here is the caller graph for this function:

bool AIBehaviors::is_evade_activate_on (  )  [inline]

Definition at line 204 of file aiBehaviors.h.

Here is the call graph for this function:

Here is the caller graph for this function:

bool AIBehaviors::is_evade_on (  )  [inline]

Definition at line 201 of file aiBehaviors.h.

Here is the call graph for this function:

Here is the caller graph for this function:

bool AIBehaviors::is_flee_activate_on (  )  [inline]

Definition at line 189 of file aiBehaviors.h.

Here is the call graph for this function:

Here is the caller graph for this function:

bool AIBehaviors::is_flee_on (  )  [inline]

Definition at line 186 of file aiBehaviors.h.

Here is the call graph for this function:

Here is the caller graph for this function:

bool AIBehaviors::is_flock_activate_on (  )  [inline]

Definition at line 210 of file aiBehaviors.h.

Here is the call graph for this function:

Here is the caller graph for this function:

bool AIBehaviors::is_flock_on (  )  [inline]

Definition at line 207 of file aiBehaviors.h.

Here is the call graph for this function:

Here is the caller graph for this function:

bool AIBehaviors::is_off (  )  [inline]

Definition at line 180 of file aiBehaviors.h.

Here is the call graph for this function:

bool AIBehaviors::is_pursue_on (  )  [inline]

Definition at line 198 of file aiBehaviors.h.

Here is the call graph for this function:

Here is the caller graph for this function:

bool AIBehaviors::is_seek_on (  )  [inline]

Definition at line 183 of file aiBehaviors.h.

Here is the call graph for this function:

Here is the caller graph for this function:

bool AIBehaviors::is_wander_on (  )  [inline]

Definition at line 213 of file aiBehaviors.h.

Here is the call graph for this function:

Here is the caller graph for this function:

bool AIBehaviors::Off ( _behavior_type  bt  )  [inline]

Definition at line 122 of file aiBehaviors.h.

Here is the caller graph for this function:

bool AIBehaviors::On ( _behavior_type  bt  )  [inline]

Definition at line 119 of file aiBehaviors.h.

Here is the caller graph for this function:

void AIBehaviors::pause_ai ( string  ai_type  ) 

Function : pause_ai Description : This function pauses individual or all the AIs.

Definition at line 380 of file aiBehaviors.cxx.

Here is the call graph for this function:

Here is the caller graph for this function:

void AIBehaviors::pursue ( NodePath  target_object,
float  pursue_wt = 1.0 
)

Function : pursue Description : This function activates pursue. This is the function we want the user to call for pursue to be done.

Definition at line 605 of file aiBehaviors.cxx.

Here is the call graph for this function:

void AIBehaviors::pursue_off (  ) 

Definition at line 857 of file aiBehaviors.cxx.

Here is the call graph for this function:

Here is the caller graph for this function:

void AIBehaviors::pursue_on (  )  [inline]

Definition at line 141 of file aiBehaviors.h.

Here is the caller graph for this function:

bool AIBehaviors::pursue_status (  ) 

Function : pursue_status Description : This function returns the current status of pursue.

Definition at line 618 of file aiBehaviors.cxx.

void AIBehaviors::remove_ai ( string  ai_type  ) 

Function : remove_ai Description : This function removes individual or all the AIs.

Definition at line 292 of file aiBehaviors.cxx.

Here is the call graph for this function:

void AIBehaviors::resume_ai ( string  ai_type  ) 

Function : resume_ai Description : This function resumes individual or all the AIs

Definition at line 457 of file aiBehaviors.cxx.

Here is the call graph for this function:

Here is the caller graph for this function:

void AIBehaviors::seek ( LVecBase3f  pos,
float  seek_wt = 1.0 
)

Definition at line 537 of file aiBehaviors.cxx.

Here is the call graph for this function:

void AIBehaviors::seek_off (  ) 

Function : (aitype)_off() Description : These functions are used to turn off the steering forces.

Definition at line 843 of file aiBehaviors.cxx.

Here is the call graph for this function:

Here is the caller graph for this function:

void AIBehaviors::seek_on (  )  [inline]

Definition at line 126 of file aiBehaviors.h.

Here is the caller graph for this function:

bool AIBehaviors::seek_status (  ) 

Function : seek_status Description : This function returns the current status of seek.

Definition at line 549 of file aiBehaviors.cxx.

void AIBehaviors::wander ( double  wander_radius = 5.0,
bool  flag_3D = false,
double  aoe = 0.0,
float  wander_weight = 1.0 
)

Function : wander Description : This function activates wander. This is the function we want the user to call for flock to be done.

Definition at line 815 of file aiBehaviors.cxx.

Here is the call graph for this function:

void AIBehaviors::wander_off (  ) 

Definition at line 885 of file aiBehaviors.cxx.

Here is the call graph for this function:

Here is the caller graph for this function:

void AIBehaviors::wander_on (  )  [inline]

Definition at line 156 of file aiBehaviors.h.

Here is the caller graph for this function:

bool AIBehaviors::wander_status (  ) 

Function : wander_status Description : This function returns the current status of wander.

Definition at line 827 of file aiBehaviors.cxx.

Here is the call graph for this function:


Member Data Documentation

Definition at line 228 of file aiBehaviors.h.

Definition at line 76 of file aiBehaviors.h.

Definition at line 103 of file aiBehaviors.h.

Definition at line 102 of file aiBehaviors.h.

Definition at line 79 of file aiBehaviors.h.

Definition at line 113 of file aiBehaviors.h.

Definition at line 96 of file aiBehaviors.h.

ListEvade::iterator AIBehaviors::_evade_itr

Definition at line 100 of file aiBehaviors.h.

This list is used if the ai character needs to evade from multiple onjects.

Definition at line 99 of file aiBehaviors.h.

Definition at line 95 of file aiBehaviors.h.

Definition at line 86 of file aiBehaviors.h.

ListFlee::iterator AIBehaviors::_flee_itr

Definition at line 90 of file aiBehaviors.h.

This list is used if the ai character needs to flee from multiple onjects.

Definition at line 89 of file aiBehaviors.h.

Definition at line 85 of file aiBehaviors.h.

Definition at line 108 of file aiBehaviors.h.

Definition at line 107 of file aiBehaviors.h.

Definition at line 77 of file aiBehaviors.h.

Since Flock is a collective behavior the variables are declared within the AIBehaviors class.

Definition at line 106 of file aiBehaviors.h.

Definition at line 113 of file aiBehaviors.h.

Definition at line 93 of file aiBehaviors.h.

Definition at line 92 of file aiBehaviors.h.

Definition at line 83 of file aiBehaviors.h.

Definition at line 82 of file aiBehaviors.h.

Definition at line 80 of file aiBehaviors.h.

Definition at line 111 of file aiBehaviors.h.

Definition at line 110 of file aiBehaviors.h.

PUBLISHED float AIBehaviors::seek_wt = 1.0)

Definition at line 228 of file aiBehaviors.h.


The documentation for this class was generated from the following files:
 All Classes Files Functions Variables Typedefs Enumerations Enumerator

Generated on Tue Nov 3 22:34:31 2009 for PandAI by  doxygen 1.6.1