Search Unity

[FREE] Behavior Bricks - Visual Scripting Editor for Behavior Trees (AI & NPCs)

Discussion in 'Assets and Asset Store' started by padaone_games, Nov 28, 2016.

  1. padaone_games

    padaone_games

    Joined:
    Mar 16, 2015
    Posts:
    19
    subtitle.png

    Behavior Bricks 1.0 - Visual Editor for AI and NPCs
    - Now available for FREE on the Unity Asset Store -

    icon.png

    Behavior Bricks (BB) is a state-of-the-art engine for Behavior Trees (BTs) along with an intuitive visual editor. Behavior Bricks has been designed with three main goals in mind: efficiency, extensibility, and reusability. As a result, Behavior Bricks includes some unique features not to be found in other tools for Behavior Trees available in the Asset Store.

    State-of-the-art, unique features, and free, how is that even possible? Behavior Bricks is the showcase of the work from a research group from the Complutense University of Madrid in Spain. We work on new methods for creating artificial intelligence (AI) for non-player characters (NPCs) in games. Check our web page to find research papers related to machine learning and behavior trees, and take a glimpse of what the future may bring to Behavior Bricks:


    For complete documentation, examples and information visit:


    ...
    02.png
    03.png
    * Also compatible with Unity Personal Edition

    ...

    Includes:

     
    Last edited: May 31, 2018
  2. EvilGremlin

    EvilGremlin

    Joined:
    Aug 12, 2016
    Posts:
    231
    This looks really, really impressive. I can't believe it is free. I am going to play around with it this weekend and post my thoughts.
     
    julianr likes this.
  3. Ali_V_Quest

    Ali_V_Quest

    Joined:
    Aug 2, 2015
    Posts:
    138
    Thanks very much, seems like a great asset
     
  4. Ali_V_Quest

    Ali_V_Quest

    Joined:
    Aug 2, 2015
    Posts:
    138
    Hi there, does it support realtime view of the state machines ?
    ( visualizing the state logic while the game is running)
     
  5. EvilGremlin

    EvilGremlin

    Joined:
    Aug 12, 2016
    Posts:
    231
    I posted a review. This is a really strong contender for the best free asset on the store. The one thing that will keep me from using it is that I could not get it to work with Apex Path. I do have a suggestion. I liked the tutorial. I think it was very good, even if it did not cover anything particularly advanced. But my suggestion would be to have a demo scene with more advanced pre-built AI's. Since everything is built around scriptable objects, it would enable an almost instant AI. No other AI asset on the store offers an easily modifiable nearly plug and play AI. I even think you could sell them as separate packages.
     
    nicohan373, WicGames and jason-fisher like this.
  6. Vortavasail

    Vortavasail

    Joined:
    Apr 22, 2016
    Posts:
    44
    any chance this would be updated to work on 5.5 ?
     
  7. Radzievskyi

    Radzievskyi

    Joined:
    May 23, 2013
    Posts:
    6
    Hi!

    I can't use Behavior Bricks, because is have some error. Is not have even window of Behavior Brick.

    Look seem have some problem in dll. Because when I import Behavior Bricks to my projects, I can't Play Scene, Unity show "All compelling errors must be fixed", but console not show any error.

    I use macOS, possible on Windows is work.

    Edit: Ok, I see on some MacBook is work, so is more details about my system: Unity 5.5.0f3, macOS Sierra 10.12.1.
     
    Last edited: Dec 9, 2016
  8. dbarile

    dbarile

    Joined:
    Apr 14, 2015
    Posts:
    14
    I am working in Unity 5.4.2f2, on a MacBook Pro running OSX 10.11.6 El Capitan. I just started the tutorial, and when I try to drag and drop the MoveToPosition action, when I drop the action in the graphical editor, it bounces back. However, when I double-click the MoveToPosition action, it spawns an instance in the graphical editor, but double-clicking another action (eg. SetActive) after spawns a second instance right on top of the MoveToPosition action, and actually changes both instances to the new action (SetActive). I am unable to move forward with the tutorial. Please help!
     
  9. padaone_games

    padaone_games

    Joined:
    Mar 16, 2015
    Posts:
    19
    Behavior Bricks does not support the visual debugging of the Behaviors right now, but we are currently working on this feature, and some more, as the Zoom in the BB Editor. We want to continue improving the editor, doing it more intuitive, usable and powerful, but we cannot say when these features will be available.

    Anyway, thanks for your feedback!
     
    Ali_V_Quest likes this.
  10. padaone_games

    padaone_games

    Joined:
    Mar 16, 2015
    Posts:
    19
    Hi, EvilGremlin.

    We reallly appreciate your feedback and your detailed review!

    Thanks for reporting the conflict with Apex Path. We'll take a look at this issue and we'll try to fix it as soon as possible.
     
  11. padaone_games

    padaone_games

    Joined:
    Mar 16, 2015
    Posts:
    19
    Hi, Radzievskyi.
    Thanks for your feedback.

    Some people are experiencing problems with Drag&Drop in the BB Editor; with some versions of Unity in Mac OS (it works fine up to Unity 5.3.6). But we think this is not your case.

    We have tested Behavior Bricks in a MacBook Pro (macOS Sierra 10.12.1) with a clean Unity 5.5.0, and it does open the editor and play both Done Scenes.

    Please, try reimporting the package in a new empty project, and choose "I Made a Backup. Go Ahead!" in the API Update Required pop-up window.
    API Update Required.png

    We hope this will help you, and feel free to ask if it doesn´t work.
     
    Last edited: Dec 12, 2016
  12. padaone_games

    padaone_games

    Joined:
    Mar 16, 2015
    Posts:
    19
    Hi, dbarile.

    Some people are experiencing problems with Drag&Drop in the BB Editor; with some versions of Unity in Mac OS (it works fine up to Unity 5.3.6).

    We are working to fix this bug and to have an update on the next weeks.
    Meanwhile, if you want to try Behavior Bricks with Mac OS, we recommend using Unity 5.3.6 or earlier.

    Thanks for your feedback!
     
    Last edited: Dec 13, 2016
  13. namespacestudio

    namespacestudio

    Joined:
    Feb 4, 2016
    Posts:
    1
    Hi there! I've been messing around with behaviour bricks, and want to integrate them into my project. However, I've run into a problem when an AI that has a behaviour executor attached spawns into a scene later, instead of starting already active.

    There error I get when the AI spawns in is:
    NullReferenceException: Object reference not set to an instance of an object
    BBUnity.UnityBlackboard.BuildBlackboard ()
    BBUnity.InternalBehaviorExecutor.StartBehavior ()
    BBUnity.InternalBehaviorExecutor.Awake ()
    BehaviorExecutor.Awake () (at Assets/BehaviorBricks/BehaviorExecutor.cs:19)

    Thanks for your time!
     
  14. padaone_games

    padaone_games

    Joined:
    Mar 16, 2015
    Posts:
    19
    Hello, namespacestudio.

    There should be no problem with the delayed activation of the GameObjects.
    If a GameObject with a Behavior Executor is disabled, it doesn't call the OnUpdate() function, and doesn't use CPU time at all. Then, when you activate the GameObject, starts with it behavior and works normally (as it hadn't been deactivated).

    I've created a simple modification of the Quick Start Tutorial, with a GameObject that starts inactive and spawns when the Enemy approaches to the player. You can donwload the Unity package and play the scene in your computer.

    Maybe, we must be missing something. Please, send us an email with a more detailed description of your problem and a Unity package with an example, so that we can help you with your issue.

    Thanks for your interest in Behavior Bricks!
     

    Attached Files:

  15. d41602031

    d41602031

    Joined:
    Jan 5, 2015
    Posts:
    7
    Is a great plugin!
    But I think we need a "Priority Sequence" node to take precedence over one but with the functionality of a Sequence node.
    Because I noticed that the "MovePosition" action, calls GetComponent on OnStart many times, since it has "Repeat" as the parent node.

    Thanks for your time!
     
  16. Alverik

    Alverik

    Joined:
    Apr 15, 2016
    Posts:
    417
    This looks really interesting... and free! lol. I'll be giving it a try for my next project :)
     
  17. ZiadJ

    ZiadJ

    Joined:
    Sep 3, 2011
    Posts:
    62
    Is there any chance that this package might become open source one day? I'd like to use it in an open source project, in the robotics/AI field, so it would be preferable to base it on equally open source frameworks. I'll be recommending the use the package to potential contributors but then how can I be sure that the included DLLs are free from any kind of malicious code?
     
  18. padaone_games

    padaone_games

    Joined:
    Mar 16, 2015
    Posts:
    19
    Hi,

    We are not currently considering to liberate the core framework.
    However, all the actions and conditions are open source, so you can look at the C# code, and create your own custom actions and conditions.

    Thanks!
     
    ZiadJ likes this.
  19. markoal

    markoal

    Joined:
    Aug 31, 2015
    Posts:
    30
    Hi,
    I was also getting:
    NullReferenceException: Object reference not set to an instance of an object
    BBUnity.UnityBlackboard.BuildBlackboard ()

    Currently I'm trying to fetch gameobject from scene from tree.
    Example:
    I have Object with task "Pursue" that require InParam "target"
    I have Task "FindPlayer" that puts GameObj in OutParam "player".

    How can task "Pursue" use that player reference (without manually putting target reference in Blackboard)?
     
    VirtulaniKoncepti likes this.
  20. padaone_games

    padaone_games

    Joined:
    Mar 16, 2015
    Posts:
    19
    Hi, markoal.

    In Behavior Trees, the blackboard is the way to exchange values between nodes. If you want that one node uses the result of other one, you will have to use the blackboard.

    In this case, if you do not want to select the GameObject "player" manually from the scene (in the Inspector), you can use one of the "GameObject" actions (FindByName, FindByTag) and store the output parameter in a LOCAL blackboard variable. This local variable can be used later in the "Purse" task.

    And remember, that all the Actions and Conditions are open source, and you are free to modify it according to your needs. ;)

    Could you give us some more information about the NullReferenceException? Is it the same problem of namespacestudio, with runtime instantiation of GameObjects with Behavior Executor attached?

    We have solved this issue in the new version that will be released pretty soon. But we are having some unexpected problems with the guid of Scriptable Objects within versions, and we are trying to fix them. We will release the new version as soon as possible, and will notify in this thread when the new version be available.

    Thanks for your feedback, and sorry for the inconvenience.
     
    Last edited: Jan 18, 2017
    VirtulaniKoncepti likes this.
  21. markoal

    markoal

    Joined:
    Aug 31, 2015
    Posts:
    30
    Thank you for fast reply.
    Yes I know that i can use "FindByTag" to store the output for "Pursue" task, but not sure exacly how.
    FindByTag must store GameObject in [LocalParam]? (not InParam) and Pursue task must have also [LocalParam] where it reads GameObject or there is some other way of accessing that local parameter?
    upload_2017-1-17_22-7-16.png
    Code (CSharp):
    1. NullReferenceException: Object reference not set to an instance of an object
    2. BBUnity.UnityBlackboard.BuildBlackboard ()
    Yes, I had troubles with that before. I had Wave Spawner script that spawns multiple enemies.
    However, later I created new Unity project, where I have clean Behaviour Bricks with my custom taks and im using simple game objects, and so far I didn't had that error like before, and I'm not completely sure what is difference, maybe I used Blackboard in wrong way (for setting up values).
     
  22. padaone_games

    padaone_games

    Joined:
    Mar 16, 2015
    Posts:
    19
    In this case, you don't need an additional "target" param, because the output of "findByTag" (foundGameObject) will be the input for "Pursue" action.
    If you select LOCAL in the "foundGameObject" blackboard param, it could be used as Input parameter in the "Purse" action (I suppose your Action "Pursue" will have a [InParam("target")] or something similar).
    You will have something like this:

    2017-01-18_111704.png 2017-01-18_111505.png 2017-01-18_111510.png

    I hope this will help you . ;)
    Anyway, I recommend you to take a view to the QuickStartGuide and the ProgrammerQuickStartGuide, also included in the package. These tutorials will guide you in the basics of Behavior Trees and how to code new Actions and Conditions.

    Bye!
     
    markoal likes this.
  23. judah4

    judah4

    Joined:
    Feb 6, 2011
    Posts:
    256
    Hi,
    Is it possible to load the BehaviorExecutor from an asset bundle or create it programmatically? I'm having an issue loading it up on a gameobject from an asset bundle.
    Code (CSharp):
    1. NullReferenceException: Object reference not set to an instance of an object
    2. BBUnity.UnityBlackboard.BuildBlackboard ()
    3. BBUnity.InternalBehaviorExecutor.StartBehavior ()
    4. BBUnity.InternalBehaviorExecutor.Awake ()
    5. BehaviorExecutor.Awake () (at Assets/BehaviorBricks/BehaviorExecutor.cs:19)
    6. UnityEngine.Object:Instantiate(Object, Vector3, Quaternion)
    My behavior params are missing when it gets instaniated because of this. And suggestions?
     
  24. padaone_games

    padaone_games

    Joined:
    Mar 16, 2015
    Posts:
    19
    Hi, judah4. And thanks for your feedback ;)

    This UnityBlackboard.BuildBlackboard() exception has already been fixed, but we are having problems generating a new version, because of the compatibility of Scriptable Objects within versions.

    We will release the new version as soon as possible, and will notify in this thread when the new version will be available.
     
    Alverik likes this.
  25. judah4

    judah4

    Joined:
    Feb 6, 2011
    Posts:
    256
    Thanks! I made a workaround for now.
    Do you know if there would be any reason for Behavior bricks to not work in headless unity builds? Mine don't seem to run in the background.
     
  26. padaone_games

    padaone_games

    Joined:
    Mar 16, 2015
    Posts:
    19
    Hi all!

    We have just submitted a new package update for approval. It will be available in a few days, after unity review.

    This new update fixes the bugs related with BehaviorExecutor in builds, and the problems with runtime instantiation of GameObjects (with Behavior Executor attached).

    In addition, we've included a new feature requested by some users: Zoom & Pan in the BBEditor. :)

    We hope you like it.
     
    Alverik likes this.
  27. padaone_games

    padaone_games

    Joined:
    Mar 16, 2015
    Posts:
    19
    As we told you recently, we had problems with the BrickAssets, so we had to change its "fileID".

    Therefore, we have changed the installation process, and have included a PDF with instructions.
    • If you have never used Behavior Bricks, or you do not have any BT to keep in your project, you can do a typical setup, importing the package and that's it.
    • If you have any BT of your own that you want to keep, you will have to follow the instructions included in the package, to patch and convert then to the new version. This step is very important if you don't want to lose the BrickAssets.
    And remember to make a backup of the project whenever you import any new Unity package.
     
    Alverik and judah4 like this.
  28. esesa

    esesa

    Joined:
    Dec 26, 2016
    Posts:
    2
    Hi,

    Are random selector and random sequence working? They don't seem to.
     
  29. padaone_games

    padaone_games

    Joined:
    Mar 16, 2015
    Posts:
    19
    Hi esesa,

    Argh! You are absolutely right. It's a bug.

    We will release the new version as soon as possible, and will notify in this thread when the new version will be available.

    Thank you for reporting the issue.
     
  30. StrongCube

    StrongCube

    Joined:
    Nov 22, 2016
    Posts:
    50
    @padaone_games

    Good asset!

    How to work with an animator? (+Behavior Bricks)

    You can make an example? Switching animation of the enemy (walking, running, attack)
     
    EvilVanHalen likes this.
  31. PinkPanter

    PinkPanter

    Joined:
    Sep 26, 2013
    Posts:
    4
    @padaone_games
    Hi, your asset is great!

    It would be nice, if you implement enum mask edit. Sometimes is very helpful, now I using it to set enemies relationships.

    Now I just edit DrawEnabledGraphicObj in EnumCombo, check for Flags attribute, and draw EnumMaskField. Seems to work.

    And can you explain about OnLatentStart, as I understand, it execute one time after start and before update? Now I'm using it for immediate actions, can I do it?
     
  32. ransomink

    ransomink

    Joined:
    Aug 18, 2013
    Posts:
    3
    @padaone_games, thanks for the asset!

    I have a question: Is OnStart called every time the action runs?
    I set a variable "_maxPosition.x" inside OnStart (which I never expect to run again)
    Code (CSharp):
    1. public override void OnStart ()
    2. {
    3.    _t               = gameObject.transform;
    4.    _defaultPosition = _t.position;
    5.  
    6.    // player set?
    7.    if ( m_target == null )
    8.         m_target = D_PlayerManager.Instance.Player.transform;
    9.  
    10.    // set min/max limit
    11.    _minPosition.x = m_target.position.x + m_offset;
    12.    _maxPosition.x = _defaultPosition.x;
    13.    Debug.Log ( "Max Position: " + _maxPosition.x );
    14. }
    that should remain the same value, but when the action runs again (using the Repeat node) the value is updated (meaning OnStart is called again). Am I doing something wrong?
     
    Last edited: Mar 23, 2017
  33. judah4

    judah4

    Joined:
    Feb 6, 2011
    Posts:
    256
    Hi, I'm having class name conflicts with Inventory pro, specifically with ScriptableObjectUtility in the BBEditor.dll. It overrides Devdog.General.Editors.ScriptableObjectUtility.

    Can you move everything to a namespace?
     
  34. Arakon

    Arakon

    Joined:
    Mar 8, 2014
    Posts:
    23
    This looks very nice, thanks!
    Is there a way to read data out of the blackboard?
    I'm interested in being able to read the blackboard to draw some debug information during development.
     
  35. Spy-Shifty

    Spy-Shifty

    Joined:
    May 5, 2011
    Posts:
    546

    Hi,
    first of all, thank you for providing such a great asset for free!!!

    Whats the state of Visual Debugging right now? When do you plan to release this feature?

    Thanks in advance!
     
  36. Spy-Shifty

    Spy-Shifty

    Joined:
    May 5, 2011
    Posts:
    546
    I Don't know if this is a bug but i think so.
    By adding a condition to a Priority Selector it will also add a "Always True" condition between it. Even if there exists an "Always True" condition.
    This is weird.

    EDIT:

    Ok I solved it.

    For any one who had the same issue. Connect your action,... to the Prio Selector. It will generate a Always True Condition. Now Drag and Drop a different condition on top of the generated Always True Condition. It will replace it.
     
    Last edited: Apr 24, 2017
  37. Ardaurum

    Ardaurum

    Joined:
    Jan 20, 2015
    Posts:
    2
    I started using BB recently and I think it's a great tool. Unfortunately there is one big problem. When I build the project in development mode i get an error and all behaviors aren't working (without development mode everything is alright).

    Error message:
    UnityException: get_isEditor can only be called from the main thread.
    Constructors and field initializers will be executed from the loading thread when loading a scene.
    Don't use this function in the constructor or field initializers, instead move initialization code to the Awake or Start function.
    at (wrapper managed-to-native) UnityEngine.Application:get_isEditor ()
    at BBUnity.Managers.BBManager.InitSerializer () [0x00000] in <filename unknown>:0
    at BBUnity.Managers.BBManager..ctor () [0x00000] in <filename unknown>:0
    at BBUnity.Managers.BBManager.get_Instance () [0x00000] in <filename unknown>:0
    at BBUnity.InternalBrickAsset.OnAfterDeserialize () [0x00000] in <filename unknown>:0

    UPDATE!
    Beware it doesn't work on iOS neither [TESTED]. I suppose it is a problem with AOT [NOT TESTED] (so possibly WebGL, xBox, etc.).
     
    Last edited: May 15, 2017
  38. neshius108

    neshius108

    Joined:
    Nov 19, 2015
    Posts:
    110
    Hello!
    I went through the two tutorials and wanted to expand the wander/moveToGameObject/shoot. Since my game is 2D I converted the LookAt action into my own LookAt2D. All works fine when the enemy is in "MoveToGameObject" mode but he seems unable to turn around when shooting.

    Is there some sort of bug with the Shoot/ShootOnce actions? I tried adding the Sequence/Random Selector/Parallel and nothing worked, only using Parallel (OR) seemed to allow the enemy to look at me but he would then not shoot me.

    Either it's a bug or the Shoot/ShootOnce actions are somewhat messing up the sibling.
     
  39. Ben-BearFish

    Ben-BearFish

    Joined:
    Sep 6, 2011
    Posts:
    1,204
    @padaone_games I don't suppose you could open up the plugin from a DLL to source files, so we could modify/extend things if needed?
     
    ZiadJ likes this.
  40. Alverik

    Alverik

    Joined:
    Apr 15, 2016
    Posts:
    417
    Some more generic sample behaviors would be nice too, heh. It would also be cool if we could build a community behaviour library to share recipes or something (one can dream, lol).
     
    Last edited: May 26, 2017
  41. CoMANDOR

    CoMANDOR

    Joined:
    Sep 21, 2015
    Posts:
    8
    Good asset. This asset is support android and ios, use Reflection or not?
     
  42. neshius108

    neshius108

    Joined:
    Nov 19, 2015
    Posts:
    110
    I think the developers are not active on the forum anymore. Might be busy or they maybe dropped the project :/
     
  43. Epiplon

    Epiplon

    Joined:
    Jun 17, 2013
    Posts:
    52
    It would be really cool if we could add variables directly on the Blackboard without depending on Actions.
     
  44. BenDy557

    BenDy557

    Joined:
    Sep 18, 2015
    Posts:
    2
    To the devs if they still post here:
    Some errors related to the editor UI are preventing me from opening and fixing one of my behaviour trees, an entire's day work, down the drain.
    It's throwing a NullReferenceException for "BB.FreeTreeView.AddTree(IBTNode rootNode)"
    Is there anyway of salvaging the tree when this sort of thing happens?
     
  45. markoal

    markoal

    Joined:
    Aug 31, 2015
    Posts:
    30
    I also have error caused by this plugin for the development build (PC Build). Hope you guys didn't give up on this nice tool.

    Code (CSharp):
    1. UnityException: get_isEditor can only be called from the main thread.
    2. Constructors and field initializers will be executed from the loading thread when loading a scene.
    3. Don't use this function in the constructor or field initializers, instead move initialization code to the Awake or Start function.
    4.  at (wrapper managed-to-native) UnityEngine.Application:get_isEditor ()
    5.  at BBUnity.Managers.BBManager.InitSerializer () [0x00000] in <filename unknown>:0
    6.  at BBUnity.Managers.BBManager..ctor () [0x00000] in <filename unknown>:0
    7.  at BBUnity.Managers.BBManager.get_Instance () [0x00000] in <filename unknown>:0
    8.  at BBUnity.InternalBrickAsset.OnAfterDeserialize () [0x00000] in <filename unknown>:0
     
  46. Epiplon

    Epiplon

    Joined:
    Jun 17, 2013
    Posts:
    52
    This was promising but the board is dead. Wanted to ask about performance issues I had with the tool, but since no one is getting a reply...
     
    Alverik likes this.
  47. Enerbunni

    Enerbunni

    Joined:
    May 22, 2017
    Posts:
    1
    Hey how did you set up Behavior Bricks for 2d and does it even work for 2d? I'm currently stuck on how to do that.
    Thanks
     
  48. EvilGremlin

    EvilGremlin

    Joined:
    Aug 12, 2016
    Posts:
    231
    Yeah. It is a shame when a good asset is unsupported.
     
    Alverik likes this.
  49. Havok_ZA

    Havok_ZA

    Joined:
    Jul 27, 2016
    Posts:
    69
    Yeah pretty sad actually. a year later and dead it seems. Great asset at that.
     
    Alverik likes this.
  50. TsukinoKanTei

    TsukinoKanTei

    Joined:
    Jul 14, 2013
    Posts:
    3
    Let me resolve some misunderstanding here. I also downloaded the asset store version and came across with runtime error. But actually, I redownloaded from author's webpage and imported it into Unity. It worked. So I think the version on asset store is out of date.
     
    Alverik likes this.