Environment Class Reference

the variables and methods that a Environment contains put in this file More...

#include <Environment.h>

Collaboration diagram for Environment:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 Environment (ngl::TransformStack *_t, ngl::Camera *_cam)
 ctor
 ~Environment ()
 will explicitly call the Particle dtors as they are stored as pointers
void update ()
 update all the particles stored, if the particle died, delete it
void draw ()
 draw all the particles using the particle draw method
void addParticle ()
 add a new particle to the end of the list
unsigned int getNumParticles () const
 accessor for the number of particles stored in the class
const ngl::Camera * getCamera ()
 get the global camera
ngl::TransformStack * getTransformStack () const
 get the global transform stack
void clearParticles ()
 a method to clear all particles
void resetObject ()
 a method to reset the environment
void addNewFace (ngl::Vec3 _point, ngl::Vec3 _normal, face *_face)
 add a new face
void drawBox ()
 method to toggle the drawing the bounding box
int getPrecision ()
 get the precision
void createAgents ()
 method to create the agents
void agentsQueryUpdate (AIagent *_agent)
 method to invoke the query from the agents
void agentWallCollision (AIagent *_agent)
 method to check the wall collision
void agentObstacleCollision (AIagent *_agent)
 method to check the obstacle collision
void agentAgentCollision ()
 method to check the agent agent collision
void approachingAgent (AIagent *_agent)
 method to check the approaching agent
void drawGrid ()
 method to draw the grid
void calculateBBox (std::string _name)
 method to calculate the faces of the bounding Box
void addArmy (PyObject *_main, PyObject *_dict)
 create a new Army with a set of artificial agents
void addAgent (std::string _file, PyObject *_main, PyObject *_dict, int _index, std::string _meshName, float _radius, std::string _type, int _id)
 add a new AI agent
void addAgent (int _index, std::string _meshName, std::string _name)
 add a new User agent
AIagentgetAgent (int _id)
 method to get the agent based on ID
void startPong ()
 method to start pong game
void assignPositions ()
 method to assign the positions of obstacles to keep a track of the obstacles
void InitMap ()
 method to Initialize the map of the environment
void calculateEdges ()
 method to calculate the edges for the nodes and set the contours around the nodes for better obstacle avoidance
void setMessage (const std::string _message)
 method to send messages to the AI agents
void setGameEntityPositions ()
 method to set the Initial game entity positions like the gold coins and bullets
void checkUserEntityCollection ()
 method to check the user agent with the game entities
int getScoreToPrint ()
 method to get the score to print
int getNoOfBulletsLeftToPrint ()
 method to get the no of bullets of the user agent left
void checkBulletCollisions (std::list< Ammo * > _bullets)
 method to check the bullet collision with the obstacle or the agents
void processKeyDown (QKeyEvent *_event)
 processKeyDown passed from the main window class
void processKeyUp (QKeyEvent *_event)
 processKeyUp passed from the main window class

Public Attributes

float m_redScore
float m_blueScore
bool m_drawBox
 the bool to toggle drawBox

Private Attributes

float m_precision
 a variable to store the precision value
std::list< Agent * > m_agents
 a list to store the agents
ngl::TransformStack * m_transform
 the global transform stack, used for global rotation only so could be replaced with a single matrix if required
ngl::Camera * m_cam
 a pointer to the current camera, this is used for accesing the VP matrix to load to the shader
std::list< face * > m_faces
 list to hold the faces of the bounding box
float m_width
 variable to define the width of the map
float m_height
 variable to define the width of the map
bool m_add
 variable to check if particles are added
bool m_initAgent
 bool to check if the agents are created
bool m_pong
 variable to check if pong is started
bool m_mazeGame
 variable to check if the maze game is started
ngl::BBox * table
 pointer to save the BBox of the mesh
ngl::BBox m_court
 pointer to save the BBox of the mesh
ngl::Vec3 m_normals [6]
 vector to save the normals
ngl::Vec3 m_verts [8]
 vector to save the verts
Mapm_map
 pointer to save the map
Modelsm_model
 pointer to save the model
Parserm_parser
 the object for the parser class to load the transformations to load the level
std::vector< int > m_obstaclePositions
 the vector to hold the obstacle information read from the parser
std::map< std::string,
std::list< face * > > 
m_objFaces
 a map to hold our faces by name
std::vector< ngl::Vec3 > m_obstacles
 a vector to save the obstacles
