Basic sensory systems
An AI sensory system emulates senses such as sight, hearing, and even smell to get information from other GameObjects. 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 (also called event emitters) and sense (also called event senses). Every sense can perceive only a specific aspect; for instance, an NPC with just the sense of hearing can only perceive the sound (one of the aspects) emitted by another GameObject, or a zombie NPC can use its sense of smell to prey on the player's brain. As in real life, we do not need a single sense for every NPC; they can have sight, smell, and touch all at once.
In our demo, we'll implement a base interface, called Sense
, that we'll use to implement custom senses. In this chapter, we'll implement sight and touch senses. Sight is what we use to see the...