AI: Behaviour trees in Unity: Behave 1.1 released

This thread is primarily for Behave announcements and 1.x support. For Behave 2 support, please use your AngryAnt community account - available through the Help menu when Behave 2 is installed.

Update 12:
Whoops - missed an update!

Behave 2.4 is now out, adding utility and blackboard methods to the offering: AngryAnt - Behave 2.4

Update 11:
Behave 2.2 is out!

http://angryant.com/2013/12/23/Behave-2-2/

Update 10:
Behave 2.1 is out!

http://angryant.com/2013/10/06/Behave-2-1/

Update 9:
Behave 2 is out!

http://angryant.com/2013/08/25/Behave-2-0/

Update 8:
Whoop! Sorry about my long absence from this thread. Been a bit busy. But now Behave 1.4 is here! Blogpost contents:

So obviously I ended up not spending more time on that RPG thing… I did however work on some 3.5 stuff back at Unity, some upcoming demo stuff and baby Lili was born.

Meanwhile I spent spare time on Behave rather than the RPG thing, so now 1.4 is ready for release. TADAA!

This release primarily holds runtime optimizations, fixes and tweaks. Specifically I would like to highlight the ability to mark components as “instant”. The instant flag affects sequences and selectors when moving between child nodes. When an instant child component completes, rather than waiting for the next tick to tick the following child node, the sequence or selector does it immediately.

Anywho, get it on the asset store and remember to rebuild your libraries after installing.

The rest of the changes follow:

1.4:

  • Fixed decorator incorrectly initializing on every returning tick when tick handler returned Running.
  • Fixed debugger view dependency on active tree editor - causing reported null reference exception.
  • Fixed missing scrollbars on browser window.
  • Reduced logging noise from debug builds.
  • Agent blueprints can now be MonoBehaviour based.
  • Clarified wording on “library not loaded”.
  • Now handling reset a bit cleverer - potential performance boost.
  • Changed the default success criteria of Parallel components from SuccessOrFailure to Success.
  • Added “instant” flag to components. Components marked instant will affect sequences and selectors when moving between child nodes. When a child node marked “instant” completes, rather than waiting for the next tree tick to tick the following child node, the sequence or selector does it immediately.
  • The compiler progress bar returns.
  • Editing a Behave asset now focuses the asset browser last instead of the tree editor.
  • Behave can now be installed in any subfolder of Assets - provided its internal folder structure remains intact.
  • Compilation speed improvements.
  • Enabled references across collection borders.
  • Added Tree.DataSize - returning the number of bytes used by a tree instance. This is also displayed in the debugger window.

You’ll find a link to the package in the download section. Have fun!

Blog post.

Update 7:
After quite a long break (including shifting around at utech, doing a Path release etc.), Behave is finally getting another update!

This release is primarily a bugfix and editor polish release. One thing I’d like to highlight though is the addition of agent blueprints. From the changelog:

Generally this enables you to more explicitly tie up handlers and cuts down on tree initialization time. Oh and of-course you gain auto-completion when setting up your handlers.

Anyway, here’s the whole changelog:

1.3:

  • Fixed priority selector init flag resetting.
  • Fixed reference handling on tree renaming and deletion.
  • Fixed references still pointing at old collection post collection duplication.
  • Fixed compilation of actions and decorators with non-integral float parameters.
  • Fixed GUI list behaviours.
  • Fixed passing context back and forth between referenced trees and referrer.
  • Fixed reordering connections not causing save state to be set.
  • Various GUI tweaks.
  • Runtime optimisations.
  • Enabled scrolling of the tree list in the debugger window.
  • Exposed Tree.ReflectForwards.
  • Added Tree.ResetForwards.
  • Added agent blueprints - connecting to agent handlers through virtual methods rather than reflected handlers.
  • Made connections selectable in the tree editor via the connection nub.
  • Moved connection managing from the inspector to the tree editor, where it is more visible and handy.
  • Added support for disabling connections - for faster, less destructive debugging.
  • Double-click reference component to jump to referenced tree.
  • Changed “Cannot update unregistered tree” handling from an exception to an error message. Still need more info.
  • Now showing string and float parameters in the tree editor if either is set.

