by ebyrob » Mon Oct 24, 2011 4:43 pm
1) assign movements to ants doing something important first.
e.g. exploring, gathering food, defending, patrolling, attacking, etc.
2) calculate distances to all assigned "leader" ant's target locations. sort remaining ants by that distance.
3) starting with closest ants to leader ants move towards the closest leader ant's target location without getting "too close" to any previously assigned ant's target location. equidistant moves should be preferred to moving away unless starting position is already too close. (add each ant to assigned movement list as it's movement is calculated)
Note: It's probably not good to flock to defenders, since that will probably cause squishing up against water and overcrowding at hills.