Search Unity

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

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

  1. username132323232

    username132323232

    Joined:
    Dec 9, 2014
    Posts:
    477
    Thanks! BTW, love the new Zoom funciton! I also have a couple of questions about making the Graph more manageable.

    1. Is it possible to add an output at the center bottom of the nodes? I understand that now it's used as an input in some cases, but perhaps it will be possible to have both.

    2. It would be great if we could override the automatic connection placement. Sometimes adding a new node and a connector messes up the entire graph because of the less than optimal connection placement algorithm.
     
  2. Vectrex

    Vectrex

    Joined:
    Oct 31, 2009
    Posts:
    267
    Any chance of supporting the new 'UnityEvent' type? It's pretty neat and can do most of what C# events do with some editor integration.
    Also a reminder for static versions of C# event (and UnityEvent if that is added). Unless you can think of another way for a BT to respond to world events?
     
  3. Dbone

    Dbone

    Joined:
    Mar 10, 2014
    Posts:
    56
    I just got this error and it appears to have destroyed all the nodes in all my graphs...

    Any fix? Lost so much work.

    EDIT: Error fixed. See below.
     
    Last edited: Apr 23, 2015
  4. nuverian

    nuverian

    Joined:
    Oct 3, 2011
    Posts:
    2,087
    Hello,
    Sorry for the late reply. Glad you like the zoom.

    I think manualy setting the output/input sides would be quite tiresome, so I will take a look at how to better layout the FSM (I suppose you talk about FSM rather than BTs here). Possibly an input at the bottom can indeed help if I manage to add it along with the outputs. I have some ideas on that one.

    Thanks!

    Hey Cameron,

    Yes, I can add a CheckUnityEvent condition task, at least for events with 1 or no arguments. In any case, UnityEvents with arguments (even one), don't show up in the inspector, so I dont know whats the advantage of using those instead of C# events.

    Thanks for the reminder on the static events. I will take a look at this, but remember that you can also always use the built-in event system to send an event to a GraphOwner, also from code, which takes 1 parameter as well. There are some methods in the GraphOwner base class like for example:
    SendEvent(string name);
    SendEvent<T>(string name, T value);

    And then you can use CheckEvent or CheckEvent<T> to check that event in the BT or FSM.

    But in any case, I will take a look at UnityEvents and static C# events :)

    Cheers!

    Hello Dbone,

    This is a very weird error. I work with NC every day and this never happened before (or previously reported by someone). Have you possibly somehow modified the serialized graph string from the inspector (in debug mode) or in code?
    Even if thats the case, graphs should not be lost. What NC version are you using?

    Also please close and re-open unity as a double check.
    Finaly, please send me the project if possible (info_at_nodecanvas.com) so that I can see if I can recover it, considering that something not super critical (or cryptical) has happened.

    I am very sorry for this inconvenience.
    Please send me the project.

    Thanks
     
    Vectrex likes this.
  5. Dbone

    Dbone

    Joined:
    Mar 10, 2014
    Posts:
    56
    Managed to correct the error.

    What happened is that I named an NC group: Hand open\close
    NC took the \c as a command that it could not parse, threw an error, and then made all the nodes and groups invisible, but not destroyed. To correct it I exported the graph as a JSON file and edited it in Notepad to remove the \ in the group name. Saved and re-imported the JSON file. Everything is there. I am using NC 2.1

    I nearly died and smashed things, but it's all good.

    Dis-allowing certain characters in name fields seems like a good bug fix request.

    Thank you for your quick reply. I love NodeCanvas, it's actually my favourite asset of the many that I own.
     
    Last edited: Apr 23, 2015
    nuverian and hopeful like this.
  6. nuverian

    nuverian

    Joined:
    Oct 3, 2011
    Posts:
    2,087
    Hey,

    I am very glad it was not a critical or cryptical error and thank you very much for providing this extra information for everyone! That was a nice use of the JSON import/export.

    Although there are a whole lot of places string names can be entered, I will see if I can generaly disallow certain characters at least in the most common places

    Thanks again, as well as for your kind words. I appreciatate it :)
    I'm glad it's solved.
     
  7. Marble

    Marble

    Joined:
    Aug 29, 2005
    Posts:
    1,268
    I've noticed that the text area generated by the [TextAreaField(float height)] attribute doesn't wrap. I bet this is an oversight, no?

    Is there a supported way to set a maximum width for nodes on the canvas (so that info text wraps)? I could override my task's info property and split the string by number of characters, but that feels hacky.
     
  8. nuverian

    nuverian

    Joined:
    Oct 3, 2011
    Posts:
    2,087
    Hey,

    Yes you are correct about the wrapping of the [TextAreaField] attribute. I will have to fix that.
    Regarding the info desplayed within the node, I could add a maximum length for the info before it begins wrapping, although if you realy have looong texts, I think it would anyway look messy.
    Maybe the best option would be to limit the maximum length of the info and display a "..." after that length. What do you think?

    Cheers!
     
  9. Marble

    Marble

    Joined:
    Aug 29, 2005
    Posts:
    1,268
    My selfish vote goes to a maximum length value users can override + wrapping. It looks like it's possible to override OnNodeGUI in a custom state, however, which would give me total control over how the nodes are presented. Is that recommended?

    I love how flexible NC is.
     
  10. nuverian

    nuverian

    Joined:
    Oct 3, 2011
    Posts:
    2,087
    Hey,
    Thanks.

    While you can override OnNodeGUI, the current method does not somehow allow to set the maximum length. It could be if it returned some float value or had a ref parameter, but changing this now would mean that all nodes will have to change and could be frustrating if someone has created many nodes.
    The other way would be to create a virtual property for that. I will think this over.
    Thanks!
     
    Marble likes this.
  11. Dbone

    Dbone

    Joined:
    Mar 10, 2014
    Posts:
    56
    Got a question:
    Is there any way to reset a Filter node so that it will run a certain amount of times every time a sequencer is activated? Right now it seems like it will only reset when play mode is exited. I'd like to be able to run an action once that is part of a nested sequence, have it deactivate so it won't fail the sequence, then reset when the sequence deactivates so it will run a single time again on the next sequencer activation.

    Thoughts?
     
  12. nuverian

    nuverian

    Joined:
    Oct 3, 2011
    Posts:
    2,087
    Hey :)

    Actually, the Filter node will also reset if the BT is stoped and restarted, but I suppose this doesn't help you in this case (?)
    If the Filter was to reset whenever the parent Sequencer is "activated" wouldn't this defeat the purpose of the Filter, since it would actually run every time? Unless I misunderstood something :)
     
  13. Dbone

    Dbone

    Joined:
    Mar 10, 2014
    Posts:
    56
    I think what I'm trying to accomplish is a kind of OnEnable action for composite nodes. So a Sequencer or Selector lights up and an action happens once and then not again until the node was disabled and re-enabled. That would mean that all the other actions attached to the same composite node could continue working without the filtered action either taking precedence (on a Selector) or failing the whole branch (on a Sequencer). Then the process would repeat. On a Selector, that filter and action could be first in line to run but then be disabled until the next time, when it is first again. Hopefully that makes more sense.
    An example of how it could be used on a selector is to reset a variable to a certain value before the other actions on that selector start flicking on and off and modifying it.

    Now that I write it out I can see some flaws in how it would work if it was "built in" to the filter node.

    Maybe it's possible to have an action that would reset the filter? Then it could be placed anywhere in the tree.
     
    Last edited: May 6, 2015
  14. sballew7

    sballew7

    Joined:
    Sep 3, 2013
    Posts:
    76
    It looks like the example images on the documentation site are broken: http://nodecanvas.com/examples/

    Any chance of getting those fixed? I'd like to see some recommended ways to use NodeCanvas that I can learn from.
     
  15. nuverian

    nuverian

    Joined:
    Oct 3, 2011
    Posts:
    2,087
    Hey,
    Yeah. I don't think it can be implemented as you describe it, into the filter node somehow. I will certainly take a more deep thought on that though. Having an action that resets the filter is probably a sensible workaround. Let me know if you need it asap.

    Thanks!

    Hello,

    That page is actualy leftover and not ment to be online:) I don't know where you found the link for there.
    Please download the example scenes from here, which practicaly contain the same graphs, from which you can learn more about NC in practice :)

    Let me know if you have any questions of course. I will be glad to answer.
    Cheers!
     
  16. sballew7

    sballew7

    Joined:
    Sep 3, 2013
    Posts:
    76
    Thanks! I found the page through Google.
     
  17. Dbone

    Dbone

    Joined:
    Mar 10, 2014
    Posts:
    56
    An action that resets the filter would be awesome. I'm not in a big rush, I've run into this problem 3 or 4 times in my latest project and have so far found other ways to accomplish the tasks.

    Thanks!
     
  18. nuverian

    nuverian

    Joined:
    Oct 3, 2011
    Posts:
    2,087
    Hey everyone,

    The new version 2.3 is now submited on the asset store. Here are the changes:
    • Generic Tasks now work in iOS.
    • Property Binding now works in iOS.
    • FSM callbacks now work in iOS.
    • Added a new set of Script Control tasks, that work in all platforms. You should use these if you are targeting platforms other than standalone or web player. These are respectively subcategorized under the "Script Control" main category.
    • Fixed crash to desktop when entering play mode with the NC editor open in some very rare occasions.
    • Fixed issue with unity object references getting lost in blackboard and in some occasions.
    • Removed Behaviour Tree mutator nodes (Root Switcher, NodeToggler) for clarity.
    • Missing methods in ExecuteFunction task will now display the missing method information, instead of "No Method Selected".
    • Added some new Tasks:
      • Set List Element
      • Set Random Integer
      • Set Random Boolean
      • Check C# Event<T> (for checking c# events with an argument)
      • Check Static C# Event
      • Check Static C# Event<T>
      • Shout Event (for broadcasting a NodeCanvas event over time to other nearby agents)

    Thanks a lot to all people who reported issues and helped through!

    Cheers!

    @Dbone I am still trying to understand the problem you have with the Filter and basicaly what you are after achieving :). I mean an action part of a sequencer would in any case happen only once. If you want to not care about what an action returns (Success or Failure) in regards to it's parent node, you can use the "Optional" decorator node.
    Is that what you were missing probably? Let me know.
     
    Vectrex likes this.
  19. Tiny-Tree

    Tiny-Tree

    Joined:
    Dec 26, 2012
    Posts:
    1,315
    do you have a list of not working things on IOS?
     
  20. nuverian

    nuverian

    Joined:
    Oct 3, 2011
    Posts:
    2,087
    Hey,

    With the new version 2.3 everything will work in iOS that I know of :)
    Cheers!
     
  21. Dbone

    Dbone

    Joined:
    Mar 10, 2014
    Posts:
    56
    I've been racking my brain trying to remember the time when I thought resetting the filter would be a handy feature. Unfortunately I can't think of it now. I didn't know what could be achieved with the Optional node though. That will come in very handy.

    If I think of it or run into that situation again I'll let you know.

    Thanks!
     
  22. nuverian

    nuverian

    Joined:
    Oct 3, 2011
    Posts:
    2,087
    Hey,

    No worries :)
    If it occurs to you again, let me know.

    Cheers!
     
  23. nuverian

    nuverian

    Joined:
    Oct 3, 2011
    Posts:
    2,087
    The new version 2.3 is now live on the asset store. To sum it up along with some changes made after the original post here are the new stuff.

    • Fixed iOS.
    • Fixed WP8/WSA.
    • Fixed some minor bugs.
    • Removed some BT nodes for clarity.
    • Added new Tasks for C# Events.
    • Added new Dialogue Actions Tasks (Start Dialogue, Speak).
    • Task icons are now inherited properly in nodes.

    On top of this release, and part of the new 3rd integration beginning, two new assets have been supported.

    Cinema Director

    Simple Waypoint System

    Integrations Tasks now also come along with prety icons of the assets as well.

    integrations icons.png


    Feel free to let me know what 3rd party asset integration you would like to see next if you have a preference.

    Cheers!
     
    username132323232 likes this.
  24. JTJonesHH

    JTJonesHH

    Joined:
    Nov 5, 2013
    Posts:
    2
    First of all, Node Canvas is a great product! I downloaded it last week and it is working very well so far.

    My question was regarding WebGL support. We are currently targeting WebGL for several of our upcoming projects, and I can't seem to get NodeCanvas to work. With web debugging enabled, I see the following in the browser console output:

    "run() called, but dependencies remain, so not running"

    This is on a new project with a simple "Hello World" state machine. Unfortunately, I have been unable to get a more detailed stack trace.

    Any help or advice is appreciated!
     
  25. username132323232

    username132323232

    Joined:
    Dec 9, 2014
    Posts:
    477
    I would like to set a timeout for a state in the FSM. The state waits for a couple of events ("event1" and "event2"). However, if no event is received within 5 seconds, it should transition as if "event1" was received. Is this possible with NodeCanvas? Thanks!
     
  26. mittense

    mittense

    Joined:
    Jul 25, 2013
    Posts:
    168
    I'm getting a whole bunch of errors when I imported NodeCanvas (I also have FlowCanvas in the project)

    Assets/NodeCanvas/Framework/Design/PartialEditor/EDITOR_Graph.cs(16,30): error CS0102: The type `NodeCanvas.Framework.Graph' already contains a definition for `blackboardRect'
    Assets/NodeCanvas/Framework/Design/PartialEditor/EDITOR_Graph.cs(17,30): error CS0102: The type `NodeCanvas.Framework.Graph' already contains a definition for `inspectorRect'
    Assets/NodeCanvas/Framework/Design/PartialEditor/EDITOR_Node.cs(42,46): error CS0102: The type `NodeCanvas.Framework.Node' already contains a definition for `runningColor'

    etc.
     
  27. Dbone

    Dbone

    Joined:
    Mar 10, 2014
    Posts:
    56
    You need to delete the "Framework" folder in either FC or NC. They both use the same framework so you get conflicts if there is two Framework folders in the project.
     
    nuverian and mittense like this.
  28. mittense

    mittense

    Joined:
    Jul 25, 2013
    Posts:
    168
    Yay, thank you.

    Now I'm hitting a snag here:

    EditorUtils.ShowGameObjectEventSelectionMenu(t, SetEvent);

    Assets/FlowCanvas/Module/Nodes/Events/CodeEvent.cs(84,45): error CS1501: No overload for method `ShowGameObjectEventSelectionMenu' takes `2' arguments
     
  29. nuverian

    nuverian

    Joined:
    Oct 3, 2011
    Posts:
    2,087
    Hello and thanks!
    I haven't yet gone through what might be required for supporting WebGL and if possible. I will take a look into the weekend and post back for you as soon as possible.

    Cheers!


    Hey,

    If I understood correctly, this could be achieved by adding a "Send Event" action in the state and put a 5 second delay to it. As a result if no transition takes place within 5 seconds, the Send Event will force send the desired event.
    Is that what you are after, or I misunderstood the goal?

    Thanks!

    Hello there!

    I have PMed you a fixed file for that :)

    Thanks!
     
  30. username132323232

    username132323232

    Joined:
    Dec 9, 2014
    Posts:
    477
    Yes, that should work. Once again, great asset and great support. Thanks!
     
  31. nuverian

    nuverian

    Joined:
    Oct 3, 2011
    Posts:
    2,087
    Dbone likes this.
  32. Dbone

    Dbone

    Joined:
    Mar 10, 2014
    Posts:
    56
    Can I put in a request for Motion Controller (by Ootii) integration? I know he's thinking about it himself since he's a NodeCanvas user, but with a little help it might happen fast enough for me to use it in my current project. ;)
     
  33. nuverian

    nuverian

    Joined:
    Oct 3, 2011
    Posts:
    2,087
    Hey,

    Sure! Motion Controller will be the next one then :)

    Cheers!
     
  34. Dbone

    Dbone

    Joined:
    Mar 10, 2014
    Posts:
    56
    Oh man! I'm looking forward to this!
     
  35. nuverian

    nuverian

    Joined:
    Oct 3, 2011
    Posts:
    2,087
    Hello everyone,

    Two new 3rd party asset integrations are now online :)

    Motion Controller
    Inventory Pro

    You can download either and more here.

    If you'd like to see more tasks in the existing integrations or have a preference for the next ones, just let me know.

    Cheers and have fun!
     
    Dbone, Dan_lala and Tiny-Tree like this.
  36. Dan_lala

    Dan_lala

    Joined:
    May 14, 2015
    Posts:
    42
    Good job with inventory pro during the sale ;)

    Just one question... do you plan on supporting more 3rd party assets? I would love to see the "Dialogue System for Unity" to be supported. I know there is an dialogue system build-in NodeCanvas, but it seems a bit basic... or I am just missing something?
     
  37. nuverian

    nuverian

    Joined:
    Oct 3, 2011
    Posts:
    2,087
    Hey,

    Thanks. I suppose more people will find the integration usefull at this time :)

    Yes. A lot more 3rd party assets are on the way very soon. I will constantely release more over time.

    Regarding the Dialogue Tree included, while it's not the prime focus of NodeCanvas, I wouldn't call it basic either. There are whole lot of things you can do with it :).
    By all means, please let me know what features or improvements you are missing from the Dialogue Trees (localization is in the roadmap), and I will look into adding those.

    Thanks!
     
    Last edited: May 31, 2015
  38. Dan_lala

    Dan_lala

    Joined:
    May 14, 2015
    Posts:
    42
    :)
    I just wanted to poke into the hornets nest and see what is coming out ;) All your products look really professional and well marketed (great homepage by the way), but DialogueCanvas was imho not so well featured, as it is not the main focus of this asset like you said.

    I'm already sold on FlowCanvas (will buy it soon) and once I am done with some core concepts, I might also get NodeCanvas. Currently I am not using any FSM/BT/Dialogue system but I would mainly get it to ensure a good overview over all my player and world variables leading to interaction/text/price/etc changes. I am just afraid of some menu/dialogue dead ends. Basically I am interested in a good mapping/keeping-the-overview tool for the editor :)

    Anyway, keep up the good work.. I am soon one of your customers :)
     
  39. redmotion_games

    redmotion_games

    Joined:
    May 6, 2013
    Posts:
    84
    When I import Dialogue canvas via the Asset Store, I get 18 errors thrown from the Node Canvas directory. Should I delete the Dialogue canvas directory in the Node canvas folder?
     
  40. nuverian

    nuverian

    Joined:
    Oct 3, 2011
    Posts:
    2,087
    Hey,
    Thanks a lot for your kind words :)
    If you have any questions, don't hesitate to ask.

    Cheers!

    Hey,
    For some time now, the Dialogue Tree system is included by default in the NodeCanvas complete package, so importing the Dialogue Canvas addon from the asset store is obsolete.
    In other words, you already have Dialogue Canvas if you have imported NodeCanvas :)
    I have contacted Unity for removal of the now obsolete asset.

    Thanks!
     
  41. nuverian

    nuverian

    Joined:
    Oct 3, 2011
    Posts:
    2,087
    Hello everyone,

    There are now two more 3rd party integration packages online :)

    Chronos
    LipSync

    You can download them here as always.

    Cheers and have fun!
     
  42. Async0x42

    Async0x42

    Joined:
    Mar 3, 2015
    Posts:
    104
    Thanks for the integrations! Master Audio by the CoreGameKit author is on my integration wishlist :D
     
  43. nuverian

    nuverian

    Joined:
    Oct 3, 2011
    Posts:
    2,087
    Hey,
    You are welcome. I will add Master Audio next :)

    Cheers
     
    hopeful likes this.
  44. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    Awesome! We eagerly await. Love this plugin (NodeCanvas).
     
  45. nuverian

    nuverian

    Joined:
    Oct 3, 2011
    Posts:
    2,087
    Hey, Thanks! I can say the say for Master Audio :)

    The Master Audio integration tasks are now online.
    Donwload them here!

    Cheers and have fun!
     
    hopeful likes this.
  46. slimshader

    slimshader

    Joined:
    Jun 11, 2013
    Posts:
    187
    How to use Move Towards action? Rotate Towards rotates object fully without the need to enable repeat on the action but Move Towards moves agent only slightly in the direction of destination and finishes immediately.
     
  47. nuverian

    nuverian

    Joined:
    Oct 3, 2011
    Posts:
    2,087
    Hello,

    To get the same behaviour in MoveTowards, please open up MoveTowards.cs and replace the contents with this (or create a new action if you like :))
    Code (CSharp):
    1. using NodeCanvas.Framework;
    2. using ParadoxNotion.Design;
    3. using UnityEngine;
    4.  
    5. namespace NodeCanvas.Tasks.Actions{
    6.  
    7.     [Category("Movement")]
    8.     public class MoveTowards : ActionTask<Transform> {
    9.  
    10.         [RequiredField]
    11.         public BBParameter<GameObject> target;
    12.         public BBParameter<float> speed = 2;
    13.         [SliderField(0.1f, 10)]
    14.         public BBParameter<float> stopDistance = 0.1f;
    15.         public bool repeat;
    16.  
    17.         protected override void OnExecute(){Move();}
    18.         protected override void OnUpdate(){Move();}
    19.  
    20.         void Move(){
    21.             if ( (agent.position - target.value.transform.position).magnitude > stopDistance.value ){
    22.                 agent.position = Vector3.MoveTowards(agent.position, target.value.transform.position, speed.value * Time.deltaTime);
    23.             } else if (!repeat){
    24.                 EndAction();
    25.             }
    26.         }
    27.     }
    28. }
    You will see a small change there. That was a mistake.
    Let me know if that works for you.

    Thanks!
     
  48. slimshader

    slimshader

    Joined:
    Jun 11, 2013
    Posts:
    187
    I actually noticed that little change between action code ("else" part) but wanted to make sure. Thanks!
     
  49. nuverian

    nuverian

    Joined:
    Oct 3, 2011
    Posts:
    2,087
    Yep, you were correct in the first place :)
    You are welcome!
     
  50. nuverian

    nuverian

    Joined:
    Oct 3, 2011
    Posts:
    2,087
    Hello everyone.

    New version 2.3.5 has been submited to the asset store. Here are the changes:

    New/Improved
    • Action List and Condition List presets are now added. You can save an action/condition list preset file and load it back when you want. Usefull if you create long reusable task lists. This is done through the list's context menu.
    • [PopupField] attribute to be used when you want to restrict the values to specific ones for a field.
    • [ShowIf] attribute to show/hide a field based on another boolean field value.
    • [SliderField] attribute can now be used with integers.
    • [Name] attribute can now be used on fields.
    • [ForceObjectField] attribute can be used on interface fields to allow drag droping objects that implement the interface in the inspector.
    • Added Dialogue Tree "Multiple Condition" node.
    • Default method parameters are now taken into acount when selecting methods in Script Control tasks.
    • SubTree and SubFSM nodes are improved to show the blackboard variable name used in case the Sub Tree/FSM is parametrized with a blackboard variable instead of a direct reference.
    • SubTree and SubFSM node inspectors now also show the parameter names that are used within the Sub Tree/FSM.
    • Double clicking a node now opens up it's assigned task script (instead of node script) in case it has a task assigned.
    • Inherited members (methods/properties) from Unity, are now listed in a subcategory "More", for when selecting methods/properties in Script Control Tasks.
    Fixes
    • Fixed Destroying FSMOwner from it's own FSM.
    • Fixed Probability Selector that was messign up the weights when a child failed.
    • Fixed Preferred Types editor from reseting in some cases.
    • Fixed Preferred Types added, from being filtered out in some cases.
    • Fixed Check Static C# Event and Execute Static Function from showing only Component inherited types.
    • Fixed "Collapsed" button (when a BT branch is collapsed) that was misplaced when zoomed out.
    • and some other very minor issues.

    Cheers and have fun!