Moving in formation

Started by
19 comments, last by johnnyBravo 19 years, 7 months ago
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?
//Geron ? ,,,__oOo_(O.O)_oOo__| | | | | | | | || | | | | | | | |
Advertisement
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"?

Dave Mark - President and Lead Designer of Intrinsic Algorithm LLC
Professional consultant on game AI, mathematical modeling, simulation modeling
Co-founder and 10 year advisor of the GDC AI Summit
Author of the book, Behavioral Mathematics for Game AI
Blogs I write:
IA News - What's happening at IA | IA on AI - AI news and notes | Post-Play'em - Observations on AI of games I play

"Reducing the world to mathematical equations!"

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



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
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.
Gah, forgot to log in.. post continued here:

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.
//Geron ? ,,,__oOo_(O.O)_oOo__| | | | | | | | || | | | | | | | |
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).
Quote:Original post by BrianL
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).


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..
//Geron ? ,,,__oOo_(O.O)_oOo__| | | | | | | | || | | | | | | | |
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.
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)
//Geron ? ,,,__oOo_(O.O)_oOo__| | | | | | | | || | | | | | | | |
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?)



This topic is closed to new replies.

Advertisement