Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

[Open Source/Free] Behavior Tree Visualizer (Beta)

Discussion in 'General Discussion' started by Yecats, Sep 29, 2020.

  1. Yecats

    Yecats

    Joined:
    Jul 13, 2014
    Posts:
    69
    Behavior Tree Visualizer (Beta)
    A free editor tool for working with behavior trees.

    Behavior Trees are a fantastic way to write modular AI that can scale in complexity. Unfortunately, it can be quite hard to visualize how your tree is being executed which makes it difficult to debug potential failure points. The Behavior Tree Visualizer tool was created to solve these problems! The tool will scan for active behavior trees in your scene and group them in a drop down for easy toggle. A graph will be drawn, and nodes will light up, showing you which part of the tree is currently running.

    treeExample.gif

    Features
    1. Customize the graph by choosing the title bar color, the icon, amount to dim inactive nodes and more.
    2. Robust debug messages can be viewed directly on the graph. Surface anything you want to see.
    3. Includes basic node types to help you get up and running quickly. No need to write a sequencer, selector, inverter, or more!
    What's Included

    This package comes with:
    1. Behavior Tree Visualizer tool built with Unity Toolkit (formerly UI Elements)
    2. Standard Behavior Tree nodes to get you up and running quickly
    3. Sample project to demonstrate the implementation
    Quick Links
    1. GitHub Repository
    2. Documentation
    3. Package Import URL (select git as source): https://github.com/Yecats/UnityBehaviorTreeDebugger.git?path=/com.wug.behaviortreevisualizer
     
    Last edited: Sep 29, 2020
    Ryiah, OCASM, useraccount1 and 2 others like this.
  2. angrypenguin

    angrypenguin

    Joined:
    Dec 29, 2011
    Posts:
    15,617
    That looks pretty neat!

    Are you also able to use the graph to create and edito the trees?
     
  3. Yecats

    Yecats

    Joined:
    Jul 13, 2014
    Posts:
    69
    Thanks! Not yet, you still have to author the tree itself via code. It's on my to do list (and now officially on the backlog) to add support for creating / editing trees though.
     
    angrypenguin likes this.
  4. angrypenguin

    angrypenguin

    Joined:
    Dec 29, 2011
    Posts:
    15,617
    I'm not doing anything that requires AI at the moment, but I'd definitely check this out more if I were.
     
  5. Yecats

    Yecats

    Joined:
    Jul 13, 2014
    Posts:
    69
    Well, that's great to hear! If/when you do and you have any feedback or feature requests please be sure to let me know. I've been using this tool for my own game and its come in handy quite a bit. I'm sure that there's a lot more that could be added to make it useful for others though.
     
    MadeFromPolygons likes this.
  6. angrypenguin

    angrypenguin

    Joined:
    Dec 29, 2011
    Posts:
    15,617
    As long as people can easily assemble / edit trees and custom nodes are straightforward to write then I think that would pretty much have me covered. Personally, I'd much rather a nice implemetnation of the foundations which I can extend to meet my needs than for an author to try and anticipate everything and include a bunch of extra stuff.
     
    MadeFromPolygons likes this.
  7. Yecats

    Yecats

    Joined:
    Jul 13, 2014
    Posts:
    69
    That makes sense - which is why I went with providing standard/routine nodes versus a bunch of custom ones. My own game is built off of those standard nodes. I have ~30+ custom nodes, most of which wouldn't easily adapt to other games. But, I have been debating whether there are some more routine ones that are a bit more tied to Unity - a navigation one, for example. I could see having a node that takes a Vector3 position, does `NavMesh.SamplePosition()` on first evaluation and then moves the game object as being pretty generic.

    I'd thought about the authoring of the trees previously... but I'd found the lack of debugging to be more frustrating then creating them. That being said - I am drawing out the trees in Miro ahead of time and it would be nice to cut that part out and work in a single spot. The bigger my tree gets the more jumping back and forth gets annoying.
     
    angrypenguin likes this.
  8. angrypenguin

    angrypenguin

    Joined:
    Dec 29, 2011
    Posts:
    15,617
    Good point. Nodes that are built on Unity's built-in functionality could be pretty reusable across projects.

    Since you've made it CC0, you could set up a "Community Nodes" folder in the repo and allow people to send pull requests for new generic ones they make?

    As a programmer, definitely. When I wrote my own BT system just messing around a few years ago I also just made the trees in code, and honestly it's not too bad... as long as it's only being used by programmers. I wouldn't want others on my team to have to change source files to modify behaviour of entities in the game.
     
  9. Yecats

    Yecats

    Joined:
    Jul 13, 2014
    Posts:
    69
    I love this idea! I'll set up the project to support this.

    Agreed. That is one of the nice things about Unity - being able to create tools that non programmers can easily use. I like the idea of expanding it, but it'll be a fair amount of work. I have a couple of debugging features I want to add first then I'll shift into working on it.
     
    Last edited: Oct 1, 2020
    angrypenguin likes this.