std::list< GameEntity * > m_gameEntities
 a list to save the game entities
AgentOctree * collisionTree
 a pointer to collision tree
Graphm_graph
 a pointer to graph
bool m_find
 a bool to find shortest path
Agentm_agent
 a pointer to agent
std::vector< ngl::Transformation > m_levelTransform
 a pointer to agent

Detailed Description

the variables and methods that a Environment contains put in this file

Definition at line 68 of file Environment.h.


Constructor & Destructor Documentation

Environment::Environment ( ngl::TransformStack *  _t,
ngl::Camera *  _cam 
)

ctor

Parameters:
[in] _t a pointer to the global transform stack
[in] _cam a pointer to the global camera
Environment::~Environment (  ) 

will explicitly call the Particle dtors as they are stored as pointers


Member Function Documentation

void Environment::addAgent ( int  _index,
std::string  _meshName,
std::string  _name 
)

add a new User agent

Parameters:
[in] the initial position on the graph node where the agent is placed
[in] the mesh name that is associated with the agent
[in] the unique name of the agent
void Environment::addAgent ( std::string  _file,
PyObject *  _main,
PyObject *  _dict,
int  _index,
std::string  _meshName,
float  _radius,
std::string  _type,
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 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
void Environment::addArmy ( PyObject *  _main,
PyObject *  _dict 
)

create a new Army with a set of artificial agents

Parameters:
[in] Python variable main
[in] Python variable dictionary
void Environment::addNewFace ( ngl::Vec3  _point,
ngl::Vec3  _normal,
face _face 
)

add a new face

Parameters:
[in] the _point centre of the face
[in] the _normal of the face
[in] the _face of type face
void Environment::addParticle (  ) 

add a new particle to the end of the list

Parameters:
[in] _pos position of the new particle
[in] _dir speed of the particle
[in] _c the color of this sphere
[in] _r the radius of this particle sphere
[in] _ml the maximum life of this particle
void Environment::agentAgentCollision (  ) 

method to check the agent agent collision

Parameters:
[in] the _agent the artificial agent
void Environment::agentObstacleCollision ( AIagent _agent  ) 

method to check the obstacle collision

Parameters:
[in] the _agent the artificial agent
void Environment::agentsQueryUpdate ( AIagent _agent  ) 

method to invoke the query from the agents

Parameters:
[in] the _agent the artificial agent
void Environment::agentWallCollision ( AIagent _agent  ) 

method to check the wall collision

Parameters:
[in] the _agent the artificial agent
void Environment::approachingAgent ( AIagent _agent  ) 

method to check the approaching agent

Parameters:
[in] the _agent the artificial agent
void Environment::assignPositions (  ) 

method to assign the positions of obstacles to keep a track of the obstacles

void Environment::calculateBBox ( std::string  _name  ) 

method to calculate the faces of the bounding Box

Parameters:
[in] the _name the mesh
void Environment::calculateEdges (  ) 

method to calculate the edges for the nodes and set the contours around the nodes for better obstacle avoidance

void Environment::checkBulletCollisions ( std::list< Ammo * >  _bullets  ) 

method to check the bullet collision with the obstacle or the agents

Parameters:
[in] the list of bullets _bullets
void Environment::checkUserEntityCollection (  ) 

method to check the user agent with the game entities

void Environment::clearParticles (  ) 

a method to clear all particles

void Environment::createAgents (  ) 

method to create the agents

void Environment::draw (  ) 

draw all the particles using the particle draw method

void Environment::drawBox (  ) 

method to toggle the drawing the bounding box

Here is the caller graph for this function:

void Environment::drawGrid (  ) 

method to draw the grid

AIagent* Environment::getAgent ( int  _id  ) 

method to get the agent based on ID

Parameters:
[in] the _id of the agent
const ngl::Camera* Environment::getCamera (  )  [inline]

get the global camera

Definition at line 106 of file Environment.h.

References m_cam.

00106 {return m_cam;}

int Environment::getNoOfBulletsLeftToPrint (  ) 

method to get the no of bullets of the user agent left

unsigned int Environment::getNumParticles (  )  const

accessor for the number of particles stored in the class

Returns:
the number of particles
int Environment::getPrecision (  )  [inline]

get the precision

Definition at line 133 of file Environment.h.

References m_precision.

00133 {return m_precision;}

int Environment::getScoreToPrint (  ) 

method to get the score to print

ngl::TransformStack* Environment::getTransformStack (  )  const [inline]

get the global transform stack

Definition at line 110 of file Environment.h.

References m_transform.

00110 {return m_transform;}

void Environment::InitMap (  ) 

method to Initialize the map of the environment

void Environment::processKeyDown ( QKeyEvent *  _event  ) 

processKeyDown passed from the main window class

Parameters:
*_event a pointer to the QKeyEvent passed from main window class
void Environment::processKeyUp ( QKeyEvent *  _event  ) 

processKeyUp passed from the main window class

Parameters:
*_event a pointer to the QKeyEvent passed from main window class
void Environment::resetObject (  ) 

a method to reset the environment

Here is the caller graph for this function:

void Environment::setGameEntityPositions (  ) 

method to set the Initial game entity positions like the gold coins and bullets

void Environment::setMessage ( const std::string  _message  ) 

method to send messages to the AI agents

void Environment::startPong (  ) 

method to start pong game

Here is the caller graph for this function:

void Environment::update (  ) 

update all the particles stored, if the particle died, delete it


Member Data Documentation

AgentOctree* Environment::collisionTree [private]

a pointer to collision tree

Definition at line 363 of file Environment.h.

bool Environment::m_add [private]

variable to check if particles are added

Definition at line 303 of file Environment.h.

a pointer to agent

Definition at line 375 of file Environment.h.

std::list<Agent *> Environment::m_agents [private]

a list to store the agents

Definition at line 278 of file Environment.h.

Definition at line 263 of file Environment.h.

ngl::Camera* Environment::m_cam [private]

a pointer to the current camera, this is used for accesing the VP matrix to load to the shader

Definition at line 288 of file Environment.h.

ngl::BBox Environment::m_court [private]

pointer to save the BBox of the mesh

Definition at line 323 of file Environment.h.

the bool to toggle drawBox

Definition at line 267 of file Environment.h.

std::list<face *> Environment::m_faces [private]

list to hold the faces of the bounding box

Definition at line 291 of file Environment.h.

bool Environment::m_find [private]

a bool to find shortest path

Definition at line 371 of file Environment.h.

std::list<GameEntity *> Environment::m_gameEntities [private]

a list to save the game entities

Definition at line 359 of file Environment.h.

a pointer to graph

Definition at line 367 of file Environment.h.

float Environment::m_height [private]

variable to define the width of the map

Definition at line 299 of file Environment.h.

bool Environment::m_initAgent [private]

bool to check if the agents are created

Definition at line 307 of file Environment.h.

std::vector<ngl::Transformation> Environment::m_levelTransform [private]

a pointer to agent

Definition at line 379 of file Environment.h.

Map* Environment::m_map [private]

pointer to save the map

Definition at line 335 of file Environment.h.

bool Environment::m_mazeGame [private]

variable to check if the maze game is started

Definition at line 315 of file Environment.h.

pointer to save the model

Definition at line 339 of file Environment.h.

ngl::Vec3 Environment::m_normals[6] [private]

vector to save the normals

Definition at line 327 of file Environment.h.

std::map<std::string, std::list<face*> > Environment::m_objFaces [private]

a map to hold our faces by name

Definition at line 351 of file Environment.h.

std::vector<int> Environment::m_obstaclePositions [private]

the vector to hold the obstacle information read from the parser

Definition at line 347 of file Environment.h.

std::vector<ngl::Vec3> Environment::m_obstacles [private]

a vector to save the obstacles

Definition at line 355 of file Environment.h.

the object for the parser class to load the transformations to load the level

Definition at line 343 of file Environment.h.

bool Environment::m_pong [private]

variable to check if pong is started

Definition at line 311 of file Environment.h.

float Environment::m_precision [private]

a variable to store the precision value

Definition at line 274 of file Environment.h.

Definition at line 262 of file Environment.h.

ngl::TransformStack* Environment::m_transform [private]

the global transform stack, used for global rotation only so could be replaced with a single matrix if required

Definition at line 283 of file Environment.h.

ngl::Vec3 Environment::m_verts[8] [private]

vector to save the verts

Definition at line 331 of file Environment.h.

float Environment::m_width [private]

variable to define the width of the map

Definition at line 295 of file Environment.h.

ngl::BBox* Environment::table [private]

pointer to save the BBox of the mesh

Definition at line 319 of file Environment.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