Advertisement

Flocking and equilibrium

Started by February 15, 2004 11:04 PM
8 comments, last by boyohboy17 20 years, 9 months ago
So, I finally got around to writing a flocking application. Nothing fancy, just the usual 3 rules that boids uses and no objects to avoid. All weights and parameters are tweakable. Velocities and accelerations are limited to a certain amount. I let it run, and for a while the flocking was beautiful to behold. But the movement of the birds seemed to dampen, and soon they reached equilibrium (a sphere). Did I weight the rules incorrectly? Or is this equilibrium natural when there are no outside forces or other random elements acting on the flock?
Did you have a leader within this flock? A boid that followed a set path... or did you just implement a bunch of boids that followed each other. If the latter is the case, then you can expect them to reach an equilibrium state as the ''forces'' within the flock balance out.

Timkin
Advertisement
yeah, you need a leader for this sort of thing. Otherwise it will come to a neutral point at some point in time.

My Kung Fu is stronger.
neo88
My Kung Fu is stronger.May the Source be with you.neo88
You can also insert some parametric noise into the rule calculations. After all, when was the last time you saw a bird or a fish whip out a tape measure or surveying equipment? Fuzzy things up a bit!

Dave Mark - President and Lead Designer
Intrinsic Algorithm - "Reducing the world to mathematical equations!"

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 neo88
yeah, you need a leader for this sort of thing. Otherwise it will come to a neutral point at some point in time.

My Kung Fu is stronger.
neo88


You can even have a set of rules to determine who is leader. Determine which bird has the most other birds "following" him, and every minute or so, update the leader.
ah yeah, a leader, i never really thought about it, i just got really annoyed when my little dots decided to stop moving
Advertisement
Thanks guys, I definitely like both the idea of selecting a leader and adding some randomness. I''m also considering adding a predator of some sort as well as object avoidance, but first I plan to put together a nice octree implementation.

Thanks!
If you give every bird some goals other than simply flocking the flock should go from place to place, according to those other goals, without specifying a leader.

Maybe have attractive points, or repellant points (food/predators) which appear and dissappear over time.

Selecting a leader gets you away from emergent behavior. The flock is no longer a collection of similar individuals behaving collectively. There is a special individual who''s behavior is determined by a radically different set of rules and to which all the others are slaved (though really the food is the same thing I guess ).
Hi all,

Im new to all this AI stuff but i am doing a project on boids. I have created an app in C++ (im a noob at that too) which anyone can have if they want me to post the link (source and exe).

I too came accross your problem (and others) referring to Reynolds and from what i have learnt the best solution is not to use leader following, i think that would be referred to as a planning stategy which just over complicates things (for a start anyhow), i built it up in stages and refined the 3 rules only, to get the desired behaviour. I also created locomotion (a vehicle class, the embodiment?) and derived from it my boids.

Anyhow i didnt use leader following and i dont get that problem anymore . What Reynolds does is get the boids to only flock towards the surrounding boids (a simple check of the distance between a boid and neighbouring boids, this also forms loads of funky seperate flocks). The boids try to match the velocity of the near by boids. Boids can only see view a certian about angle i think its 270 degrees? that gives them more direction. including seperation that covers the 3 rules.

This site was a massive help:

http://www.vergenet.net/~conrad/boids/

i am only noob but i hope this is helpful.

Seb

oh make sure they have a minimum velocity!

[edited by - sllabres on February 24, 2004 7:16:44 AM]
If there is even ONE hard-coded number in your parameters, you aren''t doing it right. Rather than putting constants in that are the same for the whole flock, randomize them a bit. No two birds/fish/sheep are the same in the real world... why should your boids be the same? All of these parameters should be within some sort of range.

Min. Velocity
Max. Velocity
Turn rate
Acceleration rate
Desired sep. distance
Radius to check for other boids

What''s even more important and really accentuates the above is the vary these thresholds over time for the same boid. One time, the boid may adjust because the neighboring boid is within X distance. The next time, he may adjust because that same neighbor is within Y distance. Another way of accomplishing that is to space out the state checks. If you check every Z number of frames, the boid may catch the neighbor at X distance the first time and Y distance the next check.

The real world is comprised of gray areas. Use them.



Dave Mark - President and Lead Designer
Intrinsic Algorithm - "Reducing the world to mathematical equations!"

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!"

This topic is closed to new replies.

Advertisement