#include <soccerruleaspect.h>
Inheritance diagram for SoccerRuleAspect:
Public Types | |
typedef std::list< boost::shared_ptr< AgentState > > | TAgentStateList |
Public Member Functions | |
SoccerRuleAspect () | |
virtual | ~SoccerRuleAspect () |
virtual void | Update (float deltaTime) |
called during the update of the GameControlServer to allow the ControlAspect to perform any necessary checks. | |
void | DropBall () |
Drop ball at its current position and move all players away by the free kick radius. | |
void | DropBall (salt::Vector3f pos) |
Drop ball at a given position and move all players away from that position by the free kick radius. | |
void | Broadcast (const std::string &message, const salt::Vector3f &pos, int number, TTeamIndex idx) |
broadcast a said message to all players | |
void | ClearPlayersWithException (const salt::Vector3f &pos, float radius, float min_dist, TTeamIndex idx, boost::shared_ptr< AgentState > agentState) |
Move all the players from a team which are too close to pos away from pos, with exception of the specified agent. | |
Protected Member Functions | |
virtual void | UpdateCachedInternal () |
rereads the current soccer script values | |
virtual void | OnLink () |
set up the reference to the ball and field collider | |
virtual void | OnUnlink () |
reset the reference to the ball and field recorder | |
void | CheckTime () |
checks if the time for one game half has passed | |
void | UpdateBeforeKickOff () |
updates the RuleAspect during BeforeKickOff mode | |
void | UpdateKickOff (TTeamIndex idx=TI_NONE) |
updates the RuleAspect during KickOff mode | |
void | UpdateKickIn (TTeamIndex ti=TI_NONE) |
updates the RuleAspect during KickIn mode | |
void | UpdateGoalKick (TTeamIndex ti=TI_NONE) |
updates the RuleAspect during Goal Kick mode | |
void | UpdateCornerKick (TTeamIndex ti=TI_NONE) |
updates the RuleAspect during Corner Kick mode | |
void | UpdatePlayOn () |
update the RuleAspect during PlayOn mode | |
void | UpdateGoal () |
update the RuleAspect during Goal mode | |
void | UpdateOffside (TTeamIndex ti=TI_NONE) |
update the RuleAspect during Offside mode | |
void | UpdateGameOver () |
update the RuleAspect when the match is over | |
bool | CheckBallLeftField () |
checks if the ball is not on the playing field and puts it back to its last valid position. | |
bool | CheckGoal () |
Checks if the ball is in one of the two goals and scores the appropriate team. | |
bool | CheckOffside () |
checks if the assistant referee should raise the flag for offside | |
void | MoveBall (const salt::Vector3f &pos) |
moves the ball to pos setting its linear and angular velocity to 0 | |
void | MoveAgent (boost::shared_ptr< oxygen::Body > agent_body, const salt::Vector3f &pos) |
Moves an agent to pos setting its linear and angular velocity to 0. | |
void | ClearPlayers (const salt::Vector3f &pos, float radius, float min_dist, TTeamIndex idx) |
Move all the players from a team which are too close to pos away from pos. | |
void | ClearPlayers (const salt::AABB2 &box, float min_dist, TTeamIndex idx) |
Move all the players from a team inside an rectangular area away from that area. | |
Protected Attributes | |
boost::shared_ptr< oxygen::Body > | mBallBody |
reference to the body node of the Ball | |
boost::shared_ptr< GameStateAspect > | mGameState |
reference to the GameStateAspect | |
boost::shared_ptr< BallStateAspect > | mBallState |
reference to the BallStateAspect | |
float | mBallRadius |
the radius of the Ball | |
float | mGoalPauseTime |
the length of the pause after a goal | |
float | mKickInPauseTime |
the length of the pause after the ball left the field | |
float | mHalfTime |
the length of one game half | |
float | mDropBallTime |
the time we wait before dropping the ball in play modes where only one team can touch the ball | |
salt::Vector3f | mLastValidBallPos |
the point above the ground, where the ball left the field | |
float | mFieldLength |
the field length (in meters) | |
float | mFieldWidth |
the field width (in meters) | |
float | mGoalWidth |
the goal width (in meters) | |
salt::Vector3f | mFreeKickPos |
the point on the field where we do the kick in, free kick etc. | |
float | mFreeKickDist |
the distance opponents have to keep during free kicks, kick ins etc. | |
float | mFreeKickMoveDist |
the (least) distance opponents will be moved away if they are to close during a free kick, kick in and situations like that. | |
bool | mAutomaticKickOff |
flag if the simulator should do the kick off automatically after the agent | |
float | mWaitBeforeKickOff |
time to wait until we kick off automatically | |
bool | mSingleHalfTime |
flag if we want to play only one half of the match | |
salt::AABB2 | mRightHalf |
bounding box for the right half of the field | |
salt::AABB2 | mLeftHalf |
bounding box for the left half of the field | |
salt::AABB2 | mRightPenaltyArea |
bounding box for the right penalty area | |
salt::AABB2 | mLeftPenaltyArea |
bounding box for the left penalty area | |
int | mSayMsgSize |
say message size max limit | |
float | mAudioCutDist |
max distance that player can hear a message | |
std::vector< int > | mInOffsideLeftPlayers |
list of players that are in offside position | |
std::vector< int > | mInOffsideRightPlayers |
boost::shared_ptr< oxygen::AgentAspect > | mPreLastCollidingAgent |
bool | mFirstCollidingAgent |
first colliding player in playon mode | |
bool | mNotOffside |
if agents don't pass don't worry about offside | |
bool | mUseOffside |
use offside law |
Definition at line 43 of file soccerruleaspect.h.
|
Definition at line 46 of file soccerruleaspect.h. |
|
Definition at line 40 of file soccerruleaspect.cpp. |
|
Definition at line 58 of file soccerruleaspect.cpp. |
|
broadcast a said message to all players
|
|
checks if the ball is not on the playing field and puts it back to its last valid position. returns true if the ball left the field Definition at line 382 of file soccerruleaspect.cpp. References salt::gAbs(), SoccerBase::GetAgentState(), mBallBody, mBallRadius, mBallState, mFieldLength, mFieldWidth, mFreeKickPos, mGameState, MoveBall(), PM_CORNER_KICK_LEFT, PM_CORNER_KICK_RIGHT, PM_GOAL_KICK_LEFT, PM_GOAL_KICK_RIGHT, PM_KickIn_Left, PM_KickIn_Right, TI_LEFT, salt::TVector3< DATATYPE, TYPE >::x(), and salt::TVector3< DATATYPE, TYPE >::y(). Referenced by UpdatePlayOn(). Here is the call graph for this function: ![]() |
|
Checks if the ball is in one of the two goals and scores the appropriate team.
Definition at line 478 of file soccerruleaspect.cpp. References mBallState, mGameState, PM_Goal_Left, PM_Goal_Right, TI_LEFT, TI_NONE, and TI_RIGHT. Referenced by UpdatePlayOn(). |
|
checks if the assistant referee should raise the flag for offside
Definition at line 814 of file soccerruleaspect.cpp. References SoccerBase::GetAgentBody(), SoccerBase::GetAgentState(), SoccerBase::GetAgentStates(), SoccerBase::GetTransformParent(), mBallBody, mBallRadius, mFirstCollidingAgent, mFreeKickPos, mGameState, mInOffsideLeftPlayers, mInOffsideRightPlayers, mNotOffside, mPreLastCollidingAgent, SoccerBase::OpponentTeam(), PM_OFFSIDE_LEFT, PM_OFFSIDE_RIGHT, TI_LEFT, and TI_RIGHT. Referenced by UpdatePlayOn(). Here is the call graph for this function: ![]() |
|
checks if the time for one game half has passed
Definition at line 564 of file soccerruleaspect.cpp. References GH_FIRST, GH_SECOND, mGameState, mHalfTime, mSingleHalfTime, PM_BeforeKickOff, and PM_GameOver. Referenced by Update(). |
|
Move all the players from a team inside an rectangular area away from that area.
Definition at line 125 of file soccerruleaspect.cpp. References salt::AABB2::Contains(), SoccerBase::GetAgentBody(), SoccerBase::GetAgentStates(), SoccerBase::GetTransformParent(), salt::AABB2::maxVec, mBallState, salt::AABB2::minVec, MoveAgent(), TI_LEFT, and TI_NONE. Here is the call graph for this function: ![]() |
|
Move all the players from a team which are too close to pos away from pos.
Definition at line 79 of file soccerruleaspect.cpp. References salt::BoundingSphere::Contains(), SoccerBase::GetAgentBody(), SoccerBase::GetAgentStates(), SoccerBase::GetTransformParent(), mBallState, mFieldLength, MoveAgent(), TI_LEFT, and TI_NONE. Referenced by DropBall(), UpdateBeforeKickOff(), UpdateCornerKick(), UpdateGoalKick(), UpdateKickIn(), UpdateKickOff(), and UpdateOffside(). Here is the call graph for this function: ![]() |
|
Move all the players from a team which are too close to pos away from pos, with exception of the specified agent.
|
|
Drop ball at a given position and move all players away from that position by the free kick radius.
Definition at line 167 of file soccerruleaspect.cpp. References ClearPlayers(), salt::AABB2::Contains(), salt::AABB2::maxVec, mFreeKickDist, mFreeKickMoveDist, mGameState, salt::AABB2::minVec, mLeftPenaltyArea, MoveBall(), mRightPenaltyArea, PM_PlayOn, TI_LEFT, TI_RIGHT, salt::TVector3< DATATYPE, TYPE >::x(), and salt::TVector3< DATATYPE, TYPE >::y(). Here is the call graph for this function: ![]() |
|
Drop ball at its current position and move all players away by the free kick radius.
Definition at line 161 of file soccerruleaspect.cpp. References mBallBody. Referenced by UpdateCornerKick(), UpdateGoalKick(), UpdateKickIn(), UpdateKickOff(), and UpdateOffside(). |
|
Moves an agent to pos setting its linear and angular velocity to 0.
Referenced by ClearPlayers(). |
|
moves the ball to pos setting its linear and angular velocity to 0
Definition at line 63 of file soccerruleaspect.cpp. References mBallBody. Referenced by CheckBallLeftField(), DropBall(), UpdateBeforeKickOff(), UpdateCornerKick(), UpdateGoal(), UpdateGoalKick(), UpdateKickIn(), and UpdateOffside(). |
|
set up the reference to the ball and field collider
Reimplemented from SoccerControlAspect. Definition at line 679 of file soccerruleaspect.cpp. References SoccerBase::GetBallBody(), oxygen::ControlAspect::GetControlAspect(), mBallBody, mBallState, mGameState, and SoccerControlAspect::OnLink(). Here is the call graph for this function: ![]() |
|
reset the reference to the ball and field recorder
Reimplemented from zeitgeist::Leaf. Definition at line 693 of file soccerruleaspect.cpp. References mBallBody, mBallState, mGameState, and zeitgeist::Leaf::OnUnlink(). Here is the call graph for this function: ![]() |
|
called during the update of the GameControlServer to allow the ControlAspect to perform any necessary checks.
Implements oxygen::ControlAspect. Definition at line 589 of file soccerruleaspect.cpp. References CheckTime(), zeitgeist::Object::GetLog(), mBallBody, mBallState, mGameState, PM_BeforeKickOff, PM_CORNER_KICK_LEFT, PM_CORNER_KICK_RIGHT, PM_GameOver, PM_GOAL_KICK_LEFT, PM_GOAL_KICK_RIGHT, PM_Goal_Left, PM_Goal_Right, PM_KickIn_Left, PM_KickIn_Right, PM_KickOff_Left, PM_KickOff_Right, PM_OFFSIDE_LEFT, PM_OFFSIDE_RIGHT, PM_PlayOn, TI_LEFT, TI_RIGHT, UpdateBeforeKickOff(), UpdateCachedInternal(), UpdateCornerKick(), UpdateGameOver(), UpdateGoal(), UpdateGoalKick(), UpdateKickIn(), UpdateKickOff(), UpdateOffside(), and UpdatePlayOn(). Here is the call graph for this function: ![]() |
|
updates the RuleAspect during BeforeKickOff mode
Definition at line 192 of file soccerruleaspect.cpp. References ClearPlayers(), mAutomaticKickOff, mBallRadius, mGameState, mLeftHalf, MoveBall(), mRightHalf, mWaitBeforeKickOff, TI_LEFT, and TI_RIGHT. Referenced by Update(). Here is the call graph for this function: ![]() |
|
rereads the current soccer script values
Reimplemented from zeitgeist::Leaf. Definition at line 704 of file soccerruleaspect.cpp. References SoccerBase::GetSoccerVar(), mAutomaticKickOff, mBallRadius, mDropBallTime, mFieldLength, mFieldWidth, mFreeKickDist, mGoalPauseTime, mGoalWidth, mHalfTime, mKickInPauseTime, mLeftHalf, mLeftPenaltyArea, mRightHalf, mRightPenaltyArea, mSingleHalfTime, mUseOffside, and mWaitBeforeKickOff. Referenced by Update(). Here is the call graph for this function: ![]() |
|
updates the RuleAspect during Corner Kick mode
Definition at line 339 of file soccerruleaspect.cpp. References ClearPlayers(), DropBall(), mBallState, mDropBallTime, mFreeKickDist, mFreeKickMoveDist, mFreeKickPos, mGameState, mKickInPauseTime, MoveBall(), SoccerBase::OpponentTeam(), and PM_PlayOn. Referenced by Update(). Here is the call graph for this function: ![]() |
|
update the RuleAspect when the match is over
Definition at line 546 of file soccerruleaspect.cpp. References zeitgeist::Object::GetCore(), and mGameState. Referenced by Update(). Here is the call graph for this function: ![]() |
|
update the RuleAspect during Goal mode
Definition at line 519 of file soccerruleaspect.cpp. References mBallRadius, mGameState, mGoalPauseTime, MoveBall(), PM_Goal_Left, TI_LEFT, and TI_RIGHT. Referenced by Update(). Here is the call graph for this function: ![]() |
|
updates the RuleAspect during Goal Kick mode
Definition at line 283 of file soccerruleaspect.cpp. References ClearPlayers(), salt::AABB2::Contains(), DropBall(), mBallBody, mBallState, mDropBallTime, mFreeKickPos, mGameState, mKickInPauseTime, mLeftPenaltyArea, MoveBall(), mRightPenaltyArea, SoccerBase::OpponentTeam(), PM_PlayOn, TI_LEFT, TI_NONE, and TI_RIGHT. Referenced by Update(). Here is the call graph for this function: ![]() |
|
updates the RuleAspect during KickIn mode
Definition at line 238 of file soccerruleaspect.cpp. References ClearPlayers(), DropBall(), zeitgeist::Object::GetLog(), mBallState, mDropBallTime, mFreeKickDist, mFreeKickMoveDist, mFreeKickPos, mGameState, mKickInPauseTime, MoveBall(), SoccerBase::OpponentTeam(), and PM_PlayOn. Referenced by Update(). Here is the call graph for this function: ![]() |
|
updates the RuleAspect during KickOff mode
Definition at line 208 of file soccerruleaspect.cpp. References ClearPlayers(), DropBall(), mBallState, mDropBallTime, mFreeKickDist, mFreeKickMoveDist, mFreeKickPos, mGameState, mLeftHalf, mRightHalf, SoccerBase::OpponentTeam(), PM_PlayOn, TI_LEFT, and TI_RIGHT. Referenced by Update(). Here is the call graph for this function: ![]() |
|
update the RuleAspect during Offside mode
Definition at line 1012 of file soccerruleaspect.cpp. References ClearPlayers(), DropBall(), SoccerBase::GetAgentState(), zeitgeist::Object::GetLog(), mBallBody, mDropBallTime, mFreeKickDist, mFreeKickMoveDist, mFreeKickPos, mGameState, mKickInPauseTime, MoveBall(), SoccerBase::OpponentTeam(), and PM_PlayOn. Referenced by Update(). Here is the call graph for this function: ![]() |
|
update the RuleAspect during PlayOn mode
Definition at line 495 of file soccerruleaspect.cpp. References CheckBallLeftField(), CheckGoal(), CheckOffside(), and mUseOffside. Referenced by Update(). Here is the call graph for this function: ![]() |
|
max distance that player can hear a message
Definition at line 240 of file soccerruleaspect.h. |
|
flag if the simulator should do the kick off automatically after the agent
Definition at line 222 of file soccerruleaspect.h. Referenced by UpdateBeforeKickOff(), and UpdateCachedInternal(). |
|
reference to the body node of the Ball
Definition at line 181 of file soccerruleaspect.h. Referenced by CheckBallLeftField(), CheckOffside(), DropBall(), MoveBall(), OnLink(), OnUnlink(), Update(), UpdateGoalKick(), and UpdateOffside(). |
|
the radius of the Ball
Definition at line 190 of file soccerruleaspect.h. Referenced by CheckBallLeftField(), CheckOffside(), UpdateBeforeKickOff(), UpdateCachedInternal(), and UpdateGoal(). |
|
reference to the BallStateAspect
Definition at line 187 of file soccerruleaspect.h. Referenced by CheckBallLeftField(), CheckGoal(), ClearPlayers(), OnLink(), OnUnlink(), Update(), UpdateCornerKick(), UpdateGoalKick(), UpdateKickIn(), and UpdateKickOff(). |
|
the time we wait before dropping the ball in play modes where only one team can touch the ball
Definition at line 204 of file soccerruleaspect.h. Referenced by UpdateCachedInternal(), UpdateCornerKick(), UpdateGoalKick(), UpdateKickIn(), UpdateKickOff(), and UpdateOffside(). |
|
the field length (in meters)
Definition at line 209 of file soccerruleaspect.h. Referenced by CheckBallLeftField(), ClearPlayers(), and UpdateCachedInternal(). |
|
the field width (in meters)
Definition at line 211 of file soccerruleaspect.h. Referenced by CheckBallLeftField(), and UpdateCachedInternal(). |
|
first colliding player in playon mode
Definition at line 248 of file soccerruleaspect.h. Referenced by CheckOffside(). |
|
the distance opponents have to keep during free kicks, kick ins etc.
Definition at line 217 of file soccerruleaspect.h. Referenced by DropBall(), UpdateCachedInternal(), UpdateCornerKick(), UpdateKickIn(), UpdateKickOff(), and UpdateOffside(). |
|
the (least) distance opponents will be moved away if they are to close during a free kick, kick in and situations like that.
Definition at line 220 of file soccerruleaspect.h. Referenced by DropBall(), UpdateCornerKick(), UpdateKickIn(), UpdateKickOff(), and UpdateOffside(). |
|
the point on the field where we do the kick in, free kick etc.
Definition at line 215 of file soccerruleaspect.h. Referenced by CheckBallLeftField(), CheckOffside(), UpdateCornerKick(), UpdateGoalKick(), UpdateKickIn(), UpdateKickOff(), and UpdateOffside(). |
|
reference to the GameStateAspect
Definition at line 184 of file soccerruleaspect.h. Referenced by CheckBallLeftField(), CheckGoal(), CheckOffside(), CheckTime(), DropBall(), OnLink(), OnUnlink(), Update(), UpdateBeforeKickOff(), UpdateCornerKick(), UpdateGameOver(), UpdateGoal(), UpdateGoalKick(), UpdateKickIn(), UpdateKickOff(), and UpdateOffside(). |
|
the length of the pause after a goal
Definition at line 193 of file soccerruleaspect.h. Referenced by UpdateCachedInternal(), and UpdateGoal(). |
|
the goal width (in meters)
Definition at line 213 of file soccerruleaspect.h. Referenced by UpdateCachedInternal(). |
|
the length of one game half
Definition at line 199 of file soccerruleaspect.h. Referenced by CheckTime(), and UpdateCachedInternal(). |
|
list of players that are in offside position
Definition at line 243 of file soccerruleaspect.h. Referenced by CheckOffside(). |
|
Definition at line 244 of file soccerruleaspect.h. Referenced by CheckOffside(). |
|
the length of the pause after the ball left the field
Definition at line 196 of file soccerruleaspect.h. Referenced by UpdateCachedInternal(), UpdateCornerKick(), UpdateGoalKick(), UpdateKickIn(), and UpdateOffside(). |
|
the point above the ground, where the ball left the field
Definition at line 207 of file soccerruleaspect.h. |
|
bounding box for the left half of the field
Definition at line 231 of file soccerruleaspect.h. Referenced by UpdateBeforeKickOff(), UpdateCachedInternal(), and UpdateKickOff(). |
|
bounding box for the left penalty area
Definition at line 235 of file soccerruleaspect.h. Referenced by DropBall(), UpdateCachedInternal(), and UpdateGoalKick(). |
|
if agents don't pass don't worry about offside
Definition at line 251 of file soccerruleaspect.h. Referenced by CheckOffside(). |
|
Definition at line 245 of file soccerruleaspect.h. Referenced by CheckOffside(). |
|
bounding box for the right half of the field
Definition at line 229 of file soccerruleaspect.h. Referenced by UpdateBeforeKickOff(), UpdateCachedInternal(), and UpdateKickOff(). |
|
bounding box for the right penalty area
Definition at line 233 of file soccerruleaspect.h. Referenced by DropBall(), UpdateCachedInternal(), and UpdateGoalKick(). |
|
say message size max limit
Definition at line 238 of file soccerruleaspect.h. |
|
flag if we want to play only one half of the match
Definition at line 226 of file soccerruleaspect.h. Referenced by CheckTime(), and UpdateCachedInternal(). |
|
use offside law
Definition at line 254 of file soccerruleaspect.h. Referenced by UpdateCachedInternal(), and UpdatePlayOn(). |
|
time to wait until we kick off automatically
Definition at line 224 of file soccerruleaspect.h. Referenced by UpdateBeforeKickOff(), and UpdateCachedInternal(). |