You’ll find a link to the package in the download section. Have fun!

Blog post.

Update 6:
I just updated the Behave documentation to include a link to Bjoern Knafla’s very nice introduction to behaviour trees, published for #AltDevBlogADay.

http://angryant.com/behave/documentation/

Update 5:
I’ve set up a survey to better understand peoples use of Behave and uncovered needs. Please take a few minutes to complete the survey and help shape future releases of Behave:

http://angryant.com/behave/survey/.

Update 4:
Just set up the Behave release project on github. Please use the github issue tracking system for bug reports and feature requests.

http://github.com/AngryAnt/Behave-release

Update 3:
Just finished uploading Behave 1.2. A few fixes in there including one for the broken release build. Also some additions: Priority selectors (thanks Jiong for pushing that up my TODO list again) and branch contexts.

Blog post:
http://angryant.com/2010/10/11/behave-1-2-released/

Changelist:

  • Fixed release building.
  • Added the priority selector, introducing the API points:
  • int IAgent.SelectTopPriority (Tree sender, params int[ ] IDs);
  • enum BL[LibraryName].PriorityType { PriorityName, …, Unknown };
  • Added support for branch contexts, introducing the API points:
  • enum BL[LibraryName].ContextType { ContextName, …, Unknown };
  • int Tree.ActiveContext { get; }
  • Changed IAgent interface:
  • Tick (bool init, Tree sender) → Tick (Tree sender, bool init)
  • Added “Select asset” button to the standard inspector.
  • Interface polish.

Update 2:
Added a new video demonstrating how to get from an empty project to up and running with Behave plus brief introduction to the authoring environment:
http://angryant.com/2010/09/29/video-behave-starting-from-scratch/

Update:
The new runtime is now documented on AngryAnt.com - I will be adding documentation for the authoring environment soon.
AngryAnt - Behave runtime documentation updated

Original post:
That’s right. I’m ready with a new version of Behave - fully Unity 3 compatible, stuffed with polish and a shiny new debugger.

Blog post:
http://angryant.com/2010/09/29/behave-1-1-released/

Debugger teaser:
http://angryant.com/Debugger.mov

Changelist:

  • Made compatible with Unity 3.0 - including ensuring that the 2.5-2.6.1 bug preventing compilation on Windows is fixed on the Unity side.
  • UI tweaks and polish.
  • Added the option to have return values of nodes be inverted.
  • Fixed compiler bug when facing sequence or selector with only one child node.
  • Renamed Library.Tree → Library.InstantiateTree.
  • Added Tree.Tick () and Tree.Reset () methods using the IAgent instance given at instantiation of the tree.
  • Removed the abstract Library class.
  • Changed generated library class:
  • Trees → TreeType.
  • Actions → ActionType.
  • Decorators → DecoratorType.
  • Tree InstantiateTree (int, IAgent) → static Tree InstantiateTree (TreeType, IAgent)
  • int TreeID (Tree) → static TreeType Type (Tree)
  • bool IsAction (int) → static bool IsAction (int)
  • bool IsDecorator (int) → static bool IsDecorator (int)
  • Upped editor performance.
  • New asset structure change with automatic import of Behave 1.0 assets.
  • Changed action and decorator handlers. These are now the handlers mapped:
  • public BehaveResult Init[Name][Action/Decorator] (Tree sender, string stringParameter, float floatParameter, IAgent agent, object data);
  • public BehaveResult Tick[Name][Action/Decorator] (Tree sender, string stringParameter, float floatParameter, IAgent agent, object data);
  • public void Reset[Name][Action/Decorator] (Tree sender, string stringParameter, float floatParameter, IAgent agent, object data);
  • public BehaveResult Init[Name][Action/Decorator] (Tree sender);
  • public BehaveResult Tick[Name][Action/Decorator] (Tree sender);
  • public void Reset[Name][Action/Decorator] (Tree sender);
  • public BehaveResult [Name][Action/Decorator] {get; set;}
  • Added support for collection duplication.
  • Moved debug rendering into the editor with its own dedicated debugger window, including actor listing.
  • Debugger now renders active sub-trees as well.

