Contents |
Introduction
To clarify the use of Janus and the implementation of roles as first-class entity, role dynamics and role communication, a short example of a ||:wikipedia:Boids|boids]] simulation designed using the CRIO metamodel and implemented with the Janus platform is presented.
The Boids demo provides a possible implementation of Boids.
The source code of this demo is embedded into a runnable jar that may downloaded at: not available. Just use
java -jar <jarname>in your beloved console to run this demo. Extract this jar to see the associated java source code and use
mvn clean installto compile it (assuming the use of Maven).
Boids Principle
Boids are proposed in 1986 as a computer model of coordinated animal motion such as bird flocks and fish schools. It was based on three dimensional computational geometry of the sort normally used in computer animation or computer aided design. The basic flocking model consists of three simple steering behaviors which describe how an individual boid maneuvers based on the positions and velocities its nearby flockmates:
- Separation: steer to avoid crowding local flockmates,
- Alignment: steer towards the average heading of local flockmates, and
- Cohesion: steer to move toward the average position of local flockmates .
Originally, each boid has direct access to the whole scene's geometric description, but flocking requires that it reacts only to flockmates within a certain small neighborhood around itself. The neighborhood is characterized by a distance (measured from the center of the boid) and an angle, measured from the boid's direction of flight. Flockmates outside this local neighborhood are ignored. The neighborhood could be considered a model of limited perception (as by fish in murky water) but it is probably more correct to think of it as defining the region in which flockmates influence a boids steering.
For more details on boids, please refers to the Wikipedia page on Boids.
Boids Applet
Download
Binary and Sources
not available - not available
Sources Only
boids-0.5-20120205.232620-227-sources.jar - 54 KB


