#boids #bevy #search

app boids_rs_bevy

Rust boids simulation using Reynolds model running with Bevy engine

1 unstable release

0.1.0 Nov 9, 2023

#387 in Simulation

GPL-3.0-or-later

3MB
348 lines

https://github.com/danieldidiobalsamo/boids/assets/79797812/dd61766b-6962-4ac8-957f-da5a2f3b936d

About

Rust boids simulation using Reynolds model running with Bevy engine.

The following parameters can be updated while the simulation is running:

  • turn factor: boids ability to turn fast
  • visual range: radius (in px) of the circle in which boids can see
  • protected range: radius (in px) of the circle in which boids wants to be alone
  • centering factor (cohesion rule) : boids move toward the center of mass of their neighbors
  • avoid factor (separation rule): boids move away from other boids that are in protected range
  • matching factor (alignment rule): boids try to match the average velocity of boids located in its visual range
  • Maximum boids velocity
  • Minimum boids velocity
  • bias: some boids are searching for food, and are not exactly following the flock

While all the parameters can be updated live, you can also press 'P' to pause/resume the simulation. Press 'Q' to leave.

How to launch

Make sure cargo is installed and then just launch:

cargo install boids_rs_bevy
boids_rs_bevy

Build manually

Firstly, install bevy dependencies

Then

cargo run --release

Note: if you want to launch as dev, make sure to add the following feature to decrease compilation time :

cargo run --features bevy/dynamic_linking 

Dependencies

~37–71MB
~1M SLoC