part of a video of my flocking algorithms, RTS game.
there are 4 behaviors: cohesion, alignment, separation and avoidance.
cohesion steers toward center of unit's group,
alignment steers towards uniform velocity,
separation steers away from colliding units,
and avoidance steers away from obstacles.
as a formation flocking, basic cohesion is applied to steer towards unit's position in formation, not towards the centre of a group, which is recalculated every step.
there is a leader of a group, which behavior can be improved by using pathfinding (A*) or some optimizing algorithms...
@ManInAHighCastle Thanks for the comment - but its really is a nightmare to program a good group algorithm. Have decided to cheat and allow objects to pass selectively through others - it still aint easy but it is doable...
StunnedByStupidity 6 months ago
@StunnedByStupidity You could do a distance check from the rest of the group's average position. If this exceeds a certain amount, you repath to rejoin the group.
ManInAHighCastle 6 months ago
Great demo. I have been SLOWLY working on similar on and off for months. I'm curious to know if you know how you manage part of a flock getting separated from the main body of the flock, say a fork in a wall, and which leads away from the main group (this would mean backing up and re joining the group). I have a lovely fast HPAstar algorithm. A nice fast (dynamic) AStar algorithm. But am LOST how you keep a group together following a single path... Any book suggestions would be much appreciated.
StunnedByStupidity 7 months ago