|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcz.cuni.amis.pogamut.base.agent.module.AgentModule<AGENT>
cz.cuni.amis.pogamut.base.agent.module.SensorModule<UDKBot>
cz.cuni.amis.pogamut.udk.agent.module.sensor.Items
public class Items
Memory module specialized on items on the map.
Apart from providing useful getters based on ItemType
, ItemType.Group
and ItemType.Category
it also
provides an optimistic approach for guessing whether some item is spawned inside the map via getSpawnedXYZ methods
such as getSpawnedItems()
.
WARNING:There are methods that contains "reachable" in its name but it is totally unclear what UT2004 means by reachable!!! These methods are for experimenting purposes only.
It is designed to be initialized inside IUDKBotController.prepareBot(UDKBot)
method call
and may be used since IUDKBotController.botInitialized(cz.cuni.amis.pogamut.udk.communication.messages.gbinfomessages.GameInfo, cz.cuni.amis.pogamut.udk.communication.messages.gbinfomessages.ConfigChange, cz.cuni.amis.pogamut.udk.communication.messages.gbinfomessages.InitedMessage)
is called.
Nested Class Summary | |
---|---|
protected class |
Items.EndMessageListener
EndMessage listener. |
protected class |
Items.ItemPickedUpListener
ItemPickedUp listener. |
protected class |
Items.ItemsListener
|
protected class |
Items.MapPointsListener
MapPointsListObtained listener. |
protected class |
Items.NavPointListener
MapPointsListObtained listener. |
Field Summary | |
---|---|
protected AgentInfo |
agentInfo
AgentInfo memory module. |
protected Items.EndMessageListener |
endMessageListener
|
static double |
ITEM_RESPAWN_TIME
How fast are items respawning inside UT2004. |
protected Items.ItemPickedUpListener |
itemPickedUpListener
|
protected Items.ItemsListener |
itemsListener
|
protected Items.MapPointsListener |
mapPointsListener
MapPointsListObtained listener |
protected Items.NavPointListener |
navPointListener
|
protected Map<UnrealId,NavPoint> |
navPoints
|
protected List<NavPoint> |
navPointsToProcess
Contains only navpoints that are visible so we can check whether they are spawning-points, if so - we may check whether the item is laying there or not to handle spawning times. |
Fields inherited from class cz.cuni.amis.pogamut.base.agent.module.SensorModule |
---|
worldView |
Fields inherited from class cz.cuni.amis.pogamut.base.agent.module.AgentModule |
---|
agent, controller, eventBus, log |
Constructor Summary | |
---|---|
Items(UDKBot bot)
Constructor. |
|
Items(UDKBot bot,
AgentInfo agentInfo)
Constructor. |
|
Items(UDKBot bot,
AgentInfo agentInfo,
Logger log)
Constructor. |
Method Summary | |
---|---|
protected Items.ItemsListener |
createItemsListener(IWorldView worldView)
This method is called from the constructor to hook a listener that updated the items field. |
protected Items.MapPointsListener |
createMapPointsListener(IWorldView worldView)
This method is called from the constructor to create a listener that initialize items field from the MapPointListObtained event. |
Map<UnrealId,Item> |
getAllItems()
Retrieves list of all items, which includes all known pickups and all visible thrown items. |
Map<UnrealId,Item> |
getAllItems(ItemType.Category category)
Retrieves map of all items belonging to a specific 'category' of items, which includes all known pickups. |
Map<UnrealId,Item> |
getAllItems(ItemType.Group group)
Retrieves map of all items belonging to a specific 'group' of items, which includes all known pickups. |
Map<UnrealId,Item> |
getAllItems(ItemType type)
Retrieves list of all items of specific type. |
Item |
getItem(String stringUnrealId)
Retrieves a specific item from the all items in the map. |
Item |
getItem(UnrealId id)
Retrieves a specific item from the all items in the map. |
double |
getItemRespawnTime(ItemType itemType)
Returns how fast are the items respawning based on their item type. |
Item |
getKnownPickup(String stringUnrealId)
Retrieves a specific pickup point. |
Item |
getKnownPickup(UnrealId id)
Retrieves a specific pickup point. |
Map<UnrealId,Item> |
getKnownPickups()
Retrieves list of all known item pickup points. |
Map<UnrealId,Item> |
getKnownPickups(ItemType.Category category)
Retrieves map of all known pickups belonging to a specific 'category' of items, which includes all known pickups. |
Map<UnrealId,Item> |
getKnownPickups(ItemType.Group group)
Retrieves map of all known pickups belonging to a specific 'group' of items, which includes all known pickups. |
Map<UnrealId,Item> |
getKnownPickups(ItemType type)
Retrieves list of all known item pickup points of specific type. |
Item |
getRandomItem()
Returns random item from 'all' items. |
Item |
getReachableItem(String stringUnrealId)
Retrieves a specific item from the all items in the map that is currently reachable. |
Item |
getReachableItem(UnrealId id)
Retrieves a specific item from the all items in the map that is currently reachable. |
Map<UnrealId,Item> |
getReachableItems()
Retrieves list of all reachable items, which includes all reachable known pickups and all reachable and visible thrown items. |
Map<UnrealId,Item> |
getReachableItems(ItemType.Category category)
Retrieves map of reachable items belonging to a specific 'category' of items, which includes all known pickups. |
Map<UnrealId,Item> |
getReachableItems(ItemType.Group group)
Retrieves map of reachable items belonging to a specific 'group' of items, which includes all known pickups. |
Map<UnrealId,Item> |
getReachableItems(ItemType type)
Retrieves list of all reachable items of specific type, which includes all reachable known pickups and all reachable and visible thrown items. |
Map<UnrealId,Item> |
getSpawnedItems()
Uses isPickupSpawned(Item) to return all items that are believed to
be currently spawned. |
Map<UnrealId,Item> |
getSpawnedItems(ItemType.Category category)
Uses isPickupSpawned(Item) to return all items belonging to a specific 'category' that are believed to
be currently spawned. |
Map<UnrealId,Item> |
getSpawnedItems(ItemType.Group group)
Uses isPickupSpawned(Item) to return all items belonging to a specific 'group' that are believed to
be currently spawned. |
Map<UnrealId,Item> |
getSpawnedItems(ItemType type)
Uses isPickupSpawned(Item) to return all items of 'type' that are believed to
be currently spawned. |
Item |
getVisibleItem(String stringUnrealId)
Retrieves a specific item from the visible items in the map. |
Item |
getVisibleItem(UnrealId id)
Retrieves a specific item from the visible items in the map. |
Map<UnrealId,Item> |
getVisibleItems()
Retreives list of all visible items, which includes all visible known pickups and all visible thrown items. |
Map<UnrealId,Item> |
getVisibleItems(ItemType.Category category)
Retrieves map of visible items belonging to a specific 'category' of items, which includes all known pickups. |
Map<UnrealId,Item> |
getVisibleItems(ItemType.Group group)
Retrieves map of visible items belonging to a specific 'group' of items, which includes all known pickups. |
Map<UnrealId,Item> |
getVisibleItems(ItemType type)
Retreives list of all visible items of specific type, which includes all visible known pickups and all visible thrown items. |
boolean |
isPickupSpawned(Item item)
Tells, whether the given pickup point contains a spawned item. |
boolean |
isPickupSpawned(UnrealId itemId)
Tells, whether the given pickup point contains a spawned item. |
protected void |
start(boolean startPaused)
Provides initialization of the module (clearing internal data structures). |
Methods inherited from class cz.cuni.amis.pogamut.base.agent.module.AgentModule |
---|
cleanUp, getComponentId, getLog, getState, initComponentId, isRunning, kill, pause, reset, resume, stop, toString |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final double ITEM_RESPAWN_TIME
protected Items.ItemsListener itemsListener
protected Items.MapPointsListener mapPointsListener
protected Map<UnrealId,NavPoint> navPoints
protected List<NavPoint> navPointsToProcess
protected Items.NavPointListener navPointListener
protected Items.EndMessageListener endMessageListener
protected Items.ItemPickedUpListener itemPickedUpListener
protected AgentInfo agentInfo
Constructor Detail |
---|
public Items(UDKBot bot)
bot
- owner of the module that is using itpublic Items(UDKBot bot, AgentInfo agentInfo)
bot
- owner of the module that is using itagentInfo
- AgentInfo memory modulepublic Items(UDKBot bot, AgentInfo agentInfo, Logger log)
bot
- owner of the module that is using itagentInfo
- AgentInfo memory modulelog
- Logger to be used for logging runtime/debug info, if null is provided the module creates its own loggerMethod Detail |
---|
public Item getRandomItem()
Note that there is no need to provide all "getRandomXYZ(xyz)", just
use MyCollections.getRandom(java.util.Collection)
.
public Map<UnrealId,Item> getAllItems()
Note: The returned Map is unmodifiable and self updating throughout time. Once you obtain a specific Map of items from this module, the Map will get updated based on what happens within the map.
public Map<UnrealId,Item> getAllItems(ItemType type)
Note: The returned Map is unmodifiable and self updating throughout time. Once you obtain a specific Map of items from this module, the Map will get updated based on what happens within the map.
public Map<UnrealId,Item> getAllItems(ItemType.Category category)
Note: The returned Map is modifiable and is always constructed upon every invocation of this method.
WARNING: O(n) complexity!
category
-
public Map<UnrealId,Item> getAllItems(ItemType.Group group)
Note: The returned Map is modifiable and is always constructed upon every invocation of this method.
WARNING: O(n) complexity!
group
-
public Item getItem(UnrealId id)
Once obtained it is self-updating based on what happens in the game.
id
-
public Item getItem(String stringUnrealId)
Once obtained it is self-updating based on what happens in the game.
stringUnrealId
-
public Map<UnrealId,Item> getVisibleItems()
Note: The returned Map is unmodifiable and self updating throughout time. Once you obtain a specific Map of items from this module, the Map will get updated based on what happens within the map.
public Map<UnrealId,Item> getVisibleItems(ItemType type)
Note: The returned Map is unmodifiable and self updating throughout time. Once you obtain a specific Map of items from this module, the Map will get updated based on what happens within the map.
public Map<UnrealId,Item> getVisibleItems(ItemType.Category category)
Note: The returned Map is modifiable and is always constructed upon every invocation of this method.
WARNING: O(n) complexity!
category
-
public Map<UnrealId,Item> getVisibleItems(ItemType.Group group)
Note: The returned Map is modifiable and is always constructed upon every invocation of this method.
WARNING: O(n) complexity!
group
-
public Item getVisibleItem(UnrealId id)
Once obtained it is self-updating based on what happens in the game.
id
-
public Item getVisibleItem(String stringUnrealId)
Once obtained it is self-updating based on what happens in the game.
stringUnrealId
-
public Map<UnrealId,Item> getReachableItems()
Note: The returned Map is unmodifiable and self updating throughout time. Once you obtain a specific Map of items from this module, the Map will get updated based on what happens within the map.
WARNING:It is totally unclear what UT2004 means by reachable!!!
public Map<UnrealId,Item> getReachableItems(ItemType type)
Note: The returned Map is unmodifiable and self updating throughout time. Once you obtain a specific Map of items from this module, the Map will get updated based on what happens within the map.
WARNING:It is totally unclear what UT2004 means by reachable!!!
public Map<UnrealId,Item> getReachableItems(ItemType.Category category)
Note: The returned Map is modifiable and is always constructed upon every invocation of this method.
WARNING: O(n) complexity!
WARNING:It is totally unclear what UT2004 means by reachable!!!
category
-
public Map<UnrealId,Item> getReachableItems(ItemType.Group group)
Note: The returned Map is modifiable and is always constructed upon every invocation of this method.
WARNING: O(n) complexity!
WARNING:It is totally unclear what UT2004 means by reachable!!!
group
-
public Item getReachableItem(UnrealId id)
Once obtained it is self-updating based on what happens in the game.
WARNING:It is totally unclear what UT2004 means by reachable!!!
id
-
public Item getReachableItem(String stringUnrealId)
Once obtained it is self-updating based on what happens in the game.
WARNING:It is totally unclear what UT2004 means by reachable!!!
stringUnrealId
-
public Map<UnrealId,Item> getKnownPickups()
Note: The returned Map is unmodifiable and self updating throughout time. Once you obtain a specific Map of items from this module, the Map will get updated based on what happens within the map.
isPickupSpawned(Item)
public Map<UnrealId,Item> getKnownPickups(ItemType type)
Note: The returned Map is unmodifiable and self updating throughout time. Once you obtain a specific Map of items from this module, the Map will get updated based on what happens within the map.
isPickupSpawned(Item)
public Map<UnrealId,Item> getKnownPickups(ItemType.Category category)
Note: The returned Map is modifiable and is always constructed upon every invocation of this method.
WARNING: O(n) complexity!
category
-
public Map<UnrealId,Item> getKnownPickups(ItemType.Group group)
Note: The returned Map is modifiable and is always constructed upon every invocation of this method.
WARNING: O(n) complexity!
group
-
public Item getKnownPickup(UnrealId id)
Once obtained it is self-updating based on what happens in the game.
id
-
public Item getKnownPickup(String stringUnrealId)
Once obtained it is self-updating based on what happens in the game.
stringUnrealId
-
public Map<UnrealId,Item> getSpawnedItems()
isPickupSpawned(Item)
to return all items that are believed to
be currently spawned.
WARNING: O(n) complexity!
public Map<UnrealId,Item> getSpawnedItems(ItemType type)
isPickupSpawned(Item)
to return all items of 'type' that are believed to
be currently spawned.
WARNING: O(n) complexity!
public Map<UnrealId,Item> getSpawnedItems(ItemType.Category category)
isPickupSpawned(Item)
to return all items belonging to a specific 'category' that are believed to
be currently spawned.
Note: The returned Map is modifiable and is always constructed upon every invocation of this method.
WARNING: O(n) complexity!
category
-
public Map<UnrealId,Item> getSpawnedItems(ItemType.Group group)
isPickupSpawned(Item)
to return all items belonging to a specific 'group' that are believed to
be currently spawned.
Note: The returned Map is modifiable and is always constructed upon every invocation of this method.
WARNING: O(n) complexity!
group
-
public double getItemRespawnTime(ItemType itemType)
itemType
-
public boolean isPickupSpawned(Item item)
This implementation is guessing (optimistically) whether the item is spawned based on the last time we have seen it missing (bot has seen its spawning-navpoint but the item was not laying there).
Note that the guessing is not perfect, experiment with it or check the source code and possibly reimplement (probably copy-paste) to suit your needs.
Note that this method is working correctly only if items are respawning.
item
- Item, for which its pickup point is to be examined.
getKnownPickups(boolean,boolean)
public boolean isPickupSpawned(UnrealId itemId)
This implementation is guessing (optimistically) whether the item is spawned based on the last time we have seen it missing (saw its navpoint but the item was not laying there).
Note that the guessing is not perfect, experiment with it or check the source code and possibly reimplement to suit your needs.
Note that this method is working only if items are respawning.
itemId
- Id of the item, for which its pickup point is to be examined.
getKnownPickups(boolean,boolean)
protected Items.ItemsListener createItemsListener(IWorldView worldView)
It must:
By overriding this method you may provide your own listener that may wrap Items with your class adding new fields into them.
worldView
- protected Items.MapPointsListener createMapPointsListener(IWorldView worldView)
By overriding this method you may provide your own listener that may wrap Items with your class adding new fields into them.
worldView
-
protected void start(boolean startPaused)
start
in class AgentModule<UDKBot>
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |