Search Unity

How to Make Minons to encircle the target in my RTS game?

Discussion in 'Navigation' started by jakeli, Aug 19, 2015.

  1. jakeli

    jakeli

    Joined:
    Apr 3, 2015
    Posts:
    3
    How you make minions encircle the target when they attack it. Dose it require physics? Apply carving on each minions? either way, I didn't think of any ideas to make minions encircle the target
     
  2. Lahzar

    Lahzar

    Joined:
    May 6, 2013
    Posts:
    87
    On the top of my head I can think of a few ways. Wheter or not it can be done by physics depends on what kind of pathfinding you use! Most pathfinding options won't need physics.

    Anyways, I assume you want the quickest easiest ways and not the long complicated ways? If so you could just use Random.InsideUnitCircle and do a simple raycast check to see if this place is taken or not.

    Some pathfinding solutions found on the asset store use cooperative pathfinding, which can make it alot easier and smoother!

    I am in the process of adding something like this in my RTS example included in my Simple Option Stacker, so I'll be back with more info later.
     
    jakeli likes this.
  3. jakeli

    jakeli

    Joined:
    Apr 3, 2015
    Posts:
    3
    Thanks for replying.
    I found using A star to avoid minions colliding with each other is more realistic. Since repath will apply when ai found the next step is on an unwalkable gird, but i should use carving to make a area unwalkable in navmesh.
    Would love to see some solution for collision avoidance in navmesh.
     
  4. Lahzar

    Lahzar

    Joined:
    May 6, 2013
    Posts:
    87
    Carving on navmesh doesn't really give optimal results. It sometimes acts.. strange. Atleast thats my experience with it. Anyways, I don't know how they do it in the tripple A RTS games with potentially hundreds of units on the map. But if you can spare some performance you could use something often called the "Kung Fu Circle" mechanic.

    It works like this: Everything which can be attacked, contains a script which keeps track of all the points inside a certain maximum radius. When you attack this building, each unit will request a spot. The first script will then que up all the requests, and then decide which unit should end up where. And if the radius is filled with units, it can just extend the radius! There are plenty of stuff you can do with this, depending on how player vs AI controlled you want units to be!
     
  5. Shbli

    Shbli

    Joined:
    Jan 28, 2014
    Posts:
    126
    Carving performance is great in static object

    Carving a moving object like a character will kill the performance, try to add it to your character and see yourself.
     
    Lahzar likes this.
  6. Griffo

    Griffo

    Joined:
    Jul 5, 2011
    Posts:
    700