Gathering information with sensors
An AI works first by taking in info about its surroundings, then that data is analyzed to determine an action and finally, the chosen action is executed, and as you can see, we cannot do anything without information, so let's start with that part. There are several sources of information our AI can use, such as data about itself (life and bullets) or maybe some game state (winning condition or remaining enemies), which can be easily found with the code we saw so far, but one important source of information is also the AI senses. According to the needs of our game, we might need different senses such as sight and hearing, but in our case, sight will be enough, so let's learn how to code that.
In this section, we will examine the following sensor concepts:
- Creating Three-Filters sensors
- Debugging with Gizmos
Let's start seeing how to create a sensor with the Three-Filters approach.