Agent Class Reference

our agents and its basic atrributes put in this file More...

#include <Agent.h>

Collaboration diagram for Agent:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 Agent (Environment *_environment, Models *_model, Graph *_graph)
 ctor passing in the environment variable which is the parent in which the agents exist the models class variable which contains the meshes to draw Graph class for the nodes
 ~Agent ()
 dtor will clear the agents it contains
void update ()
 this method updates all the agents
void draw (ngl::TransformStack *_tx, ngl::Camera *_cam)
 draw the scene
float getScore ()
 get the score of the agent
void setScore (const int _score)
 set the score of the agent
void resetScore ()
 reset the score of the agent
int getReset ()
int getPrecision ()
 get the precision value i.e, no of nodes per dimension in the node graph
ngl::Vec3 getAITargetPos (int _ID)
void setAITargetPos (const ngl::Vec3 _pos, const int _ID)
 set the target object position to the agent
void setAITargetPos (const ngl::Vec3 _pos)
 set the target object position to all the agents
ngl::Vec3 getUserPosition (std::string _name)
 get the user agent position
void addNewArmy (PyObject *_main, PyObject *_dict)
 create a new Army with a set of artificial agents
void addAIagent (std::string _file, PyObject *_main, PyObject *_dict, int _index, std::string _meshName, float _radius, std::string _type, int _id, int _armyId, std::string _state)
 add a new AI agent
void addAIagent (std::string _file, PyObject *_main, PyObject *_dict, ngl::Vec3 _pos, std::string _type, float _radius, std::string _meshName, int _ID)
 add a new AI agent
void addUserAgent (int _index, std::string _meshName, std::string _name)
 add a new User agent
AIagentgetAIagent (int _id)
 get the AI agent
UserAgentgetUserAgent (std::string _name)
 get the user agent
void addPongPlayers (PyObject *_main, PyObject *_dict)
 add agents for the pong game
void clearAgents ()
 clear the agents
void resetAgents ()
 reset the agents to their home positions
void setInitialOccupiedStatus ()
 set the initial status of the nodes occupied by the agents to occupuied
void addPongPlayers (PyObject *_main, PyObject *_dict, ngl::Vec3 _pos1, ngl::Vec3 _pos2)
 add agents fot the pong game
void agentsQueryUpdate (AIagent *_agent)
 query the environment in each iteration for collisions and update
void checkUserBulletsCollision (std::list< Ammo * > _bullets)
 the User bullets collision status
void checKTheAIhitstatus (Ammo *_ammo)
 check if the agents are hit with the bullets
std::list< AIagent * > getAIagentsList ()
 get the list of AI agents

Private Attributes

PyObject * m_main
 a hook into the python __main__ function where I program is to be run from
PyObject * m_dict
 a pointer to the python dictionary for all variables in __main__
Environmentm_environment
 a pointer to the environment variable
Modelsm_model
 a pointer to the models variable
Graphm_graph
 a pointer to the graph variable
int m_precision
 a variable to specify the dimension of the graph
std::list< AIagent * > m_aiAgents
 a list to hold the AI agents
std::list< AIagent * > m_aiAgentsTempVector
 a temporary list to hold the AI agents while creating army with the agents
std::list< UserAgent * > m_userAgent
 a list to hold the user agents
std::map< int, AIagent * > m_aiAgentMap
 a map to hold the agents with the unique ID
std::map< std::string,
UserAgent * > 
m_userAgentMap
 a map to hold the user agents with the name
std::list< Army * > m_armies
 a list to hold the armies
std::map< int, Army * > m_armyMap
 a map of the armies with the ID
int m_aiagentID
 a int to assign the agent ID
int m_armyID
 a int to assign the army ID

Detailed Description

our agents and its basic atrributes put in this file

Definition at line 46 of file Agent.h.


Constructor & Destructor Documentation

Agent::Agent ( Environment _environment,
Models _model,
Graph _graph 
)

ctor passing in the environment variable which is the parent in which the agents exist the models class variable which contains the meshes to draw Graph class for the nodes

Parameters:
[in] the environment
[in] the model
[in] the graph
Agent::~Agent (  ) 

dtor will clear the agents it contains


Member Function Documentation

void Agent::addAIagent ( std::string  _file,
PyObject *  _main,
PyObject *  _dict,
ngl::Vec3  _pos,
std::string  _type,
float  _radius,
std::string  _meshName,
int  _ID 
)

add a new AI agent

