Week 8 Part 2 - AI Behavior Tree Updated

AI Behavior Tree Updated

We had a problem with our previous alien AI that it would go straight to the maze right at the start of the game (when the player was still in the lobby) instead of when the game actually started (when the player was in the spaceship mid-game).

So, to fix this I updated my AI's behavior tree. I spent time this week researching a thing called Decorator, which can be attached to the behavior tree of AI, adding an extra layer of logic to the behavior logic of AI.

The Decorator I chose to use is according to a Blackboard Condition I set. In my plan, when the AI behavior tree tries to go through this node, it will check a Boolean (that is, the value of whether the game starts or not). When the value is False, the behavior under this branch will not be executed, and vice versa.

In this test, I made a button UI to simulate the game start button. When the player presses the start button, the value of this Boolean will be changed, so that the AI will start to perform the behavior of going through the maze.

Implement Explanation

1. Adding a decorator in the place we want to check if we are executing the branch or not. Also creating a blackboard boolean value.


2. Creating a button UI in its event graph reference the blackboard object and changes the boolean value as the player clicks the Game Start button.


3. Finally, add the UI to the viewport.

Demo


Comments