An AI sensory system emulates senses such as sight, hearing, and even smell to get information from other game objects. In such a system, the NPCs need to examine the environment and check for such senses periodically based on their particular interest.
In a minimal sensory system, we have two principal elements: Aspect and Sense. Every sense is capable of perceiving a specific aspect: for instance, an NPC with the sense of hearing can perceive the sound (the aspect) emitted by another game object, or a zombie NPC can use its smell sense to prey on the player's brain. As in real life, NPCs are not forced to use a single sense; they can have many such as sight, smell, and touch.
For our demo, we are going to implement a base interface, called Sense, that we'll use to implement custom senses. In this chapter, we'll implement sight and touch...