Game Development Reference
In-Depth Information
Creating the AI using cover
Having AI using cover is a huge step towards making characters seem more believable and
it usually makes them more challenging as they don't die as quickly.
There are many ways to implement this functionality. In the simplest form, the AI is not
aware of any cover. It's simply scripted (by a designer) to move to a predefined favorable
position when they spot an enemy. A player playing the sequence for the first time can't
possibly notice the difference between an AI taking the decision by itself. Hence, the task
of creating a believable AI (for that situation) is accomplished.
A much more advanced way would be to use the same principles for cover, which was es-
tablished in Chapter 2 , Cameras and Game Controls . However, evaluating options also be-
comes far more complex and unpredictable. Unpredictable AI might be good from the
player's perspective, but it's a nightmare from a designer's perspective.
In this recipe, we'll go for a middle ground. First of all, we will base the AI on the FSM
created in the previous recipe, and add a new state that handles finding cover. We will then
add cover points to a scene, from which the AI can pick a suitable one and move there be-
fore attacking.
State diagram
Search WWH ::




Custom Search