Search Unity

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,125
    If you haven't yet take a look at my second edit - it will send the event to all of the running tasks including parents (and I've already made that change to all of the callbacks for the next release).

    By "always running task" I mean an action task that is under a parallel task. In order for it to work without the code changes above the task needs to be at a leaf node.
     
  2. spiaggefredde

    spiaggefredde

    Joined:
    Sep 24, 2013
    Posts:
    24
    perfect. as always, thank you for your time!
     
  3. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,125
    Sure thing.

    As I mentioned in a previous post, I changed the behavior tree serialization from JSON to binary. This should decrease the time it takes for the behavior tree to start up and reduce the amount of allocations. I would really appreciate it if I could get a few people playing with it to ensure I didn't break anything. I tested this version against the various sample projects, unit tests, and other manual test cases and it seems to be working well but I don't want to submit it to the Asset Store just yet. If you would like to help out just send me a PM or email (support@opsive.com) with your invoice number and I'll forward you a link to the new version.

    Justin
     
  4. ManAmazin

    ManAmazin

    Joined:
    Aug 7, 2013
    Posts:
    246
    hi ive been looking to purchase behavior designer for my next project but wanted to know does it support photon Networking or easy to implement? thanks for your time
     
  5. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,125
    Thanks for taking a look at Behavior Designer.

    I have not personally tried it but I do know of at least one person using Photon with Behavior Designer. They haven't asked me too many questions so I assume that it is going well. After looking at the documentation for Photon it doesn't look like you have to change your workflow. You should still be able to add the Photon View component and have it synchronize the data. Of course, if you have any problems with it you can post here or send me an email.
     
  6. ManAmazin

    ManAmazin

    Joined:
    Aug 7, 2013
    Posts:
    246

    ahh ok yea because networking is still a bit new to me so tutorials with photon kinda help out to i get use to synchronizing etc but ok i think this, dialogue system and core gamekit will do just nicely! thanks for the response
     
  7. RandAlThor

    RandAlThor

    Joined:
    Dec 2, 2007
    Posts:
    1,293
    Hi,

    I am a new owner of the behavior designer and start to learn it.
    But i have already a future feature or more a support wish and that is that the behavior designer support unistorm an asset also in the asset store.
    It have some different weather types that can be noticed by script or something and also have a time running so you can use it for letting i.e. creatures comming out at night but go when the morning is comming.
    Also when the weather is realy cold, some animals could try to get warmer by standing near each other.

    There is a new wiki site with script examples too but it would be nice if the behavior designer let me do things with it to.
    http://unistorm-weather-system.wikia.com/wiki/Example_Scripts
    https://www.assetstore.unity3d.com/en/#!/content/2714
     
  8. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,125
    Sure, I'll see what I can do. In the meantime, the Invoke Method task uses reflection and depending on how Unistorm is setup you may be able to use that task already.
     
  9. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,125
    Behavior Designer 1.3.4 has been released. For a full change log take a look at this post, but here are the highlights:

    Binary serialization instead of JSON
    Based on my tests, switching to a binary serialization has increased performance by about 10% when loading the tree and dramatically reduced the number of objects allocated on the heap (thus reducing the amount of work the garbage collector has to do). Since the serialization method has changed, make sure you have a backup just in case something goes wrong (as you should be backing up anyway). The JSON serialization data is not cleared out until the binary serialization completes successfully so if something goes wrong we will be able to recover it.

    Master Audio Integration


    Master Audio is a great asset which allows you to control basically every aspect of audio in your game, including mixing, playlists, and playing an audio file based off of an event. You can now control Master Audio with the included integration tasks.

    NGUI Integration

    Everybody knows what NGUI is so it doesn't need an introduction. Basically, you can now control your GUI from a behavior tree.
     
  10. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,125
    The latest update of Master Audio and Core GameKit contains a distribution version of Behavior Designer that shows the corresponding sample scene in action. I purchased Master Audio awhile ago and it really is a great audio asset. I am newer to Core GameKit but it makes spawning and combat really easy. Especially now that you can use it in a behavior tree :)

    To go along with that, Behavior Designer 1.3.4a has been released and it is mostly a third party task update. It also contains some minor bug fixes though so it's worth updating to.
     
    chelnok likes this.
  11. wvaughn409

    wvaughn409

    Joined:
    Oct 8, 2012
    Posts:
    11
    Hello. I'm part of a team that is using Behavior Designer in conjunction with Core Game-Kit. The player and all enemies are being spawned as a wave. When the player dies however, if there are enemies currently pursuing him or her, I get the following two errors:

    ArgumentOutOfRangeException: Argument is out of range.
    Parameter name: index
    System.Collections.Generic.List`1[System.Collections.Generic.Stack`1[System.Int32]].get_Item (Int32 index) (at /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/System.Collections.Generic/List.cs:633)
    BehaviorDesigner.Runtime.BehaviorManager.PopTask (BehaviorDesigner.Runtime.BehaviorTree behaviorTree, Int32 taskIndex, Int32 stackIndex, BehaviorDesigner.Runtime.Tasks.TaskStatus& status, Boolean popChildren, Boolean notifyOnEmptyStack)
    BehaviorDesigner.Runtime.BehaviorManager.PopTask (BehaviorDesigner.Runtime.BehaviorTree behaviorTree, Int32 taskIndex, Int32 stackIndex, BehaviorDesigner.Runtime.Tasks.TaskStatus& status, Boolean popChildren)
    BehaviorDesigner.Runtime.BehaviorManager.RunTask (BehaviorDesigner.Runtime.BehaviorTree behaviorTree, Int32 taskIndex, Int32 stackIndex, TaskStatus previousStatus)
    BehaviorDesigner.Runtime.BehaviorManager.RunTask (BehaviorDesigner.Runtime.BehaviorTree behaviorTree, Int32 taskIndex, Int32 stackIndex, TaskStatus previousStatus)
    BehaviorDesigner.Runtime.BehaviorManager.Tick (BehaviorDesigner.Runtime.BehaviorTree behaviorTree)
    BehaviorDesigner.Runtime.BehaviorManager.Tick ()
    BehaviorDesigner.Runtime.BehaviorManager.Update ()



    MissingReferenceException: The object of type 'Transform' has been destroyed but you are still trying to access it.
    Your script should either check if it is null or you should not destroy the object.
    UnityEngine.Transform.get_position () (at C:/BuildAgent/work/d63dfc6385190b60/artifacts/EditorGenerated/UnityEngineTransform.cs:28)
    BehaviorDesigner.Samples.WithinDistance.OnUpdate () (at Assets/Behavior Designer Samples/Common/WithinDistance.cs:56)
    BehaviorDesigner.Runtime.BehaviorManager.RunTask (BehaviorDesigner.Runtime.BehaviorTree behaviorTree, Int32 taskIndex, Int32 stackIndex, TaskStatus previousStatus)
    BehaviorDesigner.Runtime.BehaviorManager.RunTask (BehaviorDesigner.Runtime.BehaviorTree behaviorTree, Int32 taskIndex, Int32 stackIndex, TaskStatus previousStatus)
    BehaviorDesigner.Runtime.BehaviorManager.RunTask (BehaviorDesigner.Runtime.BehaviorTree behaviorTree, Int32 taskIndex, Int32 stackIndex, TaskStatus previousStatus)
    BehaviorDesigner.Runtime.BehaviorManager.RunTask (BehaviorDesigner.Runtime.BehaviorTree behaviorTree, Int32 taskIndex, Int32 stackIndex, TaskStatus previousStatus)
    BehaviorDesigner.Runtime.BehaviorManager.RunTask (BehaviorDesigner.Runtime.BehaviorTree behaviorTree, Int32 taskIndex, Int32 stackIndex, TaskStatus previousStatus)
    BehaviorDesigner.Runtime.BehaviorManager.RunTask (BehaviorDesigner.Runtime.BehaviorTree behaviorTree, Int32 taskIndex, Int32 stackIndex, TaskStatus previousStatus)
    BehaviorDesigner.Runtime.BehaviorManager.RunTask (BehaviorDesigner.Runtime.BehaviorTree behaviorTree, Int32 taskIndex, Int32 stackIndex, TaskStatus previousStatus)
    BehaviorDesigner.Runtime.BehaviorManager.RunTask (BehaviorDesigner.Runtime.BehaviorTree behaviorTree, Int32 taskIndex, Int32 stackIndex, TaskStatus previousStatus)
    BehaviorDesigner.Runtime.BehaviorManager.RunTask (BehaviorDesigner.Runtime.BehaviorTree behaviorTree, Int32 taskIndex, Int32 stackIndex, TaskStatus previousStatus)
    BehaviorDesigner.Runtime.BehaviorManager.RunTask (BehaviorDesigner.Runtime.BehaviorTree behaviorTree, Int32 taskIndex, Int32 stackIndex, TaskStatus previousStatus)
    BehaviorDesigner.Runtime.BehaviorManager.Tick (BehaviorDesigner.Runtime.BehaviorTree behaviorTree)
    BehaviorDesigner.Runtime.BehaviorManager.Tick ()
    BehaviorDesigner.Runtime.BehaviorManager.Update ()



    I think I know what is happening, sort of, but i do not know how to fix it. The player has a behavior on him or her that is constantly running, storing their transform as a global variable. That way, the behaviors on the enemies can access it to pursue, rotate around, move towards, seek, etc. But when the player runs out of health, dies, and respawns, there is a point where that global variable is null or void or empty or whatever you magic programmer types call it :) So can someone please either tell me what i'm doing wrong, or tell me how to modify behavior designer or the behaviors themselves to account for the possibility that the variables might not always contain info or go missing or something, and have that situation simply return fail within behavior designer, but not send a red error to the console. Also, if this matters, it is Behavior Manager that is sending the console errors during gameplay. Thank you for reading all this and thank you for thinking critically about it regardless if you have a solution. I realize I am at a disadvantage not coming to the table with extensive c# and java skills, but I am determined to resolve this nonetheless.

    Thanks!
     
  12. wvaughn409

    wvaughn409

    Joined:
    Oct 8, 2012
    Posts:
    11
    Also, I am aware that the second error actually gives me some guidance as follows:

    "MissingReferenceException: The object of type 'Transform' has been destroyed but you are still trying to access it.
    Your script should either check if it is null or you should not destroy the object."

    So Here is the script for that particular behavior (WithinDistance):

    REMOVED POTENTIALLY PAID ASSET

    So where in here, and exactly how, should I add a part so that it checks if the object is null?
     
    Last edited: Aug 3, 2014
  13. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,125
    Hopefully if we get the second error solved it will then fix the first. The second error points to line 56 of the file that you just posted.

    Code (csharp):
    1.  
    2. for (int i = 0; i < targets.Length; ++i) {
    3.    direction = targets[i].position - transform.position;
    4.  
    The problem is with the transform and the fact that it no longer exists. We can change this to check in the beginning if the transform does exist. If it does not then we can just return failure. So take this code
    Code (csharp):
    1.  
    2. public override TaskStatus OnUpdate()
    3. {
    4.    Vector3 direction;
    5.  
    And change it to:
    Code (csharp):
    1.  
    2. public override TaskStatus OnUpdate()
    3. {
    4.    if (transform == null)
    5.       return TaskStatus.False;
    6.    Vector3 direction;
    7.  
     
  14. wvaughn409

    wvaughn409

    Joined:
    Oct 8, 2012
    Posts:
    11
    That fixed the second error! Thank you for the quick reply. Though I had to change it to this:

    Code (CSharp):
    1. public override TaskStatus OnUpdate()
    2.         {
    3.             if (transform == null)
    4.                 return TaskStatus.Failure;
    5.             Vector3 direction;
    Failure instead of False. Easy fix :) I actually came up with the same error on a behavior that i did a hack and slash on and it fixed that one too. It was originally the rotate around behavior but i modified it to be able to use a transform in addition to a vector 3. I called it orbit, because i used it in conjunction with a move towards, so that the enemy circles around the player while maintaining a set distance from him or her at all times

    So the first error is still unresolved though, but it only happens once the player has alerted the enemies, they are pursuing him or her, and then the player dies. If the player just falls into a kill zone without first having alerted an enemy, the error does not show up.
     
  15. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,125
    You would think that after all of the times that I've written TaskStatus I would know that it was Failure instead of False :)

    The first error looks more dependent on the structure of the behavior tree and it being in some weird state. Can you post a picture of the behavior tree when it starts throwing that error? I'll first need to be able to reproduce it to solve it. Alternatively, if you have a small repro scene that throws the error that would be even better.
     
  16. RandAlThor

    RandAlThor

    Joined:
    Dec 2, 2007
    Posts:
    1,293
    The goblin demo is not working for me even not with the latest version ob the behavior designer and the latest motion designer. The goblins just standing there but do nothing besides sometimes one of them jumps a step into the air without animation and then sinks back to the ground.
     
  17. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,125
    When did you download it? This morning I was working with Tim from ootii on getting it working with the latest version of BD and MC. In the past we had been storing it on the opsive server but now we placed it on dropbox so we both can edit it. Here's a new link:

    https://www.dropbox.com/s/uze61z7k6d5jt8x/GoblinLife.zip
     
  18. RandAlThor

    RandAlThor

    Joined:
    Dec 2, 2007
    Posts:
    1,293
    I tried it today, maybe 3 hours ago with fresh asset store downloads.
    Will tr it again tomorow with the new goblin link you just posted.
     
  19. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,125
    That was around the time that I changed the link so it's possible that you still got the old version. Both Tim and I verified that it works with the latest release of each asset before I switched the link over. Make sure you import MC, BD, and the MC tasks before you open the scene. If you open the scene beforehand it's no problem, you'll just have to open it again so everything is initialized properly.
     
  20. wvaughn409

    wvaughn409

    Joined:
    Oct 8, 2012
    Posts:
    11
  21. wvaughn409

    wvaughn409

    Joined:
    Oct 8, 2012
    Posts:
    11
    So i thought i fixed that one on orbit, but apparently i did not. I just didn't encounter it for a while. So patrol, seek, orbit, and i think move towards, all of which set a destination for the navMeshAgent, are throwing errors. I think it is because, in that particular moment, another behavior has caused them to be off the navigation mesh (for one enemy, it hovers around a bit in mid air as it seeks the player). Possibly this would be solved by me using pro so I could add an off-mesh link to both enemies? Would the behavior then automatically utilize the off-mesh link?
     
  22. wvaughn409

    wvaughn409

    Joined:
    Oct 8, 2012
    Posts:
    11
    Aside from the navMeshAgent stuff, the first error we talked about is that first screen shot, and i don't actually know if the player or the enemy is causing it.
     
  23. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,125
    From your screenshots it looks like there are two separate issues - the first is related to the behavior manager and the second is related to the nav mesh tasks. Can you extract the runtime source code and tell me what line number the Argument Out Of Range error occurs on? Your tree looks a little too specific for me to recreate.

    As for the nav mesh error, the only times that I have seen that error is when I forgot to bake the scene. I wonder if the problem is that the the agent is hovering for a bit before while it is trying to use the nav mesh, therefore it isn't actually over the nav mesh. This is just a guess though.. As far as the off-mesh link, I haven't used that feature before but since the tasks just use the native nav mesh agent to move I am guessing that it will just work.
     
  24. wvaughn409

    wvaughn409

    Joined:
    Oct 8, 2012
    Posts:
    11
    K i extracted the source code and had a hell of a time getting my global variables and custom behaviors back in, but after i figured that out, here is the error:

    ArgumentOutOfRangeException: Argument is out of range.
    Parameter name: index
    System.Collections.Generic.List`1[System.Collections.Generic.Stack`1[System.Int32]].get_Item (Int32 index) (at /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/System.Collections.Generic/List.cs:633)
    BehaviorDesigner.Runtime.BehaviorManager.PopTask (BehaviorDesigner.Runtime.BehaviorTree behaviorTree, Int32 taskIndex, Int32 stackIndex, BehaviorDesigner.Runtime.Tasks.TaskStatus& status, Boolean popChildren, Boolean notifyOnEmptyStack) (at Assets/Plugins/Behavior Designer/Runtime/BehaviorManager.cs:1075)
    BehaviorDesigner.Runtime.BehaviorManager.PopTask (BehaviorDesigner.Runtime.BehaviorTree behaviorTree, Int32 taskIndex, Int32 stackIndex, BehaviorDesigner.Runtime.Tasks.TaskStatus& status, Boolean popChildren) (at Assets/Plugins/Behavior Designer/Runtime/BehaviorManager.cs:1065)
    BehaviorDesigner.Runtime.BehaviorManager.RunTask (BehaviorDesigner.Runtime.BehaviorTree behaviorTree, Int32 taskIndex, Int32 stackIndex, TaskStatus previousStatus) (at Assets/Plugins/Behavior Designer/Runtime/BehaviorManager.cs:988)
    BehaviorDesigner.Runtime.BehaviorManager.RunTask (BehaviorDesigner.Runtime.BehaviorTree behaviorTree, Int32 taskIndex, Int32 stackIndex, TaskStatus previousStatus) (at Assets/Plugins/Behavior Designer/Runtime/BehaviorManager.cs:967)
    BehaviorDesigner.Runtime.BehaviorManager.Tick (BehaviorDesigner.Runtime.BehaviorTree behaviorTree) (at Assets/Plugins/Behavior Designer/Runtime/BehaviorManager.cs:886)
    BehaviorDesigner.Runtime.BehaviorManager.Tick () (at Assets/Plugins/Behavior Designer/Runtime/BehaviorManager.cs:753)
    BehaviorDesigner.Runtime.BehaviorManager.Update () (at Assets/Plugins/Behavior Designer/Runtime/BehaviorManager.cs:732)


    and when i double click it, it brings up BehaviorManager.cs at line 1075...


    [REMOVED CODE - IT'S NOT ALLOWED TO PUBLICLY POST PAID ASSETS]
     
    Last edited by a moderator: Aug 2, 2014
  25. wvaughn409

    wvaughn409

    Joined:
    Oct 8, 2012
    Posts:
    11
    if you are wanting to see this one:

    System.Collections.Generic.List`1[System.Collections.Generic.Stack`1[System.Int32]].get_Item (Int32 index) (at /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/System.Collections.Generic/List.cs:633)

    I have no idea how to get at that. I did a search for List.cs and there is no such file. What am I missing here?
     
  26. wvaughn409

    wvaughn409

    Joined:
    Oct 8, 2012
    Posts:
    11
    But for BehaviorManager.cs, throwing errors at lines 732, 753, 886, 967, 988, 1065, and 1075
     
  27. wvaughn409

    wvaughn409

    Joined:
    Oct 8, 2012
    Posts:
    11
    this is the one where the player has alerted the enemies, then jumps into a killzone while they are in pursuit. They are tracking a global variable that the player's behavior stores.
     
  28. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,125
    For future posts, please don't attach the source code from Behavior Designer as this is a public forum :) Individual tasks are fine, but the Behavior Manager class is the core of how the behavior trees work.

    It looks like you were using an old version of Behavior Designer - you should first try updating to see if that happens to fix your problem. Make sure you first have a backup in case things go wrong (1.3.4 updated the serialization and it was a major change). If you are still getting the error is it possible for you to send PM or email me (support@opsive.com) a stripped down version? I am going to have to step through it to figure out what is happening.
     
    Last edited: Aug 2, 2014
  29. RandAlThor

    RandAlThor

    Joined:
    Dec 2, 2007
    Posts:
    1,293
    What are the MC tasks and where do i get them to import?
     
  30. wvaughn409

    wvaughn409

    Joined:
    Oct 8, 2012
    Posts:
    11
    Sorry about posting the source code. Noob mistake on my part. Won't happen again. I am coordinating with my team to update our project with the latest version of behavior designer. Hopefully that fixes it. I'll let you know. Thanks for all the help so far!
     
  31. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,125
    @RandAlThor - the MC tasks are the tasks used to integrate the two assets. They are located at /Behavior Designer/Third Party/MotionControllerAssets.unitypackage.

    @wvaughn409 - sounds good, hopefully that fixes it. If not get in contact with me over PM or email so I can take a closer look.
     
  32. TheLordDave

    TheLordDave

    Joined:
    Mar 2, 2014
    Posts:
    28
    Im having an issue, that has just appeared in a previously working tree. It seems like a movetowards task after a find nearest task it being run twice in the same tick.

    This results in the gameobject moving towards the object and setting the transform, then in the second tick the transform is reset.

    This results in the gameobject vibrating back and forth rather than moving towards the target.

    I have triple checked my code and i am not altering the position anywhere else but in this script. Have you seen this behaviour before?
     
  33. TheLordDave

    TheLordDave

    Joined:
    Mar 2, 2014
    Posts:
    28
    ignore me again, this is becoming a bit of a habit. It was the animator component interferring with the absolute position of the element. I hate meccanim...
     
  34. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,125
    Behavior Designer - Movement Pack version 1.1.1 has been released on the Asset Store and an email remind has been sent to those who purchased via opsive.com. This version includes the following:
    • Added the Within Distance conditional task
    • Cover now accepts a layer mask to determine what objects it can take cover behind
    • Improved the cover algorithm for determining if an object is considered cover
    This within distance conditional task is similar to the one found in the CTF sample project, this version is just cleaned up a bit to not be so specific for the particular CTF project.

    Note that the Asset Store still shows version 1.1. This is incorrect and it is actually version 1.1.1. I am working with the Asset Store team to try to get it cleared up. If you download a new version of the Movement Pack it will be version 1.1.1.
     
    chelnok likes this.
  35. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,125
    The Movement Pack version number issue has been resolved and you should now see an update notification to download version 1.1.1.
     
  36. ZJP

    ZJP

    Joined:
    Jan 22, 2010
    Posts:
    2,649
  37. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,125
    Behavior Designer 1.3.5 has been released on the Asset Store. The full release notes are located here. The highlights of this release include:
    • New option to set the type of serialization: binary or JSON. This option can be toggled from the preferences
    • AI For Mecanim integration
    I haven't made the AI For Mecanim sample project yet but I wanted to get it out as soon as I could since AI For Mecanim is currently in the Madness Sale. The integration is pretty straight forward though and this page gives a basic example of having the behavior tree talk to the state machine. I'll make another post as soon as I get the sample project up.

    Going along with this, version 1.1.2 of the Movement Pack has been released as well. This just adds support for Behavior Designer 1.3.5.
     
  38. broesby

    broesby

    Joined:
    Oct 14, 2012
    Posts:
    118
    Hi,..

    I was wondering if anyone had tutorials or hints for making basic flying AI with Behavior Designer lying around :)
    Birds, for instance.

    Another thing: I was considering to buy Apex Path as it is on Madness Sale. Any idea how it goes along with BD? do they overlap much...

    To clarify: I need to make both ground based (nav-mesh or grid) and flying AI. I don't think Apex Path works for flying AI at all...

    Best wishes

    Jesper, Denmark
     
  39. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,125
    Hi Jasper,

    What do you want your flying behavior to do? If you give me a basic outline I should be able to come up with something to start with.

    Apex Path has been a pretty popular request now that it is in the Madness Sale. I will work on adding it to the Movement Pack.

    None of the integrations within the Movement Pack work with flying AI - they all require some type of ground. This type of pathfinding is more specialized since it is slower and requires more memory then pathfinding on the ground.

    --

    Unrelated, but I forgot to post yesterday that the AI For Mecanim sample project is now available.



    In this sample project, the robot will patrol a path by using AI For Mecanim's state machine. The robot has a large sphere trigger and when the red sphere enters that trigger the behavior tree will stop the active state machine. A new state machine will run which moves the robot towards the sphere. After the robot is done moving towards the sphere it will continue on its patrol path.

    Justin
     
  40. hopeful

    hopeful

    Joined:
    Nov 20, 2013
    Posts:
    5,682
    Your question reminded me of this asset (Living Birds), though maybe you'd prefer to make your own.
     
  41. OnePxl

    OnePxl

    Joined:
    Aug 6, 2012
    Posts:
    307
    I have a weird issue with the Asset Store in Unity trying to update Behavior Designer to version 1.3.4a repeatedly. So this last update, the Asset Store reported it as 1.3.4a instead of 1.3.5. Do you have any idea what might be causing this? I only have this with Behavior Designer, all other packages update correctly.
     
  42. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,125
    There was a version problem with 1.3.3, but everything should have been fixed as of 1.3.4a. During the 1.3.3 timeframe I was having submission problems where the Asset Store didn't think the new version was actually new. On my personal account I was able to update to 1.3.5 without any problems. What version does it show on the welcome screen (Tools->Behavior Designer->Welcome Screen)? I'm curious if you actually got 1.3.5 but it still shows 1.3.4a on the update screen.
     
  43. OnePxl

    OnePxl

    Joined:
    Aug 6, 2012
    Posts:
    307
    That was it, it said 1.3.4a on the update screen, but it is indeed 1.3.5.
     
  44. cg_destro

    cg_destro

    Joined:
    Aug 13, 2013
    Posts:
    142
    quick question: is it possible to make enemies that will move on tiles ( up, down, left, right) and in turn based fashion with this asset?
     
  45. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,125
    Short answer: yes :)

    Longer answer: At its core Behavior Designer is a behavior tree implementation. What this basically means is that behavior trees allows you to control the flow of game AI. Although behavior trees were initially developed for AI, I have heard of lots of people using Behavior Designer to control things outside of AI such as GUI menus or controlling when different packages are loaded. As long as you can create a task for it (which basically means as long as you can script it in Unity), you can use it with Behavior Designer.

    For your specific use case, the movement would be controlled with some type of pathfinding solution and the behavior trees could control the turn based aspect of it. For movement, the Movement Pack provides a set of tasks which should be able to accomplish what you want.

    In terms of moving on tiles, either tonight or tomorrow I am going to be releasing an update to the Movement Pack which will add Apex Path integration. I mention this because Apex Path specifically has an option which allows you to restrict your movement to just tiles.
     
  46. broesby

    broesby

    Joined:
    Oct 14, 2012
    Posts:
    118
    My bird needs to fly either randomly around the scene (like wander), probably within a height margin so it doesn't fly too vertically... Or some birds might need to fly a certain path.... straight towards a waypoint for instance... or in a circle..... or a path... but not totally straight....

    It also needs to react to my plane with a fleeing behaviour.

    But most importantly it needs to avoid crashing into mountains, trees etc...

    Actually I was thinking I don't need nav mesh based navigation/AI for flying.... after all air is free in three dimensions ;-)
    But robust local avoidance is definitely needed.... Do you think BD will be useful for that?? Btw I have AI for mechanim also + I use Playmaker for most "coding" stuff.... I suck at coding I'm afraid :-/

    I know that one... It looks really nice and I might actually buy it at some point.... But I need something more than that... :) Thx anyway.

    Jesper
     
  47. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,125
    @broesby

    It sounds like you are looking more for individual tasks rather than a complete behavior tree. For example, the "Fly on Path", "Fly in a Circle", or the "Flee" task. Its tough because I haven't seen any assets that deal with pathfinding/local avoidance in 3D space.. This is a complicated subject so while I do think that you could get something primitive going with Behavior Designer/PlayMaker, I think that it would look a lot better if you used Behavior Designer with an asset that was meant for 3D local avoidance.

    I have no doubt in my mind that you could get something basic going without any programming, such as using colliders and raycasts for the local avoidance, and following a 3D path using Vector3.MoveTowards, but for a more natural look I'm afraid you are going to need an asset designed for that purpose or some programming experience.
     
  48. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,125
    Behavior Designer - Movement Pack now supports Apex Path!

    Movement4.png
    Ever since Apex Path appeared in the Madness Sale I got a lot of requests to add Apex Path support to the Movement Pack. The latest version of the Movement Pack (1.2) adds that support and is now listed on the Asset Store.

    The one thing that is different about these integration files is that they are not located in the standard Third Party folder. Instead they are on the Movement Pack's integration webpage. You'll need your Movement Pack invoice number in order to download it. In addition to attempting to reduce piracy, this will allow me to update the third party packages without having to submit a new release just for a new set of third party tasks. When the next version of Behavior Designer or the Movement Pack is released, I will of course add what third party tasks changed so you won't need to download the tasks all over again just to see if they have changed. If you have any problems with the download please let me know. I'll take care of it as soon as I can.
     
  49. eridani

    eridani

    Joined:
    Aug 30, 2012
    Posts:
    655
    Would it be hard to make AI bot vehicles that move like the ones in the game Indestructible? Basically the bot cars follow you around but don't drive directly at you... they don't try to ram you; they usually drive past you and drive circles around you, and back up when they hit a wall.

    If this sort of AI is possible, could you make a tutorial or video outlining the process? Here's some example gameplay of the sort of AI I want (probably better to play the actual game, but this will give you an idea):



    I own A* Pathfinding Project, Apex Path, and AI for Mecanim already if those assets are needed to implement such an AI. Thanks!
     
    Last edited: Aug 18, 2014
  50. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,125
    @eridani -

    A tree similar to the following should work:

    tree.PNG

    The left branch uses a conditional abort to keep reevaluating if the agent is stuck. If it is stuck then it will go in reverse. The right branch uses a parallel task which will keep getting a new position for the seek task. This is where you would set the position to be off to the side of the player. You could have it always reevaluating the position but I added a wait task before setting the target position so it would use the agent's steering behaviors more. In terms of actually implementing the tasks, you could use AI For Mecanim or I bet you could even use the various tasks that Behavior Designer provides in order to accomplish it. The seek task can use the A* Pathfinding Project or Apex Path, whichever you prefer.

    @RandAlThor -

    I haven't added Unistorm integration tasks because it looks like Unistorm is getting a major update with version 1.7.5. I'll add support for it as after that update is released.