BehaviorTrees3 + BTrees Visual Editor v3.0

Is there a way to duplicate an entire tree folder?
I want to retain a bunch of behavior for a seperate npc but I also want to use a bunch of the same logic.
The editor doesn’t work on a new clone of a folder if I just try to copy it.

Now with Roblox’s new Task Library it would be a good idea to change the “task” table to treeTask or something different to prevent compatibility issues in new work.

8 Likes

Would be amazing if we could specify the quality of the bezier curve (i.e how many frames it uses) as on my larger behaviour trees it gets really painful to use. I also can’t split them out into more as then we loose features such as linked tasks.

UPDATE: You can modify the variable ‘segments’ in DrawCurve.lua as low as 6 (down from 24). There are lots of other improvements which could be made. Right now there’s way too much instancing and destroying going on but I haven’t found the time to dig my teeth into it.

UPDATE UPDATE: It is now 2:30am, Got sucked in haha. Found a fair few inefficiencies, for instance rather than pooling existing frames for the bezier curves we were creating new ones each time and destroying the old. Changelog:

  • Use existing pool, only create new instances when required
  • Switch from RenderStepped to Heartbeat
  • Only call update every 4 frames for avg cost and 6th for expensive
  • Reduce framecount per bezier curve from 24 to 6

BehaviorTreesPlugin_V4.rbxmx (1.1 MB)
All my changes were made on the fly with no consideration for futureproofing or conflicts passed the immediate term. Only use if you need it (i.e you have large trees).

3 Likes

Can someone make a comprehensive documentation on this?

2 Likes

It’s well documented already, install the plugin. Create a tree then click “Help”

1 Like

I can’t find a single tutorial anywhere and I have no clue how to use it, I really need this for an AI system I’m making as it will be a pain to code a custom behavior tree. I would really appreciate if someone linked me with a comprehensible tutorial.

4 Likes

That’s simply a guide as to what each of the node does. Not a full documentation.

4 Likes

Ok Guys, I’ll give my best explanation as to how I think this should work. So the most basic of basics is that you need an update function

-- Services
local RunService = game:GetService("RunService")
local Tree = BehaviorTreeCreator:Create("Place Tree location here")
local function Update()
     Tree:Run()
end

RunService.Stepped:Connect(Update)

In order to run your tree repeatedly. As of right now I’m trying to figure out the logic as to how to make it not run when it is currently running/ doing something repeatedly. My best bet is to go into each script and return the script when it IS running so that i can

A) Identify the script that is running and just do checks to see if it is running
B) Stop the entire tree from running

Hopefully i’ll figure out something and share more with you guys!

I’m having a similar issue, if anyone has a solution to this would be much appreciated. As soon as one NPC dies another one fires up, but two can’t run simultaneously. tree:run() is being fired but it doesn’t do anything in the “waiting” npcs. I’m guessing that the repeat node I have has it running and disallows other NPCs from running(don’t know why). Been trying to resolve this issue for almost a week now. Would really appreciate any advice or help.Thanks for the assistance and can provide code if needed!

Hey everyone! I know one of the big problems I had while using this plugin was the lack of easy Rojo support as well as the lack of sharing tasks between behavior trees.

Well, given I had some time I decided to quickly try playing around with the module and plugin and have come up with a decent solution to this:

External Tasks


External tasks work independently from Tasks in that rather than having the task module sit inside the the BehaviorTree’s folder, it can now be referenced from another source entirely! This is a nice way to have all your tasks made easily accessible to something like Rojo, or other behavior trees.

Some things to note:

  1. This is not battle tested and may still have bugs. Feel free to DM me if you find any.
  2. You’ll need both the ET edition plugin and module for things to work.
  3. I am not responsible for creating or maintaining BehaviorTrees, and all credit still mostly applies to the others involved, I’m just trying to make things more accessible for this amazing tool!
  4. I did ask before posting this and it seems like I’m in the clear. If I made a mistake with how I posted something I’ll update ASAP.

Plugin | Model

11 Likes

Same.

I need a tutorial cause its very weird and i barely understand it.

1 Like

Im trying to create and AI that has 2 trees:
Idle and Chase
the idle tree requires the chase tree and vise versa
this causes some kind of error where they generate recursivley causing a error and about 5k output lines
update: nvm i always find the solution when i post it, still might be helpful if someone has the same error, the go to the other tree node dosen’t mean it will be stuck at the node it will always revaluate from the root node (idk did i explain it properly)

I find this library really awesome , i want to point to some important topic about RUNNING state:
https://devforum.roblox.com/t/btreesv5-rojo-support-fixes/1781449 as this is the latest version and you should use this for newer work , with this version when tree sees a RUNNING state while traversing , it pauses the tree and starts traversing from where it returned running instead of traversing all tree again. I don’t know if this was like that on prior versions , but i saw couple messages about this above. So i felt the need to clarify this for other devs thinking using this module.

I might be wrong on this, but I think I’ve found an issue with the way the tree traversal handles subtrees. The loop through nodes relies on “didResume” to determine whether or not to call the task.start() method of tasks. didResume is the result of data.paused and this works fine for trees.

However, if a sub tree ever returns the status RUNNING, data.paused is set to true. When the tree eventually returns a SUCCESS / FAIL result, this doesn’t swap data.paused or didResume.

This causes an annoying issue: whenever a tree returns the RUNNING result, subsequent nodes will no longer have their .start() methods called (even after the tree returns success), as the traversal also uses data.paused to evaluate whether the node at the current index has already had its start method called.

Currently:
image

My suggested amendment:
image

I’m hoping this amendment is correct and I haven’t made a glaringly obvious mistake! Anyhow, this plugin is an amazing resource and I’m extremely grateful to all of you who helped make it!

1 Like

Sorry for the necro but are you planning on updating this module to work with Parallel Luau?
these module and plugin are amazing but the performance boost you can have with Parallel make it almost a waste

Is there any way to change the default script inside a leaf node? too many comments and I use a different style in my code

For some reason every time I use this plugin it disables the redo command, ctrl + shift + z. Is there a fix?

how to unlink a connection ? maybe am too dumb

is there a way to destroy or get rid of a behaviour tree once I don’t need it anymore?

I’d create a pull request on github