flocking with independent behavior based on situation, where part of that behavior is broadcast message and part is cascade to nearest neighbor that then informs rest of individuals in the unit.
That way if an order to lose formation is given, 5 feet between men, it broadcasts to rest of unit. If close formation is ordered it broadcast also. That order would not be cascaded by weight by iteration but only set at if based on formation by broadcast.
while if a wall impact created a cascade order procedure, it would be weighted cascade and a move for each unit and move of 'unit center point' that would include positional effect by number of iteration it takes to get the message.
The method to cascade I developed in an app years ago, everyone cascades to neighbor but ignores 'order number 'something'' if it already processed that order, and distance adds to weight of order in cases where you want a smooth transition.(to stop recursion orders are numbered and processed only once per individual)
so if one guy hits wall, he cascades 'move closer' formation message to neighbors, and as it filters outwards, they all cascades to neighbors but only first message reception is processed and is processed by depth of iteration to lessen the effect as further from source.
And each unit has a center point at middle of formation that then deduces there path to best choice location individually while the entire unit is pathed with that center point.
Also can be useful in things like individual morale cascading to other units,awareness or agro cascading, or healing cascading to units with effect that effectively includes distance from first effected unit. It also can be used to determine if a unit needs to change formation to a line for instance when it can not 'closer' and fit through an area. A formation change would be created instead of a modification to location within a formation.
Each formation has a center point, and each individual has a dfcp (distance from center point) for the formation(no situation) and a dfcp modification value based on situation where any individual encounter a collision or event. Then units path to that modified location and it changes when any unit collides or stops colliding. The (no situation) values are set by the units choice of formation. And the entire unit is moved by pathing the center point, while each unit paths based on there dfcp offset of that center point.
It is possible to use broadcast all in non weighted events, but the 8 neighbor broadcast method allows for different depths based on iteration count.
Although that code was stolen from me years ago and I have not been compensated.
think of this as explanation of center point, and shadow as broadcast and cascade pipes to neighbors. You only have to walk the center point, while the individuals calculate distance from that center point, and entire unit will still react to events effecting unit on other side of formation while still maintaining independent actions.
Green Day - Boulevard of Broken Dreams
And cascade can also be used to fill front line ranks if units are damaged, routed or killed.
thinking back on the original design I wrote, some of the other uses is that a single independent unit, can get full unit status by what messages it receives from different individuals through the cascade or broadcast, and can be used to get healers to start casting group heals, or generals to call in back up cavalry, or various other full unit actions based on individual states within the unit.
So while setting position and agro, the healer unit is also receiving detailed information of damage and morale information from each unit as the individual units broadcast or cascade state.
And the general unit is paying attention to the states of individuals damage and morale, and can order front line rotations after collision with enemy in combat and some distress situation from a morale or damage cascade or broadcast.
Any message that should inform every unit equally is full broadcast, any message that should have a distance component is cascaded.
cascade messaging is also shown in this movie, although you would have to know about glyphs in the sand.