public class Players extends SensorModule<UT2004Bot>
All Player objects returned by this memory module are always self-updating throughout the time, until the associated player leaves the game. This means that once a valid Player object is obtained, it is not necessary to call any methods of this memory module to get the object's info updated (e.g. player's location, visibility, reachability, etc.). The object will autoupdate itself.
The same principle is applied to all Maps returned by this memory module. Each returned Map is self-updating throughout the time. Once a specific Map is obtained (e.g. a map of visible enemies) from this memory module, the Map will get updated based on actions of the players (e.g. joining or leaving the game, changing their team, moving around the map, etc.) automatically.
Note: All Maps returned by this memory module are locked and can not be modified outside this memory module. If you need to modify a Map returned by this module (for your own specific purpose), create a duplicate first. Such duplicates, however and of course, will not get updated.
If you need to get info about players' deaths use Senses
module.
WARNING:It is totally unclear what UT2004 means by reachable!!!
It is designed to be initialized inside IUT2004BotController.prepareBot(UT2004Bot)
method call
and may be used since IUT2004BotController.botInitialized(cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.GameInfo, cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.ConfigChange, cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.InitedMessage)
is called.
worldView
agent, controller, eventBus, log
Constructor and Description |
---|
Players(UT2004Bot bot)
Constructor.
|
Players(UT2004Bot bot,
Logger log)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
boolean |
canSeeEnemies()
Tells, whether the agent sees any other enemies.
|
boolean |
canSeeFriends()
Tells, whether the agent sees any other friends.
|
boolean |
canSeePlayers()
Tells, whether the agent sees any other players.
|
protected void |
cleanUp() |
Map<UnrealId,Player> |
getEnemies()
Retreives a Map of all enemies.
|
Map<UnrealId,Player> |
getFriends()
Retreives a Map of all friends.
|
Player |
getNearestEnemy(double recentlyVisibleTime)
Returns nearest enemy that is visible or that was 'recently' visible.
|
Player |
getNearestFriend(double recentlyVisibleTime)
Returns nearest friend that is visible or that was 'recently' visible.
|
Player |
getNearestPlayer(double recently)
Returns nearest player that is visible or that was 'recently' visible.
|
Player |
getNearestVisibleEnemy()
Returns nearest-visible enemy - if no enemy is visible returns null.
|
Player |
getNearestVisibleFriend()
Returns nearest-visible friend - if no friend is visible returns null.
|
Player |
getNearestVisiblePlayer()
Returns nearest-visible player - if no if no player is visible returns null.
|
Player |
getNearestVisiblePlayer(Collection<Player> players)
Returns nearest-visible player to the bot from the collection of 'players' - if no player
is visible returns null.
|
Player |
getPlayer(UnrealId UnrealId)
Retreives last known info about given player.
|
Map<UnrealId,Player> |
getPlayers()
Retreives a Map of all players.
|
Player |
getRandomVisibleEnemy()
Returns random visible enemy - if no enemy is visible returns null.
|
Player |
getRandomVisibleFriend()
Returns random friend - if no friend is visible returns null.
|
Player |
getRandomVisiblePlayer()
Returns random visible player - if no if no player is visible returns null.
|
Map<UnrealId,Player> |
getVisibleEnemies()
Retreives a Map of all visible enemies.
|
Map<UnrealId,Player> |
getVisibleFriends()
Retreives a Map of all visible friends.
|
Player |
getVisiblePlayer(UnrealId UnrealId)
Retreives info about given player, but only it the player is visible.
|
Map<UnrealId,Player> |
getVisiblePlayers()
Retreives a Map of all visible players.
|
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 |
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.
|
getComponentId, getLog, getState, initComponentId, isRunning, kill, pause, reset, resume, start, stop, toString
public Players(UT2004Bot bot)
bot
- owner of the module that is using itpublic Player getPlayer(UnrealId UnrealId)
Note: The returned Player object is self updating throughout time. Once you have a valid Player object, you do not have to call this method to get updated info about that player.
UnrealId
- Player UnrealId to be retreived.getVisiblePlayer(UnrealId)
,
getReachablePlayer(UnrealId)
public Player getVisiblePlayer(UnrealId UnrealId)
Note: The returned Player object is self updating throughout time. Once you have a valid Player object, you do not have to call this method to get updated info about visibility of that player.
UnrealId
- Player UnrealId to be retrieved.getPlayer(UnrealId)
,
getReachablePlayer(UnrealId)
public Map<UnrealId,Player> getPlayers()
Note: The returned Map is unmodifiable and self updating throughout time. Once you obtain a specific Map of players from this memory module, the Map will get updated based on actions of the players (e.g. joining or leaving the game, changing their status, etc.).
getEnemies()
,
getFriends()
,
getVisiblePlayers()
,
getReachablePlayers()
public Map<UnrealId,Player> getEnemies()
Note: The returned Map is unmodifiable and self updating throughout time. Once you obtain a specific Map of enemies from this memory module, the Map will get updated based on actions of the players (e.g. joining or leaving the game, changing their team or status, etc.).
getPlayers()
,
getFriends()
,
getVisibleEnemies()
,
getReachableEnemies()
public Map<UnrealId,Player> getFriends()
Note: The returned Map is unmodifiable and self updating throughout time. Once you obtain a specific Map of friends from this memory module, the Map will get updated based on actions of the players (e.g. joining or leaving the game, changing their team or status, etc.).
getPlayers()
,
getEnemies()
,
getVisibleFriends()
,
getReachableFriends()
public Map<UnrealId,Player> getVisiblePlayers()
Note: The returned Map is unmodifiable and self updating throughout time. Once you obtain a specific Map of players from this memory module, the Map will get updated based on actions of the players (e.g. joining or leaving the game, or changing their visibility, etc.).
getPlayers()
,
getVisibleEnemies()
,
getVisibleFriends()
,
canSeePlayers()
public Map<UnrealId,Player> getVisibleEnemies()
Note: The returned Map is unmodifiable and self updating throughout time. Once you obtain a specific Map of enemies from this memory module, the Map will get updated based on actions of the players (e.g. joining or leaving the game, changing their team, status or visibility, etc.).
getEnemies()
,
getVisiblePlayers()
,
getVisibleFriends()
,
canSeeEnemies()
public Map<UnrealId,Player> getVisibleFriends()
Note: The returned Map is unmodifiable and self updating throughout time. Once you obtain a specific Map of friends from this memory module, the Map will get updated based on actions of the players (e.g. joining or leaving the game, changing their team, status or visibility, etc.).
getFriends()
,
getVisiblePlayers()
,
getVisibleEnemies()
,
canSeeFriends()
public Player getNearestPlayer(double recently)
recently
- how long the player may be non-visible. IN MILISECONDS!public Player getNearestEnemy(double recentlyVisibleTime)
recentlyVisibleTime
- how long the player may be non-visible IN MILISECONDS!public Player getNearestFriend(double recentlyVisibleTime)
recentlyVisibleTime
- how long the player may be non-visible IN MILISECONDS!public Player getNearestVisiblePlayer()
public Player getNearestVisibleEnemy()
public Player getNearestVisibleFriend()
public Player getNearestVisiblePlayer(Collection<Player> players)
players
- collection to go throughpublic Player getRandomVisiblePlayer()
public Player getRandomVisibleEnemy()
public Player getRandomVisibleFriend()
public boolean canSeePlayers()
getVisiblePlayers()
public boolean canSeeEnemies()
getVisibleEnemies()
public boolean canSeeFriends()
getVisibleFriends()
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)
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.