tagGame::Perception Class Reference

Controller's should gain all access to game-state information through a perception object. More...

#include <Perception.h>

Collaboration diagram for tagGame::Perception:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 Perception (GameState *gs)
void setMe (Character *me)
 Set the character from whose point of view percepts are to be calculated.
void setTagged (Character *tagged)
 Set the character that is currently tagged.
CharactergetMe () const
 Accessors for the pushed information.
CharactergetTagged () const
RealVec const & myPosition () const
 Some basic information about me.
RealVec myVelocity () const
Real mySpeed () const
RealVec const & myOrientation () const
Real myMaxExtent () const
Real myExtent (RealVec const &dir) const
Real myMaxSpeed (void) const
bool myselfTagged () const
Character const * whoLastTaggedMe () const
 Memory percept for who last tagged me.
int myRecentTaggedCount () const
 Some memory percepts for recent events.
bool myselfRecentlyTagged () const
RealVec const & taggedPosition () const
 Some basic information about the tagged character.
RealVec taggedVelocity () const
RealVec taggedRelativePosition () const
Real distanceSquaredToTagged () const
Real distanceToTagged () const
RealVec taggedFuturePosition () const
 Predictor percept for tagged character's future position.
CharacternearestCharacter () const
 Information about the nearest character.
RealVec const & nearestCharacterPosition () const
RealVec nearestCharacterRelativePosition () const
Real distanceSquaredToNearestCharacter () const
Real distanceToNearestCharacter () const
ObstaclenearestObstacle () const
 Some information about obstacles.
RealVec nearestObstaclePosition () const
RealVec nearestObstacleRelativePosition () const
Real distanceSquaredToNearestObstacle () const
Real distanceToNearestObstacle () const
RealVec const & position (Obstacle const &which) const
 Information about an arbitary obstacle.
RealVec relativePosition (Obstacle const &which) const
Real distanceSquaredTo (Obstacle const &which) const
Real distanceTo (Obstacle const &which) const
Real timeToCollision () const
 Predictor percept for time until my next collision.
RealVec nextCollisionPoint () const
 Predictor percept for my next collision point.
ObstaclenextCollider () const
 Predictor percept for obstacle for my next collision.
int getFrame ()
 Some basic information about the game.
int getTicks ()
Real getTime ()
GameStategetGameState ()
 Full access to the underlying game-state should be restricted to debugging use only.

Static Public Attributes

static int const recentThreshold = 5000
 How many milliseconds ago counts as "recent".

Detailed Description

Controller's should gain all access to game-state information through a perception object.


Member Function Documentation

void tagGame::Perception::setMe ( Character me  )  [inline]

Set the character from whose point of view percepts are to be calculated.

This method should be called prior to the associated character's controller selecting an action. Most percepts "pull" information from the game as it is required by a controller. The "setMe" method is the main "push" method for telling a controller which character is selecting an action.

void tagGame::Perception::setTagged ( Character tagged  )  [inline]

Set the character that is currently tagged.

Information about which character is currently tagged could be "pulled" from the game, but currently the information is only stored locally in the tagged character. It is therefore more efficient for the game to explicitly "push" the information whenever a new character is tagged.

RealVec const & tagGame::Perception::position ( Obstacle const &  which  )  const [inline]

Information about an arbitary obstacle.

Note that, characters are also obstacles.

Real Perception::timeToCollision (  )  const

Predictor percept for time until my next collision.

For discrete-event simulation (see Chapter 2), an anlogous game-side function would need to be defined. Such a game-side version would have to provide reliable and conservative predictions. In contrast, this predictor percept only needs to be accurate enough to provide "reasonable" collision avoidance behavior. Where, in this case (as in many games), "reasonable" admits the possibility of the odd collision not being avoided.


The documentation for this class was generated from the following files:
Generated on Sat Mar 31 22:31:00 2007 for tagGame by  doxygen 1.5.1