====== AI Editor ====== * A brand new editor for editing creatures behaviors - **Behavior Tree Editor**. Allows developers to customize creature behavior and make the behavior of creatures no longer rigid, but more flexible and controllable. * This is a graphical programming tool used to describe the behavior of entities. It is a tool similar to a flow chart. * Behavior trees consist of Nodes and Connections. Different nodes represent different behaviors or conditions, and the connections between nodes represent the order in which the nodes are executed. {{ :developer_center:AI_editor_tutorials_1.png?nolink&800 |}} * **Entrance: Creature Plug-in->Edit Creature >Advanced>Behavior Tree** //**Note:** If behavior tree editing is used, the old version of creatures (traditional creature card abilities) will be invalid, so developers must control all movement, attack, walk, sleep, etc.// {{ :developer_center:AI_editor_tutorials_2.png?nolink&800 |}} ---- ====== The behavior tree consists of the following points: ===== **1. Root node: the starting point of the behavior tree. The program will start from here to execute the behavior of the creature in every frame.**\\ {{ :developer_center:AI_editor_tutorials_3.png?nolink&400 |}} **2. Event node: used to monitor special events in the game. (hit, audio-triggered, etc.)**\\ {{ :developer_center:AI_editor_tutorials_4.png?nolink&400 |}} **3. Decorator node: hung on any node except the root node, playing a logical supplementary role to the mounted node. (Initialization, node return value, etc.)**\\ {{ :developer_center:AI_editor_tutorials_5.png?nolink&400 |}} **4. Combined node: a bridge connecting nodes. It does not execute specific functional logic, but only handles the access sequence of child nodes and the interruption relationship of nodes. (Sequential execution, selective execution, simultaneous execution, etc.)**\\ {{ :developer_center:AI_editor_tutorials_6.png?nolink&400 |}} **5. Condition node: only performs conditional judgment and does not perform actual actions. (Health volume judgment, target judgment, etc.)** {{ :developer_center:AI_editor_tutorials_7.png?nolink&400 |}} **6. Action node: perform a specific behavior. (Move, attack, set attribution, etc.)**\\ {{ :developer_center:AI_editor_tutorials_8.png?nolink&400 |}} **7. Value node: only performs numerical logic and does not perform actual behavior. (Get blood volume, find targets, etc.)**\\ {{ :developer_center:AI_editor_tutorials_9.png?nolink&400 |}} **8. Connection line: connects nodes to nodes and is used to control the actual execution sequence of nodes.**\\ {{ :developer_center:AI_editor_tutorials_10.png?nolink&400 |}} **9. Variables: store and read information when the node is executed. This is common to trigger variables.**\\ //The behavior tree logic can be reused in different creatures within the map.// {{ :developer_center:AI_editor_tutorials_11.gif?nolink |}} **Debugging function:** Provides a debugging interface that can view biological running behavior trees in real time, making it easier for developers to discover problems in behavior tree production on time. {{ :developer_center:AI_editor_tutorials_12.gif?nolink |}} === Example: === **How to use the AI editor to create a creature that actively attacks the player and turns into a firefly when it's HP <= 50:** * We need to first customize a creature. * Then change the Advanced Editing Method to Advanced Editing for Behavior Tree in the creature editing panel; {{ :developer_center:AI_editor_tutorials_13.gif?nolink |}} * Create the node to determine whether there are players nearby. If there are players, attack. {{ :developer_center:AI_editor_tutorials_14.mp4?nolink&800 |}} * Create another node to determine to change to Firefly when its current hp is lower than 60. {{ :developer_center:AI_editor_tutorials_15.png?nolink&800 |}} * The final result is as follows: {{ :developer_center:AI_editor_tutorials_16.gif?nolink |}} ----