UnrealScript Game Programming Cookbook

(Chris Devlin) #1

5


AI and Navigation


In this chapter, we will be covering the following recipes:


f Laying PathNodes on a map
f Laying NavMeshes on a map
f Adding a scout to create NavMesh properties
f Adding an AI Pawn via Kismet
f Allowing a pawn to wander randomly around a map
f Making a pawn patrol PathNodes on a map
f Making a pawn randomly patrol PathNodes on a map
f Allowing a pawn to randomly patrol a map with NavMeshes
f Making a pawn follow us around the map with NavMeshes

Introduction


The Unreal Engine has two ways of handling pathfinding. They both have their pros and cons,
despite being somewhat similar. Quite simply, they can be broken down into WayPoints and
navigation meshes.


WayPoints


Pathfinding in the Unreal Engine is based on a pre-generated path network, which is laid down
by the developer. The path network doesn't cover 100 percent of the area the AI may navigate.
Therefore the AI also needs to be able to perform localized evaluation and routing of the
environment. The AI does this by using collision (ray) traces to determine how far objects
are and whether or not they are passable.

Free download pdf