Gathering information with sensors
AI in games works in a three-step process: gathering information, analyzing it, and executing actions based on such analysis. This is important as it reflects a simple version of how the human mind works, making the resulting AI more realistic. 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 easily be found with the code we’ve seen so far. One important source of information, however, is sensors such as sight and hearing. 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-filter sensors with C#
- Creating three-filter sensors with Visual Scripting
- Debugging with gizmos
Let’...