Search Unity

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
    Thank you for your kind words Ghosthowl! :)
    I am glad you've managed to get it going and sharing information about it, and I agree on the video tutorials. I'm on it :)
    Thanks for the typo. Indeed OnInit is string and not void. Fixed that one on the website now.
    For any more questions please let me know :)
     
  2. ClaudioFreda

    ClaudioFreda

    Joined:
    Nov 16, 2013
    Posts:
    7
    Nuverian, your answers so far have been great. There's one thing that's still keeping me on the edge from buying this: Does the blackboard allow custom types, or at least types/structs made of standard types? Will the blackboard support Vector2?
     
  3. nuverian

    nuverian

    Joined:
    Oct 3, 2011
    Posts:
    2,087
    Hello and thanks :),

    Currently the blackboard supports these types:
    bool
    float
    int
    string
    Vector3
    Component
    GameObject
    List<GameObject>

    Adding a new supported type is quite easy, so I'm thinking of adding these in the next version:
    Color
    Rect
    Vector2
    Quaternion
    UnityEngine.Object
    System.Object (non editable of course)

    If I'm missing a type please let me know :)
    If then you really want to add your own custom type, I can guide you on how to do it.

    Thanks :)
     
  4. ClaudioFreda

    ClaudioFreda

    Joined:
    Nov 16, 2013
    Posts:
    7
    Ok, I've finally bought NodeCanvas. It'd be great if you tell me how to implement custom types, I often end up using things like that. I'm taking a look at the code now, it's great that you give full source code access.

    Currently I'm not liking the fact that it clutters your hierarchy so much with graphs as GameObjects. What is the use for that? Maybe setting HideFlags.HideInHierarchy could make things better.

    How would I go for handling messages received by the GameObject.SendMessage method? What about RPCs and network events?
     
    Last edited: Apr 20, 2014
  5. nuverian

    nuverian

    Joined:
    Oct 3, 2011
    Posts:
    2,087
    Hello again and thanks :)
    Sorry for being late, I was with family for Eastern.

    The BehaviourTreeOwner (or FSMOwner) component is a front end that simply wraps the execution of a Behaviour Tree graph (the one added beneath it). So the real graph is contained within that one added beneath and you may build a behaviour that only later you realize you want to use for another object as well. Having that graph wraped up in there alone decouples it from the BehaviourTreeOwner (that you add on the object to behave), thus you can take it out of there, or make it a prefab and assign it to another (or more than one) BehaviourTreeOwner on another gameobject as well.
    So the real graph is contained within that BTContainer (on the gameobject beneath) while the BehaviourTreeOwner is simply a front end that wraps it's execution and that in more advanced uses it can totaly be omited and instead use and instance of the graph directly.
    The same is true for FSM as well (FSMOwner FSMContainer)

    I hope that explanation wasn't too confusing :)

    Because NC Actions Conditions are build on MonoBehaviour and thus they live on gameobjects (hidden to not clutter hierarchy), you can use RPC as you normaly would within a custom action task and also have the NetworkView component added, for example with the RequiredComponent Unity attribute used on the your Action class.

    It's important to know that Actions Conditions are derived from MonoBehaviour and thus you can do anything that you normaly could do with a MonoBehaviour on top of their functionality.

    If you want to make use of -for example- OnTriggerEnter in one of your action or condition, you have to specify that by using the EventListener(params string[]) on that action or condition. For example:
    Code (csharp):
    1.  
    2. using NodeCanvas;
    3.  
    4. [EventListener("OnTriggerEnter"]
    5. public class CheckTrigger : ConditionTask{
    6.  
    7.     void OnTriggerEnter(){
    8.         //...
    9.     }
    10. }
    11.  
    Please take a look at the CheckTrigger Condition Task included.

    If you asking how to handle a SendMessage that was sent to the agent's gameobject but the method is within an action or condition of the agent's Behaviour Tree or State Machine, the easier way right now is to use BroadcastMessage instead of SendMessage.

    I tried to PM you regarding the guide to adding custom blackboard types, but it seems you have disabled to receive PMs? :)
    If you want to keep it that way, please PM me your email so that I can guide you through that request or anything else that you may require :)

    Please let me know if the answers were sufficient or any further assistance :)

    Thanks,
    Gavalakis Vaggelis
     
  6. ClaudioFreda

    ClaudioFreda

    Joined:
    Nov 16, 2013
    Posts:
    7
    I have no idea why the PMs were disabled. Now I can receive them.

    Thanks for the explanations, you were not confusing at all.

    Do tasks get put inside a State gameobject that is made children of the graph owner's gameobject? Is that correct?

    I have another question, about Agents. What would be the use cases of setting a different agent than the graph owner?
     
    Last edited: Apr 20, 2014
  7. nuverian

    nuverian

    Joined:
    Oct 3, 2011
    Posts:
    2,087
    Yes that is kind of correct. They are children of the graph.
    The agent dropdown selection on the GraphOwner is legacy on how NC initialy worked but it won't appear anymore in the next version to avoid confusions. So for all cases you can leave it as is since it will make no difference on how NC works now :)
     
  8. castor76

    castor76

    Joined:
    Dec 5, 2011
    Posts:
    2,517
    I have actually tried to bench mark NC vs using Playmaker for AI in my project.

    I have about 200 simple minded AI enemies in the scene and after changing to playmaker I have noticed about 30% increase in fps.
    Which I think it is a lot considering... Also result only seems to affect in mobile platform as 200 isn't enough to cause difference in my PC build.

    I want to post some stats here, but I have lost the paper that I wrote stats down.. but as far as I remember , using profile , I have noticed about 1/3 drop in all number of objects / game objects / etc using player maker. Also noticed drop of 1/3 in ms on processing "transform" of the game objects.

    I will try to find that stat paper and post here if I can.

    I have bought NC and tried to love it and tried to use it a lot.. but alas, I couldn't justify keep using it for a $ spent sake at least for my project.

    I am sure it would be fine if there are only few AI's lucking around per scene at any time.

    I still think NC has great potential, just need to keep improving it... Perhaps I will find better use for it in different project.

    This is just for let others know about potential pitfall with NC if you are planning to have many nodes and many game object with NC. If you are running it on desktop , maybe it would be fine. Just saying.
     
  9. nuverian

    nuverian

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

    I appreciate that you went in and benched NC and your overal positive thinking.

    I went in and did some optimizations/improvements sooner rather than later so that finaly these concerns go away. (in a good way)
    Expect to see a heavy performance boost in the next update which I am wraping up right now to release as soon as possible, even with 200+ agents. And just to clarify your possible immediate concern, there is no impact based on the number of nodes at all.

    It will be great if you find that bench paper so that you will be able to see the new performance next to the previous one and possibly share your thought on that.

    Best regards and thanks.
    (There is always room for improvement :))
     
    Last edited: Apr 20, 2014
  10. castor76

    castor76

    Joined:
    Dec 5, 2011
    Posts:
    2,517
    I am sure the paper must be somewhere. It will be interesting to test the new version, but what did you do on the optimization?
     
  11. nuverian

    nuverian

    Joined:
    Oct 3, 2011
    Posts:
    2,087
    In a few words, deactivated the GOs amongst other things.
     
  12. nuverian

    nuverian

    Joined:
    Oct 3, 2011
    Posts:
    2,087
    So after long last I've build a demo version for everyone to be able to try out NodeCanvas before commiting to buy it. It comes with some limitations of course but it will at least let you play around with it and decide if it suits your needs.



    Demo Version Limitations:
    • DLL (except Action Condition Tasks for example).
    • Max 8 nodes per graph.
    • Can't build application.
    Please note that demo version graphs to full version is not upgradable and will result in missing scripts, as it seems that Unity can't replace the DLLed versioned components with the scripted ones. Please use the demo version in a new test project.

    The Demo version is and will probably remain at version 1.3.0 although the new version is around the corner.

    As a sidenote. After extensive tests and benchmarks, GOs are not the issue and I am getting the same performance no matter number of GOs, active or inactive and I can't stress this enough. Of course the rest of optimizations I did surely boosted the performance. I am getting 4ms for 200 agents checking some conditions and moving around and about 50 radnom dublicate nodes in the Behaviour Tree.
    Performance comparisons comming soon...
     
    Last edited: Apr 22, 2014
  13. sonicviz

    sonicviz

    Joined:
    May 19, 2009
    Posts:
    1,051
    Will NC be supporting Mecanim any time soon?
     
  14. nuverian

    nuverian

    Joined:
    Oct 3, 2011
    Posts:
    2,087
    Hey there,
    I've added some new mecanim Action Condition Tasks in the new version as well as that "Wait Until Finish" we've talked about early on :)
    I'm collecting and will post what's new in a while. Lot's of stuff actually :)
     
  15. nuverian

    nuverian

    Joined:
    Oct 3, 2011
    Posts:
    2,087
    Alright then. It took me a while for a new version, but finaly here it is. I am submitting version 1.4 today!
    Here is what's new/changed:

    GENERAL
    • A lot of performance improvement!
    • 2D Unity events are now handled. Added CheckTrigger2D and CheckCollision2D Condition Tasks.
    • Added Color, Vector2 and System.Object Blackboard variables.
    • It's now possible to send a method message to all Tasks of a graph by calling SendMessage on the GraphOwner.
    • Connections can now get disabled/enabled. Even in runtime as always. For Behaviour Trees, it is like the node is not connected at all.
    • More Tasks. Notably Mecanim ones.

    BEHAVIOUR TREES
    • Probability Selector:
      "The Probability Selector will select and execute a child node based on it's chance to be selected. It will then return whatever that child returns. The Probability Selector may immediately return Failure if a 'Failure Chance' is introduced or no childred are connected."
    • Limiter Decorator:
      "Limits the access of it's child node either a specific number of times, or every specific amount of time(aka cooldown)."
    • Accessor Decorator:
      "Accessor will execute it's child node if the Condition Task assigned is true and will return whatever the child node returns. Accessor will return Failure if the Condition is false and the child node is not already Running. It is kind of the opposite and complamentary to the Interruptor."
    • Added remap to Inactive, in Remapper Decorator. By inactive it means that the node will be treated as not connected at all.
    • All decorators will now be treated as inactive if they have no child node.
    • Added behaviour tree breakpoints (no unity pause). A breakpoint can be set in the Debugger Decorator.
    • Dublicate by Reference! BT Action BT Condition (for now) nodes can be "Dublicated by Reference"(Context Menu). What this means is that any ActionTask or ConditionTask assigned respectively to the "master" node will be referenced to the referenced node. Changing one will change the other. It is possible at any point, to "Break Reference" in the dublicated node, while creating a new copy of the Task assigned to the "master". A referenced dublicate node shows a small "R" on the top right.
    • Make Nested. Re-added the ability to create nested BT trees through the Context Menu of a BT node. This will create a new NestedBT node and add the selected node and all of it's children within that new NestedBT node. (Use with care since it's impossible to "Un-Nest" a NestedBT right now, but soon will)

    STATE MACHINES
    • Concurrent State:
      "This node will execute as soon as the graph is started and in parallel to any other state. This is not a state per se and thus it has no transitions as well as it can't be Entered by transitions."

    EDITOR
    • Removed the 'Agent' dropdown selection in the BT, FSM Graph Owner inspectors.
    • Added debug controls in BT, FSM Graph Owner inspectors. Start, Stop, Pause, Tick..(when in play mode)
    • Tasks can now be folded/unfolded in the inspector by clicking their titlebar. (More useful in task lists)
    • Added Dublicate as a right click context menu on the nodes on top of existing CTRL+ D.
    • Context menu tasks and nodes, are now also alphabeticaly ordered instead of only their categories (duh!)

    FIXES
    • Fixed UI bug when adding node and canvas was scrolled.
    • Fixed bug in GetProperty Action.
    • Fixed BT Parallel bug where children were re-executed.


    New Actions
    Wait :)eek:)
    SetLayerWeight (Mecanim)

    New Conditions
    CheckCollision2D
    CheckTrigger2D
    Probability
    Timeout
    CheckMecanimBool
    CheckMecanimFloat
    CheckMecanimInt
    IsInTransition (Mecanim)
     
  16. Danirey

    Danirey

    Joined:
    Apr 3, 2013
    Posts:
    548
    Hi nuverian,

    This looks nice!

    I've a few questions. I'm working on a Turn Based Game like Jagged Alliance 2(Some Videos Here) (Forum Here). Right now i'm building the playable characters systems, so i don't need AI for now. But i'm looking for something that could allow to "enable"/"disable" the thinking of the AI's to be able to do stuff one after one. First will think and act the first enemy of the list, and when finished, the first rests and enter the next one to work. Do you think it would be possible mixing States and trees? like if state is "rest" then wait, and if it is "think", then enters the behaviour tree?

    Also, is it possible to use all this stuff from JS? I've some personal issues with C# :D


    Cheers!
     
  17. nuverian

    nuverian

    Joined:
    Oct 3, 2011
    Posts:
    2,087
    Hey there. Thanks! :)
    You've done some progress on your game. Nice!

    I really think that NodeCanvas, is a canvas :p, meaning, that there are really many ways you could go about having a list of AIs behaving in order after one another. You can enable and disable a behaviour whenever you like, or start a behaviour and get a callback when it's finished so that the next AI takes over, or use the Behaviour Tree Iterator which is essentially kind of a foreach loop for some examples.
    Regarding mixing Behaviour Trees with State Machines..definetely. That's what NC is made for :)

    As far as JS go, it should work fine, but there will be some tedious folder/files moving around into the Plugins folder needed :(

    By all means, do download the trial version from the website, have a test drive and ask anything you'd like here, but I'll answer "yes" to your questions (with a small window for the JS one) :)

    Best regards,
    Gavalakis
     
  18. Danirey

    Danirey

    Joined:
    Apr 3, 2013
    Posts:
    548
    :D Thank you so much!


    I'll take a look at the demo version. As soon as i finish all the curent stuff, the next step is the enemy AI, so i think we'll talk again!


    Cheers! ;)
     
  19. nuverian

    nuverian

    Joined:
    Oct 3, 2011
    Posts:
    2,087
    You are very welcome. Let me know when you need me ;)

    Cheers!
     
  20. msl_manni

    msl_manni

    Joined:
    Jul 5, 2011
    Posts:
    272
    Hi,
    I see that you have not added any example scenes with demo version. Please add some example scenes too.
    I see that a BT can have nested FSM and BT also. Can Dialogue Tree be added to BT or FSM and can the result of DT be used as condition in BT.

    For ex - Enemy ask to hand's up. Player chooses yes - enemy asks another question, if player chooses No - enemy shoots the player.
     
  21. nuverian

    nuverian

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

    Your specific example could be made entirely into the dialogue tree itself, where you can have Actions (and Conditions). For example:

    $DT.png
    Node #7 is an Action node. In this example I just send a message "Shoot" to the Enemy actor.​

    Dialogue Trees can't be added as "nested node" in the same sense, although they could, but of course they can be started with an Action from within a BT for example, which is practicaly the same in this case. The simplest one could be:

    Code (csharp):
    1.  
    2. using UnityEngine;
    3. using NodeCanvas.DialogueTree;
    4.  
    5. namespace NodeCanvas.Actions{
    6.  
    7.     public class StartDialogueTree : ActionTask {
    8.  
    9.         [RequiredField]
    10.         public DialogueTreeContainer dialogueTree;
    11.  
    12.         protected override void OnExecute(){
    13.  
    14.             dialogueTree.StartGraph(EndAction);
    15.         }
    16.     }
    17. }
    18.  
    Right now there is no simple way of getting a Success or Failure to use in the BT out of a DT, but that would be interesting to add :)
    I have improvements and workflow polishing for the Dialogues Trees in mind for later on, but I had to finish v.1.4 which was more BT centric (as seen couple of posts above)

    Yes, I will add some example scenes in the trial version as well.

    Let me know if I miss anything :)
     
  22. msl_manni

    msl_manni

    Joined:
    Jul 5, 2011
    Posts:
    272
    Thanks very much for DT example.

    One more thing about DT, is it persistent for player input? or can it be overridden. Like There is a wizard who is consistent about player does his few tasks before he will give the player a key. He reveals the new task only when the player has completed the previous task. So plater can do the task in hand and come again to the wizard.

    Can this be achieved with full ver of NodeCanvas, as it might not be done by demo as demo has fewer nodes.

    I would like to know if DT can be used as a story telling, as the game progresses.
     
  23. nuverian

    nuverian

    Joined:
    Oct 3, 2011
    Posts:
    2,087
    You are welcome.

    You can use the blackboard variables for that. Here is an oversimplified example:

    $Wizard.png

    Nodes #2 and #5 are Condition nodes. They check a condition and proceed to either the 1st child node if the condition is true or the 2nd child node if it's false. More like a decision tree.

    In this case the condition is checking a boolean blackboard variable in both cases (task1Complete, task2Complete). And on the blackboard assigned to the "Player" Dialogue Actor since that's the actor we've selected for those 2 nodes.

    One of the changes I want to make is to also allow checking variables from a local blackboard on the Dialogue Tree which is more easy to catch and more streamlined, instead of only blackboard on the Dialogue Actors which might seem a bit confusing.

    You can actually try this out in the trial version..I'ts 8 nodes ;)
    Let me know if that is what you ment :)
     
  24. msl_manni

    msl_manni

    Joined:
    Jul 5, 2011
    Posts:
    272
    Thanks for the example. Seeing it, it will serve my purpose, but I will have to check it for sure.

    As the wizard is just checking variables on player, the player input is not necessary. The wizard DT sequence can be triggered using Trigger Collider or distance check. Or a story manager can be just updating the UI as the game progresses. Thanks.

    Another thing I want is BT example. Say an enemy is patrolling a waypoint path that is assigned to that particular enemy. If he sees the player he follows and attacks him. If his health gets gets below 30% he runs away into a secret chamber to fill up his health. He locks himself into that chamber, and player is not able to kill him. When his health is above 70%, he comes outside the chamber. If he sees the player, he attacks player, else he starts to patrol his waypoint path again.

    I suppose I am not asking too much. :D
     
    Last edited: May 1, 2014
  25. nuverian

    nuverian

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

    Yes you can start a DT or any graph for that matter however you like, like a trigger as you mentioned.

    Your example BT can be done in many ways depending on what exactly you are after. Here is a quick one where I use (the obscured) conditional connections ;)

    $DemoPatrol.png

    There are 3 blackboard variables here:
    health Float
    target GameObject
    WPoints List<GameObject>

    In reality you are most probably going to use custom Aciton Condition Tasks, so, the second branch could be done with but a single custom ActionTask that tells the AI to go to the desired position, fill his health and only then End the Action, instead of using all these nodes, but I wanted to use the included tasks for this demo.

    By the way health checks here are not precentage checks. Just numbers.

    There is no DT Owner. A DT is not owned by a specific game object. You create a DT by going to GameObject/Create Other/NodeCanvas/DialogueTree :)

    Let me know if you have any questions.
     
    Last edited: May 1, 2014
  26. nuverian

    nuverian

    Joined:
    Oct 3, 2011
    Posts:
    2,087
    The new version 1.4 is now live :)
    You can read the release notes a couple of posts above or in the first post of this thread as always.
     
  27. msl_manni

    msl_manni

    Joined:
    Jul 5, 2011
    Posts:
    272
    Please post an example of custom action that can be used for things like these. That will really help me to create my own logic states and condense my workflow. It will also keep me in touch with programming, which I like the most. :rolleyes:
     
    Last edited: May 2, 2014
  28. nuverian

    nuverian

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

    This simple action will increase the selected blackboard float variable over time by 1 per second until it's value has reached or is greater than the specified "Increase Until" value and only then it will End.

    Code (csharp):
    1.  
    2. using UnityEngine;
    3. using NodeCanvas;
    4. using NodeCanvas.Variables;
    5.  
    6. public class IncreaseFloatOverTime : ActionTask{
    7.  
    8.     public BBFloat floatToIncrease = new BBFloat{blackboardOnly = true};
    9.     public float increaseUntil = 10;
    10.  
    11.     protected override void OnUpdate(){
    12.  
    13.         if (floatToIncrease.value >= increaseUntil){
    14.             EndAction(true);
    15.             return;
    16.         }
    17.  
    18.         floatToIncrease.value += Time.deltaTime;
    19.     }
    20. }
    21.  

    Please read the included actions and conditions. They will help a lot to get you started, as well as the online documentation on Creating Custom Actions Conditions ;)
     
  29. msl_manni

    msl_manni

    Joined:
    Jul 5, 2011
    Posts:
    272
    Thanks again. I made a decreaseFloatOverTime function in no time and it works fine.


    One problem I am encountering right now is, I am unable to make enemy navagent to go between two different targets using triggerStay.

    If he is within a triggerStay then he should goto target1, else he should goto target2. The response should be immediate, ie dynamic.

    Please help.
     
  30. msl_manni

    msl_manni

    Joined:
    Jul 5, 2011
    Posts:
    272
    I suppose the goto target function only ends its state when the navagent reaches the target. So there is a delay, but a bool is set immediately. And I was thinking I had some bug.
     
  31. msl_manni

    msl_manni

    Joined:
    Jul 5, 2011
    Posts:
    272
    $parallel.png

    Do I see a BUG? According to info of parallel node and its choices I dont think its working as a parallel node. But rather it is working as either selector or sequencer only. :cry:
     
  32. nuverian

    nuverian

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

    Not all actions end immediately. Some require time to complete, like the move actions for example, but there are different ways for a Running action to stop prematurely. Some of those ways are:

    You can use an Interruptor. So when the assigned condition on the interruptor becomes true, the interruption will take place and as such the decorated child node will be interrupted.
    You can use a conditional connection directly. If the condition is false, the connection itself will return Failure and interrupt the connected target node as well.
    Or you can use the "Dynamic" option in the Selector and the Sequencer which makes them revaluate their child nodes from the start.
    So a Dynamic Sequencer will interrupt the current Running node if a previous one return Failure and the Sequencer will return Failure as well.
    A Dynamic Selector will interrupt the current Running node if a previous one returns Success and the Selector will return Success as well.

    Here are 2 trees that represent the later 2 options:

    $TriggerStay.png


    This is not a bug..
    A Parallel node executes all of it's children simultaneously. A Selector and a Sequencer executes them in order.
    The option you see here lets you select the Prallel policy to be used.

    If it is set to First Failure, the Parallel will return Failure when the first child returns Failure, but Success when all children return Success (like a Sequencer)

    If is is set to First Success, the Prallel will return Succes when the first child return Success, but Failure when all children return Failure (like a Selector)

    This information can be found in the online documentation here :)
     
  33. msl_manni

    msl_manni

    Joined:
    Jul 5, 2011
    Posts:
    272
    Sorry but both solutions are not dynamic, as second branch is not dynamic.
     
  34. nuverian

    nuverian

    Joined:
    Oct 3, 2011
    Posts:
    2,087
    Sorry, I'm not sure what you mean.
    That branch will do what you suggested you want to do.
    "If he is within a triggerStay then he should goto target1, else he should goto target2. The response should be immediate"

    If the AI is in a Trigger (TriggerStay == true) it will go to objectA, else it will go to objectB. The condition effect is immediate.

    By the way and just in case, here is a great article on behaviour trees. Totaly worth a read.
     
    Last edited: May 3, 2014
  35. msl_manni

    msl_manni

    Joined:
    Jul 5, 2011
    Posts:
    272
    Please read as
    Or another option could be

    Thats how, I would code it.
     
  36. nuverian

    nuverian

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

    While it may be a 2 liner of code, behaviour trees don't really work that way.
    What I mean is that they are ment to have small reusable blocks doing a specific task, that allow for a rapid flexibility in design patterns and direct feedback debugging of those patterns. Moreover they are ment to be used as a bridge of programmers + designers and thus the graphical tools.

    Regardless, both branches posted above do exactly that you want. The first branch especially, comes closer to that 2 liner. Please do mark the Selector (of the first branch) as Dynamic too, to revaluate the TriggerStay condition while going to ObjectB. Something I forgot to do in the screenshot.
    I hope that was not the confusion about.
     
  37. msl_manni

    msl_manni

    Joined:
    Jul 5, 2011
    Posts:
    272
    You are absolutely right that Behaviour Trees dont work that way.

    I will write special functions to accomplish this kind of tasks.

    I see that NodeCanvas is purely a canavs, where I can add my own nodes/tasks. So it would fit my workflow easily. And as I am the only developer, I can implement my own interpretations.

    BTW I tried every solution possible like dynamic or negating both branches, it does not works as I need it to be. I just wanted to check with you, if you have any solution. If you need then I can upload a work project.
     
  38. nuverian

    nuverian

    Joined:
    Oct 3, 2011
    Posts:
    2,087
    Please do send me a work project so that I can take a look as of what doesn't work for you as you'd like to do. You can send the file directly at info@nodecanvas.com.
     
  39. msl_manni

    msl_manni

    Joined:
    Jul 5, 2011
    Posts:
    272
    Two scenes sent.
     
  40. msl_manni

    msl_manni

    Joined:
    Jul 5, 2011
    Posts:
    272
    Funny that you were using the 1.4, while I am 1.3 and a bug in movement code in 1.3 and blah blah blah .....................................
    Nice that it is sorted out now.

    Thanks for the fix.
     
    Last edited: May 4, 2014
  41. nuverian

    nuverian

    Joined:
    Oct 3, 2011
    Posts:
    2,087
    You are welcome :)
    Thanks as well
     
    Last edited: May 4, 2014
  42. BurningthumbStudios

    BurningthumbStudios

    Joined:
    Apr 28, 2008
    Posts:
    95
    I'm trying out the demo, I have setup a dialog, which I can run in the editor BUT it only seems to run with the default actor. How can I get it to run for a different actor? How can I start the dialog from a script? I know these are "basic" questions but the demo does not seem to answer them.
     
  43. BurningthumbStudios

    BurningthumbStudios

    Joined:
    Apr 28, 2008
    Posts:
    95
    Also, I seem to have an issue with dialog choices. Is there a way to ask a question along with the choices. Right now it just shows the choices, but I need something like:
    Which way would you like to turn?
    choice 1
    choice 2
    ...
    choice n
     
  44. nuverian

    nuverian

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

    You can start a dialogue tree by script by calling either:

    StartGraph() on that DialogueTree
    if you are not using nodes that are set to be perfomed by "_Owner" actor in the dropdonw menu, or

    StartGraph(Component actor, Blackboard blackboard)
    if you are using nodes that are set to be performed by the "_Owner" Actor. So in this case, every node that is set to be performed by the "_Owner" will do so by the actor you provide in the argument here as well as the blackboard you provide, although the blackboard can be null if you don't need it.

    You can also get a callback when the dialogue is finished. Here is an example:
    Code (csharp):
    1.  
    2. using NodeCanvas.DialogueTree;
    3. public class Example : MonoBehaviour{
    4.  
    5.     public DialogueActor actor;
    6.     public DialogueTreeContainer dialogue;
    7.  
    8.     void Start(){
    9.  
    10.         dialogue.StartGraph(actor, actor.blackboard, OnFinish);
    11.     }
    12.  
    13.     void OnFinish(){
    14.         Debug.Log("Dialogue is finished");
    15.     }
    16. }
    17.  

    Yes, the Choice node just shows the options available, but you can simply add a "Say" node before the Choice node :)
     
  45. nuverian

    nuverian

    Joined:
    Oct 3, 2011
    Posts:
    2,087
    I've updated the online documentation with the new node's reference and features as well as added some more clarification :)

    Meanwhile a new rather small version 1.4.2 is submitted mostly fixing some bugs. More specificaly:

    • Fixed the StartCoroutine in Tasks and Nodes to be of type Coroutine instead of void.
    • Fixed a small bug in the Move Action Tasks where they were not reseted correctly in very specific cases.
    • Dialogue Trees can now be stoped by calling StopGraph() as well.
    • EDITOR. Default summary info for tasks will no longer show the namespace in front if any.
    • EDITOR. Fixed Dialogue Tree Action node where tasks could not be minimized.
    • EDITOR. When Task titlebar is minimized it will show the summary info.
     
    Last edited: May 8, 2014
  46. nuverian

    nuverian

    Joined:
    Oct 3, 2011
    Posts:
    2,087
    Well that was rather quick :) The update is live
     
  47. bkw

    bkw

    Joined:
    Sep 20, 2013
    Posts:
    49
    Anyone else noticing high CPU usage when the NodeCanvas editor window is open? On OSX, Unity jumps up to 100% core usage with the editor window open (with a BT with no nodes).

    Oh, and might I suggest that the playmaker stuff be zipped instead of RAR'd? Unless it's some file size issue, at least zip can be opened by Windows and OSX natively. =)
     
    Last edited: May 10, 2014
  48. bkw

    bkw

    Joined:
    Sep 20, 2013
    Posts:
    49
    Oh, one other thing... I can't figure out how to add non-action/condition nodes. When I right-click in the editor, Composites, Decorators, and Nested are grayed out. Likewise when I try to add a task to an action or condition node, everything is grayed out.
     
  49. nuverian

    nuverian

    Joined:
    Oct 3, 2011
    Posts:
    2,087
    That's weird, it runs very smoothly here (windows). Does anyone else has this issue on a MAC? Please share.
    Sure I can add them in .zip. No size issue here, was just a choice :)

    This is a bug I've been informed just yesterday that happens only MACs after the last update. I will PM you a fix right now so tha you don't have to wait for the update.
     
  50. bkw

    bkw

    Joined:
    Sep 20, 2013
    Posts:
    49
    Thanks for the quick fix!

    Another issue, might be a mac thing, don't know.. but in the get/set property action task, when selecting the Component, the popup isn't showing the component name (everything before the pipe). E.g. from Demo0, the ComponentField shows something like "BehaviourTreeOwner | Cat". When I try to change it, the drop down should be something like "Transform | Cat", "BehaviourTreeOwner | Cat", and "Blackboard | Cat", but the popup only shows " Cat", " Cat", and " Cat". Seems like unity's .Popup might be doing something funny with string that contains pipes?

    Oh, and a usability thing, don't know what other programs do, or what other people expect, but when I try to pan the graph with the middle mouse button and I click down on a node, it moves the node. My expectation would be that it pans the graph regardless of whether I clicked an empty space or on a node.