Skip to content

tetzgabriel/flocking

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

38 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Flocking Simulation

This is a small flocking simulation example using p5.js.

I made this inspired on the Boids algorithm created by Craig Reynolds and by Coding Challenge #124: Flocking Simulation video of The Coding Train.

Basicaly the dots in your screen follow 3 simple rules:

You can read more about these rules here, and you can watch The Coding Challenge video here for more details of the math involved.

Some Changes and Addons

In this version of flocking simulation I made some changes and added new functions to the base algorithm:

  • Proportion between the perception maxSpeed and max force
    • Set the perception -> maxSpeed = perception/10 and maxForce = maxSpeed/10
  • Obstacles
    • By clicking or dragging the mouse, you can create obstacles in the canvas, so the boids will avoid them

Improvements, Bugs and New Features

I'm working on this project in my spare time, so it can take a while for me to launch any improvement, bugfix ou new feature. So feel free to open a Pull Request or, if you prefer, send me an e-mail on: tetz.gabriel@gmail.com!

About

An flocking simulation using p5.js

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages