NetLogo Models Library:
This is a vector-based 3D flocking model, based on Jon Klein's implementation of Craig Reynolds' Boids algorithm. Each bird is influenced by a series of urges. By assigning different weights to each urge, the birds exhibit different flocking behaviors.
Each bird has vectors for velocity and acceleration, that is, a velocity and acceleration in the x, y, and z directions. Each of these vectors is influenced by six urges, to be near the center of the flock, to have the same velocity as the rest of the flock, to be keep spacing correct, to avoid colliding with obstacles, to be near to the center of the world and to wander throughout the world. Each of these factors affects the resulting velocity and acceleration; however, the sliders in the interface weight the amount that each has an effect.
Choose the number of birds with the POPULATION slider. Press SETUP to create the birds. Press GO to start the simulation.
BUILD-CUBES randomly places floating-ball obstacles throughout the world. BUILD-WALL creates a randomly placed wall.
VISION is the distance that a bird can see around it. MAX-VELOCITY is the fastest a bird can go and MAX-ACCELERATION is the fastest a bird can accelerate. CRUISE-DISTANCE is the minimum distance from a nearby bird for a bird to feel comfortable.
A bird's movement is determined by the set of urges acting on that bird:
CENTER-CONSTANT - urge to move towards the center of its flock VELOCITY-CONSTANT - urge to align its velocity with the velocity of her flockmates SPACING-CONSTANT - urge to be no closer than CRUISE-DISTANCE from other birds AVOIDANCE-CONSTANT - urge to avoid colliding with obstacles WORLD-CENTER-CONSTANT - urge to avoid the edges of the world WANDER-CONSTANT - urge to move in a random way
The urge-constant sliders control the weight of each urge in determining the birds' behavior.
If the VERTICAL-SPACING? switch is off the spacing urge only operates horizontally.
If a bird hits an obstacle, the bird dies. The COUNT DEAD-BIRDS monitor shows the number of dead birds.
Compare how long it takes the birds to form flocks in this model to how long it takes in the regular 3D Flocking model.
Given the default settings the flocks travel in a circular pattern.
Turn VERTICAL-SPACING? off and notice how it changes the shape of the flocks.
Try changing the different constants so that the birds become better or worse at avoiding obstacles.
Try adding different urges to the model; also try making different types of obstacles for birds to avoid.
Create different breeds of birds that behave differently from each other and see how they interact.
This model uses lists and
map fairly extensively to represent and manipulate vectors.
This model is based on Jon Klein's "Swarm" demo for breve, (see http://www.spiderland.org/s/) which was inspired by Craig Reynolds classic Boids flocking algorithm.
If you mention this model or the NetLogo software in a publication, we ask that you include the citations below.
For the model itself:
Please cite the NetLogo software as:
Copyright 2005 Uri Wilensky.
This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License. To view a copy of this license, visit https://creativecommons.org/licenses/by-nc-sa/3.0/ or send a letter to Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA.
Commercial licenses are also available. To inquire about commercial licenses, please contact Uri Wilensky at firstname.lastname@example.org.