Creating and managing state trees
From this section onward, we will be creating a new gym based on a couple of AI agents using state trees instead of behavior trees. This will help us to understand the basic principles behind this new development pattern.
To help us understand these principles, we’ll be doing the following:
- Create/place an actor in the level who will periodically emit a noise by using a dedicated state tree
- Create/place a dummy character who will be managed by another state tree and will do the following:
- Stay idle in its starting location
- Reach the noise location whenever a noise is perceived
- Get back to its starting location after a brief time investigating the location
Although pretty simple, this logic can be used as a starting point for a guard AI agent that will investigate a level looking for intruders and responding to any suspicious noise around.
As the state trees feature is not enabled by default, the first thing to do will...