public class AgentInfo extends SensorModule<UT2004Bot> implements ILocated
It is designed to be initialized inside IUT2004BotController.prepareBot(UT2004Bot)
method call
and may be used since first Self
message is received, i.e, since the first IUT2004BotController.botFirstSpawn(cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.GameInfo, ConfigChange, InitedMessage, Self)
is called.
Modifier and Type | Field and Description |
---|---|
static double |
AT_LOCATION_EPSILON
Which distance to a location is considered the same as specified location.
|
static double |
CLOSE_ENOUGH_EPSILON
EXACT at location (in UT units).
|
Game |
game
Game memory module.
|
static double |
IS_FACING_ANGLE
What angle is considered to be maximum facing angle by default (in degrees).
|
static String |
NONE_WEAPON_ID |
static int |
TEAM_BLUE
Blue team number.
|
static int |
TEAM_GOLD
Gold team number.
|
static int |
TEAM_GREEN
Green team number.
|
static int |
TEAM_NONE
No-team number.
|
static int |
TEAM_RED
Red team number.
|
worldView
agent, controller, eventBus, log
Constructor and Description |
---|
AgentInfo(UT2004Bot bot)
Constructor.
|
AgentInfo(UT2004Bot bot,
Game game)
Constructor.
|
AgentInfo(UT2004Bot bot,
Game game,
Logger log)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
Double |
_getCurrentVolumeTerminalVelocity()
FIXME[js]: What the hell is this good for?
|
boolean |
atLocation(ILocated location)
Returns whether the bot is at 'location', using
AT_LOCATION_EPSILON . |
boolean |
atLocation(ILocated location,
double epsilon)
Returns whether the bot is at 'location', using 'epsilon' as a distance tolerance
|
boolean |
atLocation(String objectId)
Tells whether the bot is at navpoint/item/...
|
boolean |
atLocation(String objectId,
double epsilon)
Tells whether the bot is at navpoint/item/...
|
protected void |
cleanUp() |
Double |
getAccelerationRate()
Retreives acceleration rate of the agent.
|
Integer |
getAdrenaline()
Tells, how much adrenaline the agent has.
|
Double |
getAirControl()
Retreives agent's control of movement while in the air.
|
Double |
getAirSpeed()
Retreives maximum speed of the agent while moving in the air.
|
Integer |
getArmor()
Tells, how much of combined armor the agent is wearing.
|
Double |
getBaseSpeed()
Retreives maximum base speed of the agent.
|
ConfigChange |
getConfig()
Retrieves the configuration of the bot inside UT2004.
|
Integer |
getCurrentAmmo()
Tells, how much ammunition the agent has left for the current weapon
in its primary firing mode.
|
Integer |
getCurrentSecondaryAmmo()
Tells, how much ammunition the agent has left for the current weapon
in its alternate (secondary) firing mode.
|
Double |
getCurrentVolumeDamagePerSec()
Amount of damage taken for spending time in the current volume.
|
String |
getCurrentVolumeDamageType()
Retreives type of damage the current volume inflicts to the agent while
he spends time in this volume.
|
Double |
getCurrentVolumeFluidFriction()
Friction of the fluid in this map volume.
|
Double |
getCurrentVolumeGroundFriction()
Friction of the floor in this map volume.
|
UnrealId |
getCurrentWeapon()
Retreives UnrealId of the weapon the agent is currently holding.
|
String |
getCurrentWeaponName()
Returns name of the currently wielded weapon (or null if no such weapon exists).
|
ItemType |
getCurrentWeaponType()
Returns type of the weapon the agent is currently holding (or null if no such weapon exists).
|
Velocity |
getCurrentZoneGravity()
Gravity in this map zone.
|
Velocity |
getCurrentZoneVelocity()
Pulling velocity in this map zone.
|
Double |
getDamageScaling()
Retreives scaling factor for damage dealt by the agent.
|
int |
getDeaths()
Retreives number of deaths the agent took.
|
Double |
getDistance(ILocated location)
Computes crow-fly distance of the agent from given location.
|
Double |
getDodgeSpeedFactor()
Retreives maximum speed of the agent while using dodge.
|
Double |
getDodgeZBoost()
Retreives boost of the agent in the Z axis while using dodge.
|
Double |
getFallSpeed()
Retreives maximum speed of the agent while falling.
|
Location |
getFloorLocation()
Retreives location of the nearest map geometry directly beneath the
agent.
|
Integer |
getHealth()
Tells, how much health the agent has.
|
Integer |
getHighArmor()
Tells, how much of high armor the agent is wearing.
|
Rotation |
getHorizontalRotation()
Retreives absolute rotation of the agent within the map.
|
UnrealId |
getId()
Retreives a unique ID of the agent in the game.
|
Double |
getJumpZBoost()
Retreives boost of the agent in the Z axis while jumping.
|
int |
getKills()
Retreives number of kills the agent scored.
|
Double |
getLadderSpeed()
Retreives maximum speed of the agent while moving on a ladder.
|
Location |
getLocation()
Retreives absolute location of the agent within the map.
|
Integer |
getLowArmor()
Tells, how much of low armor the agent is wearing.
|
String |
getName()
Retreives current name of the agent in the game.
|
Item |
getNearestItem()
Retrieves nearest known item to current agent location.
|
NavPoint |
getNearestNavPoint()
Retrieves nearest known navpoint to current agent location.
|
NavPoint |
getNearestNavPoint(double maxDistance)
Retrieves nearest known navpoint to current agent location that is not further than "maxDistance".
|
NavPoint |
getNearestNavPoint(ILocated location)
Retrieve nearest known navpoint to some location.
|
NavPoint |
getNearestNavPoint(ILocated location,
double maxDistance)
Retrieve nearest known navpoint to some location, that is not further then "maxDistance".
|
Player |
getNearestPlayer()
Retrieves nearest known player to current agent location.
|
Item |
getNearestVisibleItem()
Retrieves nearest visible item to current agent location.
|
NavPoint |
getNearestVisibleNavPoint()
Retrieves nearest visible navpoint to current agent location.
|
Player |
getNearestVisiblePlayer()
Retrieves nearest visible player to current agent location.
|
Double |
getRemainingUDamageTime()
Tells whether the agent has the damage multiplier (UDamage) bonus boost
activated and how long will the UDamage boost remain active.
|
Rotation |
getRotation()
Retreives absolute rotation of the agent within the map.
|
int |
getScore()
Retreives current agent score.
|
Self |
getSelf() |
int |
getSuicides()
Retreives number of suicides the agent commited.
|
Integer |
getTeam()
Retreives team number the agent is on.
|
int |
getTeamScore()
Retreives current agent's team score.
|
double |
getTime()
Retreives current game time, since the game started.
|
Velocity |
getVelocity()
Retreives current velocity of the agent as a vector of movement.
|
Double |
getWaterSpeed()
Retreives maximum speed of the agent while moving in water.
|
Boolean |
hasArmor()
Tells, whether the agent is armored to the maximum extent.
|
Boolean |
hasFastFire()
Tells, whether the agent has special bonus action activated: the
fast firing rate.
|
Boolean |
hasHighArmor()
Tells, whether the agent is armored to the maximum of high-armor extent.
|
Boolean |
hasInvisibility()
Tells, whether the agent has special bonus action activated: the
invisibility.
|
Boolean |
hasLowArmor()
Tells, whether the agent is armored to the maximum of low-armor extent.
|
Boolean |
hasRegeneration()
Tells, whether the agent has special bonus action activated: the
regenration, which is also called booster.
|
Boolean |
hasSpeed()
Tells, whether the agent has special bonus action activated: the
speed.
|
Boolean |
hasUDamage()
Tells whether the agent has the damage multiplier (UDamage) bonus boost
activated.
|
Boolean |
hasWeapon()
Tells whether the bot is holding some weapon or not.
|
Boolean |
isAdrenalineFull()
Tells, whether the agent has full adrenaline.
|
Boolean |
isAdrenalineSufficient()
Tells, whether the agent gained enough adrenaline to use it for special
adrenaline-based action, e.g.
|
boolean |
isAtLocation(ILocated location)
Returns whether the bot is at 'location'.
|
boolean |
isAtLocation(ILocated location,
double epsilon)
Returns whether the bot is at 'location' using 'epsilon'.
|
Boolean |
isCrouched()
Tells, whether the agent is crouched.
|
Boolean |
isCurrentVolumeAffectingProjectiles()
Tells, whether the current volume imparts its velocity to projectiles.
|
Boolean |
isCurrentVolumeBanningInventory()
Tells, whether the current volume (the one the agent is within) forbids
usage of the inventory.
|
Boolean |
isCurrentVolumeDestructive()
Tells, whether the current volume kills the actors (almost) instantly.
|
Boolean |
isCurrentVolumePainCausing()
Tells, whether the current volume is causing damage.
|
Boolean |
isCurrentVolumeWater()
Tells, whether the current volume is water.
|
Boolean |
isCurrentZoneNeutral()
Tells, whether the current zone is a neutral zone.
|
boolean |
isEnemy(int team)
Tells, whether a given team is an enemy team to the agent.
|
boolean |
isEnemy(Player player)
Tells, whether a given player is an enemy to the agent.
|
Boolean |
isFacing(ILocated location)
Tells if the agent is currently facing input location.
|
Boolean |
isFacing(ILocated location,
double angle)
Tells if the agent is currently facing input location.
|
boolean |
isFriend(int team)
Tells, whether a given team is a friend team to the agent.
|
boolean |
isFriend(Player player)
Tells, whether a given player is a friend to the agent.
|
Boolean |
isHealthy()
Tells, whether the agent is healthy, i.e.
|
Boolean |
isMoving()
Tells, whether the agent is moving.
|
boolean |
isOnNavGraph()
Check whether the bot is on navigation graph, more precisly, near some navigation point.
|
Boolean |
isPrimaryShooting()
Tells, whether the agent is shooting with primary fire mode.
|
Boolean |
isSecondaryShooting()
Tells, whether the agent is shooting with alternate (secondary) fire mode.
|
Boolean |
isShooting()
Tells, whether the agent is shooting or not.
|
Boolean |
isSuperHealthy()
Tells, whether the agent is healthy to the maximum boostable extent.
|
Boolean |
isTouchingGround()
Tells, whether the agent is currently touching the groud with his feets.
|
Boolean |
isWalking()
Tells, whether the agent is walking.
|
getComponentId, getLog, getState, initComponentId, isRunning, kill, pause, reset, resume, start, stop, toString
public static final String NONE_WEAPON_ID
public static final int TEAM_RED
public static final int TEAM_BLUE
public static final int TEAM_GREEN
public static final int TEAM_GOLD
public static final int TEAM_NONE
public static final double AT_LOCATION_EPSILON
public static final double IS_FACING_ANGLE
public static final double CLOSE_ENOUGH_EPSILON
public Game game
public AgentInfo(UT2004Bot bot)
game
- game info modulepublic AgentInfo(UT2004Bot bot, Game game)
bot
- owner of the modulegame
- game info modulepublic AgentInfo(UT2004Bot bot, Game game, Logger log)
bot
- owner of the modulegame
- game info modulelog
- Logger to be used for logging runtime/debug info. Note: If null is provided,
this memory module creates it's own logger.public UnrealId getId()
Note: This ID does not change and can be relied upon during entire match. However, be aware that the ID may change between different matches and/or sessions.
public String getName()
Note: The agent may choose and change it's name during a match and it does not need to be unique among players. Even an empty string might be a valid name.
public Integer getTeam()
TEAM_RED
,
TEAM_BLUE
,
TEAM_GREEN
,
TEAM_GOLD
,
TEAM_NONE
,
isEnemy(int)
,
isEnemy(Player)
,
isFriend(int)
,
isFriend(Player)
public boolean isEnemy(int team)
team
- Team number to be tested.getTeam()
,
isFriend(int)
public boolean isEnemy(Player player)
player
- Player to be tested.getTeam()
,
isFriend(Player)
public boolean isFriend(int team)
team
- Team number to be tested.getTeam()
,
isEnemy(int)
public boolean isFriend(Player player)
player
- Player to be tested.getTeam()
,
isEnemy(Player)
public Location getLocation()
getLocation
in interface ILocated
getDistance(Location)
,
Location.getDistance(Location)
,
Location.getDistanceL1(Location)
,
Location.getDistanceLinf(Location)
,
Location.getDistancePlane(Location)
,
Location.getDistanceSquare(Location)
public boolean atLocation(String objectId)
ILocated
) of id 'objectId'. Note that IDs are case sensitive! UT2004 is usually using camel-case.objectId
- public boolean atLocation(String objectId, double epsilon)
ILocated
) of id 'objectId'. Note that IDs are case sensitive! UT2004 is usually using camel-case.objectId
- epsilon
- public boolean isAtLocation(ILocated location)
Synonym for AgentInfo#atLocation(Location)
.
public boolean isAtLocation(ILocated location, double epsilon)
Synonym for AgentInfo#atLocation(Location)
.
epsilon
- public boolean atLocation(ILocated location)
AT_LOCATION_EPSILON
.public boolean atLocation(ILocated location, double epsilon)
location
- epsilon
- public Double getDistance(ILocated location)
location
- Location within the map.getLocation()
public Rotation getRotation()
public Rotation getHorizontalRotation()
public Velocity getVelocity()
isMoving()
public Boolean isMoving()
getVelocity()
public Boolean isCrouched()
public Boolean isWalking()
public Boolean isFacing(ILocated location)
location
- input location.public Boolean isFacing(ILocated location, double angle)
location
- input location.angle
- specifies maximum angle (in degrees) that will be still considered as facing angle.public Location getFloorLocation()
public Boolean isTouchingGround()
public Double getRemainingUDamageTime()
When UDamage is activated, the agent is causing double (or tripple, or even more) damage to other players. The multiplying factor depends on game settings and mutators.
hasUDamage()
public Boolean hasUDamage()
When UDamage is activated, the agent is causing double (or tripple, or even more) damage to other players. The multiplying factor depends on game settings and mutators.
getRemainingUDamageTime()
public Boolean hasInvisibility()
To learn, for how long the bonus action will remain activated, check
the remaining amount of adrenaline. When level of adrenaline reaches
zero, the bonus action is deactivated. See getAdrenaline()
.
getAdrenaline()
public Boolean hasFastFire()
To learn, for how long the bonus action will remain activated, check
the remaining amount of adrenaline. When level of adrenaline reaches
zero, the bonus action is deactivated. See getAdrenaline()
.
getAdrenaline()
public Boolean hasRegeneration()
To learn, for how long the bonus action will remain activated, check
the remaining amount of adrenaline. When level of adrenaline reaches
zero, the bonus action is deactivated. See getAdrenaline()
.
getAdrenaline()
public Boolean hasSpeed()
To learn, for how long the bonus action will remain activated, check
the remaining amount of adrenaline. When level of adrenaline reaches
zero, the bonus action is deactivated. See getAdrenaline()
.
getAdrenaline()
public Integer getHealth()
The health usually starts at 100, and ranges from 0 to 199. These values, however, can be changed by various mutators.
isHealthy()
,
isSuperHealthy()
public Boolean isHealthy()
getHealth()
,
isSuperHealthy()
public Boolean isSuperHealthy()
getHealth()
,
isHealthy()
public Integer getArmor()
The combined armor usually starts at 0, and ranges from 0 to 150. These values, however, can be changed by various mutators.
Note: The armor consist of two parts, which are summed together into combined armor value. However, each part is powered-up by different item (low armor by small shield; high armor by super-shield).
hasArmor()
,
getLowArmor()
,
getHighArmor()
public Boolean hasArmor()
getArmor()
,
hasLowArmor()
,
hasHighArmor()
public Integer getLowArmor()
The low armor usually starts at 0, and ranges from 0 to 50. These values, however, can be changed by various mutators.
Note: The armor consist of two parts, which are summed together into combined armor value. However, each part is powered-up by different item (low armor by small shield; high armor by super-shield).
hasLowArmor()
,
getArmor()
,
getHighArmor()
public Boolean hasLowArmor()
getLowArmor()
,
hasArmor()
,
hasHighArmor()
public Integer getHighArmor()
The high armor usually starts at 0, and ranges from 0 to 100. These values, however, can be changed by various mutators.
Note: The armor consist of two parts, which are summed together into combined armor value. However, each part is powered-up by different item (low armor by small shield; high armor by super-shield).
hasHighArmor()
,
getArmor()
,
getLowArmor()
public Boolean hasHighArmor()
getHighArmor()
,
hasArmor()
,
hasLowArmor()
public Integer getAdrenaline()
Adrenaline can be gained through fulfilling various game tasks, such as killing opponents, capturing flags, controlling domination points, picking up adrenaline pills, etc. Note: More adrenaline is gained when the agent fulfill these tasks in combos (e.g. by scoring a double-kill the agent receives significantly more adrenaline than by scoring two single-kills).
Once the adrenaline reaches a designated level, it can be used to
start special bonus actions like booster, invisibility,
speed, etc. The adrenaline is then spent on the action. The more
adrenaline the agent has, the longer the action lasts. Note: The agent
may gain new adrenaline during the bonus action, which prolongs the
action duration. See isAdrenalineFull()
to determine, when the
necessary adrenaline level is reached.
The adrenaline usually starts at 0, and ranges from 0 to 100. These values, however, can be changed by various mutators.
isAdrenalineFull()
public Boolean isAdrenalineSufficient()
getAdrenaline()
public Boolean isAdrenalineFull()
getAdrenaline()
public UnrealId getCurrentWeapon()
The UnrealId might contains a substring, which identifies the type of the weapon. However, this is not guaranteed by definition. Therefore, you shoud use inventory to retreive the appropriate weapon object, to further retreive correct type of weapon.
getCurrentAmmo()
,
getCurrentSecondaryAmmo()
,
Weaponry.getCurrentWeapon()
,
Weaponry#getWeapon(UnrealId)
public String getCurrentWeaponName()
getCurrentWeapon
public ItemType getCurrentWeaponType()
public Boolean hasWeapon()
Note that getCurrentWeapon()
always returns some id. But there is a special id that marks 'no weapon'
public Integer getCurrentAmmo()
getCurrentSecondaryAmmo()
,
Inventory#getCurrentPrimaryAmmo()
public Integer getCurrentSecondaryAmmo()
getCurrentAmmo()
,
Inventory#getCurrentSecondaryAmmo()
public Boolean isShooting()
This method reports shooting with either primary or secondary fire
mode. To distinguish between the fire modes, see isPriShooting()
,
isAltShooting()
.
isPrimaryShooting()
,
isSecondaryShooting()
public Boolean isPrimaryShooting()
This method reports shooting with primary fire mode only. See
isAltShooting()
method to determine, whether the agent shoots
with alternate firing mode. See isShooting()
to determine,
whether the agent shoots with either primary or alternate firing mode.
isShooting()
,
isSecondaryShooting()
public Boolean isSecondaryShooting()
This method reports shooting with alternate (secondary) fire mode only. See
isPriShooting()
method to determine, whether the agent shoots
with primary firing mode. See isShooting()
to determine,
whether the agent shoots with either primary or alternate (secondary) firing mode.
isShooting()
,
isPrimaryShooting()
public int getKills()
A kill is counted, whenever the agent kills an opponent.
public int getDeaths()
A death is counted, whenever the agent dies.
Note that if Integer.MIN_VALUE
is returned, than the number of deaths is unknown. This happens only
if you call this method before the first logic iteration of the agent (i.e., before first PlayerScore
messages
are exported by GameBots).
public int getSuicides()
A suicide is counted, whenever the agent dies by his own weapon, or by damaging himself by falling into pits, lava, acid, etc.
It can also be said that suicide is every agent's death, which could not be credited to any other player in the map.
Each suicide is also counted as death. See getDeaths()
.
public int getScore()
Agent score is usually rising by achieving some goals, e.g. killing opponents, capturing flags, controlling domination points, etc. Note: Agent score might decrease upon suicides, based on map, game type and game settings.
Note that if Integer.MIN_VALUE
is returned, than the score is unknown. This happens only
if you call this method before the first logic iteration of the agent (i.e., before first PlayerScore
messages
are exported by GameBots).
public int getTeamScore()
Agent's team score is usually rising by achieving team goals, e.g. killing opponents, capturing flags, controlling domination points, etc. Note: Agent's team score might decrease, when oposing teams score points themselves, based on map, game type and game settings.
public Velocity getCurrentZoneVelocity()
public Velocity getCurrentZoneGravity()
getFallSpeed()
.public Double getCurrentVolumeGroundFriction()
public Double getCurrentVolumeFluidFriction()
public Double _getCurrentVolumeTerminalVelocity()
public Boolean isCurrentVolumeWater()
getCurrentVolumeFluidFriction()
and getWaterSpeed()
can
help to determine changes to movement and speed of the agent. Also note
that getCurrentZoneVelocity()
, getCurrentZoneGravity()
,
and others may change (and usually does) in water.public Boolean isCurrentVolumePainCausing()
getCurrentVolumeDamagePerSec()
. When the volume damages the
agent to the death, the death is counted as a suicide.isCurrentVolumeDestructive()
,
getCurrentVolumeDamagePerSec()
public Double getCurrentVolumeDamagePerSec()
isCurrentVolumePainCausing()
public Boolean isCurrentVolumeDestructive()
isCurrentVolumePainCausing()
public String getCurrentVolumeDamageType()
FIXME[js]: Is is possible to provide an enum here?
public Boolean isCurrentVolumeBanningInventory()
public Boolean isCurrentVolumeAffectingProjectiles()
public Boolean isCurrentZoneNeutral()
public Double getDamageScaling()
public Double getBaseSpeed()
public Double getAirSpeed()
public Double getLadderSpeed()
public Double getWaterSpeed()
public Double getFallSpeed()
public Double getDodgeSpeedFactor()
FIXME[js]: Check about the name depending on the meaning/value.
public Double getAccelerationRate()
public Double getAirControl()
public Double getJumpZBoost()
public Double getDodgeZBoost()
public double getTime()
public ConfigChange getConfig()
public NavPoint getNearestNavPoint()
WARNING: O(n) complexity.
public NavPoint getNearestNavPoint(double maxDistance)
WARNING: O(n) complexity.
public NavPoint getNearestNavPoint(ILocated location)
location
- public NavPoint getNearestNavPoint(ILocated location, double maxDistance)
location
- public boolean isOnNavGraph()
WARNING: O(n) complexity.
public NavPoint getNearestVisibleNavPoint()
WARNING: O(n) complexity.
public Item getNearestItem()
WARNING: O(n) complexity.
public Item getNearestVisibleItem()
WARNING: O(n) complexity.
public Player getNearestPlayer()
WARNING: O(n) complexity.
public Player getNearestVisiblePlayer()
WARNING: O(n) complexity.
public Self getSelf()
protected void cleanUp()
cleanUp
in class AgentModule<UT2004Bot>
Copyright © 2012 AMIS research group, Faculty of Mathematics and Physics, Charles University in Prague, Czech Republic. All Rights Reserved.