Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Behavior Designer - Behavior Trees for Everyone

Discussion in 'Assets and Asset Store' started by opsive, Feb 10, 2014.

  1. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,122
    @Baraff -

    Does the SoldierBadNPC agent move to a cover position, even if is wrong? You are firing 100 raycasts with a step length of 1. If the cube is not within 100 degrees of the angle that the character is facing then it isn't going to find a cover point. Also, when it fires the raycasts it uses the position of the agent so if that position is at the bottom it may be intersecting with the ground.
     
  2. Baraff

    Baraff

    Joined:
    Aug 16, 2014
    Posts:
    255
    The NPC never shows any sign of movement to a cover position.

    I had tried a few things.
    • Changed the raycasts to 360, step still 1
    • Changed the step to 5
    • Moved the cube and re-baked.
    • The NPC is generally near the starting brick building as the sample has the NPC attacking pretty much immediately on first run. Pressing M to re-start the level seems to change that behavior though.
    I had noticed that sometimes the NPC would stop shooting at me after I had shot it once or twice. It did not do this not always though. The Cover box was green, but it was prior to it stopping shooting too.
    I also notice on a run just then that the nav mesh showed that a path had been highlighted to behind the cube. The NPC did not move, but had stopped shooting at me on this occasion.
    A few more tests showed that after just making more rock objects Cover positions too, I can see that when the agent stops shooting, it has created a path, but never moves.

    A few more tests later and I managed to see it attempt to move to a Cover position. But it kind of went nuts and dragged the frame rate down to 5fps. I ran the profiler and could see it was the logging so I turned it back off.
    I then managed to get it head for cover again after a few attempts.Still trying to pick the pattern. Mind you it did just slide across the landscape this second time, no animation. The first time it did animate as it ran.
     
  3. Baraff

    Baraff

    Joined:
    Aug 16, 2014
    Posts:
    255
    It almost seems like it needs to have seen me but been too far away to shoot so it starts moving towards my position. If I shoot the NPC before it starts shooting it will take cover.

    It also seems that if it has moved to a cover position, shooting it again will make it move again.
    If it had started shooting at you while in a cover position, it will slide across the landscape to the cover pos. If it had not started shooting at you it will run (animated).
    It does not seem to ever stop the running animation when it gets to the cover pos though.

    Not sure how this relates yet, but I am seeing this error when the agent does move to a cover position. Both of these were logged 1156 times

    "SetDestination" can only be called on an active agent that has been placed on a NavMesh.
    UnityEngine.NavMeshAgent:SetDestination(Vector3)
    AI:MoveTowards(Vector3) (at Assets/RFPSP/Scripts/AI/AI.cs:665)
    AI:SearchTarget(Vector3) (at Assets/RFPSP/Scripts/AI/AI.cs:622)
    <AttackTarget>c__Iterator8:MoveNext() (at Assets/RFPSP/Scripts/AI/AI.cs:562)
    UnityEngine.MonoBehaviour:StartCoroutine(String)
    BehaviorDesigner.Runtime.Tasks.RFPS.AttackTarget:OnStart() (at Assets/Behavior Designer/Third Party/Realistic FPS Prefab/Tasks/AttackTarget.cs:26)
    BehaviorDesigner.Runtime.BehaviorManager:pushTask(BehaviorTree, Int32, Int32)
    BehaviorDesigner.Runtime.BehaviorManager:RunTask(BehaviorTree, Int32, Int32, TaskStatus)
    BehaviorDesigner.Runtime.BehaviorManager:RunParentTask(BehaviorTree, Int32, Int32&, TaskStatus)
    BehaviorDesigner.Runtime.BehaviorManager:RunTask(BehaviorTree, Int32, Int32, TaskStatus)
    BehaviorDesigner.Runtime.BehaviorManager:RunParentTask(BehaviorTree, Int32, Int32&, TaskStatus)
    BehaviorDesigner.Runtime.BehaviorManager:RunTask(BehaviorTree, Int32, Int32, TaskStatus)
    BehaviorDesigner.Runtime.BehaviorManager:Tick(BehaviorTree)
    BehaviorDesigner.Runtime.BehaviorManager:Tick()
    BehaviorDesigner.Runtime.BehaviorManager:Update()

    "Resume" can only be called on an active agent that has been placed on a NavMesh.
    UnityEngine.NavMeshAgent:Resume()
    AI:MoveTowards(Vector3) (at Assets/RFPSP/Scripts/AI/AI.cs:666)
    AI:SearchTarget(Vector3) (at Assets/RFPSP/Scripts/AI/AI.cs:622)
    <AttackTarget>c__Iterator8:MoveNext() (at Assets/RFPSP/Scripts/AI/AI.cs:562)
    UnityEngine.MonoBehaviour:StartCoroutine(String)
    BehaviorDesigner.Runtime.Tasks.RFPS.AttackTarget:OnStart() (at Assets/Behavior Designer/Third Party/Realistic FPS Prefab/Tasks/AttackTarget.cs:26)
    BehaviorDesigner.Runtime.BehaviorManager:pushTask(BehaviorTree, Int32, Int32)
    BehaviorDesigner.Runtime.BehaviorManager:RunTask(BehaviorTree, Int32, Int32, TaskStatus)
    BehaviorDesigner.Runtime.BehaviorManager:RunParentTask(BehaviorTree, Int32, Int32&, TaskStatus)
    BehaviorDesigner.Runtime.BehaviorManager:RunTask(BehaviorTree, Int32, Int32, TaskStatus)
    BehaviorDesigner.Runtime.BehaviorManager:RunParentTask(BehaviorTree, Int32, Int32&, TaskStatus)
    BehaviorDesigner.Runtime.BehaviorManager:RunTask(BehaviorTree, Int32, Int32, TaskStatus)
    BehaviorDesigner.Runtime.BehaviorManager:Tick(BehaviorTree)
    BehaviorDesigner.Runtime.BehaviorManager:Tick()
    BehaviorDesigner.Runtime.BehaviorManager:Update()
     
  4. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,122
    @Baraff -

    You'll get that error when a NavMesh hasn't been baked. I am attaching a new scene which has a baked NavMesh and SoldierBadNPC takes cover behind the cube in front of him. In order for this scene to work you'll need to add the "Cover" layer to User Layer 22

    cover.PNG
     

    Attached Files:

  5. Baraff

    Baraff

    Joined:
    Aug 16, 2014
    Posts:
    255
    @opsive

    I did bake the nav mesh many times, but perhaps in the end after trying to enable more cover options I missed one.
    Anyway, tried your simple example and yes it slides behind cover as expected.

    So the question then is, why does the example I shown not work?

    I tried it again from scratch. Imported the sample project which has the SoldierBadNPC come after the player on start.
    Inserted the Cover Cube copied from your simple example and baked.
    Inserted the Cover task to respond after Is Damaged.
    The Cover task lights up, and I can see a destination drawn on the nav mesh, but it does not move. Is this just not the right way to do this or am I just way off on this test scenario?


    Just as a side note... I was able to get those NavMesh errors again by simply adding a Cover task after Attack Target on the tree. Nothing had added to the scene and the navmesh had already been working fine, so it is not an issue with baking or not baking the nav mesh it seems.

    upload_2015-6-25_7-31-23.png
     
    Last edited: Jun 24, 2015
  6. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,122
    @Baraff -

    I just played around with that tree and saw the same results where the agent doesn't actually move to the cover position. After looking into it some more, it looks like it is because the RFPS AI component also uses the NavMesh and is stopping/setting the destination at various points. Depending on which RFPS AI functions you want to use, you may be able to go through the RFPS AI component and manually remove the agent.Stop and agent.SetDestination calls. In order to do this properly and have both the AI component and the Movement Pack tasks working together the RFPS AI component is going to need to be restructured. I can add it to my list to add RPFS integration to the Movement Pack.
     
  7. Baraff

    Baraff

    Joined:
    Aug 16, 2014
    Posts:
    255
    For this particular game I believe the Movement pack tasks probably covers all I would need for movement as such. I would just need to integrate it into working with the RFPS functions for targeting, attacking, firing, damage type things. So maybe disabling the movement items like you mentioned would work? I'll have a play around, but I guess integration for the Movement pack and RFPS would be ideal/easier.

    I was planning to grab the Formations pack too. Is that likely to have the same issue?
     
    Last edited: Jun 25, 2015
  8. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,122
    Yeah, that sounds like the quickest solution. Just open the AI component and remove all references to the NavMesh agent field. This way only the Movement Pack has control.
    Yes, it would. The Formations Pack works well with the Movement Pack but you will first need to make the RFPS AI component modifications.
     
  9. Baraff

    Baraff

    Joined:
    Aug 16, 2014
    Posts:
    255
    @opsive
    Is there a quick video on playing the movement animations from BD. I assume I will lose all of these and will need to implement them in the tree as tasks... Parallel I guess.
     
  10. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,122
    I don't have a video but take a look at this post for an overview. If you are going to use root motion I would actually recommend keeping the movement animations out of the behavior tree. It will make for a cleaner tree and it doesn't take too much work to get going. In addition to that forum link, here's an article from MecWarriors.
     
  11. Baraff

    Baraff

    Joined:
    Aug 16, 2014
    Posts:
    255
    @opsive
    Thinking of a slightly different approach as I would really like to avoid messing around with hooking up the animations as I seem to be losing a lot of what RFPS already provides, if that makes sense. So let me ask you something.....How adjustable is the TPC camera? Would it be possible to set it to an FPS view. My character will generally be in a fixed position and only pivoting.
    I am assuming this would make the rest of the mechanics all that much simpler as all of your packages integrate easily, right?
     
    Last edited: Jun 25, 2015
  12. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,122
    You could still use the built in RFPS animations such as the agent shooting, but you would need to add the movement animations on your own. It's definitely possible to add these animations in the behavior tree itself (using a Parallel task is a great approach), but I personally prefer these animations to be outside of the tree. There isn't just one "right" way to do it so if that is the easiest to do then I'd say go for it.

    Everything does integrate well together but unfortunately there is no way to put the Third Person Controller camera in first person.
     
  13. Baraff

    Baraff

    Joined:
    Aug 16, 2014
    Posts:
    255
    OK thanks for the reply. I think sensible approach for then will be to at least get it running as expected with parallels and RFPS animations then iterate later to mech anim and an off tree approach when I get around to replacing the RFPS built in character models and animations.

    Disabling the agent calls worked well and still seemed to leave the other RFPS behavior in tact meant that the enemies still tried to shoot you complete with the firing animations, so now just need to get the movement anims playing.
     
  14. jamesliulyc

    jamesliulyc

    Joined:
    May 27, 2015
    Posts:
    13
    @opsive
    hi,could I ask some question about abort type?
    upload_2015-7-1_17-11-51.png

    when the AI meet the enemy, "AIFindNearEnemy" will return Sucess, then go to AIAttack, the still stand.
    But how to execute AIAttack by repeating only use abort type.
    like that?
    upload_2015-7-1_17-15-38.png

    or like it?
    upload_2015-7-1_17-16-1.png
     
  15. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,122
    Do you have branches to the right of that current branch? If so then your second option will reevaluate AI Find Near Enemy when the tree is in a lower-priority branch. Since your first option does not have any conditional aborts setup on that parent Sequence task the AI Find Near Enemy task will only be reevaluated when AI Walk By Path is executing. Your very first screenshot will also reevaluate only when AI Walk By Path is active - if you want it to be reevaluated during AI Attack and AI Stand then you should change that conditional abort on the Selector to a Both conditional abort. In terms of repeating the attack, you'll need to parent the AI Attack task by a Repeater. Conditional aborts only reevaluate conditional tasks and do not repeat other tasks.
     
  16. RecursiveRuby

    RecursiveRuby

    Joined:
    Jun 5, 2013
    Posts:
    163
    Hey I was wondering what would be the best way to handle instance variables? as in lets say I have two instances of a warrior prefab, how can I make warrior A faster than warrior B without having to break the prefab link and create a new behaviour tree? I was thinking using the Variable Synchronizer but I'm not sure if this is the best practice.
     
  17. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,122
    I'd recommend creating an external tree and then you can override the external tree variables within your prefab instance. For example, if you have the variable Health of type float within your external tree and you create Health of type float within your prefab instance it will replace the external tree's Health value with that of the prefab instance. Since you are using an external tree on that prefab instance you'll be able to edit the values within the prefab instance.

    Also, as a side note, if you want to be able to edit the prefab instance variables directly you can enable "Allow edit of prefab instances" within the preferences. The reason that this was added is because there is a chance that Unity could corrupt your behavior tree data when merging the parent prefab with the prefab instance. This is rare though so you probably won't have a problem if you enable the preference. If you do this I would also switch to JSON serialization because it is easier for Unity to merge.
     
  18. jamesliulyc

    jamesliulyc

    Joined:
    May 27, 2015
    Posts:
    13
    @opsive
    hi, I find that I cannot shared object variables.
    Code (CSharp):
    1. public class SharedPathPointList : SharedVariable
    2.     {
    3.         public List<PathPoint> Value { get { return mValue; } set { mValue = value; } }
    4.         [SerializeField]
    5.         private List<PathPoint> mValue;
    6.  
    7.         public override object GetValue() { return mValue; }
    8.         public override void SetValue(object value) { mValue = (List<PathPoint>)value; }
    9.  
    10.         public override string ToString() { return (mValue == null ? "null" : mValue.Count + " PathPoint"); }
    11.         public static implicit operator SharedPathPointList(List<PathPoint> value) { var sharedVariable = new SharedPathPointList(); sharedVariable.SetValue(value); return sharedVariable; }
    12.     }
    Code (CSharp):
    1.  public class PathPoint
    2.     {
    3. private Vector3[] _points;
    4. }
    Code (CSharp):
    1.    private void OnValidate()
    2.     {
    3.         Transform p = gameObject.transform.parent;
    4.         if (p != null)
    5.         {      
    6.             BehaviorTree tree = p.GetComponent<BehaviorTree>();
    7.             List<PathPoint> list = GetSharedPointList();
    8.             SharedPathPointList sharedList = new SharedPathPointList();
    9.             sharedList.SetValue(list);
    10.             tree.SetVariable("path_point", sharedList);
    11.         }
    12.     }
    then I find some errors in the console.
    upload_2015-7-6_21-4-38.png

    thank you.
     
  19. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,122
    That error says that a SharedObjectList cannot be set to a SharedPathPointList which makes since because SharedPathPointList is not a Unity Object list. When you created the variable "path_point" within the editor - did you assign that a type of SharedObjectList?
     
  20. jamesliulyc

    jamesliulyc

    Joined:
    May 27, 2015
    Posts:
    13
    :(but I want shared object list, not unity object list.
     
  21. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,122
    The SharedObjectList is of type UnityEngine.Object because there is no Unity inspector for the System.object type. In your case SharedPathPointList derives from SharedVariable and your assignment script looks good. I think that the problem is that within the Variables inspector of Behavior Designer you created the "path_point" variable to have a type of SharedObjectList instead of your custom variable SharedPathPointList. Just change the type of "path_point" within the Variable inspector and you'll be good to go.
     
    Last edited: Jul 6, 2015
  22. jamesliulyc

    jamesliulyc

    Joined:
    May 27, 2015
    Posts:
    13
    Sorry, I find that I'm mistake, I add the
    using System.Linq;
    , if remove it, SharedPathPointList is ok.
    Thank you very much.
     
  23. Jay-Pavlina

    Jay-Pavlina

    Joined:
    Feb 19, 2012
    Posts:
    195
    How do I zoom in/out in the editor view if I have "mouse wheel scrolls graph view" enabled in preferences?

    Thanks for including that option by the way.
     
  24. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,122
    Currently if that preference is enabled then there is no way to zoom the graph. It's a quick addition though - do you think that if you hold down control and move the mouse wheel then it should zoom even though the preference enabled?
     
  25. Jay-Pavlina

    Jay-Pavlina

    Joined:
    Feb 19, 2012
    Posts:
    195
    I think you should hold a key, but it shouldn't be control because that zooms the entire screen on mac if you have accessibility options enabled. I'd make it either the command or option key.
     
  26. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,122
    Makes sense - I just mapped it to the command key. If you want this version now feel free to send me a PM with your invoice number.
     
  27. BortStudios

    BortStudios

    Joined:
    May 1, 2012
    Posts:
    48
    How do I pause a behavior tree from going? Further, what is the recommended way to swap behavior trees mid gameplay? Currently I set a new external tree, make sure that start when enabled is set to on, and then disable and enable it. It seems to work fine. However, I find that the 'pause when disabled' option doesn't seem to do anything - when I disable the tree, the external tree continues to run. How do I actually pause a tree?

    I found what's up. I think it's a bug. If a tree was disabled and paused, and a new tree is set, the new tree shows up as the external behavior, but the tree that was in the external behavior slot when the tree was disabled is the one that's actually running. So, to set a new tree, I have to make sure that the tree is enabled, then set it, then disable it, then reenable it?

    Edit again: So Start() seems to work, not sure why I wasn't using it. Nevertheless I think the thing I mentioned above is a bug. Now my code sets the tree to enabled, sets the tree, and either runs Start() or disables, if it should be paused with the new tree
     
    Last edited: Jul 18, 2015
  28. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,122
    You can manually pause the behavior tree with behaviorTree.DisableBehavior(true). To enable it again you can call behaviorTree.EnableBehavior(). I just tried the Pause When Disabled option and it did pause the tree - make sure you disable the BehaviorTree component and not the external tree.

    In terms of the possible bug, can you post the script that you are using to switch out the trees? I also just tried switching it out and things look like they are working.
     
  29. BortStudios

    BortStudios

    Joined:
    May 1, 2012
    Posts:
    48
    Yeah. So I have startwhenenabled, pausewhendisabled, and restartwhencomplete all set to true. The agent uses a behavior tree Idle. I disable that behavior and run this code to put in a new tree:


    tree.ExternalBehavior = newTree;

    tree.enabled = false;
    tree.enabled = true;

    In the unity editor window, it shows the proper newTree in the external behavior slot, and when I select the agent it shows that tree in the behavior designer window, but it doesn't show it as running. Instead, the agent continues to run the Idle tree invisibly
     
  30. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,122
    I don't think that there have been any changes to this but are you using the latest version? I just tried the same code and the external tree replaced, stopped, and started again. You mentioned an idle tree - is that one of the external trees?

    When you set a new external tree you don't need to disable and enable the component - it will automatically restart with the new external tree.
     
  31. BortStudios

    BortStudios

    Joined:
    May 1, 2012
    Posts:
    48
    Yeah, Idle is one of the external trees. I have that and Flee attached to an AI script, which is in charge of selecting which one to 'plug in'. I just updated to the latest version - 1.52 - and tested again. It starts with the idle tree, I disable the behavior tree component, and when it sets a new tree (this time using just tree.ExternalBehavior = newTree), it updates to show Flee in the component in the gui, but the agent is still running the idle behavior

    Like I said, it works for me when I just enable the tree before setting a new external tree. Guess I could have something somewhere in my code messing with it
     
  32. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,122
    I have attached a repro package that I have been using to try to reproduce it. The tree starts disabled, then when you click the "Enable" button it will assign the first external tree and start executing. From there if you click the "Switch" button it will swap between the external trees. Can you modify it to reproduce the bug? Alternatively, if you want to send me a repro package using your existing trees I can then take a closer look at it. If you want to send me a complete scene with all of the scripts you can email it to support@opsive.com, otherwise if you upload it here I'll just need the scenes/scripts that I don't have.
     

    Attached Files:

  33. BortStudios

    BortStudios

    Joined:
    May 1, 2012
    Posts:
    48
    Sure, I've updated repro to produce the error. I found that the error lies in the PauseOnDisabled option. When that is selected and you disable the tree, Tree 1 pauses. On the switch, it says tree 2 is loaded, but tree 1 continues to play
     

    Attached Files:

  34. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,122
    Thanks for helping me track it down. In the package that you uploaded I see a PlayMaker FSM and Behavior Tree component attached to the Main Camera. When you hit play the FSM waits a second and then sends an event to the behavior tree. The behavior tree responsed to that event and then logs that the event occurred. Is this the right repro scene? Where does the external tree switch happen?
     
  35. BortStudios

    BortStudios

    Joined:
    May 1, 2012
    Posts:
    48
    Sorry, that wasn't the right package. I've never made one before. This one should work. Just start the scene, click enable to get tree 1 running, disable the tree component, then hit switch. You should see that the component has tree 2 in its external reference, but tree 1 is still writing to the console
     

    Attached Files:

  36. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,122
    Awesome - that did it! I just fixed it - if you could PM me your Behavior Designer invoice number I'll send you a link to the new version. If you could include your Unity version as well that would be great.
     
  37. CarterG81

    CarterG81

    Joined:
    Jul 25, 2013
    Posts:
    1,773
    I am using Unity version 5.1.2f1

    and am getting the following error:
    Code (csharp):
    1.  
    2. UNetWeaver error: Rpc function [BehaviorDesigner.Runtime.Behavior:RpcDirtyVariableTransform] parameter [value] is of the type [Transform] which is a Component. You cannot pass a Compent to a Rpc call. Try passing data from within the component.
    3. UnityEngine.Debug:LogError(Object)
    4. Unity.UNetWeaver.Log:Error(String) (at C:/buildslave/unity/build/Extensions/Networking/Weaver/Program.cs:19)
    5. Unity.UNetWeaver.NetworkBehaviourProcessor:processMethods() (at C:/buildslave/unity/build/Extensions/Networking/Weaver/UNetBehaviourProcessor.cs:1343)
    6. Unity.UNetWeaver.NetworkBehaviourProcessor:process() (at C:/buildslave/unity/build/Extensions/Networking/Weaver/UNetBehaviourProcessor.cs:51)
    7. Unity.UNetWeaver.Weaver:processNetworkBehaviourType(TypeDefinition) (at C:/buildslave/unity/build/Extensions/Networking/Weaver/UNetWeaver.cs:997)
    8. Unity.UNetWeaver.Weaver:CheckNetworkBehaviour(TypeDefinition) (at C:/buildslave/unity/build/Extensions/Networking/Weaver/UNetWeaver.cs:1436)
    9. Unity.UNetWeaver.Weaver:Weave(String, IEnumerable`1, String, String, String) (at C:/buildslave/unity/build/Extensions/Networking/Weaver/UNetWeaver.cs:1542)
    10. Unity.UNetWeaver.Weaver:WeaveAssemblies(IEnumerable`1, IEnumerable`1, String, String, String) (at C:/buildslave/unity/build/Extensions/Networking/Weaver/UNetWeaver.cs:1611)
    11. Unity.UNetWeaver.Program:process(String, String, String, String[], String[], Action`1, Action`1) (at C:/buildslave/unity/build/Extensions/Networking/Weaver/Program.cs:33)
    12. UnityEditor.Scripting.Serialization.Weaver:WeaveUnetFromEditor(String, String, String, String, Boolean)
     
  38. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,122
    Did you enable networking? In the past you could send Transforms via ClientRPCs but it looks like this has been changed with later 5.1 releases. I'll send you a link to a version that doesn't do this.
     
  39. CarterG81

    CarterG81

    Joined:
    Jul 25, 2013
    Posts:
    1,773
    I'm in the process of getting rid of all my UNET code and replacing it with the FORGE asset. Couldn't get rid of some UNET components until I fixed all compiler errors. I finally fixed all the errors whenever I deleted BD and tried reinstalling it. Er, besides this error (which also stated after it that it failed to install BD, although the BD files seemed to install anyway.)

    Anyway, thank you. UNET has given me so many problems, I am ready to be done with it entirely.
     
  40. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,122
    In that case if you remove the ENABLE_MULTIPLAYER compiler definition then the ClientRPC code will no longer be called. I can still send you a new version if you'd like but since you are no longer using UNET it won't change anything.
     
    CarterG81 likes this.
  41. CarterG81

    CarterG81

    Joined:
    Jul 25, 2013
    Posts:
    1,773
    Where is this located so I can remove it?
     
  42. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,122
  43. CarterG81

    CarterG81

    Joined:
    Jul 25, 2013
    Posts:
    1,773
    No, never. I haven't touched Behavior Designer in months, besides updating it whenever I get an email.
     
  44. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,122
    That's odd - that part of the code is within #if ENABLE_MULTIPLAYER so you have to specifically enable it. I just tried the latest release on 5.1.2 and it worked. Anyway, I'll PM a version to you that has the transform change.
     
  45. CarterG81

    CarterG81

    Joined:
    Jul 25, 2013
    Posts:
    1,773
    I only got this error after I installed FORGE networking, so perhaps that has something to do with it?

    Before I installed FORGE, all was well and Behavior Designer never gave any errors.

    edit: I restarted Unity, and the error seems to have disappeared.

    I guess after the first time I got rid of all compiler errors (which Behavior Designer was hiding, as the console wouldn't report anything after this error until I deleted Behavior Designer, cleared all errors, and then reinstalled it).

    Anyway, deleting BD and reinstalling it, after fixing all other errors, seems to have made this one completely vanish. Now everything works fine and the console says nothing bad.

    Before, the error would appear anytime I started Unity (but would not reappear after clicking "Clear" in the console tab) and then I'd have an entirely empty console but would still have compiler errors. Real weird. After deleting and reinstalling the newest version of BD, it gave the error that one time and then never again.
     
    Last edited: Jul 24, 2015
  46. NeuroToxin-Studios

    NeuroToxin-Studios

    Joined:
    Dec 7, 2014
    Posts:
    68
    Hello Opsive,

    I am extremely tempted to purchase BD as it looks extremely good and not very difficult to use, I am currently making a game with RFPS and currently for AI I am using Shooter AI however it is not easy to work with and is time consuming, I was 100% sure I was going to strip it out and use BD until I saw the issues Baraff was having with the movement pack, have you managed to update the movement pack to support RFPS yet? if so I will most likely buy this asset ASAP
     
  47. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,122
    Thanks for taking a look at Behavior Designer. I haven't had the chance to add RFPS integration to the Movement Pack yet. RFPS assumes that it is doing its own movement and animations so the integration involves a lot of removing code from the RFPS AI component. While this approach would work it isn't very clean and would require manual work every time RFPS is updated.

    In this case it is probably be easier to just not use the RFPS components at all on your AI agents. You can get the same (and probably more) functionality if you use the built-in tasks. The key is to be able to have your player controlled RFPS character be able to inflict damage on the AI agents and that should be a lot easier to get working. Depending on how modular RFPS is you may even be able to just take the RFPS Health component and add it to your AI agent. From there you would be able to damage the agents and then use the regular Behavior Designer / Movement Pack tasks. I don't mind helping to get this bridge setup if you want to go this route and it doesn't already work.
     
  48. NeuroToxin-Studios

    NeuroToxin-Studios

    Joined:
    Dec 7, 2014
    Posts:
    68
    Wow thanks for the fast response,

    What do you mean by "You can get the same (and probably more) functionality if you use the built-in tasks"?

    I probably would require your help to set this up as I would love to be able to use the cover node etc.

    Once I have managed to get the funds in order I will definitely be buying this, thanks for the help.
     
  49. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,670
    RFPS's CharacterDamage component assumes that the NPC also has an RFPS AI component. But you can set the AI component to do nothing by clearing all the waypoint fields and setting all the range fields to 0. CharacterDamage will still register hits. The BD integration also has a utility script called AIAgent that sets the AI component to do nothing; Justin may need to update this script and the example scene for RFPS 1.22. Then once you set up RFPS as described on Opsive's RFPS integration page, you can add a behavior tree that controls movement and firing. I recommend going through the basic BD examples first, before trying to build a custom behavior tree specifically for RFPS. Behavior trees have a bit of a learning curve, but once you get the hang of it they're very powerful and quick to put together.
     
    NeuroToxin-Studios likes this.
  50. NeuroToxin-Studios

    NeuroToxin-Studios

    Joined:
    Dec 7, 2014
    Posts:
    68
    Will this completely stop the AI script from trying to navigate thus not breaking the use of BD's movement pack? also if I purchase this before the AIAgent script is updated would doing what you said above with the AI component do the same thing?
     
    Last edited: Aug 5, 2015