Package svs_simulation :: Package ai_lib :: Module pathfinding :: Class PathPlanner
[show private | hide private]
[frames | no frames]

Class PathPlanner


This class is used by an entity to determine which paths it should use when travelling.
Method Summary
  __init__(self, entity)
  cycleOnce(self)
The path manager calls this to iterate once though the search cycle of the currently assigned search algorithm.
  getClosestNodeToPosition(self, pos)
Returns the index of the closest visible and unobstructed graph node to the given position.
  getCostToClosestItem(self, GiverType)
Returns the cost to the closest instance of the GiverType.
  getCostToNode(self, node)
Returns the cost to travel from the entity's current position to a specific graph node.
  getDestination(self)
  getNodePosition(self, idx)
Used to retrieve the position of a graph node from its index.
  getPath(self)
Called by an agent after it has been notified that a search has terminated successfully.
  prepareForNewSearch()
Called at the commencement of a new search request.
  requestPathToItem(self, item)
Creates an instance of the A* time-sliced search and registers it with the path manager.
  requestPathToPosition(self, targetPos)
Creates an instance of the Dijkstra's time-sliced search and registers it with the path manager.
  setDestination(self, newPos)
  smoothPathEdgesPrecise(self, path)
Smooths a path by removing extraneous edges.
  smoothPathEdgesQuick(self, path)
Smooths a path by removing extraneous edges.

Method Details

cycleOnce(self)

The path manager calls this to iterate once though the search cycle of the currently assigned search algorithm. When a search is terminated the method messages the owner with either the msg_NoPathAvailable or msg_PathReady messages.

getClosestNodeToPosition(self, pos)

Returns the index of the closest visible and unobstructed graph node to the given position.

getCostToClosestItem(self, GiverType)

Returns the cost to the closest instance of the GiverType. This method also makes use of the pre-calculated lookup table. Returns -1 if no active trigger found.

getCostToNode(self, node)

Returns the cost to travel from the entity's current position to a specific graph node. This method makes use of the pre-calculated lookup table created by Raven_Game.

getNodePosition(self, idx)

Used to retrieve the position of a graph node from its index. Takes into account the enumerations 'non_graph_source_node' and 'non_graph_target_node'

getPath(self)

Called by an agent after it has been notified that a search has terminated successfully. The method extracts the path from PathPlanner.currentSearch, adds additional edges appropriate to the search type and returns it as a list of PathEdges.

prepareForNewSearch()

Called at the commencement of a new search request. It clears up the appropriate lists and memory in preparation for a new search request.

requestPathToItem(self, item)

Creates an instance of the A* time-sliced search and registers it with the path manager.

requestPathToPosition(self, targetPos)

Creates an instance of the Dijkstra's time-sliced search and registers it with the path manager.

smoothPathEdgesPrecise(self, path)

Smooths a path by removing extraneous edges. This removes *all* extraneous edges.

smoothPathEdgesQuick(self, path)

Smooths a path by removing extraneous edges. Note: this may not remove all extraneous edges.

Generated by Epydoc 2.1 on Thu Oct 20 15:30:25 2005 http://epydoc.sf.net