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,051
    Hey,
    The FindClosestWithTag action, excludes the agent (self) already. Does your FindClosestWithTag.cs file has the following code at line #34?
    Code (CSharp):
    1.                 if (go == agent.gameObject){
    2.                     continue;
    3.                 }
    Thanks

    Hey,
    There are some example scenes as a learning material for BehaviourTrees which you can download online. They are not games, but rather learning examples to see how different BT elements work together.
    Also, if you are new to behaviour trees, this online article is great at explaining them and I really recommend a read on this. And of course, feel free to ask if I can help you in any way and I will be happy to do so :)
    Thanks.
     
  2. Der_Kevin

    Der_Kevin

    Joined:
    Jan 2, 2013
    Posts:
    507
    ah, oh. i should have been more accurate with my question. sorry :)
    so my Hierarchie looks like this:
    puppetmaster_nodecanvas.gif

    the FSM is on my "Character Controller". but i can also move it up to the "Third Person" GO. so the parent.
    the GO "mixamorig_Head" has the Tag "Head"
    in my FSM the Start Action says "Find closes with Tag" - Search Tag: Head
     
  3. zenGarden

    zenGarden

    Joined:
    Mar 30, 2013
    Posts:
    4,538
    This is not how it works.
    Many plugin authors like Playmaker , Nottorus and others made video tutorials on how to use their plugin lot of users didn't know FSM, but seeing what was possible they wanted to learn.
    If you don't put video examples you won't attract new people, and that won't help your plugin in the long run.

    Anyway, i think this is a minimum requirement when your plugin is sold above 50$.
     
    ZiadJ likes this.
  4. nuverian

    nuverian

    Joined:
    Oct 3, 2011
    Posts:
    2,051
    Hey,
    The FindClosestWithTag action, refers to distance in world units. By your answer above I am assuming you were expecting closest in hierarchy? Otherwise I am not really sure why you brought the hierarchy up :)
    Let me know.

    I don't think there is a standard by how things work and I'm sorry that it does not for you the way as it stands now.
    Due to language barrier, I think that well written documentation is just better than non-voice over videos for education, unless it is simply a demonstration/promotional one which is different. I am already looking after possible solutions though. The price point is really about the software and support, with both being there consistently from day one.
    I hope that you understand and thanks for your input on the subject.
     
  5. Der_Kevin

    Der_Kevin

    Joined:
    Jan 2, 2013
    Posts:
    507
    okay, maybe this clears my problem more.

    nodecanvas_findclosest.jpg

    i wanna search for the closest head (GO with Tag Head)
    the problem is, that i always find my own Head, and not the other :D
     
  6. BTables

    BTables

    Joined:
    Jan 18, 2014
    Posts:
    55
    Hi Nuverian,

    I am keen to catch up with you regarding licencing for mod users, I sent a couple of emails to the support address but haven't heard back.

    If there is a better address to get you on, please hit me up: spencer... at ...bankrollstudios.com
     
  7. nuverian

    nuverian

    Joined:
    Oct 3, 2011
    Posts:
    2,051
    Hey,
    I have attached for you here a modified version of the action with the option to ignore children gameobjects.
    Let me know if that works for you.
    Cheers

    Hello,
    I have now replied to your email. Let me know.
    Thanks.
     

    Attached Files:

    Der_Kevin likes this.
  8. ZiadJ

    ZiadJ

    Joined:
    Sep 3, 2011
    Posts:
    59
    I'm trying to implement a coach AI whose purpose is to train the player during the initial steps of the game. Basically it should provide a brief explanation and then tell the player to carry out specific tasks on certain gameobjects. It would then then check the object states, within a specific period of time, to confirm that the tasks were carried out properly and in the right order. Then it would move on to the next task or else, upon failure, it would start over again. So the dialogues will be mostly from the coach to the player only.

    However, being new to NodeCanvas, I'm a bit confused on how to get this done. Dialogue trees seem to be a natural fit here but the flow seems to rely solely on the player clicks. Ideally this should be done automatically based on player actions rather and the only workaround I can think of is to use BTs for monitoring them and then trigger the appropriate dialogues and animations from there. Something's telling me there must be a better way still. Any recommendations would be highly appreciated.
     
    Last edited: Jun 26, 2016
  9. Der_Kevin

    Der_Kevin

    Joined:
    Jan 2, 2013
    Posts:
    507
    works perfect as always :) thank you very much :)
     
  10. nuverian

    nuverian

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

    Using Dialogue Trees could be used for a decision based approach. After all NC Dialogue Trees are similar to decision trees. Have you tried using the Condition or Multiple Condition nodes? Using these two, you can split the flow based on any condition task available (or custom created), although the check is done instantly. What I mean by that, is that the node does not wait for the condition to become true, but it is rather checked immediately when the node is called. I could if that helps you, create a special condition node (Wait Until) that waits for the condition assigned to become true before continuing to the next node. It sounds useful. Let me know if that is something you require.

    On the other hand, if you want to separate the AI into states and progress from one to another, then probably an FSM would be a good fit as well. Some people I know have already used NC FSMs to create quest progression which is similar to what I understand from your description.

    Let me know what you think.
    Thanks.

    You are very welcome :)
     
  11. Der_Kevin

    Der_Kevin

    Joined:
    Jan 2, 2013
    Posts:
    507
    Have you tried this action inside flowcanvas? I have this right behind a on update node but it only finds the nearest tag on startup it seams. With ignore child true btw

    edit: i think its caused by the weird hierarchy of my character. will test something, in the meantime. ignore this question :D

    ok, i have to ignore a specific Gameobject and its childs to make it work.
    so i created this new BBParameter: publicBBParameter<Transform>ignore;
    and addet this:
    Code (CSharp):
    1. if (ignoreChildren.value && go.transform.IsChildOf(agent)){
    2.                     continue;
    3.                 }
    4.                 if (ignoreChildren.value && go.transform.IsChildOf(ignore)){
    5.                     continue;
    6.                 }
    but then i get
    Code (CSharp):
    1. FindClosestWithTag.cs(46,74): error CS1503: Argument `#1' cannot convert `NodeCanvas.Framework.BBParameter<UnityEngine.Transform>' expression to type `UnityEngine.Transform'
    edit2: when i change publicBBParameter<Transform>ignore;
    to publicTransform ignore; it works but i cant use BB variables - but for now it works, thats what matters :D
     
    Last edited: Jun 28, 2016
  12. nuverian

    nuverian

    Joined:
    Oct 3, 2011
    Posts:
    2,051

    Hey,
    When using BBParameters, you should get/set it's value through the .value property.

    So for example, instead of doing this:
    go.transform.IsChildOf(ignore)

    You should do this:
    go.transform.IsChildOf(ignore.value)

    :)
     
    Der_Kevin likes this.
  13. Dan_lala

    Dan_lala

    Joined:
    May 14, 2015
    Posts:
    42
    Hi,

    I finally purchased NodeCanvas :) I have a question though, even if you might not like it :)

    How well does this integrate with Dialogue System from Pixelcrushers? I just think it has more options than the included Dialogue tree (localization, xml/csv...). Are there just some node actions missing that I would need to setup or how would I achieve that?
     
  14. nuverian

    nuverian

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

    Thanks a lot for getting NodeCanvas!

    Well, there is no integration available with PixeCrushers Dialogue System since NodeCanvas includes a Dialogue Tree system. With that said though, I really don't have a problem creating some actions for it since I don't consider PixelCrushers a competitor. So, let me know what actions you are after. :)

    Cheers.
     
  15. Dan_lala

    Dan_lala

    Joined:
    May 14, 2015
    Posts:
    42
    Awesome, thanks! Going to check out the Dialogue Tree system first a bit to see how far I can get with this :)
     
  16. Danirey

    Danirey

    Joined:
    Apr 3, 2013
    Posts:
    520
    Hi there!

    I've found a problem after updating another asset. this is what i get:

    <b>(Deserialization Error)</b>: The classes in the module cannot be loaded.
    at (wrapper managed-to-native) System.Reflection.Assembly:GetTypes (bool)

    and

    Can't Load graph, cause of different Graph type serialized and required
    UnityEngine.Debug:LogError(Object)
    NodeCanvas.Framework.Graph:LoadGraphData(GraphSerializationData, Boolean) (at Assets/ParadoxNotion/NodeCanvas/Framework/Runtime/Graphs/Graph.cs:158)
    NodeCanvas.Framework.Graph:Deserialize(String, Boolean, List`1) (at Assets/ParadoxNotion/NodeCanvas/Framework/Runtime/Graphs/Graph.cs:132)
    NodeCanvas.Framework.Graph:OnAfterDeserialize() (at Assets/ParadoxNotion/NodeCanvas/Framework/Runtime/Graphs/Graph.cs:63)
    UnityEngine.Object:Instantiate(Graph)
    NodeCanvas.Framework.Graph:Clone(Graph) (at Assets/ParadoxNotion/NodeCanvas/Framework/Runtime/Graphs/Graph.cs:90)
    NodeCanvas.Framework.GraphOwner:GetInstance(Graph) (at Assets/ParadoxNotion/NodeCanvas/Framework/Runtime/Graphs/GraphOwner.cs:92)
    NodeCanvas.Framework.GraphOwner:Awake() (at Assets/ParadoxNotion/NodeCanvas/Framework/Runtime/Graphs/GraphOwner.cs:133)


    I can't find where is the problem. But all blackboards and FSM/BT are missing in the editor.

    Any idea?

    Cheers!
     
  17. Ludiq

    Ludiq

    Joined:
    Mar 6, 2015
    Posts:
    624
    Hi Nuverian!

    I have an issue where the references in a custom action node are sometimes reset to null. I'm not sure when or why it happens, but sometimes, I try playing my scene and I get null references from the FSM.

    Can you tell me if you see some issue with my custom action node? Here is the code for it:

    ("sync.value" is what gets reset to null)

    Code (CSharp):
    1. using NodeCanvas.Framework;
    2. using ParadoxNotion.Design;
    3.  
    4. namespace MyProject.Nodes
    5. {
    6.     [Category("Animation")]
    7.     [Icon("Animation")]
    8.     public class PlaySync : ActionTask
    9.     {
    10.         protected override string info
    11.         {
    12.             get
    13.             {
    14.                 var info = "Play Sync";
    15.  
    16.                 if (sync.value != null)
    17.                 {
    18.                     info += $" <b>{sync.value.name}</b>";
    19.                 }
    20.  
    21.                 return info;
    22.             }
    23.         }
    24.  
    25.         public BBParameter<Sync> sync;
    26.         public BBParameter<Character[]> characters;
    27.  
    28.         protected override void OnExecute()
    29.         {
    30.             sync.value.Play(characters.value, EndAction);
    31.         }
    32.     }
    33. }
     
  18. nuverian

    nuverian

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

    Everything is fine with your custom action, but if you are using an Asset rather than a Bound graph, then by Unity standards, asset files can't have scene object references. Are you using an Asset graph?
    The way around this is to either Bind the graph, or in case you don't want to, link task parameters to Blackboard Variables instead of direct assignments within tasks.

    Let me know if that works for you.
    Thanks!
     
  19. FelixTwoMenAndADog

    FelixTwoMenAndADog

    Joined:
    Nov 11, 2015
    Posts:
    3
    Hi!

    First of all - as you probably noticed - your Forum is completely unreachable at the moment.

    Other suggestions:

    - Use string hashes for the FSM state names, like Mecanim does. I don't want to be comparing strings all the time if I have to check from code what state I am in.
    - Provide a better possibility for callbacks within the FSM. OnEnter/Exit/Update that gets called on the Monobehaviour for every state in the fsm is kind of missing the point. I don't want to be checking (again, strings) within those callbacks. If state == x, if state == y etc.)
    --> you could call specific methods on your script of course, using execute function actions, but still
    - rename your callbacks - right now you get an exception when you have an FSM and Mecanim states with state machine behaviours on the samge gameobject since NodeCanvas thinks the OnStateEnter etc methods of the state machine behaviour are supposed to be callbacks for it (they have the same name but of course wrong signature)
     
  20. Ludiq

    Ludiq

    Joined:
    Mar 6, 2015
    Posts:
    624
    I can't use an asset graph because I need the scene references. However, I figured how/why it happens: if my actions are defined in a project that doesn't compile, they'll get reset, even after I fix the compilation error. It's as if it didn't keep the serialized data when the node code isn't working. That occurs even if the Canvas window is closed when compilation fails.

    This is incredibly bad, because if we miss a semicolon even once, we'll have to redo all of our state machines.

    Could you provide a fix soon? I can try to help you debug if you need more info, but this is urgent for us.
     
    Last edited: Jul 14, 2016
  21. nuverian

    nuverian

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

    The forums are now working. There was probably a small downtime by the hosting service.

    I have just fixed the issue that Animator state behaviour callbacks were called from NodeCanvas. There is no renaming required and I can tell you how to fix this now if you want. Thanks for pointing this out.

    Also thanks for the rest of the suggestions. Regarding our 2nd point specifically, what other possibilities are you suggesting?


    Hey,

    Are you using the latest version of NodeCanvas from the asset store? This was a bug introduced at a previous version and fixed in v2.5.6. If not, please update to the last version. If yes, please let me know how to reproduce this.

    Thanks.
     
  22. FelixTwoMenAndADog

    FelixTwoMenAndADog

    Joined:
    Nov 11, 2015
    Posts:
    3
    Hi,

    regarding my second point: Right now I can work with calling methods on my scripts directly that are called "OnJumpEnter" etc. ... for example.

    Please implement the string hash functionality. Specifically onUpdate checking strings is not sth. I like to do :).

    Also nice would be the possibility to be able to set mecanim parameters using string hashes. I think I could also code that myself, but it's kind of error prone to be typing in strings everywhere.

    Thanks for your quick answer - now that the Forums are working again I going back to posting there :)

    Cheers!

    p.s.: can you please tell me how to fix the callback thing without renaming?
     
    Last edited: Jul 15, 2016
  23. Ludiq

    Ludiq

    Joined:
    Mar 6, 2015
    Posts:
    624
    Upadted to v.2.5.6, now getting this error (many times) and everything is still reset:

    Code (CSharp):
    1. [Error] <b>(Deserialization Error)</b>: Object type Ephemeres.Characters.Elle cannot be converted to target type: Ephemeres.Cinematics.Sync
    2. Parameter name: val
    3. 0. MonoField.SetValue()
    4. 1. FieldInfo.SetValue()
    5. 2. ParadoxNotion.Serialization.FullSerializer.Internal.fsMetaProperty.Write()
    6. 3. ParadoxNotion.Serialization.FullSerializer.Internal.fsReflectedConverter.TryDeserialize()
    7. 4. ParadoxNotion.Serialization.FullSerializer.fsSerializer.InternalDeserialize_5_Converter()
    8. 5. ParadoxNotion.Serialization.FullSerializer.fsSerializer.InternalDeserialize_4_Cycles()
    9. 6. ParadoxNotion.Serialization.FullSerializer.fsSerializer.InternalDeserialize_3_Inheritance()
    10. 7. ParadoxNotion.Serialization.FullSerializer.fsSerializer.InternalDeserialize_1_CycleReference()
    11. 8. ParadoxNotion.Serialization.FullSerializer.fsSerializer.TryDeserialize()
    12. 9. ParadoxNotion.Serialization.FullSerializer.fsSerializer.TryDeserialize() at Assets/Plugins/NodeCanvas/Framework/_Commons/Runtime/Serialization/Full Serializer/fsSerializer.cs:695
    13. 10. ParadoxNotion.Serialization.FullSerializer.Internal.fsReflectedConverter.TryDeserialize() at Assets/Plugins/NodeCanvas/Framework/_Commons/Runtime/Serialization/Full Serializer/Converters/fsReflectedConverter.cs:88
    14. 11. ParadoxNotion.Serialization.FullSerializer.fsSerializer.InternalDeserialize_5_Converter() at Assets/Plugins/NodeCanvas/Framework/_Commons/Runtime/Serialization/Full Serializer/fsSerializer.cs:860
    15. 12. ParadoxNotion.Serialization.FullSerializer.fsSerializer.InternalDeserialize_4_Cycles() at Assets/Plugins/NodeCanvas/Framework/_Commons/Runtime/Serialization/Full Serializer/fsSerializer.cs:852
    16. 13. ParadoxNotion.Serialization.FullSerializer.fsSerializer.InternalDeserialize_3_Inheritance() at Assets/Plugins/NodeCanvas/Framework/_Commons/Runtime/Serialization/Full Serializer/fsSerializer.cs:831
    17. 14. ParadoxNotion.Serialization.FullSerializer.fsSerializer.InternalDeserialize_1_CycleReference() at Assets/Plugins/NodeCanvas/Framework/_Commons/Runtime/Serialization/Full Serializer/fsSerializer.cs:723
    18. 15. ParadoxNotion.Serialization.FullSerializer.fsSerializer.TryDeserialize() at Assets/Plugins/NodeCanvas/Framework/_Commons/Runtime/Serialization/Full Serializer/fsSerializer.cs:685
    19. 16. ParadoxNotion.Serialization.FullSerializer.fsSerializer.TryDeserialize() at Assets/Plugins/NodeCanvas/Framework/_Commons/Runtime/Serialization/Full Serializer/fsSerializer.cs:659
    20. 17. ParadoxNotion.Serialization.FullSerializer.Internal.fsIEnumerableConverter.TryDeserialize() at Assets/Plugins/NodeCanvas/Framework/_Commons/Runtime/Serialization/Full Serializer/Converters/fsIEnumerableConverter.cs:72
    21. 18. ParadoxNotion.Serialization.FullSerializer.fsSerializer.InternalDeserialize_5_Converter() at Assets/Plugins/NodeCanvas/Framework/_Commons/Runtime/Serialization/Full Serializer/fsSerializer.cs:860
    22. 19. ParadoxNotion.Serialization.FullSerializer.fsSerializer.InternalDeserialize_4_Cycles() at Assets/Plugins/NodeCanvas/Framework/_Commons/Runtime/Serialization/Full Serializer/fsSerializer.cs:852
    23. 20. ParadoxNotion.Serialization.FullSerializer.fsSerializer.InternalDeserialize_3_Inheritance() at Assets/Plugins/NodeCanvas/Framework/_Commons/Runtime/Serialization/Full Serializer/fsSerializer.cs:831
    24. 21. ParadoxNotion.Serialization.FullSerializer.fsSerializer.InternalDeserialize_1_CycleReference() at Assets/Plugins/NodeCanvas/Framework/_Commons/Runtime/Serialization/Full Serializer/fsSerializer.cs:723
    25. 22. ParadoxNotion.Serialization.FullSerializer.fsSerializer.TryDeserialize() at Assets/Plugins/NodeCanvas/Framework/_Commons/Runtime/Serialization/Full Serializer/fsSerializer.cs:685
    26. 23. ParadoxNotion.Serialization.FullSerializer.Internal.fsReflectedConverter.TryDeserialize() at Assets/Plugins/NodeCanvas/Framework/_Commons/Runtime/Serialization/Full Serializer/Converters/fsReflectedConverter.cs:88
    27. 24. ParadoxNotion.Serialization.FullSerializer.fsSerializer.InternalDeserialize_5_Converter() at Assets/Plugins/NodeCanvas/Framework/_Commons/Runtime/Serialization/Full Serializer/fsSerializer.cs:860
    28. 25. ParadoxNotion.Serialization.FullSerializer.fsSerializer.InternalDeserialize_4_Cycles() at Assets/Plugins/NodeCanvas/Framework/_Commons/Runtime/Serialization/Full Serializer/fsSerializer.cs:852
    29. 26. ParadoxNotion.Serialization.FullSerializer.fsSerializer.InternalDeserialize_3_Inheritance() at Assets/Plugins/NodeCanvas/Framework/_Commons/Runtime/Serialization/Full Serializer/fsSerializer.cs:831
    30. 27. ParadoxNotion.Serialization.FullSerializer.fsSerializer.InternalDeserialize_1_CycleReference() at Assets/Plugins/NodeCanvas/Framework/_Commons/Runtime/Serialization/Full Serializer/fsSerializer.cs:723
    31. 28. ParadoxNotion.Serialization.FullSerializer.fsSerializer.TryDeserialize() at Assets/Plugins/NodeCanvas/Framework/_Commons/Runtime/Serialization/Full Serializer/fsSerializer.cs:685
    32. 29. ParadoxNotion.Serialization.FullSerializer.Internal.fsReflectedConverter.TryDeserialize() at Assets/Plugins/NodeCanvas/Framework/_Commons/Runtime/Serialization/Full Serializer/Converters/fsReflectedConverter.cs:88
    33. 30. ParadoxNotion.Serialization.FullSerializer.fsSerializer.InternalDeserialize_5_Converter() at Assets/Plugins/NodeCanvas/Framework/_Commons/Runtime/Serialization/Full Serializer/fsSerializer.cs:860
    34. 31. ParadoxNotion.Serialization.FullSerializer.fsSerializer.InternalDeserialize_4_Cycles() at Assets/Plugins/NodeCanvas/Framework/_Commons/Runtime/Serialization/Full Serializer/fsSerializer.cs:852
    35. 32. ParadoxNotion.Serialization.FullSerializer.fsSerializer.InternalDeserialize_3_Inheritance() at Assets/Plugins/NodeCanvas/Framework/_Commons/Runtime/Serialization/Full Serializer/fsSerializer.cs:831
    36. 33. ParadoxNotion.Serialization.FullSerializer.fsSerializer.InternalDeserialize_1_CycleReference() at Assets/Plugins/NodeCanvas/Framework/_Commons/Runtime/Serialization/Full Serializer/fsSerializer.cs:723
    37. 34. ParadoxNotion.Serialization.FullSerializer.fsSerializer.TryDeserialize() at Assets/Plugins/NodeCanvas/Framework/_Commons/Runtime/Serialization/Full Serializer/fsSerializer.cs:685
    38. 35. ParadoxNotion.Serialization.FullSerializer.fsSerializer.TryDeserialize() at Assets/Plugins/NodeCanvas/Framework/_Commons/Runtime/Serialization/Full Serializer/fsSerializer.cs:659
    39. 36. ParadoxNotion.Serialization.FullSerializer.Internal.fsIEnumerableConverter.TryDeserialize() at Assets/Plugins/NodeCanvas/Framework/_Commons/Runtime/Serialization/Full Serializer/Converters/fsIEnumerableConverter.cs:72
    40. 37. ParadoxNotion.Serialization.FullSerializer.fsSerializer.InternalDeserialize_5_Converter() at Assets/Plugins/NodeCanvas/Framework/_Commons/Runtime/Serialization/Full Serializer/fsSerializer.cs:860
    41. 38. ParadoxNotion.Serialization.FullSerializer.fsSerializer.InternalDeserialize_4_Cycles() at Assets/Plugins/NodeCanvas/Framework/_Commons/Runtime/Serialization/Full Serializer/fsSerializer.cs:852
    42. 39. ParadoxNotion.Serialization.FullSerializer.fsSerializer.InternalDeserialize_3_Inheritance() at Assets/Plugins/NodeCanvas/Framework/_Commons/Runtime/Serialization/Full Serializer/fsSerializer.cs:831
    43. 40. ParadoxNotion.Serialization.FullSerializer.fsSerializer.InternalDeserialize_1_CycleReference() at Assets/Plugins/NodeCanvas/Framework/_Commons/Runtime/Serialization/Full Serializer/fsSerializer.cs:723
    44. 41. ParadoxNotion.Serialization.FullSerializer.fsSerializer.TryDeserialize() at Assets/Plugins/NodeCanvas/Framework/_Commons/Runtime/Serialization/Full Serializer/fsSerializer.cs:685
    45. 42. ParadoxNotion.Serialization.FullSerializer.Internal.fsReflectedConverter.TryDeserialize() at Assets/Plugins/NodeCanvas/Framework/_Commons/Runtime/Serialization/Full Serializer/Converters/fsReflectedConverter.cs:88
    46. 43. ParadoxNotion.Serialization.FullSerializer.fsSerializer.InternalDeserialize_5_Converter() at Assets/Plugins/NodeCanvas/Framework/_Commons/Runtime/Serialization/Full Serializer/fsSerializer.cs:860
    47. 44. ParadoxNotion.Serialization.FullSerializer.fsSerializer.InternalDeserialize_4_Cycles() at Assets/Plugins/NodeCanvas/Framework/_Commons/Runtime/Serialization/Full Serializer/fsSerializer.cs:852
    48. 45. ParadoxNotion.Serialization.FullSerializer.fsSerializer.InternalDeserialize_3_Inheritance() at Assets/Plugins/NodeCanvas/Framework/_Commons/Runtime/Serialization/Full Serializer/fsSerializer.cs:831
    49. 46. ParadoxNotion.Serialization.FullSerializer.fsSerializer.InternalDeserialize_1_CycleReference() at Assets/Plugins/NodeCanvas/Framework/_Commons/Runtime/Serialization/Full Serializer/fsSerializer.cs:723
    50. 47. ParadoxNotion.Serialization.FullSerializer.fsSerializer.TryDeserialize() at Assets/Plugins/NodeCanvas/Framework/_Commons/Runtime/Serialization/Full Serializer/fsSerializer.cs:685
    51. 48. ParadoxNotion.Serialization.FullSerializer.fsSerializer.TryDeserialize() at Assets/Plugins/NodeCanvas/Framework/_Commons/Runtime/Serialization/Full Serializer/fsSerializer.cs:659
    52. 49. ParadoxNotion.Serialization.JSONSerializer.Deserialize() at Assets/Plugins/NodeCanvas/Framework/_Commons/Runtime/Serialization/JSONSerializer.cs:87
    53. 50. ParadoxNotion.Serialization.JSONSerializer.Deserialize() at Assets/Plugins/NodeCanvas/Framework/_Commons/Runtime/Serialization/JSONSerializer.cs:61
    54. 51. NodeCanvas.Framework.Graph.Deserialize() at Assets/Plugins/NodeCanvas/Framework/Runtime/Graphs/Graph.cs:131
    55. 52. NodeCanvas.Framework.Graph.OnAfterDeserialize() at Assets/Plugins/NodeCanvas/Framework/Runtime/Graphs/Graph.cs:63
    56.  
     
  24. nuverian

    nuverian

    Joined:
    Oct 3, 2011
    Posts:
    2,051
    Hey,
    Sure. To fix the callbacks, please open up FSM.cs and change lines #179-181 to look like this:
    Code (CSharp):
    1.                 var args = new System.Type[]{typeof(IState)};
    2.                 var enterMethod = mono.GetType().RTGetMethod("OnStateEnter", args);
    3.                 var stayMethod = mono.GetType().RTGetMethod("OnStateUpdate", args);
    4.                 var exitMethod = mono.GetType().RTGetMethod("OnStateExit", args);
    Regarding the mecanim parameters set, are you referring to the included actions for setting those parameters?

    Cheers!

    Hello,

    Hmm, Is there any relation of the "Ephemeres.Characters.Elle" and "Ephemeres.Cinematics.Sync" types and when does this error comes up? Does this happen only when using your custom action posted above? Also, is there the possibility for you at all to send me the files to check out better what's going wrong and why?

    Thanks!
     
  25. Schazzwozzer

    Schazzwozzer

    Joined:
    Jul 27, 2012
    Posts:
    18
    Hi Nuverian,

    I'm a NodeCanvas Lite user, and I'm finding that I can't access the Preferred Types Editor. There is no "NodeCanvas" or "Preferred Types Editor" option in the Windows menu, or any other way to access it that I can find.

    Is the Preferred Types Editor intentionally not included with NodeCanvas Lite, or does this sound like a bug of some sort?
     
  26. nuverian

    nuverian

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

    Indeed, the Preferred Types Editor window is not included in the NodeCanvas "Lite" version, but it is rather a full version only feature. You can though still add/remove types to the preferred types list using the UserTypePrefs class API through code, specifically using the UserTypePrefs.SetPreferedTypesList(List<Type> types). So the ability to customize the preferred types is still there in the Lite version, but without the editor window available in the full version only.

    Let me know if that works for you, or if you want a code example on how to customize the types list.
    Thanks!
     
  27. TSabos

    TSabos

    Joined:
    Mar 8, 2015
    Posts:
    90
    Anyone mind giving a really quick bullet idea of utilizing Node for monster AI as far as re-usability? We have a basic Enemy AI tree that works pretty well, but if we need to add things like "Leap attack on first encounter" this is custom and not sure how to approach. Also, for boss AI that is very custom.. I assume people simply make an entirely new tree for every boss? I know tasks should be used and custom code for re-usability, but the tree part is the thing I'm hung up on and whether or not to just make entirely new tree assets per monster. Lot of work.
     
  28. Marble

    Marble

    Joined:
    Aug 29, 2005
    Posts:
    1,216
    You could build a single tree and then have it behave differently depending on the blackboard it's attached to, which might contain AI variables like how bold the monster is, how many times it's encountered the player, how aggressive it is, etc. Save your AI graph as an asset and then reuse it for a lot of different monsters with different blackboards.
     
    nuverian likes this.
  29. Schazzwozzer

    Schazzwozzer

    Joined:
    Jul 27, 2012
    Posts:
    18
    After some tinkering, here's what I've got.
    Code (csharp):
    1. [MenuItem( "Tools/ParadoxNotion/NodeCanvas/Custom/Register Preferred Types" )]
    2. private static void SetPreferredTypes()
    3. {
    4.    List<Type> list = UserTypePrefs.GetPreferedTypesList( typeof( object ), false );
    5.    list.AddRange( userTypes );
    6.    UserTypePrefs.SetPreferedTypesList( list );
    7.    UnityEngine.Debug.Log( "NodeCanvas preferred types set." );
    8. }
    userTypes is my custom list of types, and as you can see, I'm just calling this method from a menu. Does this look about right? Anything I'm missing?

    Thanks in advance!
     
    nuverian likes this.
  30. TSabos

    TSabos

    Joined:
    Mar 8, 2015
    Posts:
    90
    We use a universal blackboard that reads in monster AI variables for things like follow distance, aggressive behavior, and all of that but there's nothing similar about creating the actual trees other than the follow, attack, idle flow from monster to monster. Bosses do very unique things like perform custom walk to point actions at % health or minions could spawn in and the boss steps out invulnerable while you kill them off.. lots of big workflow tasks. I'm going to assume these just have to be completely custom BTs from scratch. The minion one would require an event sent to the tree once they are killed off. As a programmer I try to shove everything possible into 1 system, but I think this calls for just doing some grunt work.
     
  31. Marble

    Marble

    Joined:
    Aug 29, 2005
    Posts:
    1,216
    I don't know whether it's applicable to your situation, but you may be able to reduce some redundancy by using nested behavior trees for any common behavior.
     
    nuverian likes this.
  32. Smokas

    Smokas

    Joined:
    Mar 7, 2016
    Posts:
    115
    Bought FlowCanvas some time ago, like it and saw that here is update price for NodeCanvas. I got it too :)

    Maybe it was explained a lot of times, but I cannot find info - how to connect FlowScript to BT? Example screenshots:

    Screen Shot 2016-07-29 at 21.26.51.png Screen Shot 2016-07-29 at 21.21.32.png
     
  33. nuverian

    nuverian

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

    Thanks a lot for getting the tools! :)

    The nested flowscript in the BT will be called the OnEnable event as soon as the node is ticked. Then, to return "control" back to the BT, the Finish node should be used in the flowscript, which also takes a parameter to return Success or Failure back as well. For example:

    BTFlowscript.png

    Furthermore, as soon as the Finish flowscript node is called (or the nested flowscript BT node is interrupted for any reason), the OnDisable event will also be called. While the node is running, the Update event is also called of course. Both of those events can be used, using the relevant OnDisable and Update nodes, similar to how the OnEnable node is used above.

    So, to make your posted example work, you should basically add the OnEnable event node before LogText and connect it to it's input, as well as the Finish node after the AddForce node and of course connect it as well :)

    BTFlowScript2.png

    Please let me know if that is what you are after, or of course if you need more information.
    Thanks again!
     
  34. Smokas

    Smokas

    Joined:
    Mar 7, 2016
    Posts:
    115
    Thank very much. You explained everything perfectly clear.
    One more question - if I want to send event with parameter from BT to another object FlowScript - which approach should be used?

    BTW The Halo effect works :) - now I am seriously considering about getting Slate.
     
    Last edited: Jul 30, 2016
  35. nuverian

    nuverian

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

    Sorry for the late reply.
    If you want to send an event with a parameter to another GraphOwner or FlowScriptController, you can simply use the "Utilities/Send Event<T>" action.

    In the SendEvent action, you can then specify the GraphOwner that you want to receive the event, by overriding the target agent at the top (highlighted in the image).

    SendEventT.png

    Then in the FlowScript you should use the CustomEvent<T> node to make use of that event send:
    FlowScriptEvent.png

    Let me know if that is what you are after :)
    Thanks!
     
  36. Smokas

    Smokas

    Joined:
    Mar 7, 2016
    Posts:
    115
    Thank you for info. Starting to get hands on Slate now :)
     
  37. nuverian

    nuverian

    Joined:
    Oct 3, 2011
    Posts:
    2,051
    You are very welcome and thank you! :)
     
  38. calebc01

    calebc01

    Joined:
    Jul 21, 2015
    Posts:
    62
    I've been tinkering with NodeCanvas' behavior trees, and I have a question regarding reusing trees.

    I have a Creature base class that exposes common functionality among all my game characters. I also have a NodeCanvas Behavior Tree that defines the AI for all creatures. Specific creature behaviors are differentiated by derived classes that override the parent Creature behavior, but as far as the BehaviorTree is concerned, it should only need call the parent member functions and let the child do what it needs to do.

    I'd *like to have the BehaviorTree exist as a standalone asset that I can drop onto any game object with a Creature script attached, and have it just work. So far, I've had to reassign all the member variable hooks AND function calls, even though I'm referencing the Creature base class in both cases. I only have to do it once for each creature, true, but I have 20+ linked variables and ~ 10 member function calls referenced in each case. It's a bit of a pain.

    Is there a way to make this work without manually fixing the links every time I create a new creature?
     
  39. calebc01

    calebc01

    Joined:
    Jul 21, 2015
    Posts:
    62
    A second question, perhaps more important than the first - I need to be able to completely reset a behavior tree. Stopping and starting it again doesn't seem to work (as in, "execute once" filters and so on don't seem to reset). Is there a good way to do a hard reset on a behavior tree?
     
  40. nuverian

    nuverian

    Joined:
    Oct 3, 2011
    Posts:
    2,051
    Hey!

    Just so that I confirm I understand correctly and we are on the same track: Are you referring to the Script Control Tasks and the fact that when selecting a method or property the task is set to call the method on the derived class rather than the base Creature class, and as such when the same Behaviour Tree is used with another Creature derived class, it results to an error like for example "'Failed to resolve Agent to requested type 'Dragon', or new Agent is NULL"?

    In this example Dragon and Hydra both derive Creature and DoSomething() is a virtual method of Creature.

    Execute Function on Dragon:
    ExecuteFunction.png

    Same BT Execute Function on Hydra:
    ExecuteFunction2.png

    Please let me know if that is indeed what you mean, or something completely different. If something different, can you please provide a bit more information?
    Thanks.

    Hmm. Stopping and Restarting the BT should correctly reset it along with it's nodes. I've just tried specifically with a Filter Decorator set to "Limit Number of Times" and it worked as expected, being reset on each stop/restart of the BT.
    Can you please share a screenshot of a BT that fails to reset by stopping/restarting it?
    Alternatively, if you can send me a reproduction project that showcase this problem to support@paradoxnotion.com that would be great!

    Thanks in advance.
     
  41. cindyxu

    cindyxu

    Joined:
    Nov 13, 2012
    Posts:
    1
    I think I'm running into some confusion with global variables. I created a global Blackboard containing a variable of custom class Inhabitant. I also have two behavior trees. When the game starts, I run an Execute Function in the first behavior tree and save the result to the global variable. However, when the second behavior tree tries to access the variable later, it complains that it is null. I tried logging from both trees - the first tree thinks the variable is set, but the second does not. Interestingly, I tried it with an integer variable, and the variable propagated properly.
    Is there a way of getting around this? Thanks! :)
     
  42. nuverian

    nuverian

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

    Hmm. That is weird. Custom types and the ones supported in NodeCanvas by default are generally treated exactly the same. I tried reproducing the problem you are facing, but I was unfortunately not able to. :-/
    Is it possible for you to please send me a small project showcasing this problem to support_AT_paradoxnotion.com? If so that would be great and I will be able to help you better.

    Thanks in advance! :)
     
  43. adsilcott

    adsilcott

    Joined:
    Aug 30, 2014
    Posts:
    17
    Since I bought NodeCanvas two days ago, this is the third time that I've noticed a missing behaviour, and opened the subtree to find all the nodes gone. Do you have any idea why this is happening? This is getting extremely frustrating.
     
  44. nuverian

    nuverian

    Joined:
    Oct 3, 2011
    Posts:
    2,051
    Hello,
    Can you please provide more information as of when this is happening for you? Is it after some specific action you make for example?

    Thanks in advance.
     
  45. calebc01

    calebc01

    Joined:
    Jul 21, 2015
    Posts:
    62
    Yes, exactly. That, and an unbound behavior tree doesn't maintain any links to a blackboard. So, if I want to apply a behavior tree asset, I have to recreate all the blackboard variables (using Edit -> Create Defined Blackboard Variables), and then I have to reassociate all of them to the Creature base class' properties and fields.

    It would be awesome if I could say,

    1. "this behavior tree will *always be connected to a Script derived from type Creature, and"
    2. "this behavior tree will always use a blackboard containing these variables, and these variables will always be linked to the Creature class with the following fields and properties."

    That way, I could easily redefine new creatures that use the same behavior tree and blackboard variables, without having to do all the associations from scratch.
     
  46. FelixTwoMenAndADog

    FelixTwoMenAndADog

    Joined:
    Nov 11, 2015
    Posts:
    3
    Regarding the mecanim parameters set, are you referring to the included actions for setting those parameters?

    Cheers!

    Yes :)
    That way I could for example populate Blackboard variables with the parameter hashes that I need and use them directly instead of putting in the Mecanim Parameter names by hand (error prone and slow(er) in execution).
     
  47. adsilcott

    adsilcott

    Joined:
    Aug 30, 2014
    Posts:
    17
    I sorted out the problem on the nodeCanvas forum, thanks. It was due to cross-referenced subtrees.
     
  48. Problematic

    Problematic

    Joined:
    Sep 29, 2012
    Posts:
    3
    First, I'm (still) loving NodeCanvas. Thank you for the hard work you put into making it great!

    I have a suggestion (or maybe I still have more to learn about the way behavior trees should be designed!): possibly adding a "Sensor" node type, which is meant to query the world state and update the blackboard, but can be executed while another action later in the sequence is Running.

    An example from the project I'm working on: the world is decorated with "patrol" nodes, which the agent looks at and chooses the least-recently patrolled node, then paths there. While pathing, the agent needs to update the "last visited at" values for other patrol nodes that it might happen to pass.

    My first attempt put the "update nearby patrol nodes" sensor at the beginning of a dynamic sequencer, decorated with a cooldown filter (the spherecast and priority queue update for nearby patrol nodes is expensive, and only needs to happen once or twice a second), but I discovered that while the conditional decorator would be executed while the "move to" action was running, the action it was decorating would not. It's my understanding that this is by design, so that you don't potentially end up with two actions in the running state.

    It would be great if there was a node type that could be re-evaluated in a dynamic sequencer, with the understanding that it will only ever return Success or Failure, never Running. I'm currently approximating this by having the sensor action on the left side of a parallel composite, and the actions that depend on data from that sensor on the right. Is there a better way to do this?

    Again, thanks for this great asset!
     
  49. nuverian

    nuverian

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

    The thing is that in NodeCanvas, the variables (Blackboard) is part of the agent (GraphOwner) rather than the Graph itself. The design choice behind this, is so that the same graph can be parametrized by usage of different blackboards, and most importantly so that variables can have scene object references (which is impossible for assets).

    With that said, I am already looking for the ability of graphs to have and use a local blackboard, which would pretty much make what you describe easier to manage.

    One other thing you can also do, is to copy-paste the blackboard component values through the normal component context menu. Doing this will save you from having to rebind the variables to properties and fields too. :)

    Thanks.

    Hey,
    Alright, I will add the optional ability to use a hash instead of only name in the Animator tasks and in the next update.
    Cheers.

    Hey,

    Thanks a lot! I am very glad you like NC :)

    Indeed, more than 1 actions should never be running at the same time by design (and BT paradigm in general) and the only way for that to happen, is by using a Parallel node pretty much the way you already do.

    Now, regarding having actions re-valuate as part of a Dynamic Sequencer, I could possibly add an option for that, but it would basically be the same as using a Parallel node (set to First Failure), no? :)

    Last but not least, there is a small cheat you can do, and that is to implement your "update patrol nodes" as a condition rather than an action (even though not practically a condition as far as I can tell) and then you will be able to have it on the left side of a Dynamic Sequencer and it will re-valuate, since conditions do re-valuate as part of a Dynamic Sequencer already.

    Let me know what you think and thanks again!
    Cheers.
     
  50. Frair

    Frair

    Joined:
    Jul 1, 2016
    Posts:
    1
    I'm having a very hard time finding video tutorial on how to implement nodecanvas (specifically for implementing AI) and I'm having a hard time understanding the documentation (I must be a little bit of a slow poke).

    Is there any videos or sites that you can recommend for this type of training material?

    Kind regards,

    GF
     
unityunity