Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice

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

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

  1. Seith

    Seith

    Joined:
    Nov 3, 2012
    Posts:
    755
    @nuverian Hi, I just updated to the latest version of NC and found what looks like a huge bug (but hopefully very simple to fix): all the conditions in the AI trees have been inverted by the upgrade. Basically every node that was testing for a "False" now tests for a "True" and vice-versa. Of course it thoroughly breaks the AI behavior.

    Here you can see that all the condition nodes are inverted:



    And on the image below you can see that the conditional decorators (like the one visible at the bottom) are NOT affected by the bug (they remain identical in both cases):



    Needless to say this is kind of an emergency and I hope you can find a fix as soon as possible. Thank you!
     
  2. JakeTBear

    JakeTBear

    Joined:
    Feb 15, 2014
    Posts:
    123
    It worked fine after I closed and opened the editor, this happened after I duplicated the branch before attempting to create a subtree, oddly I cannot seem to reproduce it as well.
     
  3. sanpats

    sanpats

    Joined:
    Aug 24, 2011
    Posts:
    343
    I have already reported this bug, and it has been fixed already. @nuverian said he's submitted the update to the asset store.
     
  4. sanpats

    sanpats

    Joined:
    Aug 24, 2011
    Posts:
    343
    @nuverian

    I usually develop in OS X, but I develop on my Windows PC some time. I notice that in Windows Unity Editor, the GameObject with a GraphOwner Component do not have the special icon after the GasmeObject's Name in the Hierarchy View. They do in Mac. Is this normal?
     
  5. Der_Kevin

    Der_Kevin

    Joined:
    Jan 2, 2013
    Posts:
    517
    Hey!
    Is there a discount for already happy flow canvas customers? :)
     
  6. Seith

    Seith

    Joined:
    Nov 3, 2012
    Posts:
    755
    I see. Well I'm eagerly waiting for the new publish with the fix to come through then...!
     
  7. nuverian

    nuverian

    Joined:
    Oct 3, 2011
    Posts:
    2,087
    Hey,
    This is indeed a bug that shiped with the latest version. The fixed version was send to the asset store just 1 day after v2.4.0, but it seems that due to christmas and weekend it still isn't live after all these days.
    If you want I can send you the new version personaly. Please PM me an email and I will do so as soon as possible.
    Thanks!

    Thanks for letting me know. I will try to reporduce this issue once more. If it somehow happens to you again, please let me know.
    Thanks!

    Hm. That's weird. I am on windows and the hierarchy icon shows as normal. Do you maybe have any other asset/plugin that fiddles with custom hierarchy icons in your project?
    Let me know.
    Thanks!

    Hey,
    I will add a small discount price from FlowCanvas to NodeCanvas and vice versa in the next couple of days :)
    Cheers!
     
  8. sanpats

    sanpats

    Joined:
    Aug 24, 2011
    Posts:
    343
    It's the same project I develop on OS X. I use git to sync the project. On Mac, there is the icon, on windows, no. May be it's Unity 5.3.1p1 autoupdater's fault. I will try to reimport NodeCanvas.
     
  9. nuverian

    nuverian

    Joined:
    Oct 3, 2011
    Posts:
    2,087
    Hey,
    Hm. I can't manage to reproduce a case where the hierarchy icons are not showing up in my windows editor.
    Please, if you manage to pinpoint this down, let me know. Meanwhile, I will keep searching for what might possibly be wrong with them.
    Thank you!
     
  10. sanpats

    sanpats

    Joined:
    Aug 24, 2011
    Posts:
    343
    I tested with a new and empty project. Imported NC, made an empty GameObject, attached FSMOwner, and no hierarchy icon. Unity 5.3.1p1 on Windows 10. Might be an Unity bug, or related to high-def screen (2,736 x 1,824) with Windows 10 scaling on Surface Pro 4. I tried disable Windows scaling for Unity (which will make texts and UI small), but no icons too. I will test with my other windows machine when I have time. One thing is, it's not relate to my project.
     
  11. aer0ace

    aer0ace

    Joined:
    May 11, 2012
    Posts:
    1,513
    Is there any documentation on how to use NodeCanvas for Dialogue Trees? I don't see any on the asset website.
     
  12. Der_Kevin

    Der_Kevin

    Joined:
    Jan 2, 2013
    Posts:
    517
    Hey!
    Whats actually the difference between the pro and lite version?
    Or better: what cant be done with the lite version?
     
  13. nuverian

    nuverian

    Joined:
    Oct 3, 2011
    Posts:
    2,087
    Best of wishes for a Happy New Year!!

    Hey,
    Thanks for testing and letting me know. I suspect a Unity bug probably. Do you see any other font icons in any other NodeCanvas place, like for example the triangle icons as illustrated bellow:
    Triangle.png

    Thanks!

    Hello,
    I will update the website tomorrow first thing and add the Dialogue Tree documentation, along with the sample demo scene.
    Thanks!

    Hey,
    To start with, the Lite version is only Behaviour Trees. Neither FSMs, nor Dialogue Trees at all.
    Furthermore, even the Behaviour Trees in the Lite version, come with only the basic Behaviour Tree nodes (Sequencer, Selector, Invert, Conditional Decorator, Action, Condition). Far less than those included in the full version and no "SubTrees" ability.
    Last but not least the lite version also comes with far less premade action/condition tasks and no reflection based (Script Control) tasks.
    The "Lite Version", is ment to be an affordable, but still a full Behaviour Tree solution, thus the reason why the above have been removed from the package. The Lite Version, is still though a very complete Behaviour Tree asset if you don't require the above features, plus you are fine with scripting for creating custom action/condition tasks, which is rather easy anyway :)

    Please let me know if you a need more detailed version comparison.

    Thanks!
     
    Last edited: Jan 2, 2016
  14. sanpats

    sanpats

    Joined:
    Aug 24, 2011
    Posts:
    343
    The other icons work fine.
     
  15. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    I'm finally getting back into my game and really like NodeCanvas, but I'm looking for some guidance from those of you who have used it for a while.

    Basically, I'm trying to figure out standard structures to do conditional logic. For example...


    I figured out using a sequence with a condition is a good way to do an "if statement".

    But, what if I want the top sequence to continue even if the sword is already connected? Here, I'm just forcing the failure to a success. Is this the right way to allow the top sequence to continue or should I be using a different structure?

    Thanks

    (I know this seems basic, but I don't want to go building all my logic to find out later there was a better way to do things. ;))
     
  16. Tiny-Tree

    Tiny-Tree

    Joined:
    Dec 26, 2012
    Posts:
    1,315
    not sure im understanding what you want to do but if you want both to be ticked you could change the top one to a parallel and use an "always return true"
     
  17. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    Thanks for the suggestion. But, when using a parallel both paths would run at the same exact time (I think). Instead, I'd like to unsheathe the sword (if needed) and then move to to the enemy. So, unsheathing only occurs if it's needed.

    I guess (in this example) I'm wondering if there's a way to have sequence where all children run no matter if a child returns a false or not. Using the remap works. I just wasn't sure if there's a "more correct" way of doing it.

    Thanks again for helping :)
     
  18. nuverian

    nuverian

    Joined:
    Oct 3, 2011
    Posts:
    2,087
    Thanks for letting me know. I am still looking at this.

    Hey!
    Glad to hear that :)
    If I understood correctly, you are after the 'Optional' decorator node instead of the invert/remap.
    The 'optional' decorator always return a "Resting" status, thus in practise making the parent node ignore it in regards to success/failure/running.
    Let me know if this is what you are after.

    Cheers!
     
  19. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    Perfect! Not sure how I missed that, but that makes sense. Thank you. :)
     
  20. kenlem

    kenlem

    Joined:
    Oct 16, 2008
    Posts:
    1,630
    Arghhh... just updated to latest version of NodeCanvas and get an exception on iOS. Looks like a change in the Paradox framework has an unsupported call. Looks like it's breaking on a lamda expression compile.

    Code (CSharp):
    1. (Filename: /Users/builduser/buildslave/unity/build/artifacts/generated/common/runtime/UnityEngineDebugBindings.gen.cpp Line: 37)
    2.  
    3. SaveScene: /var/mobile/Containers/Data/Application/CB844FA0-4477-436F-8DA9-69F177A2A082/Documents/current/Home-Interior.json
    4. UnityEngine.DebugLogHandler:Internal_Log(LogType, String, Object)
    5. UnityEngine.DebugLogHandler:LogFormat(LogType, Object, String, Object[])
    6. UnityEngine.Logger:Log(LogType, Object)
    7. UnityEngine.Debug:Log(Object)
    8. PersistentObjectManager:SaveScene(String, PersistentGameState)
    9. GameManager:SaveCellState(String)
    10. <_LoadCell>c__Iterator12:MoveNext()
    11. (Filename: /Users/builduser/buildslave/unity/build/artifacts/generated/common/runtime/UnityEngineDebugBindings.gen.cpp Line: 37)
    12.  
    13. NotSupportedException: /Users/builduser/buildslave/unity/build/Tools/il2cpp/il2cpp/libil2cpp/icalls/mscorlib/System.Reflection.Emit/DynamicMethod.cpp(21) : Unsupported internal call for IL2CPP:DynamicMethod::create_dynamic_method - System.Reflection.Emit is not supported.
    14.   at System.Reflection.Emit.DynamicMethod.create_dynamic_method (System.Reflection.Emit.DynamicMethod m) [0x00000] in <filename unknown>:0
    15.   at System.Reflection.Emit.DynamicMethod.CreateDynMethod () [0x00000] in <filename unknown>:0
    16.   at System.Reflection.Emit.DynamicMethod.CreateDelegate (System.Type delegateType, System.Object target) [0x00000] in <filename unknown>:0
    17.   at System.Linq.Expressions.EmitContext.CreateDelegate (System.Runtime.CompilerServices.ExecutionScope scope) [0x00000] in <filename unknown>:0
    18.   at System.Linq.Expressions.CompilationContext.CreateDelegate (Int32 unit, System.Runtime.CompilerServices.ExecutionScope scope) [0x00000] in <filename unknown>:0
    19.   at System.Linq.Expressions.CompilationContext.CreateDelegate () [0x00000] in <filename unknown>:0
    20.   at System.Linq.Expressions.LambdaExpression.Compile () [0x00000] in <filename unknown>:0
    21.   at System.Linq.Expressions.Expression`1[TDelegate].Compile () [0x00000] in <filename unknown>:0
    22.   at ParadoxNotion.Serialization.FullSerializer.fsMetaType..ctor (System.Type reflectedType) [0x00000] in <filename unknown>:0
    23.   at ParadoxNotion.Serialization.FullSerializer.fsMetaType.Get (System.Type type) [0x00000] in <filename unknown>:0
    24.   at ParadoxNotion.Serialization.FullSerializer.Internal.fsReflectedConverter.TrySerialize (System.Object instance, ParadoxNotion.Serialization.FullSerializer.fsData& serialized, System.Type storageType) [0x00000] in <filename unknown>:0
    25.   at ParadoxNotion.Serialization.FullSerializer.fsSerializer.InternalSerialize_4_Converter (System.Object instance, ParadoxNotion.Serialization.FullSerializer.fsData& data) [0x00000] in <filename unknown>:0
    26.   at ParadoxNotion.Serialization.FullSerializer.fsSerializer.InternalSerialize_3_ProcessVersioning (System.Object instance, ParadoxNotion.Serialization.FullSerializer.fsData& data) [0x00000] in <filename unknown>:0
    27.   at ParadoxNotion.Serialization.FullSerializer.fsSerializer.InternalSerialize_2_Inheritance (System.Type storageType, System.Object instance, ParadoxNotion.Serialization.FullSerializer.fsData& data) [0x00000] in <filename unknown>:0
    28.   at ParadoxNotion.Serialization.FullSerializer.fsSerializer.InternalSerialize_1_ProcessCycles (System.Type storageType, System.Object instance, ParadoxNotion.Serialization.FullSerializer.fsData& data) [0x00000] in <filename unknown>:0
    29.   at ParadoxNotion.Serialization.FullSerializer.fsSerializer.TrySerialize (System.Type storageType, System.Object instance, ParadoxNotion.Serialization.FullSerializer.fsData& data) [0x00000] in <filename unknown>:0
    30.   at ParadoxNotion.Serialization.JSONSerializer.Serialize (System.Type type, System.Object value, Boolean pretyJson, System.Collections.Generic.List`1 objectReferences) [0x00000] in <filename unknown>:0
    31.  
    32.   at NodeCanvas.Framework.Blackboard.Serialize () [0x00000] in <filename unknown>:0
    33.   at PersistentObject.toJSON () [0x00000] in <filename unknown>:0
    34.   at PersistentObjectManager.SaveSceneToString () [0x00000] in <filename unknown>:0
    35.   at PersistentObjectManager.SaveScene (System.String name, .PersistentGameState gameState) [0x00000] in <filename unknown>:0
    36.   at GameManager.SaveCellState (System.String levelName) [0x00000] in <filename unknown>:0
    37.   at GameManager+<_LoadCell>c__Iterator12.MoveNext () [0x00000] in <filename unknown>:0
    38.  
     
  21. sanpats

    sanpats

    Joined:
    Aug 24, 2011
    Posts:
    343
    @nuverian

    Nice job adding log message toggle!
     
  22. nuverian

    nuverian

    Joined:
    Oct 3, 2011
    Posts:
    2,087
    You are welcome!
    Glad to know it works for you :)

    Cheers!

    Hey,
    Indeed there is a slight bug introduced in last version. Sorry about that.
    I have attached the fixed file. Please replace and let me know if everything works fine again.

    Thanks!

    Thanks! This was requested a long time now :)
     

    Attached Files:

  23. nuverian

    nuverian

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

    Crazy Minnow Studio has created an extension for their fantastic Salsa with RandomEyes product that allows simple and automatic lip sync for your characters! This extension comes with a lot of actions to control anything like facial expressions and settings, and most importantely it works with the NC Dialogue Trees directly and without a hassle!

    They have made a great post about this integration along with a video tutorial. You can read all about it here.
    If you don't know about SALSA, check it out on the asset store, because it's a fantastic tool!
     
  24. nuverian

    nuverian

    Joined:
    Oct 3, 2011
    Posts:
    2,087
    For the people that missed this, version 2.4.1 is live on the asset store.
    Together with v2.4.0, here are the total changes:
    • Deserialization is now fixed and much faster.
    • Added "Don't Retrigger Active State" in FSM AnyState node. This option prevents the AnyState from retriggering a "true" transition if it leads to the already currently active state.
    • Added “Log Events” preference option, to toggle whether or not the events are loged in the console.
    • Added "Create New" option in the dropdown menu when selecting a variable, which will basicaly create and automaticaly link a new variable on the blackboard.
    • Added "DontDestroyOnLoad" option in Global Blackboards inspector.
    • The editor is now faster and smoother.
    • Fixed BBparameters losing reference to blackboard in some cases.
    • Fixed the node/task browser to auto-focus the search field.
    • Fixed FSM callbacks that where called only the last MonoBehaviour in the stack.
    • And some other minor fixes and improvements :)

    Cheers!
     
  25. JakeTBear

    JakeTBear

    Joined:
    Feb 15, 2014
    Posts:
    123
    I am happy for the faster deserialization, thank you for that!

    Any news on the manual updating? It would be awesome if we could even pass a delta time to tick a tree manually.

    Keep up the awesome job :)
     
  26. kenlem

    kenlem

    Joined:
    Oct 16, 2008
    Posts:
    1,630

    Thanks for the fix! It doesn't crash now but throws an error on deserilize.

    Code (CSharp):
    1.  
    2. (Filename: /Users/builduser/buildslave/unity/build/artifacts/generated/common/runtime/UnityEngineDebugBindings.gen.cpp Line: 37)
    3.  
    4. Deserialization Error: 'Constructor of NodeCanvas.Tasks.Actions.GetGlobalBlackboardVariable`1[System.Boolean] threw an exception when creating an instance'
    5. '  at ParadoxNotion.Serialization.FullSerializer.Internal.fsDateConverter.TryDeserialize (ParadoxNotion.Serialization.FullSerializer.fsData data, System.Object& instance, System.Type storageType) [0x00000] in <filename unknown>:0
    6.  at ParadoxNotion.Serialization.FullSerializer.fsMetaType.CreateInstance () [0x00000] in <filename unknown>:0
    7.  at ParadoxNotion.Serialization.FullSerializer.Internal.fsReflectedConverter.CreateInstance (ParadoxNotion.Serialization.FullSerializer.fsData data, System.Type storageType) [0x00000] in <filename unknown>:0
    8.  at ParadoxNotion.Serialization.FullSerializer.fsSerializer.InternalDeserialize_3_Inheritance (ParadoxNotion.Serialization.FullSerializer.fsData data, System.Type storageType, System.Object& result, System.Collections.Generic.List`1& processors) [0x00000] in <filename unknown>:0
    9.  at ParadoxNotion.Serialization.FullSerializer.fsSerializer.InternalDeserialize_1_CycleReference (ParadoxNotion.Serialization.FullSerializer.fsData data, System.Type storageType, System.Object& result, System.Collections.Generic.List`1& processors) [0x00000] in <filename unknown>:0
    10.  at ParadoxNotion.Serialization.FullSerializer.fsSerializer.TryDeserialize (ParadoxNotion.Serialization.FullSerializer.fsData data, System.Type storageType, System.Object& result) [0x00000] in <filename unknown>:0
    11.  at ParadoxNotion.Serialization.FullSerializer.Internal.fsReflectedConverter.TryDeserialize (ParadoxNotion.Serialization.FullSerializer.fsData data, System.Object& instance, System.Type storageType) [0x00000] in <filename unknown>:0
    12.  at ParadoxNotion.Serialization.FullSerializer.fsSerializer.InternalDeserialize_5_Converter (ParadoxNotion.Serialization.FullSerializer.fsData data, System.Type resultType, System.Object& result) [0x00000] in <filename unknown>:0
    13.  at ParadoxNotion.Serialization.FullSerializer.fsSerializer.InternalDeserialize_4_Cycles (ParadoxNotion.Serialization.FullSerializer.fsData data, System.Type resultType, System.Object& result) [0x00000] in <filename unknown>:0
    14.  at ParadoxNotion.Serialization.FullSerializer.fsSerializer.InternalDeserialize_3_Inheritance (ParadoxNotion.Serialization.FullSerializer.fsData data, System.Type storageType, System.Object& result, System.Collections.Generic.List`1& processors) [0x00000] in <filename unknown>:0
    15.  at ParadoxNotion.Serialization.FullSerializer.fsSerializer.InternalDeserialize_1_CycleReference (ParadoxNotion.Serialization.FullSerializer.fsData data, System.Type storageType, System.Object& result, System.Collections.Generic.List`1& processors) [0x00000] in <filename unknown>:0
    16.  at ParadoxNotion.Serialization.FullSerializer.fsSerializer.TryDeserialize (ParadoxNotion.Serialization.FullSerializer.fsData data, System.Type storageType, System.Object& result) [0x00000] in <filename unknown>:0
    17.  at ParadoxNotion.Serialization.FullSerializer.Internal.fsIEnumerableConverter.TryDeserialize (ParadoxNotion.Serialization.FullSerializer.fsData data, System.Object& instance_, System.Type storageType) [0x00000] in <filename unknown>:0
    18.  at ParadoxNotion.Serialization.FullSerializer.fsSerializer.InternalDeserialize_5_Converter (ParadoxNotion.Serialization.FullSerializer.fsData data, System.Type resultType, System.Object& result) [0x00000] in <filename unknown>:0
    19.  at ParadoxNotion.Serialization.FullSerializer.fsSerializer.InternalDeserialize_4_Cycles (ParadoxNotion.Serialization.FullSerializer.fsData data, System.Type resultType, System.Object& result) [0x00000] in <filename unknown>:0
    20.  at ParadoxNotion.Serialization.FullSerializer.fsSerializer.InternalDeserialize_3_Inheritance (ParadoxNotion.Serialization.FullSerializer.fsData data, System.Type storageType, System.Object& result, System.Collections.Generic.List`1& processors) [0x00000] in <filename unknown>:0
    21.  at ParadoxNotion.Serialization.FullSerializer.fsSerializer.InternalDeserialize_1_CycleReference (ParadoxNotion.Serialization.FullSerializer.fsData data, System.Type storageType, System.Object& result, System.Collections.Generic.List`1& processors) [0x00000] in <filename unknown>:0
    22.  at ParadoxNotion.Serialization.FullSerializer.fsSerializer.TryDeserialize (ParadoxNotion.Serialization.FullSerializer.fsData data, System.Type storageType, System.Object& result) [0x00000] in <filename unknown>:0
    23.  at ParadoxNotion.Serialization.FullSerializer.Internal.fsReflectedConverter.TryDeserialize (ParadoxNotion.Serialization.FullSerializer.fsData data, System.Object& instance, System.Type storageType) [0x00000] in <filename unknown>:0
    24.  at ParadoxNotion.Serialization.FullSerializer.fsSerializer.InternalDeserialize_5_Converter (ParadoxNotion.Serialization.FullSerializer.fsData data, System.Type resultType, System.Object& result) [0x00000] in <filename unknown>:0
    25.  at ParadoxNotion.Serialization.FullSerializer.fsSerializer.InternalDeserialize_4_Cycles (ParadoxNotion.Serialization.FullSerializer.fsData data, System.Type resultType, System.Object& result) [0x00000] in <filename unknown>:0
    26.  at ParadoxNotion.Serialization.FullSerializer.fsSerializer.InternalDeserialize_3_Inheritance (ParadoxNotion.Serialization.FullSerializer.fsData data, System.Type storageType, System.Object& result, System.Collections.Generic.List`1& processors) [0x00000] in <filename unknown>:0
    27.  at ParadoxNotion.Serialization.FullSerializer.fsSerializer.InternalDeserialize_1_CycleReference (ParadoxNotion.Serialization.FullSerializer.fsData data, System.Type storageType, System.Object& result, System.Collections.Generic.List`1& processors) [0x00000] in <filename unknown>:0
    28.  at ParadoxNotion.Serialization.FullSerializer.fsSerializer.TryDeserialize (ParadoxNotion.Serialization.FullSerializer.fsData data, System.Type storageType, System.Object& result) [0x00000] in <filename unknown>:0
    29.  at ParadoxNotion.Serialization.JSONSerializer.Deserialize (System.Type type, System.String serializedState, System.Collections.Generic.List`1 objectReferences) [0x00000] in <filename unknown>:0
    30.  at ParadoxNotion.Serialization.JSONSerializer.Deserialize[T] (System.String serializedState, System.Collections.Generic.List`1 objectReferences) [0x00000] in <filename unknown>:0
    31.  at NodeCanvas.Framework.Graph.Deserialize (System.String serializedGraph, Boolean validate, System.Collections.Generic.List`1 objectReferences) [0x00000] in <filename unknown>:0
    32.  at NodeCanvas.Framework.Graph.OnAfterDeserialize () [0x00000] in <filename unknown>:0 '
    33.  
    34. <b>Please report bug</b>
    35. (Filename: /Users/builduser/buildslave/unity/build/artifacts/generated/common/runtime/UnityEngineDebugBindings.gen.cpp Line: 37)
     
  27. nuverian

    nuverian

    Joined:
    Oct 3, 2011
    Posts:
    2,087
    Hey,
    It's in my TODO list :) I will also see at the possbility of a delta time tick.

    Cheers!

    Hey,

    Do you still have the AOTDummy.cs in your project folder?
     
  28. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    Another noob question... ;)

    I have a "Determine Position" action and a "Navigate To Position" action. I would like DP to run before NTP all the time. This includes while NTP is still working... just in case I change the target position.

    I've tried using a dynamic sequencer, a parallel, a step iterator, and I've tried reorganizing the graph about 20 times. DP does fire once NTP completes, but not while it's working (yellow).

    I'm sure I'm just not putting the pieces together right. Any help would be appreciated. Thanks!
     
  29. JakeTBear

    JakeTBear

    Joined:
    Feb 15, 2014
    Posts:
    123
    @Tryz I had the same need, and to me this was how a basic "Parallel node" was supposed to act.

    The cool thing is that Nuverian has made it very easy to extend the system, I simply created my own "Parallel node", here is the code:

    Code (CSharp):
    1. using UnityEngine;
    2. using NodeCanvas.Framework;
    3. using ParadoxNotion.Design;
    4.  
    5. namespace NodeCanvas.BehaviourTrees
    6. {
    7.     [Category("Composites")]
    8.     [Description("Execute all child nodes once but in the same frame")]
    9.     [Icon("NCParallel")]
    10.     public class NC_Parallel : BTComposite
    11.     {
    12.  
    13.         protected override Status OnExecute(Component agent, IBlackboard blackboard)
    14.         {
    15.             for (var i = 0; i < outConnections.Count; i++)
    16.             {
    17.                 outConnections[i].Execute(agent, blackboard);
    18.             }
    19.             status = Status.Success;
    20.             return Status.Success;
    21.         }
    22.  
    23.  
    24.     }
    25. }
    It simply runs all of its children and returns success, please note I created my own Icon so "NCParallel" wont work for you.

    Best of luck and I hope this helps!
     
    nuverian likes this.
  30. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    Thanks @JakeTBear for the confirmation that I wasn't crazy. :)

    I woke up this morning thinking I'd create my own as well. So, I appreciate the head start!
     
  31. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    If anyone is interested, I created "Tandem" (so as to not confuse it with the normal Parallel). It will sub-nodes in in true parallel. Meaning each child will run every frame. It supports the OnExecute as well as OnUpdate.

    Returns "Running" if any child is running (and will reset those children that have finished)
    Returns "Failure" if any child fails
    Returns "Success" if all children return success in that frame

    Code (CSharp):
    1. using System.Collections.Generic;
    2. using UnityEngine;
    3. using NodeCanvas.Framework;
    4. using ParadoxNotion.Design;
    5.  
    6. namespace NodeCanvas.BehaviourTrees
    7. {
    8.     [Description("Execute all child nodes once each frame. If all child nodes succeed, this succeeds. If one child node fails, this fails. Child nodes will reset until they all succeed in the same frame.")]
    9.     [Category("Composites")]
    10.     [Icon("Parallel")]
    11.     public class Tandem : BTComposite
    12.     {
    13.         // Record those indices
    14.         private readonly List<int> mFinishedIndices = new List<int>();
    15.  
    16.         /// <summary>
    17.         /// Called each frame
    18.         /// </summary>
    19.         protected override Status OnExecute(Component agent, IBlackboard blackboard)
    20.         {
    21.             Status lFinalStatus = Status.Success;
    22.  
    23.             // Process each connection
    24.             mFinishedIndices.Clear();
    25.             for (var i = 0; i < outConnections.Count; i++)
    26.             {
    27.                 Status lConnectionStatus = outConnections[i].Execute(agent, blackboard);
    28.  
    29.                 // Any failure immediately forces a failure
    30.                 if (lConnectionStatus == Status.Failure)
    31.                 {
    32.                     return Status.Failure;
    33.                 }
    34.                 // Record a success to restart if needed
    35.                 else if (lConnectionStatus == Status.Success)
    36.                 {
    37.                     mFinishedIndices.Add(i);
    38.                 }
    39.             }
    40.  
    41.             // If all the connections report success, we can simply stop. Otherwise,
    42.             // we need to restart the finished ones and flag running
    43.             if (mFinishedIndices.Count < outConnections.Count)
    44.             {
    45.                 lFinalStatus = Status.Running;
    46.                 for (int i = 0; i < mFinishedIndices.Count; i++)
    47.                 {
    48.                     outConnections[mFinishedIndices[i]].Reset();
    49.                 }
    50.             }
    51.  
    52.             // Return our final status
    53.             return lFinalStatus;
    54.         }
    55.     }
    56. }
    Thanks again @JakeTBear
     
    nuverian likes this.
  32. JakeTBear

    JakeTBear

    Joined:
    Feb 15, 2014
    Posts:
    123
    @Tryz Thats very cool! I required my behaviors to run even on failure, but I created something similar that instead of looking for failure it looks for running and returns running immediately, also thanks for sharing :)!
     
    Tryz likes this.
  33. nuverian

    nuverian

    Joined:
    Oct 3, 2011
    Posts:
    2,087
    Hey guys :)
    @Tryz & @JakeTBear

    Based on your suggestions and requirements, I went ahead and modified the Parallel node. So, the differences are as follows:
    • All child nodes will now execute at least once before the parallel returns anything.
    • If set to Dynamic, finished child nodes are now being reset and repeated.
    • If the above takes place (repeated children), and the parallel policy (First Success, First Failure) is not met, the parallel will return the acording Status only after all child nodes have been completed (returned Success or Failure) at least once in the parallel's life cycle.

    ParallelChange.png
    So basically, in the above example, the 1st action will execute a total of 5 times, the 2nd action will repeat per frame and the 3rd action will execute only once since it's the longest action here. After that, the parallel will return Success, since it's set to First Failure and no action returns Failure here.

    I have attached the new Parallel node bellow. Let me know if this works for your cases and also thanks for sharing your nodes and suggestions! :)

    Cheers!
     

    Attached Files:

    Last edited: Jan 14, 2016
    JakeTBear and Tryz like this.
  34. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    Awesome! Thank you. I'll let you know how things go. :)
     
  35. Greenwar

    Greenwar

    Joined:
    Oct 11, 2014
    Posts:
    54
    Hey Nuverian,

    Just decided to check this asset out, loving it so far.
    However one thing worries me.

    I wrote my own condition task and assigned it within the editor. When i decided to delete the .cs file later on the whole asset reference got cleared and the editor threw a deserialization error (this is with 2.4.1).

    The error is understandable since it is referencing something that doesnt exist anymore, but I'd suggest that the condition node reverts to a placeholder wrapper instead of clearing the entire project, if possible.

    Right now messing with custom task files seems...risky
     
    Last edited: Jan 18, 2016
  36. nuverian

    nuverian

    Joined:
    Oct 3, 2011
    Posts:
    2,087
    Hey,
    Thanks! I'm glad you like NodeCanvas :)
    Actually, deserializing into a missing task/node if the type is not found/removed and fully recovering back to it again if found at a later point IS possible, but I just noticed that the last version has a bug that prevents that from happening due to some change I did. I've just PMed you the latest version which has this bug fixed :)

    MissingTask.png

    Thanks for pointing this out.
    Cheers!
     
  37. Greenwar

    Greenwar

    Joined:
    Oct 11, 2014
    Posts:
    54
    That was quick. Works great. Thanks!
     
    nuverian likes this.
  38. nuverian

    nuverian

    Joined:
    Oct 3, 2011
    Posts:
    2,087
    I just saw this video by the Unity asset store team and I'm very glad to see that NodeCanvas is being used in P.A.M.E.L.A :) A game that I was actually already been looking forward to play!

     
    Last edited: Jan 18, 2016
  39. BigToe

    BigToe

    Joined:
    Nov 1, 2010
    Posts:
    208
    Great product! Quick question on FSM workflow. I am coming from writing my own FSMs and am trying to adjust to using a visual FSM.

    When writing my own FSM, I would have 3 actions in a state. Enter, Update and Exit. My state's update was executed via a coroutine. I am trying to accomplish something similar with NC, which may not be the best practice.

    I would like to run some actions on enter, repeat some actions on update, and call some actions when I leave the state. Currently the Action state allows you to either repeat all the state actions or none of them. Since the repeating option applies to all the actions I am unable to specify that there are one time enter actions, repeating update actions and one time exit actions.

    So should I change my mindset of how to use NC FSM, or should I pursue an option like creating a custom FSM node that visually implements Enter, Update and Exit? (Not totally sure if this is possible)
     
  40. BigToe

    BigToe

    Joined:
    Nov 1, 2010
    Posts:
    208
    Also, if I use ScriptControl to start a coroutine, what is the best way to stop that coroutine when I leave the state? Currently NC appears to end the coroutine automatically if a transition condition is met, but when I return back to the state for the first time, the coroutine doesn't start again. It will start again when I come back the second time though.
     
  41. nuverian

    nuverian

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

    Indeed there are no seperate action lists for each of Enter, Update and Exit. Instead, each action respectively handles what happens on Enter, Update and Exit on it's own. So if you are writing your custom actions, OnExecute coresponds to Enter, OnUpdate coresponds to Update and OnStop coresponds to Exit for example.

    The reason that there are no seperate action lists for each of these "callbacks" in the action state, is that it doesn't make much sense if for example you were to add an action that takes time to complete in the OnExit callback and would result in the action still running even though it's state has exited.

    Having said that, I have created a state with different action lists for each callback a while ago for someone else which you can find attached in this post. I'm not sure yet if I include this state in the package though, so it's best if you can keep it somewhere safe in your project :)
    SuperActionState.png

    This is a bug in the ExecuteFunction.cs script control tasks. To fix this quickly, please open ExecuteFunction.cs and change line #121 to look like this:
    Code (CSharp):
    1.             if (routineRunning){
    2.                 EndAction();
    3.             }
    (If you are using the Multiplatform version, this is located at line #93)

    Thanks!
     

    Attached Files:

  42. BigToe

    BigToe

    Joined:
    Nov 1, 2010
    Posts:
    208
    Wow! Thanks so much for the quick reply with great solutions. I'll definitely put a little more thought into whether I should use the super action state, but right now I certainly like the option especially for actions I am calling via Script Control.
     
    nuverian likes this.
  43. nuverian

    nuverian

    Joined:
    Oct 3, 2011
    Posts:
    2,087
    You are very welcome :)
     
  44. sanpats

    sanpats

    Joined:
    Aug 24, 2011
    Posts:
    343
    Hi @nuverian

    Unity 5.4 don't allow Application.isPlaying to be called during Serialization such as in Blackboard.cs & Graph.cs
     
  45. nuverian

    nuverian

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

    Thanks. I will remove that. Feel free to remove it from the source if you want now as well.
    Cheers!
     
  46. sanpats

    sanpats

    Joined:
    Aug 24, 2011
    Posts:
    343
    Is it not important?
     
  47. nuverian

    nuverian

    Joined:
    Oct 3, 2011
    Posts:
    2,087
    They kind of were some version back but not really anymore. You can safely remove the lines.
    Thanks.
     
  48. nuverian

    nuverian

    Joined:
    Oct 3, 2011
    Posts:
    2,087
    Hello everyone! The new version 2.4.2 is now online on the asset store. Here are the changes:
    • Blackboard Variables can now also be bound to fields!
    • Auto-Cast, allows Parameters to be linked to Variables of assignable types. Simply put, you can now link a Vector3 Parameter to a GameObject or Transform Variable directly to get it's position, without going through needless GetPosition nodes for example!
    • BT Composite and Decorator nodes now have "Replace" option in their context menu, to replace them while keeping all connections intact.
    • BT Parallel node is improved to automaticaly repeat it's child nodes if it's set to Dynamic.
    • Added a new connection style preference, "Straight Lines".
    • Added the missing "Set Other Blackboard Variable" action task.
    • Added GreaterOrEqual and LessOrEqual to the comparison methods used in tasks.
    • Fixed iOS error.
    • Fixed deserialization recovery from missing task and node types.
    Cheers!
     
    sanpats likes this.
  49. Evgeny-Eliseev

    Evgeny-Eliseev

    Joined:
    Jan 21, 2015
    Posts:
    19
    We have some problems with execution nodecanvas in Windows Store Platform (Use Net Core).

    I tried to switch nodecanvas to last version (2.3.8 -> 2.4.2). But it's not even compilable for WinStore :)
     
  50. nuverian

    nuverian

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

    Can you please let me know of the issues, or any relevant logs?
    Thanks