Skip to content

CJBuzz/boids

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Boids Simulation

Built a simulation to try out boids algorithm. You can view it here.

Idea is inspired by Conrad Parker's post and Ben Eater's code.

Boid rules

  1. Fly towards centre of mass of nearby boids.
  2. Keep a small distance away from other boids and objects.
  3. Match velocity with nearby boids.

More details can be found on Conrad Parker's post.

Actions

Press spacebar to toggle between these modes:

  • View
    • Clicking won't do anything.
  • Add boids
    • Click to add more boids at mouse position (initially has 100 boids).
  • Add goals
    • Click to add an obstacle that boids will avoid.
    • Ctrl + click to remove nearby obstacles.
  • Add scatterers
    • Click to add a scatterer; boids within the scatterer's zone will move away from each other (negation of rule 1).
    • Ctrl + click to remove nearby scatterers.
  • Add goals
    • Click to add a goal that boids will move towards.
    • Ctrl + click to remove nearby goals.

Note on removal: click close to the center of environmental object.

To-do

(If I remember)

  • Add ability to remove goals and scatterers
  • Add environmental obstacles that boids try to avoid
  • More efficient methods to locate neighbouring boids
  • Try out 3D simulation

About

Testing out boids algorithm

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published