Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
quick:bolt [2019/06/06 15:39]
victorzamora
quick:bolt [2019/06/06 15:44] (current)
victorzamora
Line 32: Line 32:
 The first node of the behavior is a `bolt generic event` node in the behavior tree. A `bolt generic event` is a node that does not have input parameters, so we have just to add this node as first node in the `Sequence`. The first node of the behavior is a `bolt generic event` node in the behavior tree. A `bolt generic event` is a node that does not have input parameters, so we have just to add this node as first node in the `Sequence`.
  
-![Second phase of the behavior tree](https://​lh5.googleusercontent.com/​o49ktg8cjdlQqggFxlcCXDQ0imJc2ecfIgZ2SQ7JDBCY2JL6hK0xJZWmYTt__h5EgW-iAj42hIVCkBL1IDslW6T5iwuhf5WHxa5KyS00BHMWyXYKuRYdf1ld-NQ3ghwzjCBvf7Z9)+![Second phase of the behavior tree](images:bolt:Second phase of the behavior tree.png)
 Although the behavior does not have input parameters, we need to fill the name of the `custom event` as a constant value. This custom event name will must be the same as the `custom event` that we are going to create in Bolt. In this case, we write the name "​PendingPath"​. Although the behavior does not have input parameters, we need to fill the name of the `custom event` as a constant value. This custom event name will must be the same as the `custom event` that we are going to create in Bolt. In this case, we write the name "​PendingPath"​.
  
 Now, we create a Bolt `macro` with a `custom event` named "​PendingPath"​ (or the same name that you chose before in the "​custom event name" parameter). This `custom event` must also have one parameter, that represents a reference of the own Behavior Bricks node, used to call its own methods. The completed `macro` is shown below. Now, we create a Bolt `macro` with a `custom event` named "​PendingPath"​ (or the same name that you chose before in the "​custom event name" parameter). This `custom event` must also have one parameter, that represents a reference of the own Behavior Bricks node, used to call its own methods. The completed `macro` is shown below.
  
-![PendingPath](https://​lh4.googleusercontent.com/​HiAbOPvkzVF54BxC9vSWxhtjY4wRphIlQdaxBilzzIT5x74I90KAjJYG6Kk7RFEvyOxhc9uQ-aqAWZnBCjafX0T882FmIIkn7RJiLA7Q_zDPn9FXMk4EdYZ0_mq2jVbl_8gnbPCo)+![PendingPath](images:bolt:​PendingPath.png)
  
 As mentioned before, this `macro` checks if there is not still a path pending and if the remaining distance is less or equal than a threshold (in this example, 2) and, if so, return success. Note that the parameter of the custom event is used to call the `"​Return Main"` node. As mentioned before, this `macro` checks if there is not still a path pending and if the remaining distance is less or equal than a threshold (in this example, 2) and, if so, return success. Note that the parameter of the custom event is used to call the `"​Return Main"` node.
Line 70: Line 70:
 Next, we have to add a `Flow Machine` to the enemy and, then, create a new `macro` called, for example, `BoltGetReachableRandomPoint`. The macro generates a random vector and taking the nav mesh calculates where the GameObject must go. Next, we have to add a `Flow Machine` to the enemy and, then, create a new `macro` called, for example, `BoltGetReachableRandomPoint`. The macro generates a random vector and taking the nav mesh calculates where the GameObject must go.
  
-![GetRandomReachablePoint](https://​lh6.googleusercontent.com/​mxknY7MYK_Ol_iU7mkxTLFBYq4xSEkxB6A8p1h_qgunegLNfsC55wEzMwC7OZMRxZJ39NfZw_F3BjVieN3Rn5fXznCXRVE7BLyiyN4YxQqkNJactb0u4AFbKOpPFZSU9LFW38LgM)+![GetRandomReachablePoint](images:bolt:​GetRandomReachablePoint.png)
  
 This `macro` must have a `Custom Event` module with number of arguments setted at two and the name of the event will be `GetRandomReachablePoint`. In this case, we have 2 parameters: the reference of the own Behavior Bricks node and the variable that we have just created. In addition, a `Return Main` module is necessary too. As in the previous node (Check Pending Path), it indicates the node what was the result of the execution. This `macro` must have a `Custom Event` module with number of arguments setted at two and the name of the event will be `GetRandomReachablePoint`. In this case, we have 2 parameters: the reference of the own Behavior Bricks node and the variable that we have just created. In addition, a `Return Main` module is necessary too. As in the previous node (Check Pending Path), it indicates the node what was the result of the execution.
Line 76: Line 76:
 Now, we have to add the new node `GetRandomReachablePoint` in the behavior tree, as in the image below. Now, we have to add the new node `GetRandomReachablePoint` in the behavior tree, as in the image below.
  
-![Third phase of the behavior tree](https://​lh6.googleusercontent.com/​z3UNdjx7lPPcet8c3Zr_iX_2TIpiVf7WR72zaX_5uQTI6W294As0Kl1CPbcnkikxa2dXm_h9g1jEqEJ8Tfj9iY3v6w8n0v-IXEm14mZ80l6sj_4Cfa0_rHjP0JrotzyeWzO3zrAx)+![Third phase of the behavior tree](images:bolt:Third phase of the behavior tree.png)
  
 In the Behavior Bricks editor create the variable `Max Distance` (must have the same name that the string that we add to the list in the code of `GetReachableRandomPoint` previously). In the Behavior Bricks editor create the variable `Max Distance` (must have the same name that the string that we add to the list in the code of `GetReachableRandomPoint` previously).
Line 82: Line 82:
 The Behavior Bricks constant `Custom Event Name`, again, must have the same name as the `Custom Event` module from Bolt, in this case `Get Reachable Random Point`. The Behavior Bricks constant `Custom Event Name`, again, must have the same name as the `Custom Event` module from Bolt, in this case `Get Reachable Random Point`.
  
-![GetRandomReachablePoint_parameters](https://​lh5.googleusercontent.com/​-RMmrUITd4XS2ndYEJg8DzgmX4PGJUuqYSQ4fnTmWQs1uZkSL35jARbEoUF2pF8JIKppMvgzFabyHaql3apTrDu_QapfRKr7mA2Qr7o41NR8xuyGScNF-B-3MO2dS1PjkqNqEzAP)+![GetRandomReachablePoint_parameters](images:bolt:​GetRandomReachablePoint_parameters.png)
  
 In the tab "​Blackboard",​ set the value of  `Max Distance` as 20. In some version of Unity this doesn'​t work, so you must go to the GameObject component Behavior Executor and set the value there. In the tab "​Blackboard",​ set the value of  `Max Distance` as 20. In some version of Unity this doesn'​t work, so you must go to the GameObject component Behavior Executor and set the value there.
  
-![GetRandomReachablePoint_parameters_editor](https://​lh6.googleusercontent.com/​-IFRqD3Pm_mRRyiSO08tjFEBBGpbAtlOLTfN3j9kfZlm1uNm8uP22AxyLXF3MBB3lFoluhHEAx5CXpGn4kXClonNeOwEolnAq5Hfdf1emLAeHIJ1G4fLhzVqPuP4RLj_iMxwCYMK)+![GetRandomReachablePoint_parameters_editor](images:bolt:​GetRandomReachablePoint_parameters_editor.png)
  
 ### Custom Bolt Event: Variable Wait ### Custom Bolt Event: Variable Wait
Line 111: Line 111:
 First, we create a Bolt `macro` `BoltVariableWait`,​ and we add a new `Graph Variable` called `Node` within this `macro`. ​ This variable will have a reference to the Behavior Bricks node. First, we create a Bolt `macro` `BoltVariableWait`,​ and we add a new `Graph Variable` called `Node` within this `macro`. ​ This variable will have a reference to the Behavior Bricks node.
   
-![variablewait_graphvariable](https://​lh3.googleusercontent.com/​__FJ1N8lHlTBqnZuqmmhEso4L3_vuKxPH_yf4Lg4pzsqn67BiPYMzdeXJ27qXUVnmQ7KHwSu6kEjF74zwnpih7U-CIPMvE__MZl6oM03Q59RxCSIJbGs9TzzOXuB1LLOLEavQcyI)+![variablewait_graphvariable](images:bolt:​variablewait_graphvariable.png)
  
 This `macro` must have a `Custom Event` module with number of arguments setted at three and the name of the event will be `VariableWait`. In this case, we have three parameters: the reference of the own Behavior Bricks node and the variables that we have just created. In addition, a`Return Main` modules is necessary (for indicate the result of the execution). This `macro` must have a `Custom Event` module with number of arguments setted at three and the name of the event will be `VariableWait`. In this case, we have three parameters: the reference of the own Behavior Bricks node and the variables that we have just created. In addition, a`Return Main` modules is necessary (for indicate the result of the execution).
   
-![variablewait](https://​lh3.googleusercontent.com/​seKPslUVJWNnhu4-1tc-cmx8j4eFjOi1KVDQHh_Gc6MZQHUIY7T8XZm0c9c_zgm-OhH2wQRRb0xaJDbDaqXSfuzGoZ00cWJp9eGrehLZ0lx1eEM25BW7jrrLtOwX_gs9pYpShnTp)+![variablewait](images:bolt:​variablewait.png)
 Next, in Behavior Bricks editor we have to put the variables `Min Time` and `Max Time` as blackboard variables and have to name the `Custom Event Name` as `VariableWait`. ​ Next, in Behavior Bricks editor we have to put the variables `Min Time` and `Max Time` as blackboard variables and have to name the `Custom Event Name` as `VariableWait`. ​
  
-![variablewait_parameters](https://​lh3.googleusercontent.com/​IavxTwYj81I79cbs_Oq5U0ikUdu89oFVQpu1PsgGUfu0-ZjL4iqwkJQlrnK0UiP3vE_m61VQ-WLjso04Zu80U-fiF-m3hGkJsxsAyvsPT3Pfl-I3DvybMSyeSgVnPHumDYZUOupn)+![variablewait_parameters](images:bolt:​variablewait_parameters.png)
  
 In the tab `Blackboard` we set the value of `Max Distance` as 20, `Min Time` as 2 and `Max Time` as 4. In the tab `Blackboard` we set the value of `Max Distance` as 20, `Min Time` as 2 and `Max Time` as 4.
-![variablewait_parameters_BB](https://​lh3.googleusercontent.com/​OBHTBsbSxDUdegbA0ejWYD11dPxC70lqMy1W4ZWbwWUOTmGLHG5WKoEutaEVYCxgo2xC2s4xG94PRIoMSEndA8bypTCuVTE5brIKSTHKf26PeLnafwha5SW0QE_eGKexiYuttcbc)+![variablewait_parameters_BB](images:bolt:​variablewait_parameters_BB.png)
 In some versions of Unity, default values do not work, so you have to put this values in the `Behavior Executor` component as in the image. In some versions of Unity, default values do not work, so you have to put this values in the `Behavior Executor` component as in the image.
  
-![variablewait_parameters_editor](https://​lh5.googleusercontent.com/​qB5QXVi0m84NgL5MDf2QZB-vXYEY_lHiazKMYAi64yy4beCYBTEGSLb5fPOt1fEvHXZt3EMl09FR_pQzNhWCFxZO38eexGkP-ysnKWA9LyCePdZ8Kzi1uxV0XTSTVk3yjHgF5RRh)+![variablewait_parameters_editor](images:bolt:​variablewait_parameters_editor.png)
  
 Finally, add this new node to the Behavior Tree. Finally, add this new node to the Behavior Tree.
  
-![behavior_tree](https://​lh4.googleusercontent.com/​4LtnN8yKpb5uFYVT4SJuShWIpuTWnRFYm9rHEnRmA-6RMuVKywsiotimMAcWpkvB8ssKnQ5oVmg96s1a_g3CszbtfTA0BSq-vfxMhxbEuKN_OlnoUAXPgoo8ofHht3kWDSj_JkEh)+![behavior_tree](images:bolt:​behavior_tree.png)
  
 At this moment, the behavior should work properly. Nevertheless,​ if it is not working, make sure that there is a valid navmesh created, and the agents that use it have the component `nav mesh agent`. At this moment, the behavior should work properly. Nevertheless,​ if it is not working, make sure that there is a valid navmesh created, and the agents that use it have the component `nav mesh agent`.