|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcz.cuni.pogamut.Client.GameMap
public class GameMap
GameMap provides simple navigation information e.g. nearest navigation point, path to specified object
it also integrates AStar algorithm and use it to answer request for get path. this option is valid only for paths to NavPoints and Items, paths to players are solved using Gamebot API
Field Summary | |
---|---|
private AgentBody |
body
poiter to body to use things like getPath(), knownObjects, addListener etc. |
protected AgentMemory |
memory
pointer to the memory - used by getPathAStar() and other memory related topics - like getPathToClosestMedKit etc. |
private Item |
nextItem
next item bot has to go |
private int |
nextItemIndex
next item index in itemsToRunAround |
PathManager |
pathManager
|
protected java.util.logging.Logger |
platformLog
logger for logging any messages for debugging etc. |
(package private) int |
tempCounter
|
Constructor Summary | |
---|---|
GameMap(java.util.logging.Logger logger,
AgentBody body,
AgentMemory memory)
END OF VARIABLES FOR runAroundItemsInTheMap |
Method Summary | |
---|---|
boolean |
antiStuckCheck(Triple goal)
check two things: 1) agent's velocity - size of vector greater than 50 UT units 2) agent is heading to the location - distance from the location is greater about 50 UT units than distance from object after adding agent's velocity vector to location vector - if this method fails - delete the edge in the graph for A* |
boolean |
atLocation(Triple location)
|
boolean |
atLocation(Triple location,
int epsilon)
|
java.util.ArrayList<NavPoint> |
getNavPointsAStar(AStarResult result)
auxiliary A* method converts AStarResult to ArrayList of NavPoints which is then used as path in runAlongItemsInTheMap |
AStarResult |
getPathAStar(NavPoint toWhat)
Returns path from your current position to the 'toWhat' or null if path doesn't exist. |
AStarResult |
getPathAStar(NavPoint toWhat,
int maxNumOfIterations)
Returns path from your current position to the 'toWhat' or null if path doesn't exist. |
java.util.ArrayList<NavPoint> |
getPathOfID(int ID)
Method for obtaining the path returned by GB due to the GETPATH request sent through sendGetPath(navPoint, pathID). |
java.util.ArrayList<NavPoint> |
getPathToLocation(Triple location)
obtain path to specified location keeps returning null until path is received don't forget to initialize it - initializeGetPath should be called prior this method |
void |
initializeGetPath()
Deprecated. |
java.util.ArrayList<Item> |
nearestHealth(int strength,
int numberOfHealths)
very basic method for getting healths of strenght greater or equal to strenght numberOfHealths specifies how many do you want for more complex and more efficient way of doing this use something else think about map preprocessing and more efficient methods of search through the space (than using AStar numerous times) note, it uses restricted AStar - restricted number of iterations, so it can find nothing! |
java.util.ArrayList<Item> |
nearestItems(MessageType type,
int numberOfItems)
very basic method for getting restricted number of closest items of specified type for more complex and more efficient way of doing this use something else think about map preprocessing and more efficient methods of search through the space (than using AStar numerous times) note, it uses restricted AStar - restricted number of iterations, so it can find nothing! |
NavPoint |
nearestNavPoint(Triple from)
Finds nearest navPoint - presume that the agent doesn't see any, so it uses this unefficient method needs Triple from as a parameter |
NavPoint |
nearestNavPoint(Triple from,
int minDistance)
Finds nearest navPoint - presume that the agent doesn't see any, so it uses this unefficient method counts only those in bigger distance than specified needs Triple from as a parameter |
void |
receiveMessage(RcvMsgEvent e)
add message to collected paths (adds) FIFO fashion adds at the beginning removes from the end |
void |
restartMap()
method which restarts game map instance - restart necessary variables |
boolean |
runAlongPath()
method to follow smoothly desired path - list of navigation points obtained from game map can handle movers - wait on it until top and leave note that movers in the way are in this fashion: - LiftExit -> LiftCenter -> LiftExit so as agent is supposed to go up when he is supposed to go to LiftCenter (therefore is around first LiftExit) he waits for mover to be about his level and then goes on it, wait to level with second LiftExit and move on |
void |
runAroundItemsInTheMap(java.util.List<? extends Item> itemsToRunAround,
boolean AStar)
run around items in the map is a complex method which covers behavior which runs around the map according to specified list of items, it works in the following fashion: 1) nextItem == null => shuffle itemsToRunAround, choose first one 2) path == null => obtain path 3) run along the path 4) if the run along fails or if bot reaches the item, switch to next on |
boolean |
safeRunToLocation(Triple location)
safely navigates agent to the location of choosen item (could be anywhere). moreover you can set the distance at which agent will stop when reaching last point of the path (by setting GameMapSettings.lastNavigationPointOfPathPrecision) it should be I think at least 5 as I think it is not guaranteed that bots moves precisely. |
void |
sendGetPathToLocation(int ID,
Triple toWhat)
This method sends GETPATH query to GameBots - you have to provide PathID under which the path will be returned by GB and stored in GameMap instance. |
void |
sendGetPathToNavPoint(NavPoint toWhat)
This method sends GETPATH query to GameBots - you have to provide PathID under which the path will be returned by GB and stored in GameMap instance. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected java.util.logging.Logger platformLog
private AgentBody body
protected AgentMemory memory
private Item nextItem
private int nextItemIndex
public PathManager pathManager
int tempCounter
Constructor Detail |
---|
public GameMap(java.util.logging.Logger logger, AgentBody body, AgentMemory memory)
Method Detail |
---|
public java.util.ArrayList<Item> nearestHealth(int strength, int numberOfHealths)
for more complex and more efficient way of doing this use something else think about map preprocessing and more efficient methods of search through the space (than using AStar numerous times)
note, it uses restricted AStar - restricted number of iterations, so it can find nothing!
nearestHealth
in interface Navigation
public java.util.ArrayList<Item> nearestItems(MessageType type, int numberOfItems)
for more complex and more efficient way of doing this use something else think about map preprocessing and more efficient methods of search through the space (than using AStar numerous times)
note, it uses restricted AStar - restricted number of iterations, so it can find nothing!
nearestItems
in interface Navigation
public NavPoint nearestNavPoint(Triple from)
needs Triple from as a parameter
nearestNavPoint
in interface Navigation
from
- - most often agent location
public NavPoint nearestNavPoint(Triple from, int minDistance)
counts only those in bigger distance than specified
needs Triple from as a parameter
nearestNavPoint
in interface Navigation
from
- - usualy agent location
public boolean atLocation(Triple location)
location
- - location bot is heading to, comparing to
public boolean atLocation(Triple location, int epsilon)
location
- - location bot is heading to, comparing toepsilon
- - a distance in UT units from which bot starts to be at the
location
public void sendGetPathToNavPoint(NavPoint toWhat)
sendGetPathToNavPoint
in interface Navigation
toWhat
- - target (NavPoint) of the requestpublic void sendGetPathToLocation(int ID, Triple toWhat)
sendGetPathToLocation
in interface Navigation
ID
- - id which is ment to be returned with query, toWhat -
location (triple)public java.util.ArrayList<NavPoint> getPathOfID(int ID)
getPathOfID
in interface Navigation
ID
-
public AStarResult getPathAStar(NavPoint toWhat, int maxNumOfIterations)
getPathAStar
in interface Navigation
public java.util.ArrayList<NavPoint> getNavPointsAStar(AStarResult result)
getNavPointsAStar
in interface Navigation
result
- - AStarResult
public AStarResult getPathAStar(NavPoint toWhat)
getPathAStar
in interface Navigation
public void receiveMessage(RcvMsgEvent e)
receiveMessage
in interface RcvMsgListener
public void initializeGetPath()
public java.util.ArrayList<NavPoint> getPathToLocation(Triple location)
location
-
public boolean runAlongPath()
runAlongPath
in interface Navigation
public void runAroundItemsInTheMap(java.util.List<? extends Item> itemsToRunAround, boolean AStar)
runAroundItemsInTheMap
in interface Navigation
itemsToRunAround
- - array of items - like all weapons in the mapAStar
- - switch = to use or not to use built-in AStar - both work
about the samepublic void restartMap()
public boolean antiStuckCheck(Triple goal)
goal
- - target location
public boolean safeRunToLocation(Triple location)
safeRunToLocation
in interface Navigation
location
- - location to run to
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |