Search Unity

Behavior Designer - Behavior Trees for Everyone

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

  1. Winseral

    Winseral

    Joined:
    Jul 9, 2017
    Posts:
    11
    Hi,

    Just to confirm, we are not limited to any variable type in Condition and Action Tasks? - ie I can have Events, Transforms and any SO variable and other not first class variables?

    Is it possible to call another Designer Tree based on an event within a Condition Tasked called from the same GameObject?

    Thanks
     
  2. ilusomu

    ilusomu

    Joined:
    May 28, 2015
    Posts:
    24
    Thanks for the tip! I used velocity instead and it worked like a charm.

    I have another question, albeit this time focused on how how the selectors and abort behaviors work: similar to the example in BD's documentation, I set up the agent to patrol until it either hears or sees the player. This kinda works, except as soon as the sound stops or the agent loses line of sight, it goes back into patrol mode instead of continuing to seek out the player. Funny enough, if I have a direct line from the sequence node to either see object or hear object, they work as intended. It seems like the selector and its abort rules are the culprit? Not sure how to fix this. For reference, I added my tree below.

     
  3. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,127
    I do the integrations based on the number of requests for a particular asset and this is the first time that I've received a request for Forge. I've written it down, if anybody else would like to see an integration with Forge let me know. In the meantime take a look at this post for how I recommend setting up your server-based game: http://opsive.com/forum/index.php/topic,1500.msg8163.html#msg8163
     
    AwkwardScience likes this.
  4. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,127
    Yes.

    Conditional tasks aren't designed to change game state so I would use an Action task for that, but yes you can: http://opsive.com/assets/BehaviorDesigner/documentation.php?id=120
     
  5. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,127
    This is an interesting use case. The two conditional tasks are being reevaluated when seek is active because they are a higher priority then the seek. However, in this case you don't actually want them to reevaluate when seek is active so it's going against the standard flow of lower priority. I need to think of this use case a bit more in order to determine how to properly handle it. In the meantime you can use the interrupt system to explicitly stop a task which would work in this case - take a look at the CTF sample project for an example of this.
     
  6. Emile97

    Emile97

    Joined:
    May 28, 2017
    Posts:
    105
    Hum. Hi, my name is Emile.
    I am actually at the "planning stage" of my project(to see how much I shall spend on assets) and I haven' bought any asset yet.

    1)I would like to make a Mario kart clone (to get use to unity) and I was wondering if I could mimic the power up system and AI attacs of the karts using your asset?

    2)Can I also use it to control the driving on the track(for the AI) Or shall I use another asset for that purpose only, because I'm not sure on how to make that AI system like Mario kart does .

    I'm open to any suggestions you might have.
    Thank you.
     
  7. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,127
    Hello,

    Yes, you could. Depending on the complexity of the decisions that you want to make using behavior trees may be overkill though. You would likely need to create a few tasks that are specific to the power up system and attack system that you develop for your racing AI, but Behavior Designer could definitely handle it.

    Racing AI generally follow some type of curve and then use their own steering behaviors to prevent collisions. In this case Behavior Designer generally wouldn't manage the movement so you'll likely have to take a look at another asset for this.
     
  8. Emile97

    Emile97

    Joined:
    May 28, 2017
    Posts:
    105
    Hi,
    Sorry for late reply. What do you mean by overkill? Do you mean that It will use a lot amount of resources and reduce the performance?

    Ow ok, I see what you mean. Do you have any suggestion of an asset I could use for racing Ai (i could totally write something up but still I want to speed up the development ) .

    Thank you
     
  9. led_bet

    led_bet

    Joined:
    May 5, 2015
    Posts:
    83
    I own Behavior Designer & Third Person Controller. I'd like to get a better grasp on how these two assets interact without having to buy an expansion to Behavior Designer. Any other resources beyond the sample provided that I can look to?

    For what it's worth, I'm interested in picking up the action packs on the store, I just don't want to have to buy one in order to learn the assets I already own.
     
    Last edited: May 23, 2018
  10. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,127
    I really thought that I responded to this - sorry for missing it.
    Not necessarily overkill in terms of performance, just overkill in terms of the the logic used for determining what power up to use. If there really isn't much logic used to determine which power up that should be used then personally I'd write a small script to decide. Behavior Designer really starts to help when your AI gets larger, which if you're planning a more complicated power up system then it would work well.
    Unfortunately I haven't used any racing AI assets at all so I don't have any recommendations.
     
  11. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,127
    Definitely makes sense - take a look at this video:



    The description has this video which contains a couple of basic movement tasks that you can use for learning purposes: www.opsive.com/assets/BehaviorDesigner/BehaviorDesignerTutorials.unitypackage
     
    led_bet likes this.
  12. TechnicalArtist

    TechnicalArtist

    Joined:
    Jul 9, 2012
    Posts:
    736
    Hi,
    Can possibly use this tool for the particle system?
    Every single particle become an agent?
     
  13. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,127
    One behavior tree per particle would likely become too performance heavy but it doesn't hurt to try to see if it fits your particular game. When ECS support is added that scenario will likely become much more manageable.
     
    led_bet and TechnicalArtist like this.
  14. TechnicalArtist

    TechnicalArtist

    Joined:
    Jul 9, 2012
    Posts:
    736
    Thanks for very positive response.I send pm to discuss my idea what I want to do in game.
     
  15. led_bet

    led_bet

    Joined:
    May 5, 2015
    Posts:
    83
    Hey thanks for the quick link to the basics tutorials; I'm definitely checking those out. For what it's worth, before posting here, I did begin reading through the documentation. I also like to play through example scenes to get my hands dirty with new assets; it's just how I like to learn. Hence, the reason for my original post. Kinda bummed that I'm locked out of the Behavior Designer + 3rd Person Controller example scene because I don't own an additional Behavior Designer pack. It might be worth packing the one or two Movement tasks into that example so that folks can get their hands on the sample assets without having to pay extra AND to entice buying the rest of the Movement Pack ;)

    Regardless, this is clearly a well implemented asset, one I'm looking forward to incorporating into projects going forward. Thanks for your hard work!
     
    opsive likes this.
  16. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,127
    Can you send me another PM? I didn't receive your original one.
     
  17. MaximilianPs

    MaximilianPs

    Joined:
    Nov 7, 2011
    Posts:
    322
    Did anyone tested it with Combat Framework?
     
  18. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,127
    I am not aware of any integrations with Combat Framework nor have I heard of anybody using Behavior Designer with it. You can always use the reflection tasks to access the API for the asset or create your own tasks for it.
     
  19. MaximilianPs

    MaximilianPs

    Joined:
    Nov 7, 2011
    Posts:
    322
    I'm not sure to be able. But I could ask to the CF developer :rolleyes:
     
  20. NewMagic-Studio

    NewMagic-Studio

    Joined:
    Feb 25, 2015
    Posts:
    454
    Can this asset make the enemies surround the player allowing the highest number of enemies possible surround the player depending on the space available around the player and the size of the enemies? And also set that some enemies dont surround it and use ranged attacks?
     
  21. rasto61

    rasto61

    Joined:
    Nov 1, 2015
    Posts:
    352
    short answer; yes.
    slightly longer; but you wil have to build that logic. also the formations pack might help a bit in this regard
     
    NewMagic-Studio likes this.
  22. BusterTheWizard

    BusterTheWizard

    Joined:
    Jul 2, 2012
    Posts:
    55
    It'd be awesome if LOS Pro/ Line of Sight Pro by Devdog could get integration :)
    Also Quest System Pro by Devdog so Quest/Task statuses could be used in the tree. It has Inventory Pro, just need the other two :)
     
  23. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,127
    @rasto61 is correct (thanks for helping!). The Surround task within Formations Pack can move your agents into a circular position, but it does not determine a max size for the number of agents that can be in that circle. This part would need to be added to the task (though with some scripting experience it's definitely doable).
     
    NewMagic-Studio likes this.
  24. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,127
    I have added those to the list of future integrations :)
     
    BusterTheWizard likes this.
  25. wood333

    wood333

    Joined:
    May 9, 2015
    Posts:
    851
    Inventory Pro contains character stats, but I do not believe your integration accesses them. It would be a nice addition. Also, if you do an integration for Quest System Pro, would you consider doing a similar integration for Quest Machine?

    Final thought, how old are these integrations? I see an integration for A* Pathfinding Project, but that asset was deprecated.
     
  26. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,127
    The Inventory Pro integration was based off of the integration that DevDog did for Playmaker - I'll take a look to see if the Playmaker actions have been updated to support stats.

    I do the integrations based on the number of requests that I get for a particular asset so I've written Quest Machine down as well.

    The A* Pathfinding Project is still alive and well :) There are some integrations listed for deprecated assets though and I haven't taken them down yet because people may still be using that asset. We are launching a new website within a few weeks though so I'll probably go through and remove all of the deprecated assets.
     
    wood333 and TonyLi like this.
  27. RendCycle

    RendCycle

    Joined:
    Apr 24, 2016
    Posts:
    330
    I've had some experience in using ICE Creature Control before and looking for an ideal replacement since it has been abandoned. Can Behavior Designer alone be used for NPCs that don't use Navmesh and moves by swimming and/or flying? Planning to use this with animals/creatures and connect some of their actions to Enviro Weather System.
     
  28. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,127
    The short answer is yes, but it will likely take some scripting unless you only use something like Vector3.MoveTowards (which there is a task for). In general I recommend separating the AI logic from the controller/locomotion logic as it makes for a cleaner implementation. In this case you'd have a controller move your agent, while Behavior Designer will decide where to move your agent.
     
  29. Ziron999

    Ziron999

    Joined:
    Jan 22, 2014
    Posts:
    282
    I have bought your addons but i'm seeing zero help on how to get all this to work in bolt properly. the scene for the bolt example is broken.
     
  30. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,127
    Thanks for letting me know - it looks like the latest version of Bolt changed the variables component. I've updated the sample scene so it works with the latest. The sample scene contains comments explaining how it's connected.
     
  31. RendCycle

    RendCycle

    Joined:
    Apr 24, 2016
    Posts:
    330
    Aside from additional scripting, does this also mean Behavior Designer require the Movement Add-on for this to work?
     
  32. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,127
    The Movement Pack only supports pathfinding based navigation so it doesn't work as well for general steering behaviors. Beyond that the Movement Pack does make it easy to traverse from one location to another - you can also download a couple of tasks that are within the Movement Pack from the description within this video:

     
  33. Ziron999

    Ziron999

    Joined:
    Jan 22, 2014
    Posts:
    282
    I'm not seeing anything in the bolt examples for your addons. I cannot get your formations to work properly in bolt and the tactical pack. Can't all these packs have examples as well? It's the main reason i purchased this so I hope you can explain or update the bolt examples to have more scene examples for your addon packs.
     
  34. Ziron999

    Ziron999

    Joined:
    Jan 22, 2014
    Posts:
    282
    Turns out index 0 cannot be a leader of itself that's what was causing a massive issue. There is still many issues with these addons i wish they were more dynamic they seem so limited :( Example: Since the circle.cs has no factor to determine the size of units it causes issues.
    There is also no concentric circle formation which is the main one everyone would want not just circle..
     
    Last edited: Jun 14, 2018
  35. Ziron999

    Ziron999

    Joined:
    Jan 22, 2014
    Posts:
    282
    another suggestion is to lock the leaders (lookat) rotation because if he gets bumped just once it causes a total mess
     
  36. wood333

    wood333

    Joined:
    May 9, 2015
    Posts:
    851
    My mistake. The version I purchased has been deprecated. There is a new version and an upgrade fee.

    A Path.JPG

    Which begs the question, is A* Pathfinding Project version 4.1 supported?
     
  37. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,127
    Having a differently sized agent isn't built-in but it could be added by modifying Circle.TargetPosition. The returned position is indicates where the agent should move to, and you could have theta depend on the size of the agents around them. A concentric circle task is also possible by following a similar setup - take a look at this page for creating your own formations.

    In this case you could have an invisible object be the leader, and then have all of the agents follow that object. This will prevent the object from being bumped around it, thought the task would have to account for not having a visible leader. I like this idea and will take a look at implementing it for the next update.
     
  38. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,127
    Yes, in fact version 3 is no longer supported by any of the addons.
     
    wood333 likes this.
  39. RendCycle

    RendCycle

    Joined:
    Apr 24, 2016
    Posts:
    330
    I haven't decided yet as Behavior Designer looks too different from the capabilities of my previous AI system. It looks like this is sort of similar to Playmaker but dedicated for AI. But thanks for the info!
     
  40. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,127
    That's pretty accurate. Playmaker uses finite state machines while Behavior Designer uses behavior trees, but in the end you are putting nodes on a graph for both of them.

    In general there are two different types of AI assets on the asset store: those that include the functionality for you and those that allow you to create your own functionality. ICE Creature Control is in the first group while Behavior Designer is in the second. You can create something much more powerful and unique with assets in the second group but it will take more time to initially get things going compared to those assets in the first group.
     
  41. RendCycle

    RendCycle

    Joined:
    Apr 24, 2016
    Posts:
    330
    I have quite a limited time on my current project so I need something quick for now. Thus I most probably need the first group. I have to do some more research though. But I will take a look again on Behavior Designer in the future as I think it is better suited to someone who already has advanced coding experience to better take advantage of its power. The interface looks solid too and ideal for easy debugging. Anyway, thanks for your time and clear explanation!
     
  42. Ziron999

    Ziron999

    Joined:
    Jan 22, 2014
    Posts:
    282
    I have thought about this but then slot 0 is empty making the formation look weird. I don't know how to properly code/fix this problem

    Trying to add this has been a nightmare you gotta have a navmeshagent on it which means it's gonna have collision so you gotta turn obstacle avoidance off.

    Another issue: How do you say (ok all units are here now destroy leader object) Because there will be up to 200 possible groups per a player the leader needs to be created upon use and destroyed after finished(all units are at final destination).
     
    Last edited: Jun 15, 2018
  43. Ziron999

    Ziron999

    Joined:
    Jan 22, 2014
    Posts:
    282
    White sphere is spot 0 and it's not even centered...i guess row is intended this way?

    and of course the biggest issue still remains i would need multiple dynamic leaders.
    Here is a visual example of the issue
     

    Attached Files:

  44. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,127
    Lets keep this in a single thread - I responded to your post in the Formations thread.
     
  45. kenlem

    kenlem

    Joined:
    Oct 16, 2008
    Posts:
    1,630
    In MovementUtility.cs, I changed Line 225 from

    Code (CSharp):
    1. var beginDirection = Quaternion.AngleAxis(-halfFOV, (usePhysics2D ? Vector3.forward : Vector3.up)) * (usePhysics2D ? transform.up : transform.forward);
    to

    Code (CSharp):
    1. var beginDirection = Quaternion.AngleAxis(-halfFOV, (usePhysics2D ? transform.forward : transform.up)) * (usePhysics2D ? transform.up : transform.forward);
    to correct the line of site gadget from being displayed incorrectly when the object is rotated about the x or z axis.
     
  46. djgriff

    djgriff

    Joined:
    May 29, 2014
    Posts:
    279
    Hello,

    I would just like to know how i can assign waypoints when a monster is spawned into the scene to a patrol node?

    I am currently making a multiplayer game with waves of monster being spawned into the game however if they dont see a player i would like them to start patrolling the scenes way points

    If someone could point me in the right direction would be great.

    Thanks

    Daniel
     
  47. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,127
    Thanks for posting this - I've updated the code on my end as well!
     
  48. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,127
    You can set the SharedGameObjectList from code when you spawn your monster:

    http://opsive.com/assets/BehaviorDesigner/documentation.php?id=54
     
  49. kenlem

    kenlem

    Joined:
    Oct 16, 2008
    Posts:
    1,630
    It looks like the code the actual line of site code is fine just the drawing of the gadget was off, right?
     
  50. djgriff

    djgriff

    Joined:
    May 29, 2014
    Posts:
    279
    Thank you