|
We've
all seen it many times - flocks of birds, crowds of people, schools of
fish, hundreds and thousands of insects. Specifically, what I'm referring
to is the animation of crowd scenes. Traditionally, crowd scenes were
created during postproduction, through the use of an editing feature that
allowed producers to overlay, edit, and then overlay some more to create
the requisite scenes. Nowadays, however, with the help of both powerful
processors and innovative digital tools, it is not uncommon to see such
slight-of-hand in television shows, movies, and even console games.
How
difficult is it to create a crowd scene? This article will outline the
theory and practice of creating the simple animation of a crowd scene
with the help of Maya's powerful scripting language, Maya Embedded Language
(MEL). However, be it using MEL, C/C++ codes, or other software applications,
the fundamental theory and techniques described here may always be applied.
The
Crowd Scene - A Group Behavioral Control System
Group
Behavioral Control System (GBCS) is a term that I coined to reference
the technique I use for controlling a large number of actors. The actors
can be insects, fish, birds, human-like characters, or whatever creatures
you desire to control. Some people may have different names to describe
such a system, such as behavioral animation or crowd system, but generally
we are all talking about the same thing; namely, to procedurally control
a large number of actors with the minimum number of functional parameters.
The
keyword in the above description is functional. By functional, I am referring
to a set of mathematical algorithms or functions that suitably model the
desired animation. Take a primitive example: we know that a square can
be described using a basic set of xy inequalities and a circle can be
described by the basic equation of x2 + y2 = r2.
The two sets of descriptions are essentially mutually exclusive. That
is, you cannot describe a square using the equation of circle, and vice
versa. However, if you desire to animate the morphing of a square to a
circle, you would need to derive a method of describing the shape of a
square and the shape of a circle. With your method, there must
exist a parameter that takes the form of a sliding value where, say, a
zero (0) represents a complete square while a one (1) represents a perfect
circle, and any in-between values represent a combined form of square
and circle.
The
challenge in developing a GBCS therefore lies in the derivation of a good
set of functions that correctly describe your desired animation with as
few controlling parameters as possible. Often, to achieve this, one must
tear down individual functions and descriptions and build a new set of
algorithms.
|
|
Figure
1:
In three dimensional form, a procedural function is derived to
morph between a cube (square) and a sphere (circle) with a single
parameter control. Here's
an example.
|
Implementation
Considerations...
The
Basics
In
implementing a GBCS, there are two main points to consider:
1.
The group behavior
2.
The individual member's behavior
The
group behavior represents the behavior exhibited by the entire group as
a whole. For example, in animating a swarm of hornets, the entire movement
of the swarm is its group behavior. However, while moving as a group,
each individual hornet will, for example, be flying in a slightly different
direction, moving at a different speed, and traveling at a different height.
Such individual characteristics constitute its individual behavior. Another
common example is a human crowd control system, where the crowd movement
as a whole is the group behavior, and the individual members of the crowd
exhibit their own individual, distinct behavior. Thus, to implement a
group control system, you will have to consider both the group as well
as the individual member.
AI
and Behavior
In
the past, the speed of hardware used to be a major concern when designing
games. Nowadays, this is becoming less and less the case. Instead, many
believe that the future of the gaming industry lies not in hardware features
but in software techniques. In fact, several veterans in this field believe
that the future of the industry may lie in the use of Artificial Intelligence
(AI). Currently, several games are already integrating AI into their gameplay
(one example is Age of Empires II from Microsoft).
When
implementing a GBCS, it will be of more interest to the game player if
AI is also incorporated into the gameplay. Using the hornet example above,
once the core of the GBCS is developed, you can, for example, integrate
AI into the hornet group so that the hornets exhibit enough intelligent
to decipher, say, where the common places that the players like to hide
are. The feeding of this AI to control the group behavior will certainly
improve gameplay for the users.
The
idea of integrating AI to GBCS is really nothing new. In 1987, Academy
Award winner Craig W. Reynolds suggested in one of his Computer Graphics
papers that the use of AI techniques such as an expert system could be
applied to controlling group behavior. In such a system, autonomous actors
should have, to a certain extent, the ability to determine their own actions.
These actors should to a degree have a mind of their own, so that the
animator need not be concerned with every detail of each actor's movement.
The
Physics
When
developing your GBCS, some difficult may be encountered in striking a
balance between entertainment animation and real-world physics animation.
In entertainment animation, characters and motions are exaggerated to
give players a greater sense of satisfaction and excitement. For example,
a character may jump 20 feet high just to clear an obstacle of 5 feet
in height. On the other hand, physics-based animation will allow you to
design your world based on the correct set of real-world physics rules,
thereby creating a more realistic environment for gameplay. The latter
approach has always been very restrictive and demanding in terms of programming
complexity, as everyone is quite familiar with real-world physics, and
thus any slight abnormality in the simulation is immediately conspicuous.
However,
as more and more games are being created based on exaggerated movements,
a quality physics-based games will be too distinct to be ignored. The
likelihood of an increased trend towards physics-based animation received
a boost when Sony chose Mathengine as its Playstation middleware partner
for its physics and 3D interactive entertainment. The recent collaboration
between Mathengine and Softimage to deliver real-time physical simulation
and behavior tools to game developers and animators indicate that apparently,
quality, physics-based animation is upon us.
The
integration of real world physics into a GBCS poses a great challenge
to developers. The requirement of obtaining a functional procedure to
describe the complete group behavior is a formidable task in itself, let
alone the incorporation of real world animated physics. Thus, unsurprisingly,
most present solutions to achieve the effects utilize tricks, cheats,
and clever programming, including the example that follows.
|