-
Notifications
You must be signed in to change notification settings - Fork 19
Home
fian46 edited this page Oct 27, 2020
·
11 revisions
Warning : is this the best way ? No. Nothing is perfect. The plugins is designed based on my game, i like to make it simple and throw the programming best practices out of the window. It have some of flaw in it but in my case it is perfect. You don't have to use this if it make your day bad. Try it it in 15 minutes if you don't think it fit your case please move along don't waste your time.
clone or download the addons folder and put it on your project, then activate the plugins in project settings
- it is just a behavior tree there is no magic here you need to learn the concept, search it on the internet.
- the addons work only with single script but you can combine multiple tree in one parent. for example you can separate animation tree from logic tree
- in any node add BTREE node as it children. that node must have a script ! or the plugins will error.
- select BTREE node and switch to tree editor window
- you also need a node to connect to the root or it will not running
- to create a task / leaf node, you need to make a function with name start with "task_*()". for example to scan input the function name can be something like "task_capture_input(task)" the function also need to accept one argument. this argument is flow control
- the "task" argument for every task you can call succeed() to complete success or failed() to complete failed. if you not called anything then the task status is running. that means in the next tick it will called again until you call succeed() or failed(). to determined a task is init or not you can call is_init() in control flow. if true then the node is initialized, this is useful for a task that required such need to initialized something before for example computing a path.
- You can also passing argument to the task from the tree editor. this is useful when creating some kind of dialogue system for NPC or to play some animation.
- You can look up the rest of the node behavior by hover your mouse. there is tool tip you can use. also there is help button to explain some basic control like copy node, delete node and saving stuff.
- You can visualize current running btree instance in your game by click debug button, but your game must running first or debugger will not show anything.
- Currently you only can see the status but if you need any fancy thing, please create an issue.
- Debbuger
- debugger will not work with mobile currently, only local machine is supported
- you can pause a btree during debugging by pressing pause
- you can step a btree during pause by pressing and hold step button
- to perform hot reload go to BTEditor when game is running and change stuff after pressing save or CTRL + S it will update the game entirely. not only the running tree but also the same tree after it get instanced.