官术网_书友最值得收藏!

Behavior Tree components

If you go through the official documentation, you will find that there are five types of nodes (Task, Decorator, Service, Composite, and Root) available to use, depending on the type of behavior that you're trying to create (and subsequently, how the AI should act in the world). However, I'd like to reformulate this to you in order to make it easier to understand and hopefully more practical.

Besides the Root node, the only kind of nodes (that are not leaves) are the Composites nodes. Leaves are called Tasks. Decorators and Services are add-ons for either a Composite node or a Task leaf. Although Unreal lets you leave a Composite node as a leaf, you shouldn't, because it means that you can remove that node and the Behavior Tree will still work in the same way. Here is an example of a tree showing all the different types of node (actually, we will build this Behavior Tree later in this book):

When a tree is executing, you need to start following from the root node and go down the tree, reading the nodes from left to right. You traverse all the different branches (Composite nodes) in a specific way (we are going to see this in a little while), until we reach a leaf, which is a Task. In this case, the AI performs that Task. It is important to note that a Task can fail, for instance, if the AI is unable to complete it. The fact that a Task can fail will be useful for understanding how Composite nodes work. After all, a decision-making process is just choosing which task to perform to achieve a goal in a better way (e.g. killing the player). Thus, based on which task failed to execute (or, as we will see, a Decorator can make a task or a whole branch fail), the Composite nodes will determine the next tasks in the tree.

In addition, when you create your Behavior Tree, each node can be selected, and some settings to adjust the behavior of the node/leaf can be found in the Detail Panel. Moreover, since the order is important, the nodes in the Behavior Tree have numbers (in the top-right corner) to help you understand the ordering of the node (although it is always from top to bottom, left to right). The following screenshot shows where you can find these numbers:

Let's look at these components in detail and pay particular attention to Composite nodes.

主站蜘蛛池模板: 岳阳市| 思南县| 清徐县| 荆州市| 永昌县| 丰原市| 甘肃省| 阜城县| 潼关县| 洪雅县| 平和县| 黄浦区| 新沂市| 乌兰县| 阿图什市| 策勒县| 布尔津县| 麻栗坡县| 通化县| 红安县| 安多县| 固阳县| 泰宁县| 开远市| 尉犁县| 图们市| 河池市| 玛多县| 潮安县| 高唐县| 喀喇沁旗| 香港 | 始兴县| 江津市| 龙山县| 无锡市| 姚安县| 龙南县| 顺平县| 正宁县| 晋城|