Search Unity

  1. Unity 2019.2 is now released.
    Dismiss Notice

Behavior Designer - Behavior Trees for Everyone

Discussion in 'Assets and Asset Store' started by opsive, Feb 10, 2014.

  1. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    4,679
    Behavior Designer
    Available on the Asset Store


    For technical support please post on the Opsive Forums or Discord for community support.

    Behavior Designer is a behavior tree implementation designed for everyone - programmers, artists, designers. Behavior Designer offers a powerful API allowing you to easily create new tasks. It also offers an intuitive visual editor with hundreds of tasks and PlayMaker/uScript integration making it possible to create complex AIs without having to write a single line of code!

    Behavior Designer was designed from the ground up to be as efficient as possible. As a result, it runs great on all platforms including mobile. It works with both Unity and Unity Pro.


    Features:
    • Create believable AI with an intuitive visual editor
    • A powerful API gives plenty of freedom for programmers
    • Debug with a visual runtime debugger using breakpoints, watched variables, and task execution status
    • Use local and global variables to easily communicate between tasks and behavior trees
    • Includes hundreds of tasks including parallel, interrupt and semaphore guard
    • Make your behavior trees dynamic with Conditional Aborts (similar to Observer Aborts in Unreal Engine 4)
    • React to changes with the built in event system
    • Use existing code with the included reflection tasks
    • Find errors quickly with realtime error detection
    • Binary or JSON serialization
    • Data-Oriented design for exceptional performance with zero runtime allocations after initialization
    • Object drawers (similar to property drawers)
    • Includes runtime source code
    • Works with Unity 5 and Unity or Unity Pro
    • Extensive documentation and tutorial videos
    • Sample projects available online
    Third Party Integration:
    • 2D Toolkit
    • A* Pathfinding Project (with the Movement Pack)
    • Adventure Creator
    • Anti-Cheat Toolkit
    • Apex Path (with the Movement Pack)
    • Blox2
    • Camera Path Animator
    • Cinema Director
    • Control Freak
    • Core GameKit
    • Curvy
    • Dialogue System
    • DOTween
    • Final IK
    • Inventory Pro
    • LeanTween
    • Love/Hate
    • Master Audio
    • NavMesh 2D (with the Movement Pack)
    • NGUI
    • ORK (with Gamekakkak integration)
    • PlayMaker
    • Poly|Nav (with the Movement Pack)
    • Pool Boss
    • Pool Manager
    • Simple Waypoint System
    • Third Person Controller
    • Trigger Event Pro
    • uScript
    • uSequencer
    • Vectrosity
     

    Attached Files:

    Last edited: Oct 15, 2018
  2. Cripplette

    Cripplette

    Joined:
    Sep 18, 2012
    Posts:
    60
    Hello,

    It looks good, how much are you going to sell it ? Any free or test version planned ?

    Regards,
     
  3. BTStone

    BTStone

    Joined:
    Mar 10, 2012
    Posts:
    1,070
    Interesting. Price point?
     
  4. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    4,679
    Thanks for taking a look at it. I haven't completely decided on the price but I think that I'll have a launch price of around $50 and then move it to $95 eventually. I do plan on creating a free version, it just won't be ready at launch.
     
    Last edited: Feb 10, 2014
  5. Cripplette

    Cripplette

    Joined:
    Sep 18, 2012
    Posts:
    60
    Will it be open source ?

    Can we extend the system, implement our own nodes, customize their look in the graph ?
     
  6. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    4,679
    You'll be able to easily create any type of task that you want (action, composite, conditional, or decorator) and the runtime source code is available but editor will have a DLL.

    I am currently finishing up the documentation and here's an example of a simple task that the documentation will walk you through:
    Code (csharp):
    1.  
    2. using UnityEngine;
    3. using BehaviorDesigner.Runtime.Tasks;
    4.  
    5. public class MoveTowards : Action
    6. {
    7.    public Transform target = null;
    8.    public float speed = 0;
    9.  
    10.    public override TaskStatus OnUpdate()
    11.    {
    12.        // Return a task status of success once we've reached the target
    13.        if (Vector3.SqrMagnitude(transform.position - target.position) < 1) {
    14.            return TaskStatus.Success;
    15.        }
    16.        // We haven't reached the target yet so keep moving towards it
    17.        transform.position = Vector3.MoveTowards(transform.position, target.position, speed * Time.deltaTime);
    18.        return TaskStatus.Running;
    19.    }
    20.  
    21.    // OnReset is called by the inspector
    22.    public override void OnReset()
    23.    {
    24.        target = null;
    25.        speed = 0;
    26.    }
    27. }
    28.  
    You will be able to edit the image that appears in the graph by adding a task icon attribute to the class:
    Code (csharp):
    1.  
    2. [TaskIcon("path/to/icon.png")]
    3. public class MoveTowards : Action
    4. {
    5. ...
    6.  
     
    Last edited: Mar 30, 2014
  7. Steve-Tack

    Steve-Tack

    Joined:
    Mar 12, 2013
    Posts:
    1,237
    FYI, the term "open source" does not mean "the commercial product I bought comes with source code":
    http://en.wikipedia.org/wiki/Open_source
     
  8. nixter

    nixter

    Joined:
    Mar 17, 2012
    Posts:
    319
    @Steve Tack

    What term would you suggest people use when they want to differentiate between DLLed assets and ones with the C#/UnityScript included?
     
  9. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    4,679
    Last edited: Feb 13, 2014
  10. MoHoe

    MoHoe

    Joined:
    Nov 5, 2012
    Posts:
    566
    I've purchased every behavior tree on the asset store and surprisingly none of them have made tutorials so I usually give them 1 star.

    I hope you have more sense then them (excluding NodeCanvas, they have a tutorial :) ) and make tutorials explaining how to use your asset.. don't be shy and speak in them :). not a rush job.

    You will have success with this if you take the time to make comprehensive tutorials, also you will save a lot of time in the forum answering the same questions again and again.

    The others have failed, maybe you will succeed :)
     
    Last edited: Feb 13, 2014
  11. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    4,679
    I completely agree. I have already recorded four videos that will give an introduction to Behavior Designer totaling about 30 minutes of content, and yes I did speak in them :) So far the topics have been an overview, writing a new task, PlayMaker integration, and uScript integration. I have created four sample projects and I plan on making a video for each of those explaining how they work as well. In addition I think that it would be good to have a short video on the task attributes.
     
  12. MoHoe

    MoHoe

    Joined:
    Nov 5, 2012
    Posts:
    566
    That sounds great :)

    will you be supporting mecanim?
     
  13. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    4,679
    I haven't specifically created a task for mecanim but that doesn't mean I can't get one in before I hit submit. What are you looking for? One of the nice things about the Behavior Designer system is that it is really easy to create new tasks - basically it is like creating a new MonoBehaviour object except the update function has a return status. For example, I just wrote the following task which starts an animation state based off of a trigger. When the animation is done playing it will return success (this is completely untested but *should* work):

    Code (csharp):
    1.  
    2. using UnityEngine;
    3. using BehaviorDesigner.Runtime.Tasks;
    4.  
    5. public class PlayMecanim : Action
    6. {
    7.     public string targetState = "";
    8.     public string eventName = ""; // the event that will trigger the stateName
    9.  
    10.     private Animator thisAnimator = null;
    11.     private int stateHash = 0;
    12.  
    13.     public override void OnAwake()
    14.     {
    15.         // cache for quick lookup
    16.         thisAnimator = gameObject.GetComponent<Animator>();
    17.         stateHash = Animator.StringToHash(targetState);
    18.     }
    19.  
    20.     public override void OnStart()
    21.     {
    22.         // trigger an event which will start targetState
    23.         StartCoroutine(playOnce(eventName));
    24.     }
    25.  
    26.     public override TaskStatus OnUpdate()
    27.     {
    28.         var currentState = thisAnimator.GetCurrentAnimatorStateInfo(0);
    29.         // if the current state is equal to the targetState hash then the animation isn't finished playing yet
    30.         if (currentState.nameHash == stateHash) {
    31.             return TaskStatus.Running;
    32.         }
    33.  
    34.         // the animation is no longer playing
    35.         return TaskStatus.Success;
    36.     }
    37.  
    38.     private IEnumerator playOnce(string eventName)
    39.     {
    40.         thisAnimator.SetBool(eventName, true);
    41.         yield return null;
    42.         thisAnimator.SetBool(eventName, false);
    43.     }
    44. }
    45.  
     
    Last edited: Feb 15, 2014
  14. Silly_Rollo

    Silly_Rollo

    Joined:
    Dec 21, 2012
    Posts:
    480
    Cheers for well written documentation. I hate video tutorials and it's a shame that solid documentation is still somewhat rare on the store.

    If you are using common class names like in that example I hope you are wrapping it in its own namespace btw.

    An issue I've had with other behavior tree implementations is they actually do too much or are too glitchy. Being too intrusive is a problem as I am writing the actual logic myself and have all the pathfinding already completed. I just want a lightweight framework for designing behavior flow and debugging AI states in the editor. Your framework suited to that?
     
  15. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    4,679
    We are still supporting Unity 3.5.7 and namespaces weren't really supported until Unity 4 so we have prefixed all of the tasks with "BDTask_". Whenever we set the minimum version to Unity 4 we'll transition to namespaces but for now this is a good compromise. Edit: nevermind, Behavior Designer does use namespaces and the minimum Unity version is Unity 4.

    Behavior Designer will stay out of your way :) There really will be no real game-specific functionality with the default Behavior Designer installation. We have lots of well-commented tasks with the sample projects that do include game logic and pathfinding but the base installation will ship with these tasks. As you can see, most of them are very generic and none of them are really game specific.
     
    Last edited: Feb 15, 2014
  16. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    4,679
    Behavior Designer has been submitted and is awaiting approval! I updated the first post to include the promo images that will be used on the Asset Store. I also uploaded the sample projects so you can take a look at the structure of the tasks.

    In my last post I responded to Fuzzy_Slippers about namespaces saying that we aren't using any and we've prefixed the tasks with "BDTask_". I started to think about that some more and decided against it. Behavior Designer was submitted with Unity 4.0 and does use namespaces so it should be able to import into any project without problems.
     
    Last edited: Feb 15, 2014
  17. MoHoe

    MoHoe

    Joined:
    Nov 5, 2012
    Posts:
    566
    Hey opsive! thanks for that. seeing that your BT system will work with playmaker, I'll just use your BT for the AI and utilize playmakers mecanim functions... I think that would work best :)

    Thanks for the effort, I wasn't expecting you to do that :)

    whats the price for this asset?
     
  18. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    4,679
    PHP:
    That sounds like it should work great.

    I am listing it at $50 for an introductory price then once that is over $95.
     
  19. halfbot

    halfbot

    Joined:
    Sep 22, 2013
    Posts:
    18
    I hope you reconsider the DLL only package. A lot, of developer shy away from assets which are DLL only, especially on time critical projects where changes are needed quickly or as a safety net incase the publisher support wanes. The asset looks amazing regardless, definitely the best looking and documented behavior tree asset in the store. :)
     
  20. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    4,679
    Edit: The entire runtime no longer has a DLL!

    All of the different task types are not hidden away in a DLL so if you need to make changes to a particular task it is available. It also will show you how easy it is to create new tasks, including composite tasks. That said, I definitely see the appeal of having a source code version. In terms of support, if you take a look at the reviews of my other assets you'll see that I am generally able to fix any bugs within the same day. In a previous post I mentioned that I plan on eventually listing a free version, and I also plan on listing a version that includes the source for the runtime. With that I'd like to be able to offer an 'upgrade' plan: if you purchase the DLL version, all you need to do is pay the difference for the source version.

    I appreciate it :)
     
    Last edited: Mar 30, 2014
  21. Silly_Rollo

    Silly_Rollo

    Joined:
    Dec 21, 2012
    Posts:
    480
    Yeah this is looking really good. I definitely see advantages to packaging everything neatly into a dll and one of my favorite packages (the Dialogue System) does it but not having a zipped copy of the source isn't ideal. You never know when an asset author is going to disappear.

    I'd think a good option would be how ngui does it. Rather than just access to the source offer a developer upgrade to obtain direct access to your git repo. If someone is wanting to modify the source it is way easier to merge changes that way yet everyone has access to the source as reference if they need it.
     
  22. MoHoe

    MoHoe

    Joined:
    Nov 5, 2012
    Posts:
    566
    I'm happy not to have source for $50.00. I think a source cost should be around $200.00 :)

    Giving the source is giving the blueprint for anyone to copy it make a few changes and become a competitor.

    I have strong faith in this BT system, if he runs and hides from his duties, I will send the boys round :p
     
  23. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    4,679
    That was the price point that I was thinking as well for the source code version. Even if you purchase the DLL version you'll be able to upgrade to the source code version for the price difference so you aren't "punished" by getting the DLL version at first.

    Edit: This runtime source version is now included in the standard version of Behavior Designer!

    hehe, I plan on sticking around for awhile :) I already have some updates planned and really would like to see how far I can take this behavior tree system.
     
    Last edited: Mar 30, 2014
  24. halfbot

    halfbot

    Joined:
    Sep 22, 2013
    Posts:
    18
    Good to know the types are still accessible and customizable. I did not realize you would also be providing a source version through an upgrade. I will definitely pick this up regardless but feel better that the upgrade will be available. Your great track record doesn't hurt either. Thanks Opsive, and best of luck with the asset.
     
    Last edited: Feb 17, 2014
  25. I am da bawss

    I am da bawss

    Joined:
    Jun 2, 2011
    Posts:
    2,574
    Looks pretty awesome! PlayMaker and uScript integration is definitely what seals the deal for me. This looks much more complete than "Behave 2 for Unity". This is now top of my shopping list! :)

    BTW, what's the minimum Unity version you are supporting? Any chance for Unity 3.5.7 support?
     
  26. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    4,679
    Appreciate it!

    It was working with 3.5.7 up until about four days ago when I switched to using namespaces. David Helgason said that 3.5.7 is less than 2% of Asset Store users so I figured that it was worth supporting namespaces and have more organized class names. I submitted with 4.0. Are you still on 3.5.7?

    Edit: BTW, I started to upload the videos. I'll be uploading more within the next couple of days.
     
    Last edited: Feb 17, 2014
    HakJak likes this.
  27. I am da bawss

    I am da bawss

    Joined:
    Jun 2, 2011
    Posts:
    2,574
    Yeh, still stucked at 3.5.7.
     
  28. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    4,679
    If I get a few requests for 3.5.7 then I'll change it. Getting the editor/runtime to build with 3.5.7 is easy.. the sample projects on the other hand are not so easy to switch back.
     
  29. MoHoe

    MoHoe

    Joined:
    Nov 5, 2012
    Posts:
    566
    still waiting for asset store approval?

    well done with the recent playmaker integration tutorial.

    100% I will purchase this asset :)
     
  30. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    4,679
    Yes, still waiting on approval :( I submitted it last Saturday and haven't heard anything yet.. I'm ready for this thing to be released :)

    That's great to hear, and I'm glad the PlayMaker video was helpful. I plan on getting a few more videos out that go over the sample projects (I have been using my iPhone microphone and decided that that isn't going to cut it if I keep doing these videos.. so the next videos should sound better).
     
  31. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    4,679
    Last edited: Feb 21, 2014
  32. MoHoe

    MoHoe

    Joined:
    Nov 5, 2012
    Posts:
    566
    Purchased!!! whooooooooooooooooooot :)
     
  33. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    4,679
    Awesome! I'll get the next set of videos up within the next few of days.. but by then you'll probably have a better understanding of the sample projects than I do. :) Let me know if you see anything that can be improved.
     
  34. BrUnO-XaVIeR

    BrUnO-XaVIeR

    Joined:
    Dec 6, 2010
    Posts:
    1,687
    Bookmarked on my wish list on asset store;
    Looks very nice, but I'd like to first see if using this is actually faster than just coding C#...
    You know, some of these visual tools just make you work slower... you could just write a bunch of scripts and do the job much faster for some simple tasks;
    That is not what 100$ tools should do for us, right :)
     
  35. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    4,679
    For simple AIs, yes, it probably would be quicker to just code it rather than using the editor. In the example that I used in the overview video you could absolutely code that in a less amount of time then the time it took me to explain the editor. However, as soon as you start to get into a more complex behavior tree then it becomes really nice to have an editor. I can't tell you how many times I made a minor change when I was creating the various sample projects. Even though those sample projects are relatively basic by behavior tree standards it still would have taken longer to code than it did for me to use the editor. It is also very nice to be able to pretty much change the way the entire AI reacts to different circumstances by just rearranging some nodes.

    There we go, there's my sales pitch :)
     
  36. Redbeard

    Redbeard

    Joined:
    Mar 19, 2013
    Posts:
    6
    Purchased, cant wait to play with it.

    Opsive do you have any future goals for the package you care to share? You mention in your video "And this is only version 1.0..."

    Thanks!
     
  37. FleepLoovay

    FleepLoovay

    Joined:
    Sep 4, 2013
    Posts:
    7
  38. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    4,679
    Wow, thanks everybody. I'd love to hear what you think after you have some time to dig into it.

    One of the things that I was originally going to put in the release but had to drop it from the first version is a tab that holds all of your blackboard variables. If you take a look at the CTF and RTS projects you'll see that they have a blackboard class to share variables between tasks. I'd like to put this in the editor.
     
  39. MoHoe

    MoHoe

    Joined:
    Nov 5, 2012
    Posts:
    566
    Well I've only spent a short time with it... as it stands I'm impressed and by the look of it, it's just what I'm looking for from a BT system :)

    one little suggestion... it would be cool to have icons beside the objects that have a BT tree attached to them :) same thing as playmaker but with your logo/icone.

    like this:

    $logooo.png

    Your documentation is brilliant too. And the price = bargain!!

    Thank you for this great asset :)
     
  40. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    4,679
    That's great to hear! We're doing well if that is your only suggestion :) That will be in the next release - I was actually planning on putting it in this release but the logo was basically the last thing to be done and I was anxious to submit.
     
  41. MoHoe

    MoHoe

    Joined:
    Nov 5, 2012
    Posts:
    566
    hehehe I know.. I'm trying to find something but you're ten steps ahead of me :p
     
  42. cygnusprojects

    cygnusprojects

    Joined:
    Mar 13, 2011
    Posts:
    653
    Hi Opsive,

    Just bought your asset but after import I'm facing 140 errors:
    Mismatched serialization in the builtin class 'Mesh'. (Read 60228 bytes but expected 60229 bytes)
    UnityEditor.AssetDatabase:LoadAssetAtPath(String, Type)
    BehaviorDesigner.Editor.BehaviorAutoRun:.cctor()
    UnityEditor.EditorAssemblies:SetLoadedEditorAssemblies(Assembly[])

    When I remove you asset the errors are gone. I'm using Windows 8.1 with Unity Pro 4.3.4f1 and imported your asset into our production project.

    Thanks for looking into it.
     
  43. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    4,679
    Thanks for your purchase, cygnusprojects.

    By any chance did you upgrade your project from a previous Unity version? I found this tread and it looks like it is a bug in Unity 4.3, which they just recently acknowledged. Does your project have any Unity Tree prefabs in it? It looks like some people were able to solve it by re-building all of those trees. Somebody else solved it by resaving the project.

    If none of those solutions work I can send you an assembly that doesn't have the AssetDatabase.LoadAssetsAtPath call in it until Unity fixes the bug. That piece of code isn't critical.
     
    Last edited: Feb 21, 2014
  44. Seith

    Seith

    Joined:
    Nov 3, 2012
    Posts:
    715
    Hi Opsive, I just bought Behavior Designer (barely started using it) but now I noticed that each time I enter game mode I get those warnings:

    $x4myyf.png

    I don't really understand the messages as I only have two cameras in the scene and none of them have HDR activated (plus I don't quite understand why Behavior Designer would raise warnings about that kind of things). I'm not sure how important that is but I'm kind of a stickler with keeping a clean console output (no unheeded warning messages). Would you have any idea how to get rid of them please? Thanks...
     
  45. cygnusprojects

    cygnusprojects

    Joined:
    Mar 13, 2011
    Posts:
    653
    Hi Opsive,

    Found out that indeed Unity trees are producing this error but I have tons (>350) of them so manually rebuild them all is quite impossible. So if you please would be so kind to supress the call to LoadAssetsAtPath until Unity fixes this it would be of great help.
     
  46. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    4,679
    LoadAssetsAtPath is causing me problems. Seith, the warnings that you are getting look related.

    When Behavior Designer loads it searches through all of the prefab files in the project to see if any of them have the behavior tree component added to them. If it does it can then display it in the drop down box at the top. This is what LoadAssetsAtPath is for. I will look into finding a better way to do it now. In the meantime I'll send both of you a version that doesn't have the call. Seith, are you running 4.3 as well?
     
  47. Seith

    Seith

    Joined:
    Nov 3, 2012
    Posts:
    715
    Yes I am. Thanks!
     
  48. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    4,679
    Great, I sent both of you a PM with a new assembly. The top drop down box won't show all of the behavior tree components but that is better then getting those errors/warnings. I am looking into a better solution now.
     
  49. Seith

    Seith

    Joined:
    Nov 3, 2012
    Posts:
    715
    I have a (probably silly) question but I was wondering: how can I access a task's public variable from within a different task? Let's say that I have defined a public Target transform in one task and I want to access it from another. How would I code that? Thanks...
     
  50. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    4,679
    First you'll need to get a reference to that other task. You can do that by declaring that task reference as a public variable within the first task:
    Code (csharp):
    1.  
    2. public class MyTask : Action
    3. {
    4.    public MyTask2 otherTask;
    5.  
    6.    public override void OnAwake()
    7.    {
    8.       Debug.Log(otherTask.myVariable);
    9.    }
    10. }
    11.  
    Here's what the second task looks like:
    Code (csharp):
    1.  
    2. public class MyTask2 : Action
    3. {
    4.    public float myVariable;
    5. }
    6.  
    Within the property inspector within Behavior Designer you can then select which task to link to the current task by hitting the "Select" button and clicking on which task you want to link:
    $linkedTasks.PNG
    Once you've linked the task you can then access it like you would any other class. In the code above I was just outputting the value of "myVariable" within the OnAwake method.

    Edit:
    I just added this to the documentation
     
    Last edited: Feb 22, 2014