Unity user explores Unreal Engine 4: part 9

May 22, 2020 at 10:00 am by nemirc

Last time I explored the "sensing" capabilities in UE4. That is just a small piece of the puzzle, since the entire IA system in UE4 involves different parts that have to work together to make a working AI. As I've continued working with UE4, I have learned a few more things and put those things into practice as I began to work on my AI.

One of the elements you have to use is a Blackboard. A Blackboard in UE4 is a container for variables that an AI character uses to write/read information. For example, when the AI finds the player, the AI can write information about the player (like location, health, or virtually any information you want) on the blackboard. This data is then read by another element, the Behavior Tree. The Blackboard is not really that complicated, as it only lists information.

The Behavior Tree can tell the AI what to do depending on different conditions. These conditions are mostly defined by information on the Blackboard. For example, you can setup the Behavior Tree in a way that the AI character moves to the player only if the Blackboard tells there's a direct line between both.

To execute the different branches, the Behavior Tree uses functions called "Decorators." You can think of Decorators as basically true/false functions. For example, you can set it so that it executes branch A or B whether the player character is visible or not.

Decorators are Blueprints, but I am not sure if they are C++ scripts if you are using a C++ template (I am using a Blueprints template). Then, in the branches you can set a Blackboard Based Condition to define if that branch executes or not. For example, a Blackboard Condition that checks whether or not the player has been seen, compared to other where it checks if the player has been heard.

Each branch of the Behavior Tree can have one or more tasks, and you can also control how these are executed (in sequence, or one after another when the previous one ends).

As someone coming from Unity, I see making AI on both engines as completely different workflows, since, in Unity, you need to program everything in your AI function. Of course, Unity has tools for behavior trees (I have never tried any of those), but these are third party assets and I don't consider those when it comes to comparing both engines. Another thing I like about working with AI on UE4 is being able to use "senses" on your AI. Obviously, you can program similar systems on Unity, but having them built-in saves you a lot of time.

Get Unreal Engine: https://www.unrealengine.com/en-US/get-now

Sign up for our newsletter

This website uses cookies to ensure you get the best experience possible More Info
Got it!