Using advanced state tree features
In this section, we will once again extend the BaseDummyCharacter
class to create an AI agent that listens for noise signals and moves to the location where the noise was generated. Once the location has been checked, the AI agent will return to its original position. We will start by creating an AI controller that will have hearing capabilities through the Perception System and will handle its AI logic through state trees. We are essentially developing a guard to protect a level from intruders. As usual, let’s start by creating our own base C++ class.
Creating the C++ AI controller
The AI controller class will need to implement a hearing sense and execute state tree logic. As mentioned earlier, at the time of writing this book, there seems to be a bug in Unreal Engine that prevents us from declaring a StateTreeAIComponent
class in C++ so, for the time being, we will be implementing just the hearing sense and adding the state tree component...