Boids Simulation

Boids Simulation

I recently came across an article that mentioned boids, which is essentially a computer simulation of a flock a birds. Boids uses three simple rules, from which complex behaviour emerges. Having studied large scale distributed systems I'm familiar with emergent behaviour, but I haven't seen anything that looks as impressive as boids. Craig Reynolds, introduced a system known as “boids” that could simulate something similar to birds’ flocking behavior. His model of artificial life followed three simple rules.

Boids Simulation using XNA

Introduction

Boids is an artificial life simulation originally developed by Craig Reynolds. The simulation replicates the behaviour of flock of birds. It also implements the concept of an autonomous agent. Instead of controlling the interactions of an entire flock, however, the Boids simulation only specifies the behavior of each individual bird.

The simulation has been inspired from [Flocking by Daniel Shiffman]

Installation

For Windows

You will need:

  • Visual Studio 2010
  • XNA 4.+
  • Direct X

The solution can be built and deployed using visual studio after above softwares are installed.

Issues

You can report the bugs at the issue tracker

OR

You can message me if you can't get it to work. Real fishing pro 3d system requirements. In fact, you should message me anyway.

Contributing

This game was written for a semester end project in university so don't be shy to make a Pull request if you find improvement :)

For making contribution:

  1. Fork it
  2. Clone it

use visual studio to open the project

Boids Simulation

Contributers

License

Built with by Wahab Jawed(@wahabjawed) under MIT License

This is free software, and may be redistributed under the terms specified in the LICENSE file.

You can find a copy of the License at http://wahabjawed.mit-license.org/

A simple model of a flock of birds, attacked by a predating bird.

Usage

Install NumPy, PIL, PyGame and PyOpenGL. To run boids, execute viewer.py with Python 2.

Model

The boids movement at some point converges to single point. An example dynamics rule that is now implemented is to move a random 1/3rd of the boids to a random other location.

Classic rules that are enforced on the boids:

  1. converge to the center of mass of the flock
  2. if your neighbour is too close, move away from it
  3. converge to the average velocity of the flock

For each rule, not the whole flock is considered, only the N closest neighbors. A few additional rules were added to keep the flock on screen and interesting:

  • set a minimum and maximum velocity
  • escape from the big bird, if it is close
  • escape from a given point if it is close; this is activated by a mouse click.
  • force the boids within a bounding box

The big bird has 2 rules:

  • go to the center of the flock
  • set a minimum and maximum velocity (otherwise, velocity keeps increasing and the big bird is hardly on the screen)

Each of the rules has one or two parameters, to make their effect stronger or weaker. This can also be tweaked towards the actual visualisation used.

Implementation notes

The code uses 8 processes: 1 for visualisation; 1 for computing metrics; 3 for the simulation of the original flock; 3 for the simulation of the nudged flock.

The visualisation is done with OpenGL, with a custom font and bird mesh.

Authors

Simulation and threading: Joris Borgdorff j.borgdorff@esciencecenter.nlVisualisation and user interface: Paul Melis paul.melis@surfsara.nl