Bird Patterns

Started by
7 comments, last by Omnipotent 21 years, 4 months ago
Hi All, I am attempting to incorporate birds for eye candy in a new game I am working on. I have gotten a couple examples working that look somewhat ok, but more or less it looks like a scripted event. The scenario is I have 4 – 8 birds depending on performance costs feeding off the ground. Then when a player comes near or if a ball bounces near them they are scared off and fly away and land somewhere till a certain amount of time has past then they gradually fly back and begin feeding again. Any tips onto how to approach this would be most appreciated!! Thanks, Omnipotent
Advertisement
Ferretman has done a lot of cool work on flocking algorithms. It would seem that there would be two states, both with flocking algorithm variants. The first would be that of the birds pecking around on the ground - not moving much. When there is a proximity alert, the whole flock changes states to flying, which they do for a while until they decide on a place to land again and revert to state 1.

Dave Mark - President and Lead Designer
Intrinsic Algorithm - "Reducing the world to mathematical equations!"
RIPPL Sports - NFL Statistical Analysis and Prediction System

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

Craig Reynolds has done some wonderful things with flocking behavior and steering behavior if you''re interested in that. Check his page at http://www.red3d.com/cwr/

-Kirk
Thanks for all the input so far...

InnocuousFox - I tried to find information on Ferretman flocking algorithms but was unsuccessful I was wondering if you could provide me with a URL?

Thanks,

Omnipotent
Well, you would have to have different rules for different states.
First, when on the ground.
The movements would be limited to finding the nearest food source, so the alignement rule seems irrelevant (try to face in the same direction than the rest of the flock), but the avoidance rule (dont bump into your mates) and cohesion rule (stick together).
Although I guess if you observe flocks of pigeons, you might wanna consider a degree of fighting (and thus ignoring the avoidance rule) for food supplies.

Then comes an alert, as soon as any pigeon sees threat, it will fly away. Simply propagate the "take off" reaction to nearby flockmates (really an extension of the cohesion rule, but with a global switch of the set of rules being used; the flight rules instead of the pecking rules, if you will)
Once in flight, the cohesion and alignement rules should naturally show the flock of birds following the first bird to take off. If several birds see the threat simultaneously, well, I suppose it would be interesting to see what happens ?
(Maybe have the birds have slightly different physical properties such as aggressivity (for feeding), speed (the maximum speed they can reach, especially when fleeing and the average speed otherwise), endurance (how long they can maintain the maximum speed)).
If you look at pigeons (again), they will usually simply fly away high enough, circle around and land only a few meters from the original take off point (the food source).
Again, you could use a stat to determine how "brave" birds feel towards a threat (pigeons are particularly accustomed to their human environment, for instance; I have a feeling it''s an adaptation rather than natural bravery).
Or use some risk/threat assesment technique to decide the behaviour of the flock : depending on the threat, the importance of the food source, the availability of food, the need for food and the natural bravery of each bird, each bird decide whether to wait nearby a food source but at a safe distance from the food (a pack of hyena letting a lion feed but ready to jump back on the food ASAP), simply move to the next point of food (a flock of pigeons simply hoping a few meters to a less busy food spots while some humans walk about; in this case their might not even be a take off), etc.

For all the threat avoidance, and food tracking, read up Craig Reynolds steering behaviour paper (an extension on the Boids principle).

I hope it makes sense As usual, the more rules you put in, the more interesting the resulting behaviours, the question is, if you only want to have those birds as an interesting anim, do you want to put so much details ? (possibly, instead of a risk assesment process when deciding what to do, simply pick your choice using probabilities).

Sancte Isidore ora pro nobis !
-----------------------------Sancte Isidore ora pro nobis !
search for the paper

"Interaction with Groups of Autonomous Characters" by Craig Reynolds.

It describes his solution to your problem. Although in Reynold's version there are dozens of birds. It comes with a movie of his algorithm in practice - very nice effect.


Ferretman is the pet name (sorry, couldn't help myself ) for Steve Woodcock of www.gameai.com fame. You can find his writings in the Game Programming Gems series and AI Wisdom.




ai-junkie.com

[edited by - fup on December 3, 2002 11:30:00 AM]
check out www.generation5.org. It has a lot of articles on Genetic Programming and Artificial Life projects. One of them includes a Java applet that models flocking. It is really cool.

[Formerly "capn_midnight". See some of my projects. Find me on twitter tumblr G+ Github.]

http://www.generation5.org/flozoids.shtml
Here''s a proper link.

Also, don''t forget that all the birds don''t take off at exactly the same time, one gets startled and then they all follow.

[Formerly "capn_midnight". See some of my projects. Find me on twitter tumblr G+ Github.]

Sweet thanks for all the input!! I got a pretty good design now and I am currently coding it. Thanks again for helping me get an idea of how to tackle this task.

Thanks,
Omnipotent

This topic is closed to new replies.

Advertisement