# Moving in formation

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

## Recommended Posts

I'm experimenting with flocking behaviour and formation movment. So far each individual are given a offset to the flocks center. This makes each individual in the flock seek its position in the formation. I do however have a problem. If one member in the flock is removed (dies or otherwise). I have no real good way of rearanging the formation. What I want to do is to make indivuduals close to the, now vacant, position to take its place. Anyone here who have a good suggestion on how to do this? I've considered araging the individuals in a tree structure, if one individual die, I'll just pass a child and its subtree up one level in the tree. This doesnt solve everthing though. As I want the replacement to be a bit more intelligent. The formation must always be compact, no holes.. Nor do i want a formation to look like this:
.  Front
.  xxxxx
.  x xxx
.  x x x
.    x


the abouve should rearange to
.  xxxxx
.  xxxxx
.   xxx


And it would be nice if its done in a intelligent way. I could ofcourse just rearange the whole group. This would however cause a formation to fall appart each time a member is lost. So, any ideas for a good solution to my problem?

##### Share on other sites
As I started reading the post, I was thinking the same thing you went ahead and mentioned - the idea of using a tree structure of some sort. That seems to make sense, but there are a lot of ways you could arrange it - each having pros and cons.

Based on your example, I assume that you want to have rigid, preprogrammed positions and not just the flocking rule of "get close but don't step on me"?

##### Share on other sites
Quote:
 Original post by GeronI'm experimenting with flocking behaviour and formation movment. So far each individual are given a offset to the flocks center. This makes each individual in the flock seek its position in the formation.

Do individuals have specific positions within the formation, or do you just want them all to clump together? Do individuals move only on a grid?

-Predictor
http://will.dwinnell.com

##### Share on other sites
Each individual has its own position within the flock. Though this position is only a offset to the flocks center
ASCII-art:
   ^   |   This vector represents the flocks direction and center   x      1 2 3 4  The numbers are offsets to the flock center5 6 7 8

Each individual are given a position in the flock (or offset to flock center).. The flock center is the average position of each individual.. This makes the flock behave as a flock, but gradualy the take their place in the formation.

Controlling the flock direction is done manualy, thus giving the user the ability to control where the formation will point (or move).

The problem is how to rearange the flock in a fast and somewhat intelligent way when a individual is removed. For example if the individual whos assigned position 3 in the example above dies. Whos gonna take its place. As I want the formation to be compact, and they should all want to be near the front of the formation.

##### Share on other sites

Thus in the example above, if number 3 dies, number 7 should step forward.. Then either number 6 and 5 move one step to the right or number 8 should move to the left.

In order to do this efficiently, I need help designing the logic and/or structure to make this happen.

##### Share on other sites
This sounds a bit like the 8 puzzle.

Depending on the number of units in your flock, you could do a search for the least number of 'moves' to get to a particular shape (or to any valid formation shape).

##### Share on other sites
Quote:
 Original post by BrianLThis sounds a bit like the 8 puzzle.Depending on the number of units in your flock, you could do a search for the least number of 'moves' to get to a particular shape (or to any valid formation shape).

Guess I could.. But I want this to run in real time, when using about 200-500 individuals per flock. So I need something that is rather fast..

##### Share on other sites
Flocking and rigid formation movement are quite different (imo).

In a rigid formation the position of each individual is governed by a master plan. There is an objective for individuals to achieve this master plan. Individuals move to accomplish this plan. An example of this is formations in military drills.

In flocking there is no objective. The position of each individual is not governed by any master plan, instead it is controlled by the behaviour of the individual. Flocking emerges as a result of the combined behaviour of all individuals. An example of this is shoals of fish flocking.

Your current strategy is looks kind of rigid formation rather than flocking. You are assigning each individual a position relative to the centre. You can simulate flocking like this, but as you are finding it is problematic.

If instead you give each individual the same rules to follow then you can achieve flock behaviour, and automatic resolution of the problem you are currently facing.

Even simple flocking can be accomplished with simple rules. For example just considering the nearest individual:

If too far away from nearest individual -> turn towards
If too close to nearest individual -> turn away
If blocked -> brake
If not blocked -> accel to max speed

That will just produce random flock movement though, there won't be any sort of overall direction. So there is the problem with that one.

##### Share on other sites
Im quite aware of the diffrence..
Though I'm using normal flocking rules, i.e avoid, align, center.. its just that instead of moving towards the flocks center, each individual moves to a offset of the center.. this creates the look of flocking, but the flock always asume their formation even if there is some kind of disturbance (lika obstacles or other)

##### Share on other sites
I'm curious and I'm having trouble visualizing the system you describe... how does your "flock" formation differ from a standard formation (visually)? What advantages does it offer over the usual method of offset pursuit (which requires less processing).?

(Do you have an executable we can see?)

1. 1
Rutin
26
2. 2
3. 3
4. 4
5. 5

• 9
• 11
• 10
• 13
• 20
• ### Forum Statistics

• Total Topics
632948
• Total Posts
3009391
• ### Who's Online (See full list)

There are no registered users currently online

×