Very sweet, thank you for the update :slight_smile:

With the update of mono in unity, does it still rely on a distinct mono installation?

Hi Dreamora

I dont think so from reading Behave download page:

thats why I ask, because that implies that it no longer requires it. if you check 1.0 and used it in the past you know that the package was only part of it, mono needs to be installed manually etc

I’ll check this out right now. :slight_smile:

good deal, thanks for the update.

dreamora,

http://eej.dk/angryant/behave/downloads/

An additional active Mono runtime is indeed not required for running the 1.1 compiler - which by the way runs on Windows now as well :slight_smile:

A1. Been looking forward to this. New docs be up soon too?

ty!

I’m working on it :slight_smile:

http://angryant.com/general/behave/behave-runtime-documentation-updated/

Really good news. Downloading this now

great thing, exactly what I hoped to ehar :slight_smile:

thanks Emil

Great Stuff. I have been meaning to look at this for quite a while. This new version is just the catalyst I needed.

Regards,
Matt.

Great work!
I have some problem.
How can implement Priority Selector in behave?
I need use Selector Node select 3 child node behavior by desirability (like Goal Evaluator), but selector node is sequence checking whether a child node selected in Behave.
How can I do in behave?

Documentation update: Added a new video demonstrating how to get from an empty project to up and running with Behave plus brief introduction to the authoring environment:

http://angryant.com/general/behave/video-behave-starting-from-scratch/

@Jiong:
I’m not entirely certain what it is you are after. Selectors and sequences are always evaluated left to right, so the branches you want considered first, should be placed leftmost of those which should be considered later. If you want further filtering, decorators and actions being evaluated to consider the validity of a branch should do the job.

Unless I am misunderstanding what it is you are after?

Thanks for this dude :slight_smile:

This rocks :slight_smile:

@AngryAnt
i want select a goal by best desirability score;
For example, i want select a goal in A,B,C;
In behave case,
we can do like this:
Selector
Sequence Sequence Sequence
isA A isB B isC C
but i want to select A, B, C by it desirability value;
because of Selectors and sequences are always evaluated left to right, so i can only do like this:
Check ACondition, Run A-> Checking BCondition, Run B->Check CCondition, Run C;
so i can’t do this logic:
iterates through each goal option to best by desirability value->select this goal as next running;

======
Other question, why change
public BehaveResult Init[Name][Action/Decorator] (bool init, Tree sender);
to
public BehaveResult Init[Name][Action/Decorator] (Tree sender);
public BehaveResult Tick[Name][Action/Decorator] (Tree sender);
?
it look like not convenient, we have to coding more bind function and member variable;

@Jiong:
Ah like that. Yea I’ve been considering adding in a selector like that, but unfortunately I didn’t have the time to include it in this release. I’ll push it up the TODO list. Thanks for reminding me.

Regarding the change in API, it was changed from

BehaveResult Tick[Name][Action/Decorator] (bool init, Tree sender);

to

BehaveResult Init[Name][Action/Decorator] (Tree sender);
BehaveResult Tick[Name][Action/Decorator] (Tree sender);

In my experience most actions don’t need to specifically handle the first tick and if they do, the setup ended up something like this anyway:

BehaveResult Tick[Name][Action/Decorator] (bool init, Tree sender)
{
    if (init)
    {
        DoSomething ();
    }
    else
    {
        DoSomethingElse ();
    }
}

In which case I prefer the split up and not much is gained from keeping the old structure in stead of the new one.

For anyone not familiar with behaviour trees, I added a direct link to an excellent introductory video by Alex J. Champandard of aiGameDev.com to the Behave documentation section.

Pardon my ignorance, but is there any chance of this working on iOS?

It does work. Read the features on the doc page http://angryant.com/behave/documentation