Search Unity

RTS Local Avoidance Concept

Discussion in 'Navigation' started by jpthek9, Apr 22, 2015.

  1. jpthek9


    Nov 28, 2013
    I'm brainstorming a way to handle local avoidance efficiently for DPhysics. Before, I've been applying physics forces but this can lead to undesirable results when units get clumped up or want to pass through a group. Here's what I've come up with so far:

    Units have a 'Priority' value that's similar to mass except for an RTS game. If a unit has higher priority, it pushes by units and isn't affected by a collision. By 'pushing', I mean applying the offset to the other unit to not overlap.

    If 2 units have the same priority, the ratio of Unit A to Unit B's speed is determined - this ratio is used to apply the offset to stop the overlap. The higher the velocity of Unit A, the less the offset applied to Unit A and the higher the offset applied to Unit B.

    This is just what's been going on in my head. Do you think it'll work?
  2. burtonposey


    Sep 8, 2009
  3. laurentlavigne


    Aug 16, 2012
    Like addo says, Unity has local avoidance and it's quite good.

    Since it works, now the question becomes what do you base unit priority on? I tried to make it 1/relative to unit size/level and it's not great because a smaller unit can never pierce through a gang of large units, since avoidance is so local it can't path around the gang and if the target is in the middle of the gang forget it.

    I think a better logic is to prioritize recently human-controlled unit over AI units.

    I'll be rolling out a queue system where priority decreases with "age" of interaction. We'll see what happens.