Java Boids
This is a demonstration of the boids
model of bird flocking (and related group motion) written as a
Java applet. For additional
background information, see the boids
page.
The boids are modeled as point masses. A local 3D coordinate
system (frame of reference) is attached to the point mass and made to
align with its velocity. Based on its local environment, each boid's
behavioral controller computes a steering force on each iteration of
the simulation. The steering force and velocity are clipped if they
exceed a certain threshold. In this demo the boids are contained
inside a wrap-around sphere. When they venture outside of the sphere
they are "teleported" to the opposite side of the sphere.
Note that aside from randomized initial positions for the boids, this
simulation is entirely deterministic. All the lifelike, unpredictable
behavior emerges from the complex adaptive nature of the model.
This applet was created using the
Cosmo Code 2.0 Java development environment. The 3D rendering is
accomplished using a slightly modified version of a class implemented
by Paul Haeberli for his
Pure Java
3d applet. (BTW: Paul suggested that I point out that my applet
ignores mouse input.) In the future I hope to provide a version that
allows you to interactively adjust various parameters of the
simulation. Thanks also to
Xiaoyuan Tu
and Roy Hashimoto who
made significant contributions to an earlier C++ version of this demo.
Other boids-related applets
- 3D models
- 2D models
- The four members of the
Biological Model Simulation Project made several 2d models
of "Schooling Tadpoles". One demonstrates
basic schooling (with obstacle avoidance), the same
with a predator, a version where you click the mouse to drop
food, and a version with two independent schooling
groups.
- Task Gouda
wrote this
2d boids model which includes ten parameters which you can set
to adjust the functioning of the simulation (requires Javascript).
-
Helmut Lorek wrote a Java-based simulation of
fish schooling which includes adjustable parameters. It is based on
a model by Andreas Huth and C. Wissel. See also the
ECOTOOLS page.
- This
boids swarm
applet (with source code) was developed by
Jawed Karim, Thomas Bak and Dan Durand
as part of an interactive presentation on
Artificial Life
prepared for the
ThinkQuest
competition for students aged 12 to 18.
- Rich Vanderwal (of Groovee
Creatives) produced this
2d boids applet for
Discovery Online
for a feature called
Its Alive. Notably it allows you to switch each of the three
component behaviors on and off, as well as allowing you to adjust
the size of the flock.
-
Jonathan Robbins (with help from
David Leserman) built a boids
applet and control panel. See also his
report on the project for his 8th grade science class.
- Matthew Caryl
wrote a nice 2d
Swarm
applet which includes a control panel for adjusting parameters.
The simulation also includes a voracious predator which the boids
try to avoid. Includes source code.
- Larry O'Brien wrote an article in
InterActivity called
Artificial Life Programming in Java which used herding as an example.
The article came with source code but no compiled version.
David
Brogan of Georgia Tech kindly provided a compiled copy
online.
Note that I've seen this crash browsers.
- Duncan Crombie's page
The Examination and
Exploration of Algorithms and Complex Behaviour to Realistically Control
Multiple Mobile Robots contains related information and a link to his
2d flocking applet with interactive controls and source code.
- Flock
with obstacles by
Simon Buckwell
- Flocking
with "V" formations in an applet based on a model from
Gary W. Flake's book
The Computational
Beauty of Nature. (You need to select the boid demo on the top pull
down menu.)
- BoidModel
applet by
Tomohiro Orikasa, with source code
(comments in Japanese).
-
Boids Flocking Behavior by
Scott Robert Ladd, includes a control panel.
- Boids Applet by
Kazuhiro Yoshida ("moriq") uses color coding to indicate number of nearby
flockmates for each boid.
- Tadpoids by
Phil Pocknell
demonstrates herding under the influence of a predator in a situation very
much like the interaction between a sheep-dog and a flock of sheep, such
as in a sheep-dog trial. See also his
Pest Control applet and his
dissertation.
[new]
- Flock with
Obstacles by Keith Wiley
is a Java applet using an approach similar to his
Mega Flies
application. It allows to drop in obstacles with a mouse click.
[new]
-
Les Boids en JAVA by
Cadin Gildas
features three "species" of boids flocking independently but avoiding
each other. Provides control panels to adjust flocking parameters.
[new]
-
Genetically Engineered Battle Boids (2000) by
Joshua Lifton. In
addition to a 2d herding implementation, this applet includes a mode where
two flocks of "battle boids" engage in stylized combat. In addition, the
battling boids can be put under the control of a genetic algorithm which
gradually evolves their behavior based on their success in battle. Source
code is available.
[new]
- Unlike the flock applets above, these swarms make no
attempt to align with their neighbors, and so look more like
insect swarms than bird flocks or fish schools:
- Other related models:
-
Frog Queue by
Maeda Mameo appears to be based on a follow the nearest
leader rule, but I cannot read the Japanese descriptions.
Source is included.
-
Race Boids by
Allan deCamp, a variation on the boids rules to control a
"herd" of racing cars.
[new]
See also
Applets for Neural Networks and Artificial Life by
Akio Utsugi
Mac users: for better Java support, try the
iCab browser.
Send comments to Craig Reynolds
<cwr@red3d.com>
visitors since September 24, 1996
Last update: December 7, 2000