unreal cant add key to blackboard

by Ellen Schroeder 9 min read

What are the advantages of UE4?

There are three main advantages to the way UE4 handles concurrent behaviors: 1 Clarity - Using Services and Simple Parallel nodes creates simple trees that are easier to read and understand. 2 Ease of Debugging - Clearer graphs are easier to debug. Also, having fewer simultaneous execution paths makes it easier to see what is being executed. 3 Easier Optimization - Event-driven graphs are easier to optimize if they do not have a lot of sub-trees simultaneously executing.

How does UE4 behavior tree work?

One of the ways UE4 Behavior Trees differ from other Behavior Tree systems is that UE4 Behavior Trees are event-driven to avoid doing unnecessary work every frame. Instead of constantly checking whether any relevant change has occurred, the Behavior Tree passively listens for "events" that can be used to trigger changes in the tree. In the image below, an event is used to update the Blackboard Key HasLineOfSight? . This causes any lower priority Task to be aborted in favor of executing our left-most branch which has higher priority.

What is conditional tree?

In the standard model for Behavior Trees, conditionals are Task leaf nodes, which simply do not do anything other than succeed or fail. Although nothing prevents you from making traditional conditional tasks, it is highly recommended that you use Decorators for conditionals instead.

How are behavior trees created?

Behavior Trees are created in a visual way similar to Blueprint by adding and connecting a series of nodes which have some functionality attached to them to a Behavior Tree Graph. While a Behavior Tree executes logic, a separate asset called a Blackboard is used to store information (called Blackboard Keys) the Behavior Tree needs to know about in order to make informed decisions. A typical workflow would be to create a Blackboard, add some Blackboard Keys, then create a Behavior Treethat uses the Blackboard asset (pictured below, a Blackboard is assigned to a Behavior Tree).

What is concurrent behavior?

Concurrent Behaviors. Standard Behavior trees often use a parallel composite node to handle concurrent behaviors and the parallel node begins execution on all of its children simultaneously. Special rules determine how to act if one or more of those child trees finish (depending on the desired behavior).

1 - Required Project Setup

In this first step, we set up our project with the assets we'll need for our AI character to get around the environment.

2 - Blackboard Setup

In this step, we create our Blackboard asset, which is essentially the brain of our AI. Anything we want our AI to know about will have a Blackboard Key that we can reference.

3 - Behavior Tree Layout

In this step, we will lay out the flow of our Behavior Tree and the states that we want our AI to enter. Laying out your Behavior Tree with the states you anticipate your AI could be in as a visual flow will give you an idea of what type of logic and rules you will need to create to enter those states.

4 - Task Setup - Chase Player

In this step, we set up our Chase Player Task to change the movement speed when chasing the Player.

5 - Task Setup - Find Random Patrol

In this step, we set up our Find Random Patrol Task so our AI moves to a random location when it is not chasing the Player.

6 - AI Controller Setup

In this step, we do a little bit of work inside the AI Controller in preparation for the final step, setting up a Decorator to determine which branch of our Behavior Tree to enter.

7 - Decorator and Final Setup

In this final section, we adjust a few settings on the Player Character and Enemy Character Blueprints. We also set up our Decorator in our Behavior Tree which will determine what branch we can enter based on a specified condition.

image