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

NodeCanvas - (Behaviour Trees | State Machines | Dialogue Trees)

Discussion in 'Assets and Asset Store' started by nuverian, Feb 8, 2014.

  1. nuverian

    nuverian

    Joined:
    Oct 3, 2011
    Posts:
    2,087
    Cover.png

    "One Canvas. Infinite Possibilities"
    NodeCanvas is a complete Visual Behaviour Authoring framework to create advanced AI and Logic, including three separate, fully featured modules for you to choose and easily add in your game:
    • Behaviour Trees
    • State Machines
    • Dialogue Trees

    Highlighted Features
    • Design reactive Behaviour Trees and Hierarchical State Machines within an intuitive, designer friendly visual node editor:
      (Full Undo/Redo, Zoom In/Out, Multi-selection, Duplication, Copy/Pasting, Import/Export and more)
    • Communicate local & global variables visually or in code, for creating reusable and actor-centric parametrizable AI behaviours, optionaly saving and loading variables state between gaming sessions.
    • See how your behaviours react with advanced, colorful and informative runtime debugging for direct feedback.
    • Live Edit everything while in play mode to perfectly understand your design goals and how to achieve them.
    • Extend NodeCanvas Framework to create your own Actions, Conditions, Nodes or even completely new modules with the ease of a powerful, clean and well documented API.
    • Utilize any existing code directly with advanced and extremely fast Reflection Tasks, automaticaly integrating Unity's and 3rd Party asset APIs.
    • Work with Lists/Arrays, Enums, Interfaces and pretty much ANY Variable Type you need out-of-the-box.
    • React to world changes and transfer data using the built-in Event System.
    • Reuse and Bind made behaviours amongst any number of different agents.
    • Organize your designs using Behaviour Sub-Trees and Sub-State Machines.
    • Perform exceptional.
    • Publish to all Unity platforms out-of-the-box.
    • Integrate with Playmaker able to Sync Variables and lot's of other great assets.
    • Full C# Source Code Included!
    • And so much more...

    Current 3rd Party Asset Integrations
    • Chronos
    • Cinema Director
    • Core GameKit
    • DOTween
    • Inventory Pro
    • LipSync
    • Love/Hate
    • Master Audio
    • Motion Controller
    • Playmaker
    • PolyNav
    • SALSA
    • Simple Waypoint System
    • more comming soon...
    Integrations.png
    NC1_6.png
     
    Last edited: Jan 18, 2016
    Metron, ericbegue and DMeville like this.
  2. nuverian

    nuverian

    Joined:
    Oct 3, 2011
    Posts:
    2,087
    [Empty]
     
    Last edited: Mar 28, 2015
  3. MitchStan

    MitchStan

    Joined:
    Feb 26, 2007
    Posts:
    568
    Congrats on release. Demo video looks great. Heading over to asset store to buy. Been waiting for this for a while. Hope this asset is really successful for you.

    Mitch
     
  4. nuverian

    nuverian

    Joined:
    Oct 3, 2011
    Posts:
    2,087
    Hey Mitch. Thanks a lot! Let me know of anything you might need :)
     
  5. nuverian

    nuverian

    Joined:
    Oct 3, 2011
    Posts:
    2,087
    The online documentation has been updated for Actions, Conditions, Nodes and Systems..Here is how to create a Action Task for example:

    Code (csharp):
    1.  
    2. using UnityEngine;
    3.  
    4. [Category("My Super Actions")]
    5. public class MyAction : ActionTask<Transform> {
    6.  
    7.     //To allow use of either direct value or blackboard variable. Something like Playmaker
    8.     public BBParameter<Vector3> translateBy;
    9.  
    10.     //Optional.Called once a new agent is set. Think Awake. Return an error string or null
    11.     protected override string OnInit(){
    12.         return null;
    13.     }
    14.  
    15.     //Optional.Called once
    16.     protected override void OnExecute(){
    17.  
    18.         agent.Translate(translateBy.value);
    19.         EndAction(true);
    20.     }
    21.  
    22.     //Optional.Called per frame if the Action has not ended.
    23.     protected override void OnUpdate(){
    24.  
    25.     }
    26. }
    27.  
     
    Last edited: Jun 26, 2015
  6. nuverian

    nuverian

    Joined:
    Oct 3, 2011
    Posts:
    2,087
    I just wonder..
    Are you interested in NodeCanvas but you would like a C# version?

    --EDIT--
    Obsolete; NodeCanvas is now in C#
     
    Last edited: Jun 8, 2014
  7. lilymontoute

    lilymontoute

    Joined:
    Feb 8, 2011
    Posts:
    1,181
    Would it be possible to have a node graph at runtime (using the same OnGUI() methods for renderering). If not, is it possible to extend the base code to do so? The use case would be for a node-graph based design tool, made with Unity.
     
  8. nuverian

    nuverian

    Joined:
    Oct 3, 2011
    Posts:
    2,087
    Hey,
    While it's possible to see a graph in Play mode in the editor, it's not possible to do so in build game. Basicaly because there are many unity editor methods used (helpboxes, dialogs, handles etc). I could make it possible to show a kind of striped version though in the future, but I first have to finish the Dialogue Tree and the FSM systems of NodeCanvas
     
    Last edited: Feb 13, 2014
  9. Tin-Can

    Tin-Can

    Joined:
    Jul 28, 2013
    Posts:
    3
    I tried this and it gives a compile error: "The type or namespace name `ActionTask' could not be found. Are you missing a using directive or an assembly reference?"

    This is happening because ActionTask is a javascript class, and EmptyAction is a C# class. As far as I know, you can't have C# classes extend JavaScript classes since they are compiled with different compilers. I don't know of any way to get around this.

    If this is true, then this tool cannot be used with existing projects that are written in C#. I would strongly recommend making a C# version of NodeCanvas, since C# is used far more in Unity projects.
     
    Last edited: Feb 15, 2014
  10. nuverian

    nuverian

    Joined:
    Oct 3, 2011
    Posts:
    2,087
    Hello,
    You will have to move some folders into the Plugins folder.
    Please wait for an update I've just pushed in which I relocated the folder structure a bit to make this easier along with some fixes, improvements and more Tasks.
     
  11. phato777

    phato777

    Joined:
    Dec 14, 2012
    Posts:
    138
    Absolutely! My projects are all strictly C#.
     
  12. nuverian

    nuverian

    Joined:
    Oct 3, 2011
    Posts:
    2,087
    Im very excited to say that I've just submited version 1.2. Now that's a big version change you might think, but I really think it deserves. here is why:

    The UI has been overhauled, to be more informative, nice and free up space for bigger graphs.
    The nodes now only read the info that is needed, while the controls for each node or connection and assigned Actions and Condition Tasks are shown in the new inline inspector area on the top left when a node or connection is selected.

    $2014-02-21_18h34_26.png

    The FSM System is introduced as promised!
    It can hold other nested FSM systems or nested Behaviour Trees. So that a Behaviour Tree can be a State of an FSM System for example. The FSM works with the same Actions and Conditions. Create once and reuse in all systems.

    $2014-02-21_18h37_56.png

    The Dialogue Tree System is also here!
    Create non-linear, GUI agnostic Dialogues, usable from any GUI system, since it works with the new included event system (Demo UI included).
    Using the already included Blackboard feature, it is possible to create Dialogues in which Dialogue Actors are able to remember things.
    Again, use the same Actions and Conditions. Create once and reuse in all systems.

    $2014-02-21_18h36_38.png

    Finalized Blackboard Save/Load
    The Blackboards variables can be saved and load at any time in game just by calling Save, or Load on the blackboard. It can also be set to automaticaly load OnAwake and save OnDestroy!

    $2014-02-21_23h22_07.png

    More Action Condition Tasks Included
    Usable with any system. Notably, I've included actions for Mecanim contol.

    Behaviour Tree Fix Improvements
    Fixed the Parallel Node to work as expected
    Fixed Random Selector and added Random Sequencer as well. Both of which it's possible to visually debug...

    $radnomSeq.gif

    Many more Fixes and Improvements
    Especially in the Editor UI controls

    The documentation on www.nodecanvas.com is now being written for the new systems, as well as expanded for Behaviour Trees. New videos will soon follow

    I hope it gets live soon :)
     
    Last edited: Mar 14, 2014
    ocimpean likes this.
  13. SteveB

    SteveB

    Joined:
    Jan 17, 2009
    Posts:
    1,451
    This is an excellent update. I was following along with your development, unsure how I'd use this (I either code or use Playmaker) myself, but your addition of a 'Dialogue System' is making this very attractive now. I think you're best suited to showcasing more 'practical demo's' like that, rather than trusting people to fully appreciate what a BT can do for them...I didn't necessarily so, and you won me over! :D

    Cheers man

    -Steven
     
    ocimpean likes this.
  14. nuverian

    nuverian

    Joined:
    Oct 3, 2011
    Posts:
    2,087
    Hey Steven. Thanks :)
    I'm glad you like the update! Yes it's true that Behaviour Trees are a bit specialized and thus the new FSM and Dialogue Systems which are easier to find a more... practical and direct use. But hey, BTs are powerful :)
    I hope to get some new videos up soon, showcasing the new systems, alone or even in conjuction with one another.
    Hopefully before the update goes live.

    Thanks
    -Gavalakis
     
  15. SteveB

    SteveB

    Joined:
    Jan 17, 2009
    Posts:
    1,451
    So what's coming up next Gavalakis?

    Tutorial videos are a definite must-have. :D

    Cheers man

    -Steven
     
  16. Tin-Can

    Tin-Can

    Joined:
    Jul 28, 2013
    Posts:
    3
    I really want to like this product, it has great potential. I was happy to see with your version you provide some support for C# users, allowing them to move some of the javascript files into the plugins folder so that ActionTasks and ConditionTasks can be overridden by C# classes.

    However, after playing with this for a while, I eventually ran into another brick wall:

    I wanted to write my own decorators for my behavior trees - for example, one that would interrupt a running child node when a blackboard key was set. Alas, this is not possible in C#. In fact, it is not possible to create any new behavior tree nodes in C# since they must appear in the "availableNodes" list in the BTContainer javascript class.

    I guess at this point my only option would be to rewrite the behavior tree node system in C#, which is only two dozen files - but still is a pain.

    Again, I highly recommend providing a C# version of this product. Since 95% of Unity users code in C#, I bet you would have a much higher adoption rate...
     
  17. nuverian

    nuverian

    Joined:
    Oct 3, 2011
    Posts:
    2,087
    At long last I've converted the whole NodeCanvas package to C#. I guess that was the way to go from the start. I'm really sorry if some of you have made progress with the current existing version, but all is for the better :)
    There have been a lot of improvements in the process as well.

    With that heavy load of porting and workflow improvements I wanted and are now done, I am finaly so excited to start making video tutorials for all aspects of NodeCanvas, updating knowledge base and generally illustrate what it really is. The workflow has much improved to a point that the last video is now almost obsolete :p

    I am submiting the new version tomorrow first thing!

    Thanks for all the patience!
     
  18. Vectrex

    Vectrex

    Joined:
    Oct 31, 2009
    Posts:
    267
    Cool. Do you get the source code? I notice that the Asset store files preview shows all js scripts. This makes me nervous :)
    Is there a demo/limited version i can test? Good work.
     
    Last edited: Mar 10, 2014
  19. Vectrex

    Vectrex

    Joined:
    Oct 31, 2009
    Posts:
    267
    I bought it anyway :) Looks like we get the source, very nice. It's all still JS though. I presume your c# conversion takes time to appear on the asset store?
     
    Last edited: Mar 11, 2014
  20. Darren-R

    Darren-R

    Joined:
    Feb 11, 2014
    Posts:
    66
    This looks amazing, great work!
    From what I see there is an FSM engine build in but can I use Playmaker FSMs in the Behaviour Trees as well?
     
  21. nuverian

    nuverian

    Joined:
    Oct 3, 2011
    Posts:
    2,087
    Hey thanks :)
    The C# version is submitted but has not yet apeared on the asset store. I hope it will soon does! The full C# source code is also included. Expect a lot of nice stuff in that new version. :) Please be patient and remember to make a clean import when the new version apears. I will of course let everyone know here when it does as well :)

    Thanks!
    Yes there is an FSM system in NodeCanvas as well. As far as integration with Playmaker it is something I've had many thoughts as of how to go about it as to be most convinient. Right now there is no build-in integration, but it will happen very soon :)


    @Everyone
    You will notice that the website is currently under maintenance. That's because I am updating the content especialy the documentation as we speak.
     
  22. Vectrex

    Vectrex

    Joined:
    Oct 31, 2009
    Posts:
    267
    Cool. I usually note down issues and ideas as I find them when trying something new. Take a look if you like https://docs.google.com/document/d/1Ao8QRChmCDl0kbBHCcf4BedtvTxC8tbtUa9x2dBYtP0/edit?usp=sharing
     
  23. nuverian

    nuverian

    Joined:
    Oct 3, 2011
    Posts:
    2,087
    Thanks for the feedback list!

    The Blackboard Editor needs some improvement, yes.
    I am working on undo. I know it's a must and adding namespaces now that NodeCanvas is in C# :p

    Things that are already in the submited version
    • Delete key works for deleting nodes and connections.
    • The Debugger Decorator show a UI text overlay on the agent like Playmaker does when it is in the state you select and break when executed as well. I will add stepping for the BTs. It could be interesting. Also the Debug Action does somethign similar.
    • JS also supports Reflection which I've obviously used a lot, but it doesn't matter anymore anyway :). There are both an Action and a Condition using reflection already. You can Execute a function or set a property with none or one parameter.
      You can also check a boolean method or property.
    $reflectionSet.gif $reflectionGet.gif

    Things I did
    • I've made auto connecting a new node when another is selected.
    • I've colored the checkmarx and X mark in respect to the state.
    • I've added a Nested FSM for the Behaviour Trees. As of now an FSM is finished when a state with no connections is finished. Of course a NestedFSM can be interrupted. I will expand on this to make it possible to finish the NestedFSM in Success or Failure.
    $nestedFSM.gif

    I will take notice for the rest of your suggestions. Thanks a lot for those :)
    Regarding the bug, I think with the new version's workflow that bug wont take place :)

    (PS: Interesting that you know Nuke, cause I am actually working with Nuke :) and that specific feature you sugested is something I wanted to do inspired by Nuke as well :p )

    I am also working on an icon mode but while it looks cool and all, I dont think I will keep it, because much information space is lost and taken up just for the icons.
     
    Last edited: Jul 20, 2014
  24. Vectrex

    Vectrex

    Joined:
    Oct 31, 2009
    Posts:
    267
    That's all excellent. Here's some more stuff!

    Yeah, nuke is great and it's node editor is almost perfect.. almost :) I think the Tab shortcut from Nuke would work well. One thing that I like in React is how it auto snaps everything neatly, also when rearranging. Not sure how that would be possible in a freer horizontal graph environment like NC, but I think some auto snapping would work ok without getting in the way. I really like your order dependent dynamic connection dots thing. Never seen that before.

    Is 'Prime node' a standard thing? I would have thought just calling is 'Start' would be clearer.

    Why are the BT's in all the demos separate from the GO it's being used on? It seems to work fine if I drag it inside my GO's. Is it because you can prefab them separately? (I REALLY wish Unity would hurry up with nested prefabs...)
    So the only way to reuse a BT is to separate it? I guess that's why some other BT's store them in a separate file.

    The grey nodes on grey backgrounds are pretty hard to see :)
    Can the colours be configured? That'd be nice to select colour schemes, since you can't please everyone (ie me ;) ). Even if it was just a config file.

    Do we need the nodes to be numbered? Can't think of a reason and it clutters things a bit.

    The icon stuff. Yeah, I've never found the standard BT icons make much sense. I think subtle colours for types of nodes works better. Or different node shapes? Not sure.
    That being said, I think the icons could sit next to the text. No bigger than the height of the text though (In place of the numbering?)

    Can using the blackboard variables be like enum drop-down lists, instead of typed text?

    For actions and conditions, I'd like to right click and reselect a different action/condition. Instead of deleting it and reconnecting everything.
    Also a right-click/insert option would be nice. Not needed though. Probably just steal Nuke's 'drag node onto line to insert' thing :)

    The Execute function things look great. Can't see them in the current version.

    "Regarding the bug, I think with the new version's workflow that bug wont take place"
    I actually really like how this one uses normal GO's and components so don't change that :). My own simple state machine just turns whole GO's on and off to represent states. Playmaker etc make me nervous how it's all proprietary and locked inside itself. Not to mention no source is a killer. I think you HAVE to have source for any gameplay logic stuff and you have to have options if it doesn't work out, without having to redo everything. I've found with every single locked source thing, I've hit a brick wall, so I don't buy them anymore.

    ps This BT has some interesting ideas. I like the sequencer being drawn as a group. Seems to be dead though. http://www.youtube.com/watch?v=ZzX4B_UgwaI

    pps I never really understood why BT's were represented from left to right, instead of top to bottom. I think it takes up more space and is messier. Personal preference I guess, probably from being used to indented programming.

    Sort of like this. Actually, if your graph could auto-draw the arrow to the sides of the nodes, it'd work great. If not automatically, then maybe a horizontal/vertical toggle.

    $Horizontal vs vertical.gif
     
    Last edited: Mar 13, 2014
  25. nuverian

    nuverian

    Joined:
    Oct 3, 2011
    Posts:
    2,087
    Thats all great questions/suggestions actually. So here we go :)

    Thanks :) I will see what I can do about a grid snapping. Although I like freeform stuff, I can understand how it can be handy for others.

    Not really. I can name it 'Start' or 'Root' :p

    It doesn't matter where the BT or FSM really is, as long as it is assigned to the agent. This makes a BT reusable as is, but you can also reuse a BT by using the Nested Behaviour Tree node. If you'd like you can make a BT for an agent only. Works eitherway. In the new submited 1.2.5 version the workflow has much improved and is more clean.

    Colors can't be configured right now no, but I'll maybe see about it in the future sure, possibly after I color code the nodes based on their type.
    Numbering nodes for the BT doesn't indeed hold much meaning although it does in the other systems for layouting by marking the connection virtual in the editor. I will remove the numbering from BT, yes.
    $virtualConnection.png

    I will have to give more though on the icons as not to lose valuable information.

    That's already been done as you can see in the animation in my previous post where I select myVector and myBool Blackboard Variables for the Action and the Condition :)
    Similarly as shown in that animation, there is an "X" button, so you can remove an Action or Condition Task while keeping the nodes design intact. That helps a lot in design-first aproach with placeholders and replace later with finals.
    All those and the reflection Action Condition are in the C# version that's I've submited and not yet shown on the Asset Store. I hope it does like right now.

    In NC you can do something a bit similar. You can have many actions within a single Action node by using the Systems/Actions List Action. This helps to minimize the number of nodes and pair things up. For all purposes, this will act as a mini sequencer
    $actionList.png

    Similarly you can use the ConditionsList special Condition :)
    I know, that's not exactly what you've suggested but I think it's close enough? :)

    Personaly I can't read it the from top to bottom :p. Anyway though, you can change the out and in connection sides with arrow keys and holding down ALT or CTRL. Of course that's not a solution right now to what you are asking, since even then the ordering will not be correct as you can. I don't know about that. Will have to think about it :)
    $UpDown.png

    By the way I wonder why the nodes info shows black to you o_O. Do they always show black?
     
    Last edited: Mar 13, 2014
  26. Vectrex

    Vectrex

    Joined:
    Oct 31, 2009
    Posts:
    267
    "It doesn't matter where the BT or FSM really is, as long as it is assigned to the agent. This makes a BT reusable as is, but you can also reuse a BT by using the Nested Behaviour Tree node. If you'd like you can make a BT for an agent only. Works eitherway. In the new submited 1.2.5 version the workflow has much improved and is more clean."

    Oh cool. So I can prefab BT's and make a mini one that just references the external BT if I want to keep it all inside a prefabs character.


    "I will have to give more though on the icons as not to lose valuable information."

    Yeah, I'd keep everything as it is, even if you add icons.


    "That's already been done as you can see in the animation in my previous post where I select myVector and myBool Blackboard Variables for the Action and the Condition :)
    Similarly as shown in that animation, there is an "X" button, so you can remove an Action or Condition Task while keeping the nodes design intact. That helps a lot in design-first aproach with placeholders and replace later with finals.
    All those and the reflection Action Condition are in the C# version that's I've submited and not yet aproved. I hope it does like right now."

    Great!


    "In NC you can do something a bit similar. You can have many actions within a single Action node by using the Systems/Actions List Action. This helps to minimize the number of nodes and pair things up. For all purposes, this will act as a mini sequencer"

    Actually I was just liking the way it graphically drew a box around the sequences. Like Nuke can. But functionally having multiple actions is nice. Less clutter.


    "Personaly I can't read it the from top to bottom :p"

    Heh, yeah. I'm sure I'll get used to it. Didn't know about the arrow swapping thing. Nice.
    Maybe as a compromise, allow resizing nodes to be narrower, then do some word-wrapping? Maybe a global max node width? With simple grid snapping it would neaten up big graphs I think. Still, not important as it's neat as is.


    "By the way I wonder why the nodes info shows black to you o_O. Do they always show black?"

    Ah, I checked that and it turns out that it's because I'm using the light skin (hate the dark skin :) ). I know plugins can monitor that setting, so it might be an idea so swap a few colours. It's much more readable now with dark skin.

    ps Unity takes a while approving updates it seems.. I would have thought updates would go straight through.
     
    Last edited: Mar 13, 2014
  27. Vectrex

    Vectrex

    Joined:
    Oct 31, 2009
    Posts:
    267
    With the ActionList action, couldn't you just keep the "Add action task" button even after you select an action? Maybe only have it appear when mousing over/selecting the node.
    Maybe clicking Add with an action already assigned, replaces it with an actionlist action and sets it up to keep it compatible.
    Also ActionList could be called ActionListSequencer to make it more clear. Then you could have ActionListSelector :) Not sure how useful that one would be though.
     
    Last edited: Mar 13, 2014
  28. nuverian

    nuverian

    Joined:
    Oct 3, 2011
    Posts:
    2,087
    ActionListSelector. hehe :p
    Do you mean that if you've added a single action and not a list and later decide to add a list instead, to be able to do so without removing the single action first?
     
  29. Vectrex

    Vectrex

    Joined:
    Oct 31, 2009
    Posts:
    267
    No, I mean it could take the first single action and replace it with a list, with that action inserted. I've never used the list thing though :)
    ps If you missed the colour problem solution it's in the post above.
     
  30. nuverian

    nuverian

    Joined:
    Oct 3, 2011
    Posts:
    2,087
    Ah. But then it could mean that everything will be an action list, which I don't know if it's desirable really :)

    Yep I saw the color problem issue. I should make an light color version too sometime soon I guess. By the way I will start working on a grid snapping thing after all :)
     
  31. Vectrex

    Vectrex

    Joined:
    Oct 31, 2009
    Posts:
    267
    "Ah. But then it could mean that everything will be an action list, which I don't know if it's desirable really :)"

    Well the first action would be normal, then the second added one with the button would replace the first one with a list with that first one in it AND the second one. So it'd only use actionlist for 2 and above.

    "By the way I will start working on a grid snapping thing after all :)"
    Cool, I'm mainly talking about very simple quantised movement, like the grid in Nuke. I like things neat :)
     
  32. nuverian

    nuverian

    Joined:
    Oct 3, 2011
    Posts:
    2,087
    Im glad to say that finaly the new C# version is online...
    Here is a list of changes:

    • C# version!
    • Better even simplier workflow
    • Automatic Editor GUIs for Action and Condition Tasks and attributes to do so.
    • Reflection based Actions and Conditions (as shown in first page)
    • Even more Actions and Coditions for an easy start :)
    • Blackboard data selection now done with a popup
    • Blackboard data assignments now keep reference of name changes on the blackboard
    • Even more readable graph
    • Better API
    • A lot of fixes improvements

    The website is also back online in case you didn't notice www.nodecanvas.com, with much better documentation and information as well as some simple demos

    Please notice that you will have to do a clean re import if you already have NodeCanvas. Please do not update if you have done important work due to the C# convertion.
     
    Last edited: Mar 15, 2014
  33. nuverian

    nuverian

    Joined:
    Oct 3, 2011
    Posts:
    2,087
    I'll look into it :)

    Made snapping to vertical axis only and left horizontal freeform as it makes more sense for layouting. You can toggle it off and on.

    $snapping.gif
     
  34. Vectrex

    Vectrex

    Joined:
    Oct 31, 2009
    Posts:
    267
    Yeah good idea, makes sense in this context. I'll be testing the new stuff out over the next week.
    Perhaps if you drag-drop over another node at all it snaps to just past it's edge (depending on the side of course). Unless you're planning to use drag drop for something else (actually, maybe if you drag right in the middle of another node, they swap positions (and connection order? For quick neat logic changes))
     
    Last edited: Mar 15, 2014
  35. nuverian

    nuverian

    Joined:
    Oct 3, 2011
    Posts:
    2,087
    I've finaly completed Playmaker integration. It is made as to be both ways. What this means is that it is very possible to:
    • Have a Behaviour Tree 'be' as a State of the Playmaker FSM, by using a new Playmaker Action, or
    • Have a Behaviour Tree Task to be a Playmaker FSM from which FSM we can get a Success or Failure in the end.

    In both cases you have the option to sync Playmaker variables with NodeCanvas variables. Specificaly:

    When we use a Behaviour Tree as a State of a Playmaker FSM the Playmaker variables are send to the Behaviour Tree, which can make use or modify as it desires and then all changes are send back to the Playmaker FSM to continue using the changed variables by the BT.
    In this case, the Behaviour Tree Agent can be chosen from the new Playmaker Action and of course can be the owner of the FSM.

    $StartBT.png

    In this example we have a single state which is a Behaviour Tree. Playmakers variables are send to it. Then the BT simply adds 1 to that and the modification is reflected back to Playmaker. Exiting the State will stop the Behaviour Tree.

    $FSM_BT.gif



    When we use a Playmaker FSM as a Behaviour Tree Action Task, the reverse happens. The Behaviour Tree sends it's blackboard variables to Playmaker which can use and modify as it desires and then all changes are send back to the Behaviour Tree to continue using the modified variables.
    In this case to break out of the Playmaker FSM with a Success or Failure, we simply specify two Playmaker states. As soon as Playmaker enters either of those 2 states, the Behaviour Tree Task will return Success or Failure respectively.

    $StartPM.png

    In this example, we have a Behaviour Tree which has a Playmaker Action Task. The float value is send to Playmaker, which adds +1 to it per second and for one second. Then the transition to the FinishSuccess state which is selected as to be the success state in the action task. The BT then continues and adds +10 to that float, and so on. (the other state is not used in this example, but its all a matter of entering that state and the task will return Failure)

    $BT_PM.gif



    I hope the gifs were clear as of what's happening. I will add more thorough documentation about the Playmaker integration on the website soon.
    Comming on the next update.


    I had some ideas that will possible require drag&drop as to be very convinient, although I like the swapping idea for rapid prototyping :)
     
  36. temo_koki

    temo_koki

    Joined:
    Jul 14, 2009
    Posts:
    308
    Quite complex framework, with many features, good UI design, simple workflow and it's extendable. Good job ;)
     
  37. SteveB

    SteveB

    Joined:
    Jan 17, 2009
    Posts:
    1,451
    Wow thats VERY cool Nuvi!! :D

    (I loves me my Playmaker thats for certain)

    Cheers!
     
  38. nuverian

    nuverian

    Joined:
    Oct 3, 2011
    Posts:
    2,087
    Hey thanks a a lot! Im glad you like it :)

    Hey. Thanks Steve!
    Of course you should like Playmaker. It's a great software (obviously).
    I remember you were interested in Dialogue Trees. There is also a 'Start Dialogue' Playmaker Action and you get an event when it is finished. I hope that helps :)
     
  39. Vaidoras

    Vaidoras

    Joined:
    Sep 5, 2013
    Posts:
    21
    Just bought.
    I was comparing this and about 4 other packages (mainly AI for Mecanim) together, but this won me over fast

    Nukes Node editor is best I've seen :) You should add "Inspired by Nuke" somewhere for everyone to see. :cool:
     
  40. sonicviz

    sonicviz

    Joined:
    May 19, 2009
    Posts:
    1,051
    Hi,
    I just bought this and working through the docs/examples.

    Very nice so far.

    Could I request that you please namespace the package so it does not conflict with other packages on import?

    ty!
     
  41. Vaidoras

    Vaidoras

    Joined:
    Sep 5, 2013
    Posts:
    21
    Hi, spent a good part of the day learning and experimenting NodeCanvas, I am very happy with my purchase so far.

    Have one question that I just could not answer myself or through your docs.
    How can I get and set variables I create through blackboard from outside the framework?

    Case example.
    I have a wormhole with BehaviorTree that decides what kinds of units to spawn and what should be priority target for spawned units. I would like the spawned units to have their own BehaviorTree and have access to wormholes blackboard variables. (not shared blackboard)
    For now I solved this by creating action that passes all blackboard data to an outside script... I bet there is better way to do this?
     
    Last edited: Mar 19, 2014
  42. nuverian

    nuverian

    Joined:
    Oct 3, 2011
    Posts:
    2,087
    Sorry for late reply :)

    Thanks!
    Yes, namespaces will be added very soon. Should already been there :)


    Thanks! I'm very glad :)
    Nuke is great! heh



    Hey,

    You can get and set blackboard variables from any script as long as you have the blackboard reference by GetDataValue and SetDataValue on that reference. Here is an example with a property.

    Code (csharp):
    1. using UnityEngine;
    2.  
    3. public class Unit : MonoBehaviour {
    4.  
    5.     public Blackboard blackboard;
    6.  
    7.     GameObject target{
    8.         get {return blackboard.GetDataValue<GameObject>("target");}
    9.         set {blackboard.SetDataValue("target", value);}
    10.     }
    11. }
    You can also find a blackboard by it's name with the static Blackboard.FindBlackboardWithName(string).

    Is that what you mean, or I misunderstood the question?

    Thanks :)
     
    Last edited: Mar 19, 2014
  43. nuverian

    nuverian

    Joined:
    Oct 3, 2011
    Posts:
    2,087
    The new version has been submitted. It is mostly and editor update. Here is the list of changes:

    • Two ways Playmaker Integration.
    • Added 'Update Interval' option to Behaviour Trees.
    • Made the top of the window to look like an actual toolbar.
    • Option for node grid snapping.
    • Option for auto connect new node if another node is already selected.
    • Moved the node information in the editor inspector panel if option to show Node Info is on, instead of the bottom of the editor.
    • Editor Blackboard window is now a non movable panel on the top right.
    • Redesigned Blackboard variables UI to be cleaner.
    • The current value of a Blackboard variable in a Task will show bellow the field.
    • Removed the label showing the current state of the node and instead the state is now shown with node border colors.
    • Changed Running color from purple to yellow and Success color from yellow to green.
    • Color coded the titles of the most common Behaviour Tree nodes as to be easier to read the graph.
    • Renamed 'Prime Node' to simply 'Start'.
    • Removed the node ID from the name of the Behaviour Tree nodes.
    • Fixed an issue where the nodes were showing in front of the editor inspector panel.
    • The Execute Funtion and Check Function Tasks now also show inherited members instead of only declared.
    • Possibly more things that I dont remember :)

    I hope you like it.

    $FronPage.png
    .
     
    Last edited: Mar 20, 2014
  44. sonicviz

    sonicviz

    Joined:
    May 19, 2009
    Posts:
    1,051
    Is namespacing going to be *soon* ish? I can't integrate it into a current prototype because of these conflicts.
     
  45. nuverian

    nuverian

    Joined:
    Oct 3, 2011
    Posts:
    2,087
    Yes, it's going to be in the next immediate update. Actually this update was submited yesterday before I saw your request. Sorry about this.
    I will submit the namespace version as soon as this goes live.
     
  46. sonicviz

    sonicviz

    Joined:
    May 19, 2009
    Posts:
    1,051
    A1. ty!
     
  47. sonicviz

    sonicviz

    Joined:
    May 19, 2009
    Posts:
    1,051
    and what would be a really awesome addition? Fuzzy Logic!

    Some other thoughts:

    More default tasks/behaviours, such as:
    Chance - probability based action selection so the BT has an element of stochastic execution
    Flee
    Wander
    Seek etc


    Q: How do you wait for a mecanim anim to complete (as legacy has wait till complete, but mecanim does not have one)
    Q: Is it possible to implement learning behaviours?
     
    Last edited: Mar 20, 2014
  48. Vaidoras

    Vaidoras

    Joined:
    Sep 5, 2013
    Posts:
    21
    Hi, still enjoying your framework, thus I wrote you a sparkly review on asset store :D :D

    I have a request for you though, make your blackboard more optional. I integrated it to my project only to realize that its more of a burden than advantage. I got rid of them and implemented custom blackboards by simply attaching scripts with public fields/properties - this made my scene much more organized, also....


    -I can have different blackboards for different types reused (buildings, unit, spawner)
    - don't have to mess with BBtype variables
    - getting references to other objects custom blackboards is easy-er
    - finally I think working this way makes the whole framework much more 'part of Unity' feel than external editor that sits on top of it - makes sense...?

    Finally the main thing that makes it hard to not use your blackboard is the lack of default actions that compare things outside of it to one another.
    I am currently trying to hack up a condition (its like condition Frankenstein, made from your default ones) that goes something like this:
    1. Select component
    2. Select public float field of that component
    3. Select another component and a float field OR enter number
    4. Compare them

    honestly I am beginner programmer and its not looking well, but its a learning experience.


    Another unrelated request I have is for you to give us a high level rundown of how the framework works. It would make me get even more use of this framework.
     
    Last edited: Mar 20, 2014
  49. nuverian

    nuverian

    Joined:
    Oct 3, 2011
    Posts:
    2,087
    If you mean a fuzzy logic system that would be interesting yes :)

    The Selector can be set to be 'Random'. Do you mean that but with a weight score per child node for the 'Chance'?
    Yep, I will see to it adding Wander and Flee as well as more Tasks. The more the merrier :) Seek is the MoveTo action by the way, or you mean something different?

    1: As mecanim is quite more complicated than legacy and animations can be started or changed with many different ways, I haven't added a similar setting to mecanim Play Animation action. I could add it to the Mecanim Play Animation action though if that sounds useful :)

    2: What do you have in mind for learning behaviours? Could you describe a case example please?



    Thanks a lot for the review :)
    Let's elaborate on the issues.

    The blackboard is quite optional to use but I think that in conjuction with the BBtypes it makes for reusable behaviours since you would only need to change the blackboard variable and the whole behaviour will work with that new variable instead of 'hardcoding' it in places within the behaviour. Is what you need a way to choose any blackboard variable from within any behaviour tree?

    For the condition you are after, from what I understand, you are missing an Action to Get a script field/property value and store it as a blackboard variable, similar to how the Set Property and Check Property Task work. You could then check those variables with the Check Float condition for example, if you want to keep it visual in the editor. Would such a Get Action solve this issue?

    If you don't mind, let me know your setup and what you are trying to achieve or how you'd optimaly like it to be achieved with NodeCanvas :)
    I will add many more default Actions and Condition over time as well on the next update.

    Yeah, I will add a page on the website as of how the framework overally works as soon as possible.
     
  50. sonicviz

    sonicviz

    Joined:
    May 19, 2009
    Posts:
    1,051
    yes

    Seek is more like searching for target then move to. Use case: NPC searching for food by smell or vision. I guess you could emulate it like your demo 1 but to have an pre-encapsulated action would be nice, as it is fairly generic use case.


    It would be I think. Does anyone else or am I off base?

    Something as simple as a mutating selector that reorders nodes in certain patterns based on success or failure?

    Some good recent research as well to read on this area of BT:
    Enhancing Behaviour Tree Design and Implementation withQ-Learning http://openaccess.city.ac.uk/3000/1/CIG13-paper_36-QL-BT.pdf

    I have a bunch of other links if you are interested.