# flocking and formations

This topic is 4513 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

I'm trying to make large groups of units move using flocking (swarming) behavior. But if I do that, how can I make the units move in formations like the delta that birds do? Thanks.

##### Share on other sites
By applying constraints to their local positioning rules. A formation such as a flying 'V' that some breeds of birds use is a 'follow the leader' formation. Each bird is basically trying to position the leader behind the bird that is next closest to the leader than them. Their cone of vision would prevent them from flying in a perfect line and being able to quickly react to position changes (hence the lagged V formation).

Other formations can be created in a similar fashion; find a set of local constraints that give a global behaviour when all individuals satisfy the constraint.

##### Share on other sites
Thanks, I just don't understand how their "cone of vision" prevents them from flying in a straight line? And how do you implement it?
Thanks.

##### Share on other sites

As for you you can implement this in simulation? Well, there would be several ways I can think of. I'll leave the details of implementation up to you (I don't have a lot of time at the moment to write up a detailed explanation), but you should be considering how each unit in the formation can represent and maintain its alignment to a given vector (that formed by the line between the unit next closest to the leader and the leader themself). You'll want each unit to choose its actions so as to minimise errors in alignment and separation. One method to do this would be to implement a fuzzy control system, for which you can find a wealth of information online and in a variety of game AI books.

Cheers,

Timkin

##### Share on other sites
Quote:
 Original post by TimkinBy applying constraints to their local positioning rules. A formation such as a flying 'V' that some breeds of birds use is a 'follow the leader' formation. Each bird is basically trying to position the leader behind the bird that is next closest to the leader than them. Their cone of vision would prevent them from flying in a perfect line and being able to quickly react to position changes (hence the lagged V formation).Other formations can be created in a similar fashion; find a set of local constraints that give a global behaviour when all individuals satisfy the constraint.

This is an interesting idea, but I'm not sure I follow what you mean by "position the leader behind the bird that is next closest to the leader than them". If the idea is that they want to have a clear view of any changes in heading the leader makes, why not fly in a perfect line the other way? That is, all in a single file line, the leader in front. Most birds would not see the leader when flying straight, but if the leader were to veer at all, each bird could immediately see that and adjust course.

##### Share on other sites
Quote:
 Original post by timford why not fly in a perfect line the other way? That is, all in a single file line, the leader in front. Most birds would not see the leader when flying straight, but if the leader were to veer at all, each bird could immediately see that and adjust course.

Birds have eyes on the sides of their heads, not the front like humans do.
they see better to the left and to the right than straight ahead
in fact with many birds there is a blind spot right in front, ever notice when feeding pidgeons in the park that they turn their heads a lot and give you lots of sideways glances?

they evolved that way since even though straight ahead is blind, they have excellent vision to the sides and rear in huge arcs... important for dogfighting

##### Share on other sites
Quote:
 Original post by timfordThis is an interesting idea, but I'm not sure I follow what you mean by "position the leader behind the bird that is next closest to the leader than them".

Draw a line from the leader to the bird next closest to the leader than the one you are considering. So...
                              L                        X                  X           B     A

L is the leader, A is the bird under consideration, B is the next closest to the leader from A. Draw a line from L to B. For optimal positioning, assume that A wants to stay on that line at a given distance from B. L will appear to be behind B from A's perspective.

As for the leader changing direction or speed, this will affect its position 'behind' B (as A looks at it) and will affect A's flight direction and speed. The bird X closest to L has the responsibility of staying in the correct position relative to the leader and their actions will have a ripple effect down the line.

##### Share on other sites
There's still something that I don't understand, does A look fo the next closest out of all of the birds, or just out of the ones next to him?
Thanks.

##### Share on other sites
A looks for B, which is the closest bird to itself in the direction of L. L is the furthest bird from A in the direction of B. One of these two constraints must be fixed (they're circular), so fix the leader and make it so that each bird knows who the leader is.

1. 1
2. 2
frob
16
3. 3
Rutin
12
4. 4
5. 5

• 13
• 12
• 59
• 14
• 15
• ### Forum Statistics

• Total Topics
632124
• Total Posts
3004243

×