Game Development Reference
If you were to build a game that used squads, the process of determining a location to remain
in squad formation is improved immensely, as you can actually check to see if the desired
formation location is in the mesh and thus walkable or not. Previously, developers relied on
the expensive work of finding the nearest path node to the formation location. Finally, the
location's nearest path node is not necessarily very near the formation position, and often
Additionally, if your game uses walls which have the ability to be mantled over, the AI can
perform this at any point along the wall rather than having to go to a discrete PathNode
which represents a "mantle-able" location.
No more raycasts
Much of the raycasting AI does can be eliminated by using the data we generate into the
navigation mesh. When an AI attempts to make an initial move, performed in order to
determine if the AI can go directly to its destination and avoid pathfinding on the network,
a raycast is performed.
There are two reasons to why this is eliminated, both of which are cheaper than raycasting. If
a point can be directly reached, in most cases it will be in the same polygon navigation mesh
as the AI, then in most cases, it will be the same polygon navigation mesh the AI is currently
standing in. From there it's only a matter of seeking the polygon which contains our goal, and
identifying that it is in fact the same polygon and identifying that they are the same.
Moreover, the obstacle mesh serves as a backup on which we can perform a low-overhead
linecheck to determine if we can directly reach an area.
The navigation mesh is a rough representation of the potential space the AI can walk on,
so it would be a simple task to project onto the mesh and do a single raycast to correctly
align the AI onto the visible geography, as opposed to the number of raycasts per frame
The potential to handle more crowd actors at a time by snapping them to the navigation mesh
rather than doing collision checks against world geometry with WayPoints is another benefit.
We can now handle more AI on screen at once, as the overhead for doing so is far lower.
Laying PathNodes on a map
WayPoints use PathNodes for navigation. We will start by creating a new simple map with
PathNodes for our AI pawns to follow.
In the UDK editor, create a new map by going to File | New Level. When the pop-up for
Choose a map template appears, select any of the lighting samples.