cz.cuni.pogamut.Client
Interface Navigation

All Known Implementing Classes:
GameMap

public interface Navigation

Navigation is an interface that gathers methods for agent's navigation through a map. Therefore there are methods to run along some path, to obtain nearest health item, navigation point and run for them


Method Summary
 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<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
 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.
 

Method Detail

nearestHealth

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!

Returns:
list of healths ordered according to distance from the player (using built-in AStar to figure that out)

nearestItems

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!

Returns:
list of healths ordered according to distance from the player (using built-in AStar to figure that out)

nearestNavPoint

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

Parameters:
from - - most often agent location
Returns:
NavPoint - nearest NavPoint

nearestNavPoint

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

Parameters:
from - - usualy agent location
Returns:
NavPoint - nearest NavPoint

sendGetPathToNavPoint

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.
Use getPathOfID(pathID) for retrieval.

Parameters:
toWhat - - target (NavPoint) of the request

sendGetPathToLocation

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.
Use getPathOfID(pathID) for retrieval.

Parameters:
ID - - id which is ment to be returned with query, toWhat - location (triple)

getPathOfID

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).
Note that it takes some time to resolve the GETPATH query.

Parameters:
ID -
Returns:
list of navpoints marking the path or null if ID does not exists

getPathAStar

AStarResult getPathAStar(NavPoint toWhat,
                         int maxNumOfIterations)
Returns path from your current position to the 'toWhat' or null if path doesn't exist.

Returns:
Collection of instances of NavPoint

getNavPointsAStar

java.util.ArrayList<NavPoint> getNavPointsAStar(AStarResult result)
auxiliary A* method
converts AStarResult to ArrayList of NavPoints which is then used as path in runAlongItemsInTheMap

Parameters:
result - - AStarResult
Returns:
list of navigation points which define path to object

getPathAStar

AStarResult getPathAStar(NavPoint toWhat)
Returns path from your current position to the 'toWhat' or null if path doesn't exist.

Returns:
Collection of instances of NavPoint

runAlongPath

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

Returns:
boolean value - true if there are no problems, false if agent reaches the end or is unable to reach next navPoint

runAroundItemsInTheMap

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:

Parameters:
itemsToRunAround - - array of items - like all weapons in the map
AStar - - switch = to use or not to use built-in AStar - both work about the same

safeRunToLocation

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.

Parameters:
location - - location to run to
Returns:
false if there is some problem on the path - check platform log for more details