zombie.ai.astar
Class AStarPathMap

java.lang.Object
  extended by zombie.ai.astar.AStarPathMap

public class AStarPathMap
extends java.lang.Object

A path finder implementation that uses the AStar heuristic based algorithm to determine a path.

Author:
Kevin Glass

Nested Class Summary
static class AStarPathMap.Node
          A single node in the search graph
 
Field Summary
 TileBasedMap map
          The map being searched
 java.util.ArrayList<AStarPathMap.Node> NodeMap
           
 
Constructor Summary
AStarPathMap(TileBasedMap map)
          Create a path finder
 
Method Summary
 void DoPrecalcFile(AStarPathFinder finder)
           
 int getFreeIndex(IsoGameCharacter character)
           
 float getMovementCost(Mover mover, int sx, int sy, int sz, int tx, int ty, int tz)
          get the cost to move through a given location
 AStarPathMap.Node getNode(int x, int y, int z)
           
 void LoadPrecalcFlle()
           
 void setNode(int x, int y, int z, AStarPathMap.Node newNode)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

map

public TileBasedMap map
The map being searched


NodeMap

public java.util.ArrayList<AStarPathMap.Node> NodeMap
Constructor Detail

AStarPathMap

public AStarPathMap(TileBasedMap map)
Create a path finder

Parameters:
heuristic - The heuristic used to determine the search order of the map
map - The map to be searched
maxSearchDistance - The maximum depth we'll search before giving up
allowDiagMovement - True if the search should try diaganol movement
Method Detail

LoadPrecalcFlle

public void LoadPrecalcFlle()
                     throws java.io.FileNotFoundException,
                            java.io.IOException
Throws:
java.io.FileNotFoundException
java.io.IOException

DoPrecalcFile

public void DoPrecalcFile(AStarPathFinder finder)

getFreeIndex

public int getFreeIndex(IsoGameCharacter character)

getMovementCost

public float getMovementCost(Mover mover,
                             int sx,
                             int sy,
                             int sz,
                             int tx,
                             int ty,
                             int tz)
get the cost to move through a given location

Parameters:
mover - The entity that is being moved
sx - The x coordinate of the tile whose cost is being determined
sy - The y coordiante of the tile whose cost is being determined
tx - The x coordinate of the target location
ty - The y coordinate of the target location
Returns:
The cost of movement through the given tile

getNode

public AStarPathMap.Node getNode(int x,
                                 int y,
                                 int z)

setNode

public void setNode(int x,
                    int y,
                    int z,
                    AStarPathMap.Node newNode)