flocking and formations

Started by
11 comments, last by Timkin 18 years ago
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.
"We've all heard that a million monkeys banging on a million typewriters will eventually reproduce the entire works of Shakespeare. Now, thanks to the internet, we know this is not true." -- Professor Robert Silensky
Advertisement
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.
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.
"We've all heard that a million monkeys banging on a million typewriters will eventually reproduce the entire works of Shakespeare. Now, thanks to the internet, we know this is not true." -- Professor Robert Silensky
Extend your arm out in front of your face until it is straight. Now, while looking straight ahead, move your arm in a horizontal arc until it is aligned with the line of your shoulders and look at your hand with your peripheral vision. At what point did it become difficult to clearly see your hand? For most people, that point is before the arm aligns with the shoulders. It would be difficult for you to walk in a line abreast of several other people while looking forward, because you would have to rely solely on your peripheral vision to maintain alignment. That reduces your focus on things happening ahead of you. Nor would you want to travel forward with your head cocked to one side for several days... you'd get an awful neck cramp. Thus, it's easier to walk in a line where the next person along from you is near that angle in your field of vision where you first had difficulty seeing your hand completely. You can still see it somewhat... its very easy to focus on it without moving your head (to check whether your alignment needs adjusting) and you can safely keep looking forward as you move. You'll also notice that the speed at which errors build up in your alignment is related to how far you are from the next person and how far they are from the leader.

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
Quote:Original post by Timkin
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.


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.
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
hello, im AP above...

additionally, they fly this way for aerodynaic reasons...

http://www.aerospaceweb.org/question/nature/q0237.shtml
Quote:Original post by timford
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".


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.
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.
"We've all heard that a million monkeys banging on a million typewriters will eventually reproduce the entire works of Shakespeare. Now, thanks to the internet, we know this is not true." -- Professor Robert Silensky
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.

This topic is closed to new replies.

Advertisement