Questions tagged [boids]

Boids is a computer model of coordinated animal motion such as bird flocks and fish schools.

The algorithm itself is simple. The flock is modeled as a group of individuals, and the behavior of each individual "boid" is governed by three rules:

  1. Separation: steer to avoid crowding local flockmates
  2. Alignment: steer towards the average heading of local flockmates
  3. Cohesion: steer to move toward the average position of local flockmates

These rules are applied independently to each boid, such that there is no assigned leader.

Some useful resources for implementation:

  • Craig Reynold's boids page is the canonical reference, and contains links to many implementations and articles discussing uses of the algorithm.
  • Boids pseudocode gives an overview of the basic algorithm and various tweaks to model effects like wind, targeting and scattering.
54 questions
1
vote
0 answers

Java boid rotation limiting

I'm creating a program which implements boids in java swing. To avoid boids snapping to their desired location instantly, I am limiting the angular velocity and acceleration to values defined in the static Constants class. public static final double…
Matthew Miles
  • 727
  • 12
  • 26
1
vote
0 answers

Boids in compute shader: How can I avoid a stable state when processing every boid in parallel?

I want to implement the simple, age-old boid algorithm in 2D but as compute shader in HLSL (host programm ist VVVV). Now my problem: In all 2D sample-applications I`ve found, boids are updated one at a time. This results in some jittering that…
1
vote
1 answer

NetLogo3D : Detecting a turtle between two radius

I'm currently modeling some simple boids using Netlogo3d and i'm having an issue with the in-cone and in-radius functions. (I'm re-implementing the article 'Collective Memory and Spatial Sorting in Animal Groups' from Couzin, Krause, James, Ruxton…
IBeLow
  • 11
  • 1
1
vote
2 answers

Where can I find some open source implementations of the Boids algorithm, for the iOs?

The question says it all: I'm looking for working, open source, implementations of algorithms (or derivatives there of) initially described in the Boids paper.
blueberryfields
  • 45,910
  • 28
  • 89
  • 168
1
vote
1 answer

Flocking separation rule

-(CGPoint)Rule2:(Boid*)b { CGPoint v = CGPointMake(0, 0); for (Boid *boid in ActiveBoids) { if (boid != b) { NSLog(@"%f", [Utilities Magnitude:boid.position] - [Utilities…
user3143075
1
vote
1 answer

Getting "size() does not exist" error in ArrayList

I'm modifying a flocking simulation for a project. Adding objects is fine but when I try to remove objects I get a "The function size() does not exist" error on line 240. The problem is probably at the end in AdjSize() and subBoid() but I don't know…
1
vote
1 answer

Why do my boids rush to world origin when matching speed?

I have a problem implementing Conrad Parker's boids pseudocode. I'm implementing rule1, rule2 and rule3. The problem is that whenever rule3 is active (ie, matchSpeed in my code below), the boids rush to the centre of the world (0, 0, 0) and then…
cyrus
  • 1,338
  • 3
  • 17
  • 26
1
vote
1 answer

Boids in python; calculating distance between two boids

I'm trying to program the behaviour of birds in flight with boids in Python. I haven't found much yet but currently i'm stuck on the function defining the distance between two boids. It has to be calculated with the formula (a,b) = sqrt( (a_x -…
user2162627
  • 11
  • 1
  • 4
1
vote
1 answer

Update background image through Javascript and HTML5 Canvas

Javascript is very far from being one of my strengths; therefore apologies if my question appears very remedial to many of you. I am attempting to implement Boids through Javascript and the HTML5 Canvas. Although the flocking behaviour has been…
0
votes
0 answers

Object-Avoiding for Boids Simulation Craig Reynolds

I have made a similar question recently, but discovered many silly mistakes in the program. I am trying to add obstacle-avoidance to the Boids simulation while attempting to keep the behaviour as normal as possible. This is my algorithm so far: def…
jbg05
  • 51
  • 7
0
votes
0 answers

Attempting to add obstacle avoidance in pygame to the Craig Reynolds boid simulation

I have made a similar question recently, but discovered many silly mistakes in the program. I am trying to add obstacle-avoidance to the Boids simulation while attempting to keep the behaviour as normal as possible. This is my algorithm so far: def…
jbg05
  • 51
  • 7
0
votes
1 answer

Inverse square separation of boids repels boids unevenly

I'm new to programming and I'm trying to make a little boids algorithm in python, so far I've written a method to keep the boids apart from one another using an inverse square function, and it looks like this: def separation(self, boids): …
eaeaa1232
  • 103
  • 2
0
votes
1 answer

3D boids escape bounding box, p5js

My genetic 3D boids in p5js keep escaping their bounding box. I must not be doing it correctly, and could use some help. Here is a live sketch. Here is the bounding box code: if (this.position.x < d) { desired = createVector(this.maxspeed,…
0
votes
0 answers

How to do 3D boid model simulation on Python?

I want to create a 3D Boids Model in Python. I would like to animate the whole thing during runtime and add options to change the parameters. Is there any package which supports such case? I assume matplotlib is not the right choice? I thought about…
Habenzu
  • 43
  • 6
0
votes
1 answer

Why has my quadtree made no improvement to performance?

I have a boids flocking simulation setup. It originally worked by having every boid loop through every boid so that they all constantly know where each other are at in order to tell if they are close or far away, but then I switched to a quadtree…
Michael Moreno
  • 947
  • 1
  • 7
  • 24