Game Development Reference
In-Depth Information
5.4 Waypoints
The concept of waypoints was introduced in Chapter Four as a means
of marking a route on a map that NPCs can follow. In the workshop
we developed a very simple algorithm to cycle through the waypoints
and have an NPC follow them continuously.
A waypoint is simply a remembered location on a map. Waypoints are
placed in a circuit over the map's surface and are connected by straight
line paths. Paths and waypoints are connected in such a way that an
NPC moving along the paths is assured not to collide with any fixed
obstacles. Waypoints and their connecting paths create a graph. Moving
from waypoint to waypoint along a path requires an algorithm to search
through and find all the nodes and how they are connected to each
other. An example maze and a set of waypoints are illustrated as a graph
in Figure 5.3 . The graph does not necessarily need to reflect the physical
layout of the maze when drawn. This example only shows which nodes
connect to other nodes, not the location of the nodes or the distances
between them.
FIG 5.3 A maze with a set of waypoints.
Search Nedrilad ::




Custom Search