Auto-squads for area patrol

Discussion in 'Planetary Annihilation General Discussion' started by exterminans, August 20, 2014.

  1. exterminans

    exterminans Post Master General

    Messages:
    1,881
    Likes Received:
    986
    Well, as we all know, area patrol is a troublesome feature.

    While it surely helpful, it also gets very troublesome for the server as soon as more than just a handful of units is patrolling due to the cost for pathinfinding.

    And then there is also the issue that most units are pretty much useless when straying around individually. (Unless for scouts. But then again: Only a limited number of scouts is required for full coverage.)



    So why not solve both problems at the same time?

    Whenever a large crowd of units is set to patrol an area, automatically group the crowd into squads of 3-20 units, depending on the size of the crowd. Units inside each squad move in formation with common goal.


    Squad size isn't fixed, so if new units are added to the patrol group, they get attached to the nearest squad.

    If squad size exceeds a reasonable limit then the squad splits in half at next waypoint.

    If the number of squads exceeds a reasonable limit, a simple "easiest match" is performed to merge two squads which are below the size threshold.

    Both thresholds scale dynamically with the total number of units patrolling per planet/command/whatever.


    As a bonus: For inhomogeneous unit groups, ensure that each squad has an evenly distributed unit composition, so you can just set factories to auto-produce your favorite unit-mix and have the area patrol feature group units accordingly.

    (Thread copied from the closed backer forums for a more public discussion: Auto-squad for area patrol?)

    Some noteable quotes from the original thread:
    kayonsmit101 and doud like this.
  2. steambirds

    steambirds Member

    Messages:
    98
    Likes Received:
    37
    Another useful thing would be if one patrolling unit is attacked all of the other patrolling units will rush to help it and defend.
    Planktum likes this.
  3. tatsujb

    tatsujb Post Master General

    Messages:
    12,902
    Likes Received:
    5,385
    pathfiding is the only issue here.

    patrol does practically the exact same thing the AI does when moving units around, that is : constantly issuing orders.

    if pathfind was more potent and had a Meander option in it, we could fix the lag entirely.

    be honest, doesn’t playing with an AI result in the exact same lag?
  4. exterminans

    exterminans Post Master General

    Messages:
    1,881
    Likes Received:
    986
    AI lags for different reasons actually. This specific lag is avoided when playing with the AI, since the AI doesn't use the normal area patrol command at all. (At least I don't think I have seen the AI ever using it.)

    The AI always forms squads and performs manual patrol maneuvers with these squads.

    Lags when playing with the AI are mostly caused by stuck fabbers or multiple squads colliding.
  5. tatsujb

    tatsujb Post Master General

    Messages:
    12,902
    Likes Received:
    5,385
    well better pathfind would still allow for a better take on patrol and also a better take on AI unit movement.
  6. exterminans

    exterminans Post Master General

    Messages:
    1,881
    Likes Received:
    986
    Better pathfinding sure is a prerequisite for patrol (or unit movement in general) to become efficient at all, mostly ny avoiding collisions.

    But a smarter behavior for the patrol command would still be very much desirable.

Share This Page