Creating an AI opponent
In this section, you’ll start by creating a class for your hero’s foes, complete with the basic ability to patrol and attack. Sure, they might not be the sharpest guys around, but hey, they’re the Lichlord’s undead minions – not exactly known for their intelligence, are they?
We’ll be starting by extending the Character class, which, as you may already know, can be controlled by an AIController
, allowing independent actions during gameplay.
At this point, we want the minion to have the following features:
- A random patrolling movement around the level
- A perception system that will allow it to see and hear the player’s character
- The ability to seek out the player once it has been detected
In the next chapters, we’ll extend the Character class further by adding some more features such as health and spawnable goodies (when the AI has been defeated) but for now, we’ll just...