Behavior Tree & Blackboard: Difference between revisions

From Unreal Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
 
(3 intermediate revisions by the same user not shown)
Line 31: Line 31:


<p>
<p>
==Setting keys in Task==
In the tutorial, they simply make the same name as the key but you need to make the variable<p>
instance editable, and from the behavior tree you need to select/link the key that way<p>
In The Enemy Controller, when you promote the variables HasLineOfSight, and EnemyActor<br>
you have to set the Name in the default value of those variables Which would be<br>
"HasLineOfSight" and "EnemyActor"<br>
<p>


==Blueprint settings for Enemy Actor==
==Blueprint settings for Enemy Actor==
Line 38: Line 51:
(TO DO: add image)<p>
(TO DO: add image)<p>
This will cause the AI to properly rotate
This will cause the AI to properly rotate
Note: this video contradicts that: https://www.youtube.com/watch?v=8zN9bQSX4fQ&t=1s as this stops smooth rotations<br>
also I tested this myself and the AI still rotates without it checked
as long as Orient Rotation to Movement is checked (In the character movement component)


<p>
<p>
Line 44: Line 62:
==Decorator==
==Decorator==


Attachs to a Task and Allows you check key values and execute the task if the key is a certain value
Attaches to a Task and Allows you check key values and execute the task if the key is a certain value

Latest revision as of 02:11, 9 March 2025



I mainly learned from this page https://dev.epicgames.com/documentation/en-us/unreal-engine/behavior-tree-in-unreal-engine---quick-start-guide

1. In Unreal 5.2 The Blackboard come with a key by default called selfActor, (To DO: Add picture)

Composites: Execute from left to right below are the Composites

2.Selector Executes branches from left-to-right and is typically used to select between subtrees. It will stay on a Selector until its
successful, than move on to the next. Nothing fails here?

3. A Sequence Composites , executes until something fails, such as it we are chasing the player than succeed, than we can move on to attack
if we fail to catch player we don't attack. If we fail we go back up the Nodes

Task

When you create a task for the first time, it pops up save asset as, when you create it a second/more time it populates a list
Select BTT_TaskBlueprintBase, to add a new task and popup the save asset window


Setting keys in Task

In the tutorial, they simply make the same name as the key but you need to make the variable

instance editable, and from the behavior tree you need to select/link the key that way

In The Enemy Controller, when you promote the variables HasLineOfSight, and EnemyActor
you have to set the Name in the default value of those variables Which would be
"HasLineOfSight" and "EnemyActor"

Blueprint settings for Enemy Actor

You need to Enable Use Controller Rotation Yaw, for the AI Character you are setting

You will find this detail panel if you click on the "BlueprintName" (Self) In the Components window

(TO DO: add image)

This will cause the AI to properly rotate Note: this video contradicts that: https://www.youtube.com/watch?v=8zN9bQSX4fQ&t=1s as this stops smooth rotations
also I tested this myself and the AI still rotates without it checked as long as Orient Rotation to Movement is checked (In the character movement component)

Make sure Auto Possess AI: "Placed in World or Spawned" is selected

Decorator

Attaches to a Task and Allows you check key values and execute the task if the key is a certain value