our AIagents and its methods and variables put in this file More...
#include <AIagent.h>
Public Member Functions | |
AIagent (std::string _file, PyObject *_main, PyObject *_dict, int _index, std::string _meshName, float _radius, Models *_model, Graph *_graph, Agent *_parent, std::string _type, int _ID, int _armyID, std::string _state) | |
ctor | |
AIagent (Agent *_parent, std::string _file, PyObject *_main, PyObject *_dict, ngl::Vec3 _pos, std::string _type, float _radius, Models *_model, Graph *_graph, std::string _meshName, int _ID) | |
ctor | |
~AIagent () | |
dtor will clear the strings and close down the python interpretor | |
void | update () |
this method updates the agent | |
void | draw (ngl::TransformStack *_tx, ngl::Camera *_cam) |
draw the scene | |
void | reloadScript () |
delete the old script and re-load | |
void | setNewScriptPath (const std::string &_p) |
pass in a new script and load this replacing the old one | |
void | setWallNormal (const ngl::Vec3 _normal, const float _dist) |
set the wall normal and the distance of the wall when the agent collides with the wall | |
void | setApproachingAgentParams (const float _dist, const ngl::Vec3 _pos, const ngl::Vec3 _vel) |
set the approaching agent distance, velocity and position | |
ngl::Vec3 | getPos () |
get the agent position | |
ngl::Vec3 | getVelocity () |
get the agent velocity | |
ngl::Vec3 | getForce () |
get the agent force | |
void | setPosition (const ngl::Vec3 pos) |
set the agent position | |
void | setVelocity (const ngl::Vec3 vel) |
set the agent velocity | |
float | getRadius () |
get the agent mesh radius | |
void | reset () |
reset the agent | |
float | getScore () |
get the agent score | |
void | setScore (const int _score) |
set the agent score | |
void | resetScore () |
to reset the agent score | |
int | getReset () |
get the reset value | |
std::string | getName () |
get the agent name | |
int | getNextIndex () |
get the next index of the graph that the agent traverses | |
int | getIndex () |
get the index of the graph that the agent traverses | |
void | setIndex (const int _index) |
set the index of the graph that the agent traverses | |
void | setNextIndex (const int _nextIndex) |
set the index of the graph that the agent traverses | |
void | setRoute (std::vector< int > _route) |
set the route to the shortest path in the graph | |
int | getPrecision () |
get precision | |
Direction | getDirection () |
get the direction the agent is moving | |
void | setDirection (int _direction) |
set the direction | |
void | setIntialWallBool (bool _wall) |
set the initial bool value of the variable which indicates that the agent has not found the wall | |
std::string | getMessage () |
get the message the agent has | |
std::string | getState () |
get the state the agent is in | |
void | setMessage (const std::string _message) |
set the message of the agent | |
ngl::Vec3 | getTargetPos () |
get the target position that the agent is in pursuit | |
void | setTargetPos (const ngl::Vec3 _pos) |
set the target position | |
void | setHitStatus () |
set the hit status of the agent | |
bool | getHitStatus () |
get the hit status of the agent | |
std::string | getType () |
get the type of the agent | |
ngl::Vec3 | getHomePos () |
get the home position of the agents | |
void | setState (const std::string _state) |
set the state of the agents | |
void | queryEnvironment () |
a method to query the environment to ask about the collisions | |
Public Attributes | |
bool | m_wallCollision |
the bool to indicate the collision with wall | |
bool | m_ObstacleCollision |
the bool to indicate the collision with other object | |
bool | m_approachingAgent |
the bool to indicate the approaching agent | |
ngl::Vec3 | m_wallNormal |
the normal of the wall that the agent collided with | |
float | m_wallDistance |
the distance between the agent and the wall | |
float | m_obstacleDistance |
the distance between the agent and the object | |
float | m_radius |
the radius of the agent | |
ngl::Vec3 | m_obsPos |
the position of the approaching agent | |
ngl::Vec3 | m_obsVel |
the velocity of the approaching agent | |
int | m_reset |
a variable that indicates which agent is reset to calculate the score | |
bool | m_shootSphere |
the bool to indicate the shooting of spheres | |
bool | m_shootBlock |
the bool to indicate the shooting of block | |
int | m_iterator |
the iterator to retrive the route found by the shortest path | |
bool | m_wall |
the bool to indicate the initial wall found while maze solving | |
Private Member Functions | |
void | brainFunction () |
Private Attributes | |
ngl::Vec3 | m_pos |
the position of the agent, this will be represented as pos in the python sctipt | |
ngl::Vec3 | m_dir |
the direction of the agent, this will be represented as dir in the python sctipt | |
ngl::Vec3 | m_velocity |
the speed of the agent, this will be represented as speed in the python sctipt | |
std::string * | m_script |
the source string of the python script to be run | |
std::string | m_filename |
the name of the source string loaded (for the re-load) | |
PyObject * | m_main |
these are the python object we are going to hook into the above objects | |
PyObject * | m_dict |
a pointer to the python dictionary for all variables in __main__ | |
Brain * | m_brain |
a pointer to the brain of the agent | |
ngl::Vec3 | m_tempVel |
a vector to hold the initial velocity used to reset | |
ngl::Vec3 | m_tempPos |
a vector to hold the initial position used to reset | |
ngl::Vec3 | m_force |
a vector to hold the initial force used to reset | |
Models * | m_model |
a pointer to hold the models variable | |
std::string | m_meshName |
a string to hold the mesh name | |
std::list< Ammo * > | m_ammo |
a list to hold the bullets | |
Graph * | m_graph |
a pointer to hold the graph variable | |
int | m_index |
a variable to hold the index valuable that the agent is traversing | |
int | m_nextIndex |
a variable to hold the nextIndex valuable that the agent is traversing | |
std::vector< int > | m_route |
_route the std::vector of ints that contains the indices the agent has to traverse | |
int | m_precision |
a variable to the precision | |
Direction | m_direction |
an enumerated variable to indicate the direction of the agent | |
std::string | m_message |
a variable to hold the message of the agent | |
Agent * | m_parent |
a pointer to the parent agent | |
bool | m_hit |
a bool to indicate if the agent is hit or not | |
std::string | m_type |
a variable to hold the type of the agent | |
int | m_ID |
a variable to hold the ID of the agent | |
int | m_armyID |
a variable to hold the army ID that the agent belongs to | |
std::string | m_state |
a variable to hold the state of the agent | |
ngl::Vec3 | m_targetPos |
a variable to hold the target position that the agent has to trvaers | |
float | m_score |
a variable to hold the score of the agent |
our AIagents and its methods and variables put in this file
Definition at line 60 of file AIagent.h.
AIagent::AIagent | ( | std::string | _file, | |
PyObject * | _main, | |||
PyObject * | _dict, | |||
int | _index, | |||
std::string | _meshName, | |||
float | _radius, | |||
Models * | _model, | |||
Graph * | _graph, | |||
Agent * | _parent, | |||
std::string | _type, | |||
int | _ID, | |||
int | _armyID, | |||
std::string | _state | |||
) |
ctor
[in] | the | name of the python file to load, this will be stored so the file can be re-loaded. |
[in] | Python | variable main |
[in] | Python | variable dictionary |
[in] | the | initial index on the graph node where the agent is placed |
[in] | the | mesh name that is associated with the agent |
[in] | the | radius for boundary and collision checking |
[in] | the | model variable for meshes |
[in] | the | graph variable for traversing |
[in] | the | type of the agent |
[in] | the | unique ID of the agent |
[in] | the | unique army to which the agent belongs to |
[in] | the | state in which the agent is created |
AIagent::AIagent | ( | Agent * | _parent, | |
std::string | _file, | |||
PyObject * | _main, | |||
PyObject * | _dict, | |||
ngl::Vec3 | _pos, | |||
std::string | _type, | |||
float | _radius, | |||
Models * | _model, | |||
Graph * | _graph, | |||
std::string | _meshName, | |||
int | _ID | |||
) |
ctor
[in] | the | name of the python file to load, this will be stored so the file can be re-loaded. |
[in] | Python | variable main |
[in] | Python | variable dictionary |
[in] | the | initial position where the agent is placed |
[in] | the | type of the agent |
[in] | the | radius for boundary and collision checking |
[in] | the | model variable for meshes |
[in] | the | graph variable for traversing |
[in] | the | mesh name that is associated with the agent |
[in] | the | unique ID of the agent |
AIagent::~AIagent | ( | ) |
dtor will clear the strings and close down the python interpretor
void AIagent::brainFunction | ( | ) | [private] |
void AIagent::draw | ( | ngl::TransformStack * | _tx, | |
ngl::Camera * | _cam | |||
) |
draw the scene
[in] | _tx | the transform stack of the current scene |
[in] | _cam | the current camera |
Direction AIagent::getDirection | ( | ) | [inline] |
get the direction the agent is moving
Definition at line 215 of file AIagent.h.
References m_direction.
00215 {return m_direction;}
ngl::Vec3 AIagent::getForce | ( | ) | [inline] |
bool AIagent::getHitStatus | ( | ) | [inline] |
ngl::Vec3 AIagent::getHomePos | ( | ) | [inline] |
int AIagent::getIndex | ( | ) | [inline] |
std::string AIagent::getMessage | ( | ) | [inline] |
std::string AIagent::getName | ( | ) | [inline] |
get the agent name
Definition at line 184 of file AIagent.h.
References m_meshName.
00184 {return m_meshName;}
int AIagent::getNextIndex | ( | ) | [inline] |
get the next index of the graph that the agent traverses
Definition at line 188 of file AIagent.h.
References m_nextIndex.
00188 {return m_nextIndex;}
ngl::Vec3 AIagent::getPos | ( | ) | [inline] |
int AIagent::getPrecision | ( | ) | [inline] |
get precision
Definition at line 211 of file AIagent.h.
References m_precision.
00211 {return m_precision;}
float AIagent::getRadius | ( | ) | [inline] |
get the agent mesh radius
Definition at line 159 of file AIagent.h.
References Models::getModel(), m_meshName, and m_model.
00159 {return m_model->getModel(m_meshName)->getSphereRadius();}
int AIagent::getReset | ( | ) | [inline] |
float AIagent::getScore | ( | ) | [inline] |
std::string AIagent::getState | ( | ) | [inline] |
ngl::Vec3 AIagent::getTargetPos | ( | ) | [inline] |
get the target position that the agent is in pursuit
Definition at line 242 of file AIagent.h.
References m_targetPos.
00242 {return m_targetPos;}
std::string AIagent::getType | ( | ) | [inline] |
ngl::Vec3 AIagent::getVelocity | ( | ) | [inline] |
get the agent velocity
Definition at line 141 of file AIagent.h.
References m_velocity.
00141 {return m_velocity;}
void AIagent::queryEnvironment | ( | ) |
a method to query the environment to ask about the collisions
void AIagent::reloadScript | ( | ) |
delete the old script and re-load
void AIagent::reset | ( | ) |
reset the agent
void AIagent::resetScore | ( | ) | [inline] |
void AIagent::setApproachingAgentParams | ( | const float | _dist, | |
const ngl::Vec3 | _pos, | |||
const ngl::Vec3 | _vel | |||
) | [inline] |
set the approaching agent distance, velocity and position
[in] | _dist | the distance of the agent _pos the position of the agent and _vel the velocity of the agent |
Definition at line 133 of file AIagent.h.
References m_obsPos, m_obstacleDistance, and m_obsVel.
00133 {m_obstacleDistance = _dist; m_obsPos = _pos;m_obsVel = _vel;}
void AIagent::setDirection | ( | int | _direction | ) |
set the direction
[in] | _int | new direction value which corresponds to the enumerated direction |
void AIagent::setHitStatus | ( | ) | [inline] |
void AIagent::setIndex | ( | const int | _index | ) | [inline] |
void AIagent::setIntialWallBool | ( | bool | _wall | ) | [inline] |
void AIagent::setMessage | ( | const std::string | _message | ) | [inline] |
void AIagent::setNewScriptPath | ( | const std::string & | _p | ) |
pass in a new script and load this replacing the old one
[in] | _p | the path / name of the script to load. |
void AIagent::setNextIndex | ( | const int | _nextIndex | ) | [inline] |
set the index of the graph that the agent traverses
[in] | _nextIndex | the new index |
Definition at line 202 of file AIagent.h.
References m_nextIndex.
00202 {m_nextIndex = _nextIndex;}
void AIagent::setPosition | ( | const ngl::Vec3 | pos | ) | [inline] |
void AIagent::setRoute | ( | std::vector< int > | _route | ) |
set the route to the shortest path in the graph
[in] | _route | the std::vector of ints that contains the indices the agent has to traverse |
void AIagent::setScore | ( | const int | _score | ) | [inline] |
void AIagent::setState | ( | const std::string | _state | ) | [inline] |
void AIagent::setTargetPos | ( | const ngl::Vec3 | _pos | ) | [inline] |
set the target position
[in] | the | new target position _pos |
Definition at line 247 of file AIagent.h.
References m_targetPos.
00247 {m_targetPos = _pos;}
void AIagent::setVelocity | ( | const ngl::Vec3 | vel | ) | [inline] |
set the agent velocity
[in] | _vel | to set new velocity |
Definition at line 155 of file AIagent.h.
References m_velocity.
00155 {m_velocity = vel;}
void AIagent::setWallNormal | ( | const ngl::Vec3 | _normal, | |
const float | _dist | |||
) | [inline] |
set the wall normal and the distance of the wall when the agent collides with the wall
[in] | _normal | the normal of the wall and the _dist distance between the wall |
Definition at line 128 of file AIagent.h.
References m_wallDistance, and m_wallNormal.
00128 {m_wallNormal = _normal;m_wallDistance = _dist;}
void AIagent::update | ( | ) |
this method updates the agent
std::list<Ammo *> AIagent::m_ammo [private] |
int AIagent::m_armyID [private] |
Brain* AIagent::m_brain [private] |
PyObject* AIagent::m_dict [private] |
ngl::Vec3 AIagent::m_dir [private] |
Direction AIagent::m_direction [private] |
std::string AIagent::m_filename [private] |
ngl::Vec3 AIagent::m_force [private] |
Graph* AIagent::m_graph [private] |
bool AIagent::m_hit [private] |
int AIagent::m_ID [private] |
int AIagent::m_index [private] |
PyObject* AIagent::m_main [private] |
std::string AIagent::m_meshName [private] |
std::string AIagent::m_message [private] |
Models* AIagent::m_model [private] |
int AIagent::m_nextIndex [private] |
ngl::Vec3 AIagent::m_obsPos |
ngl::Vec3 AIagent::m_obsVel |
Agent* AIagent::m_parent [private] |
ngl::Vec3 AIagent::m_pos [private] |
int AIagent::m_precision [private] |
float AIagent::m_radius |
int AIagent::m_reset |
std::vector<int> AIagent::m_route [private] |
float AIagent::m_score [private] |
std::string* AIagent::m_script [private] |
std::string AIagent::m_state [private] |
ngl::Vec3 AIagent::m_targetPos [private] |
ngl::Vec3 AIagent::m_tempPos [private] |
ngl::Vec3 AIagent::m_tempVel [private] |
std::string AIagent::m_type [private] |
ngl::Vec3 AIagent::m_velocity [private] |
bool AIagent::m_wall |
float AIagent::m_wallDistance |
ngl::Vec3 AIagent::m_wallNormal |