Parameters:
[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 radius for boundary and collision checking
[in] the type of the agent
[in] the unique ID of the agent
void Agent::addAIagent ( std::string  _file,
PyObject *  _main,
PyObject *  _dict,
int  _index,
std::string  _meshName,
float  _radius,
std::string  _type,
int  _id,
int  _armyId,
std::string  _state 
)

add a new AI agent

Parameters:
[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 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
void Agent::addNewArmy ( PyObject *  _main,
PyObject *  _dict 
)

create a new Army with a set of artificial agents

Parameters:
[in] Python variable main
[in] Python variable dictionary
void Agent::addPongPlayers ( PyObject *  _main,
PyObject *  _dict,
ngl::Vec3  _pos1,
ngl::Vec3  _pos2 
)

add agents fot the pong game

Parameters:
[in] Python variables
[in] Positions for the placement of the agents
void Agent::addPongPlayers ( PyObject *  _main,
PyObject *  _dict 
)

add agents for the pong game

Parameters:
[in] the python varialbes
void Agent::addUserAgent ( int  _index,
std::string  _meshName,
std::string  _name 
)

add a new User agent

Parameters:
[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 name of the agent
void Agent::agentsQueryUpdate ( AIagent _agent  ) 

query the environment in each iteration for collisions and update

void Agent::checKTheAIhitstatus ( Ammo _ammo  ) 

check if the agents are hit with the bullets

void Agent::checkUserBulletsCollision ( std::list< Ammo * >  _bullets  ) 

the User bullets collision status

void Agent::clearAgents (  ) 

clear the agents

void Agent::draw ( ngl::TransformStack *  _tx,
ngl::Camera *  _cam 
)

draw the scene

Parameters:
[in] _tx the transform stack of the current scene
[in] _cam the current camera
AIagent* Agent::getAIagent ( int  _id  ) 

get the AI agent

Parameters:
[in] the unique index of the agent
std::list<AIagent* > Agent::getAIagentsList (  )  [inline]

get the list of AI agents

Definition at line 200 of file Agent.h.

References m_aiAgents.

00200 {return m_aiAgents;}

ngl::Vec3 Agent::getAITargetPos ( int  _ID  ) 
int Agent::getPrecision (  ) 

get the precision value i.e, no of nodes per dimension in the node graph

Parameters:
[out] the precision
int Agent::getReset (  )  [inline]
float Agent::getScore (  )  [inline]

get the score of the agent

Parameters:
[out] the score of the agent
UserAgent* Agent::getUserAgent ( std::string  _name  ) 

get the user agent

Parameters:
[in] the name of the agent
ngl::Vec3 Agent::getUserPosition ( std::string  _name  ) 

get the user agent position

void Agent::resetAgents (  ) 

reset the agents to their home positions

void Agent::resetScore (  )  [inline]

reset the score of the agent

void Agent::setAITargetPos ( const ngl::Vec3  _pos  ) 

set the target object position to all the agents

Parameters:
[in] the new target position
void Agent::setAITargetPos ( const ngl::Vec3  _pos,
const int  _ID 
)

set the target object position to the agent

Parameters:
[in] the new target position
[in] the ID of the agent
void Agent::setInitialOccupiedStatus (  ) 

set the initial status of the nodes occupied by the agents to occupuied

void Agent::setScore ( const int  _score  )  [inline]

set the score of the agent

Parameters:
[in] the new score of the agent
void Agent::update (  ) 

this method updates all the agents


Member Data Documentation

int Agent::m_aiagentID [private]

a int to assign the agent ID

Definition at line 261 of file Agent.h.

std::map<int, AIagent *> Agent::m_aiAgentMap [private]

a map to hold the agents with the unique ID

Definition at line 245 of file Agent.h.

std::list<AIagent *> Agent::m_aiAgents [private]

a list to hold the AI agents

Definition at line 233 of file Agent.h.

std::list<AIagent *> Agent::m_aiAgentsTempVector [private]

a temporary list to hold the AI agents while creating army with the agents

Definition at line 237 of file Agent.h.

std::list<Army* > Agent::m_armies [private]

a list to hold the armies

Definition at line 253 of file Agent.h.

int Agent::m_armyID [private]

a int to assign the army ID

Definition at line 265 of file Agent.h.

std::map<int , Army *> Agent::m_armyMap [private]

a map of the armies with the ID

Definition at line 257 of file Agent.h.

PyObject* Agent::m_dict [private]

a pointer to the python dictionary for all variables in __main__

Definition at line 213 of file Agent.h.

a pointer to the environment variable

Definition at line 217 of file Agent.h.

Graph* Agent::m_graph [private]

a pointer to the graph variable

Definition at line 225 of file Agent.h.

PyObject* Agent::m_main [private]

a hook into the python __main__ function where I program is to be run from

Definition at line 209 of file Agent.h.

Models* Agent::m_model [private]

a pointer to the models variable

Definition at line 221 of file Agent.h.

int Agent::m_precision [private]

a variable to specify the dimension of the graph

Definition at line 229 of file Agent.h.

std::list<UserAgent *> Agent::m_userAgent [private]

a list to hold the user agents

Definition at line 241 of file Agent.h.

std::map<std::string, UserAgent*> Agent::m_userAgentMap [private]

a map to hold the user agents with the name

Definition at line 249 of file Agent.h.


The documentation for this class was generated from the following file:

Generated on 16 Aug 2013 for Multi-AgentSystem by  doxygen 1.6.1