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
0
votes
0 answers

display pandas DataFrame evolution

I had fun encoding BOIDS https://en.wikipedia.org/wiki/Boids in python and now I have a DataFrame with each line representing a bird, and its associated coordinates (x and y). So for every second, I have the coordinate of every point. I would like…
Nielsou Akbrg
  • 201
  • 3
  • 13
0
votes
1 answer

Calculate which way to turn a boid to get to an object in Java

tl;dr: I have angle x and angle y in radians; Which way do I need to turn angle x to match angle y? I have a boid with an angle which desires to point towards a goalAngle (angles are in radians). However the boid cannot turn at a speed greater than…
Matthew Miles
  • 727
  • 12
  • 26
0
votes
0 answers

Implementing Raycasting for pathfinding LWJGL

I am currently working on a project involving procedurally generated underwater terrain using 3d Simplex noise and the marching cubes algorithm. Right now I have made my character model as well as generated the terrain mesh. Since the project is…
Ethan Ma
  • 69
  • 3
  • 7
0
votes
1 answer

Insects following the leader - can I implement Boids algorithm for that?

I would like to illustrate how insects are following their leader in 2 dimensions. How can I acomplish that? Is it possible to do this with Boids algorithm? Or maybe someone knows another algorithm, designed especially for that reason?
rukya
  • 678
  • 4
  • 21
0
votes
1 answer

How to make boids pursue a movable character in a 2d game

I was wondering what would be the simplest way to make my group of boids pursue my character in a top down 2d game with a path finding algorithm? I'm thinking I'd have to first find a path to the player with the path finding, get the desired vector…
Ryan
  • 47
  • 1
  • 6
0
votes
1 answer

NullReferenceException when accessing an IEnumerable of a custom class

Goal I am designing a boid system using Unity. I deal with the awareness radius by adding a boid to the "Swarm" list when it enters a collider. In order to find the force for each boid, I need to cycle through the swarm list, access the "Boid"…
Sove67
  • 7
  • 4
0
votes
1 answer

pygame add object with mouse click

Trying to add more boids by using mouse click ingame. elif event.type == pygame.MOUSEBUTTONUP: self.boids_group.add(boids.Boids(rect=pygame.Rect(random()*self.width, random()*self.height, 40, 40))) I get an error msg that there is no…
MerrinX
  • 183
  • 1
  • 2
  • 12
0
votes
1 answer

How to make agent flock in their group using BOIDS rule in Netlogo?

Here is what I want to do: I need all agents move forward in a group by using BOIDS rule I want them to be able to turn around after they meet the wall (my world is not wrap, they can't penetrate the wall to reach the other side of the world) here…
linda
  • 117
  • 9
0
votes
0 answers

Collision detection between 2 'areas'

I have been working from the following example provided by the user Andrew Thompson -> Collision detection with complex shapes I have attempted to implement this in my program (code below) in the method 'draw' but for some reason the statement to…
0
votes
1 answer

Rectangle Avoidance in Boids

I am making an adaptation of the classic Boids simulation from the 80s in Java. It works well enough, but I am trying to add a new rule to the behavior that would force the agents to avoid rectangles (walls) and I am not sure how to go about…
0
votes
0 answers

Harsh movement when trying to implement rule 2 of the boids algorithm

My implementation of rule 2 of the boids pseudocode produces exactly the oposite of the desired behaviour(the boids get pushed away as if they each had a force field): They will be slightly steered away from each other, and at the next time step…
sro5h
  • 322
  • 2
  • 12
0
votes
1 answer

How can I clear the screen when I redraw an object?

I'm trying to implement the boids algorithm, and everything was going great until drawing the birds (or cubes, in my case) using three.js. The screen is not cleared after redrawing so I get even the old cubes on the screen. Here is my code: var…
mihaela
  • 394
  • 2
  • 12
0
votes
1 answer

Boids predator and obstacle behavior

I am working on a boids simulation in python with pygame. The basic behavior works, but I am now trying to add obstacle avoidance and a predator. So far, I am having trouble figuring out how to implement these behaviors. First of all, I am trying to…
Fake Name
  • 813
  • 2
  • 9
  • 17
0
votes
1 answer

Python boids implementation

I am trying to implement a fairly basic boids simulation in python. My goal is to have a simulation with a basic predator prey setup. I found some pseudocode (can't post more than two links but it is the first result if you google boids pseudocode)…
Fake Name
  • 813
  • 2
  • 9
  • 17
0
votes
1 answer

Modifying ArrayList object values from another class

I have two classes: class Creature which contains ArrayList boids, and class Food. Boids have a few parameters: Creature(float posX, float posY, int t, int bth, int ah) { location = new PVector(posX, posY); vel = new PVector(random(-5,5),…
CatNamedKat
  • 97
  • 1
  • 1
  • 7