Movement and Path Planning

Because it would be incredibly tedious to have to specify every CELL of movement for every UNIT, JCiv supports long-range movement planning. Specifically, when the player selects one or more UNITs, and gives them a Move command, the player may select any cell (including a currently invisible cell) as the target of that Move. The UNIT is responsible for translating that Move into a series of low-level, CELL-by-CELL Move commands.

The UNIT must, therefore, decide on a route to take between its current and target locations. The UNIT MUST take the minimum cost (smallest time) path between its current and target locations. To determine that path, the UNIT MUST use a shortest-path algorithm such as Dijkstra's algorithm. A number of references to Dijkstra's algorithm are available, including on the web and in Cormen, Leiserson, Rivest, and Stein's text, Introduction to Algorithms. There will be a class lecture on shortest-path algorithms.

The UNIT MUST only plan its path with respect to the visibility information (Section 4.2.2) that is available at the time that the COMMAND is issued. The UNIT MUST NOT use the TERRAIN TYPEs for any CELLs that are currently invisible to the player. It MAY treat invisible CELLs as having either minimum or maximum cost to traverse, at the designers' option.

Terran Lane 2005-04-04