Search Unity

Behavior Designer - Formations Pack

Discussion in 'Assets and Asset Store' started by opsive, Apr 7, 2015.

Thread Status:
Not open for further replies.
  1. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,127
    Behavior Designer - Formations Pack
    Available on the Asset Store

    bigweb.png
    Requires Behavior Designer
    The Behavior Designer - Formations Pack contains 14 different behaviour tree tasks focused on group formations with Unity's NavMesh or Apex Path.

    Agents can join and leave the formation at any time. The formation will dynamically respond to changes.

    The Formations Pack is integrated with the Third Person Controller allowing for movement with mecanim's root motion. It is also integrated with the Deathmatch AI Kit.

    Each task is well commented and written in a generic and clean way making it very easy to integrate into your own project. This pack will continue to grow as we hear new task suggestions from the community.

    The following tasks are included:
    • Column
    • Row
    • Grid
    • Line
    • Echelon
    • Wedge
    • V
    • Arc
    • Skirmisher
    • Swarm
    • Diamond
    • Triangle
    • Square
    • Circle

    Screenshot1.png

    Screenshot2.png

    Screenshot3.png

    Screenshot4.png
     
    Last edited: Dec 16, 2019
  2. mittense

    mittense

    Joined:
    Jul 25, 2013
    Posts:
    168
    Awesome.
     
  3. thedreamer

    thedreamer

    Joined:
    May 13, 2013
    Posts:
    226
    is this possible "auto battle system" by using this asset?
     
  4. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,127
    Appreciate it!

    Can you expand on what you mean by auto battle system?
     
  5. thedreamer

    thedreamer

    Joined:
    May 13, 2013
    Posts:
    226
    Auto Battle is just Auto Battle I mean.. AI VS AI .. player select auto mode so player can watch AI VS AI

    I think blue team is fighting against red team
     
    Last edited: Apr 7, 2015
  6. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,127
    This is an addon pack for Behavior Designer, which is a behavior tree implementation. You can definitely create a behavior tree which has the AI reacting to other AI agents. You can then use this addon pack to have your AI agents create a formation as it is battling the other agents.

    If you haven't heard of behavior trees before, they are an extremely powerful and flexible way of creating your AI. In fact, major AAA studios use behavior trees for their AI. Here is a general overview of what a behavior tree is, and Gamasutra has a great article on the details for how a behavior tree works here.
     
  7. thedreamer

    thedreamer

    Joined:
    May 13, 2013
    Posts:
    226
    thank you for quick reply.. I am very interested.. I am making mobile game.. so performance are important
    To be honest, I Bought visual scripting tools but I was very disappointed with the performance

    However, a visual script is very convenient and the future

    I want to easily implement an automatic battle

    if I make 8(AI) vs 8(AI) battle by using Behavior Designer.. Can I have good performance as a mobile game?

    I think all Visual scripting tool is easy to use.. but only problem is performance... as mobile game developer.. if If is possible to develop mobile rpg with good performance.. I always will be a fan of the product
     
  8. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,127
    You won't have a problem with performance. Here is a test that I did to see how many trees could run at the same time. Granted this was on a desktop machine but it took thousands of behavior trees to start seeing an impact. 16 agents on mobile should be fine. Traversing the Behavior Designer trees is extremely quick thanks to the data oriented design. If you do notice a slowdown it is most likely because of an actual tasks rather than the core behavior tree traversal. For example if you have task which does a GetComponent many times within the same update loop you'll notice a slowdown, but you would have noticed that same slowdown with a regular MonoBehaviour object as well.
     
  9. thedreamer

    thedreamer

    Joined:
    May 13, 2013
    Posts:
    226
    WoW.. You are great! I am Very lucky

    I will buy the products in the near future


    I has bought three of the most popular products

    one is too slow So I did not even ask to developer about mobile performance

    another was not made for the mobile game development(developer said)

    the other visual script deverloper did not have any answer to my question

    But you answered friendly and confident

    I felt a sense of trust


    I said before,

    There are a lot of Visual Script Asset

    The advantage is easy. Disadvantage is too slow

    But your approach seems different

    you consider the performance of mobile games

    I believe this is a major difference and advantage for your asset

    thank you very much
     
    opsive likes this.
  10. b4c5p4c3

    b4c5p4c3

    Joined:
    Jan 4, 2013
    Posts:
    537
    I'm subscribing to this thread.
     
  11. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,127
    The Formation Pack hasn't been approved yet but I got a question about the performance of the Formations Pack with hundreds of units. Here's the profiler for 200 units in column formation:

    performance.PNG

    This was profiled on a desktop built in mid-2011 (3.4 GHz hyper threaded quad core). The most amount of time is spent in WaitForTargetFPS which means there isn't anything causing a bottleneck. CrowdManager.Update is from Unity's NavMesh implementation and manages the pathfinding for all 200 NavMeshAgents. BehaviorManager.Update is from Behavior Designer and runs the behavior trees on all of the agents.
     
  12. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    Want to pick this up, subscribing!
     
  13. imtrobin

    imtrobin

    Joined:
    Nov 30, 2009
    Posts:
    1,548
    I prefer if without need for behavior designer.
     
  14. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,127
    As a general update I am still waiting to hear back from the Asset Store team. The Formations Pack is still in "Pending Review" status.. the Asset Store team must have a backlog of assets to go through.

    @imtrobin -

    While the math behind each formation is general and can be used for MonoBehaviour, the rest of the structure is specific to Behavior Designer.
     
  15. twobob

    twobob

    Joined:
    Jun 28, 2014
    Posts:
    2,058
    I am going to get this. Simple as that.
     
    opsive likes this.
  16. thedreamer

    thedreamer

    Joined:
    May 13, 2013
    Posts:
    226
    If two units battle Based on the formation like RTS. I would not hesitate to purchase this asset

    I want to see red team vs blue team battle
     
  17. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,127
    The Formations Pack just includes a set of tasks for creating different formations. It doesn't include any tasks that do the actual attacking. For this you can use behavior trees to determine when/if the agent should attack as well as the attack method.

    The nice thing about these formation tasks is that agents can join or leave the formation at any time. This is great for example if you have one agent that is moving in formation and then spots an enemy and wants to attack. What you can even do is have a small group of agents split from the larger formation and create their own formation. This smaller formation can then go and attack the enemy while the larger formation continues on.
     
    twobob likes this.
  18. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,127
  19. ZJP

    ZJP

    Joined:
    Jan 22, 2010
    Posts:
    2,649
    So, i can't use this pack if i've not use Unity's NavMesh?! :(
    And why not an option that allows the group to follow a leader, no matter which system (Unity Navmesh, A* Pathfinding, Waypoint etc...) used by the leader.? :p
     
  20. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,127
    Other integrations are definitely coming :) I wanted to get it out with Unity's NavMesh first and add other integrations shortly after that. The first two integrations will definitely be the A* Pathfinding Project and Apex Path. All of the tasks inherit from the same base class so to add support for other integrations I should just need to switch out that base class.
     
  21. ZJP

    ZJP

    Joined:
    Jan 22, 2010
    Posts:
    2,649
    Thanks. :cool:
    On my buy list (as usual :D .)
     
    opsive likes this.
  22. unitywlp

    unitywlp

    Joined:
    Jan 3, 2014
    Posts:
    146
    i suggest to make scripts for astar that was need if we need to implement on a game on large scale,pathfinding was bad in performance
    bots do not recognize the obstacle until they are really close

    i have bought the pack
     
  23. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,127
    Thanks for your purchase!

    A* support is definitely coming. I don't have a time estimate yet but it will be soon.

    In terms of the bots not recognizing the obstacles until they are close, right now the bots try to stay in formation relative to their leader for as long as possible. This does mean that they will get really close to an obstacle before they recognize it. In the next version I may be able to add an option for you to be able to control the tradeoff between staying in formation and avoiding obstacles.
     
  24. unitywlp

    unitywlp

    Joined:
    Jan 3, 2014
    Posts:
    146
    can you post a quick fix for the kit to make obstacle avoidance soon i need to complete project using this so
     
  25. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,127
    I still need to think of the right way to approach it so I'll need some time. Right now I'm thinking of a 0-1 range where 0 means the agent is completely following the path and avoiding obstacles and 1 means completely following the formation and only avoiding the formation when they are about to run into it. I still need to think it through a little bit more and actually try implementing it - I'll let you know as soon as I have something.
     
  26. unitywlp

    unitywlp

    Joined:
    Jan 3, 2014
    Posts:
    146
  27. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,127
    @unitywlp -

    I added a parameter which allows you to specify how much the agent looks ahead. This allows the agents to better avoid obstacles in front of them. You can see the results on the Formations page (the Line and Echelon tasks are good examples of this in particular). Feel free to send me a PM with your invoice number and I'll send you a link to this version.
     
  28. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,127
    A new version of the Formations Pack is now on the Asset Store. You can see the release notes here. This is mostly a bugfix release but a new lookAhead parameter has been added which allows your agents to avoid obstacles better.

    Assuming there are no major bug reports, the next release will add integration with A* Pathfinding Project and Apex Path.
     
  29. unitywlp

    unitywlp

    Joined:
    Jan 3, 2014
    Posts:
    146
    Thanks for the update.
    mean while there are very less video tutorials available to understand the behaviour designer how ever i have understood but in most case i recommend making few more tutorials
     
  30. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,127
    You've seen this page which has videos for all of the major Behavior Designer topics, right? Those videos should pretty much cover how Behavior Designer works, but if you can think of any more topics that I should cover I'd be happy to hear it. These addon packs don't have videos because in general it is just add the task and hit play.

    For a general behavior tree overview, take a look at this article or this topic. In the second link I go into detail with how a complete behavior tree is constructed and why the tasks are placed where they are.
     
  31. ikemen_blueD

    ikemen_blueD

    Joined:
    Jan 19, 2013
    Posts:
    341
    Hi there, I wonder whether the integration with A* & Apex Path have done yet or still in developing?
     
  32. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,127
    I added Apex Path integration to the Tactical Pack but have not had a chance to do the Formations Pack yet. Dealing with A*, I was having a problem getting all of the agents to stay aligned in a group within the Tactical Pack so I shelved that for now. I'm guessing that the A* steering behaviors are implemented slightly differently then Unity's NavMesh and Apex Path.

    I'll be at Unite next week but I can make it a priority to release an update with Apex Path after I get back.
     
    ikemen_blueD likes this.
  33. david-skooby

    david-skooby

    Joined:
    Oct 19, 2015
    Posts:
    3
    Do these packs work in 3D space or only on a 2D plane?
     
  34. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,127
    The Formations Pack works with Unity's NavMesh which is in 3D. The Tactical Pack works with Unity's NavMesh or Apex Path so that's 3D as well. The Movement Pack works with Unity's NavMesh, Apex Path, A* Pathfinding Project, or PolyNav. The first three are 3D while the last one is 2D.
     
  35. david-skooby

    david-skooby

    Joined:
    Oct 19, 2015
    Posts:
    3
    I have this in mind for a space type game where ship formations could exist that you could be in a sphere or whatever. What this work okay?
     
  36. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,127
    Unfortunately the Formations Pack is not able to work with a space game out of the box. True 3D pathfinding is computationally expensive and consumes much more memory then pathfinding on a plane. There aren't any pathfinding assets out on the store that are able to do true 3D pathfinding.

    With that said, you have two options for a space game. One option is to fake it by placing an invisible plane that the pathfinding implementation uses. You can then adjust the y position of the spaceships with a separate height adjusting component and it'll appear that your spaceships are moving in 3D space. Looking specifically at the Formations Pack, the formations created by the tasks will assume that they are on a 2D plane. It would take some modification to adjust it to have variable y positions but I don't think that it would be any harder then getting a spaceship to pathfind in space in the first place.

    The second option is to not use any pathfinding at all and instead just use basic steering behaviors. Out of all of our addon packs the Tactical Pack is the only pack that works with basic steering behaviors (so far.. I'd eventually like to add it to all of the packs). In this case you would do a simple Vector3.MoveTowards, and then use local avoidance to avoid any objects. If you chose this method then the Formations Pack would not work because it does rely on Unity's NavMesh implementation.

    I hope that gives you some ideas on how to solve it!
     
  37. david-skooby

    david-skooby

    Joined:
    Oct 19, 2015
    Posts:
    3
    Thanks for the input. I will try what you suggest and see where it can get me.
     
  38. DziDAI

    DziDAI

    Joined:
    Dec 6, 2012
    Posts:
    68
    Hello @opsive

    We would like to know if your FormationPack works with A* (from Aron Granberg)?
     
  39. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,127
    It currently does not. It is on my list to add A* support but I haven't been able to add it yet.
     
  40. unitywlp

    unitywlp

    Joined:
    Jan 3, 2014
    Posts:
    146
    Hi
    can you make playmaker actions for this plugin i have both behaviour designer and formations but i did not find a solution to use this in game to this day it was very complex to use in a game.
     
  41. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,127
    What playmaker actions would you like to see? Playmaker actions don't make as much sense for this asset because everything is self contained within the behavior tree. The Tactical Pack does have Playmaker actions but that is to allow the characters to attack using Playmaker, rather than to control the movement.
     
  42. unitywlp

    unitywlp

    Joined:
    Jan 3, 2014
    Posts:
    146
    yea i understand but for me i want helper script to control the selected objects to formation from the playmaker i can integrate behaviour designer in project but i want to control using playmaker.
     
  43. namdo

    namdo

    Joined:
    Feb 23, 2015
    Posts:
    200
    Can this be combined with the movement pack. Basically i'm using LeaderFollow from the movement pack but i don't want the agents to follow directly behind the leader.
     
  44. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,127
    Do you mean have the Formation agents follow a leader which uses a Movement Pack task? Yes, you can, though it takes a small modification. Take a look at this post.
     
  45. namdo

    namdo

    Joined:
    Feb 23, 2015
    Posts:
    200
    I mean something like this? The follower isn't directly behind the leader.
     
  46. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,127
    The Leader Follow task from the Movement Pack will only follow directly behind the player. The Column task from the Formations Pack would give you a start but it has the leader within the column along with the followers. You would be able to modify this task in order to accomplish what you want, but it would take a small amount of scripting.
     
  47. namdo

    namdo

    Joined:
    Feb 23, 2015
    Posts:
    200
    Okay, that should work. As long as they are side by side when not moving. I'm using your third person controller so they characters won't run in the same speed.
     
  48. DonLoquacious

    DonLoquacious

    Joined:
    Feb 24, 2013
    Posts:
    1,667
    I'm curious about the flexibility of the formations given immobile obstacles being in the way of the desired formation shape- are they rigid or do they respond to the constraints the environment places on them? A few examples may be in order.

    If I were to walk up to a mile-long wall with a big wedge formation trailing behind me, then turn so half of the "desired formation" shape is on one side of the wall and half on the other, would half of my units try to pathfind all of the way around to the other side or would the "desired formation" deform to the shape of the space that can contain it, as it would in many RTS titles?

    A slightly more realistic example would be a grid shape of units that are 4 by 4 (or something) and a big boulder sitting right in the middle of the spot where the formation would like to be- would it deform the goal waypoints around the boulder?
     
  49. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,127
    In this example the shape would be formed on both sides of the wall. It does not calculate if there is enough space available to create the entire formation (though this would be a neat addition).

    Yes, it will. In the web player demo there's a few formations that extend beyond the gap in the middle of the map. Before the agents hit the wall they will try to avoid it:

    line.png
     
  50. namdo

    namdo

    Joined:
    Feb 23, 2015
    Posts:
    200
    I bought the formations pack and was able to easily do what I needed to do. I just set the target transformation to the player controlled character and follow orders to the non player controlled character.

    Behavior Designer has saved me so much time on AI.
     
Thread Status:
Not open for further replies.