Predicting opponent actions

Now, let's make the character anticipate what is going to happen even before getting in confrontation against the player. This is the part where the character AI starts to plan the best options available to accomplish the objective.

Let's take a look at how we can implement an anticipation system into the character AI. We will continue to use the example mentioned in the preceding section, where we have a soldier searching for another one in the map. At the moment, we have a character that moves around the map and stops when they find the player.

If our character AI has found the player, most likely situation is for the player to find the character AI as well so that both characters are aware of each other. What ...

Get Practical Game AI Programming now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.