The behavior pattern for the birds in Aria is an adaptation of the well-known
Boids flocking algorithm as presented for autonomous characters by Craig Reynolds.
To understand the autonomous character behavior algorithms we used first
consider the problem we had to address. Our birds need to emerge from the
tree when someone plays well, then fly to the drumming individual. If an individual
continues to play well birds must circulate in front of her. If two or more
individuals are drumming then the birds have to alternately circulate between
them and circle in front of them. When the individuals play poorly or not
at all, the birds must return to the tree. And in all of this the birds need
to appear to actually be flying gracefully, which means smoothly and without
sudden starts or halts. Obviously the easiest way to handle this is to have each bird remember where
it is going and take care of all the physics itself. The problem with this approach is that we must maintain a table of which
players are drumming well and attract birds. If we maintained this table on
every bird it would be very wasteful of space and time. Ergo the Aviary. An Aviary contains all members of a single species of bird
and is responsible for remembering where that species of bird is interested
in going. Thus, while each bird is technically autonomous, the birds are capable
of sharing the state that defines where they want to go, as well as most of
the physics code. Each bird itself is a NONDETERMINISTIC FLYING AUTOMATON (NDFA). Each bird
has a number of "current behavior states" it can choose from as well as the
current physics state of position, velocity, and orientation. Let us say that the table is empty, and a player strikes the first drum.
This immediately causes that drum to be rated more highly in the opinion of
bird-dom, and a bird is generated. Upon being generated the bird springs into existence underneath the world
tree, with its current behavior set to "Seek To Point". It asks the Aviary:
"Where shall I go next?" The Aviary looks in the table that's been set by
the heuristic and rolls a die. In this case it is a two-sided die that can
point only to the first drum, or back to the tree, so the bird goes towards
the drum. When the bird gets to the drum it asks the aviary: "Now what?" Now meanwhile
the first player has carried on drumming so her score is higher. A second
player has started drumming as well, but has a lower score. Once again the
Aviary rolls a die and decides that the bird should go to the first drum.
But the bird is already at the first drum; so for now it just circles. After circling around for a while, the bird once again asks the Aviary where
it should go. This time the die says it should go to the second player. Meanwhile none of the players have been hitting their drums, so their pads
lose all their attractiveness. When the bird gets to the second drum, it asks
the Aviary, "what next?" But by now none of the drums have any probability
left on them, so there is only one place for the bird to go: back to the tree. The key attractions of this system are its computational efficiency (operation
time is only O(n) for N birds among however many total aviaries), its memory
efficiency, its ability to share heuristic data among all the birds at once
while letting each bird handle its own physics, and the ease of changing heuristics.
Since each bird essentially asks the aviary what it should do next after reaching
every point, then changing behavior on all the birds is just a matter of a
small change to the one function in the aviary. More importantly, since these
decisions are just made by a big roullette wheel inside the aviary, then the
heuristic of the experience -- the algorithm that decides who is playing well
and who isn't -- can be *very* easily swapped out as better ones become available.
All the heuristic has to do is put the weights on the players (decide how
big the spaces on the roullette wheel are) and the Aviary's probablistic mechanism
takes care of the rest. Aviary System



