This is an experiment to simulate a school of fish in Rust by implementing the boids algorithm. It is wholly inspired by Sebastian Lague's - Coding adventure with boids.
The experiment has been successful in it's object to,
- Explore and learn Rust
- Get dirty with graphics and graphics mathematics
- Be awed by procedural generation
However as I proceeded through the experiment I felt that this deserved more attention. In turn, it got absorbed into a blog that walks you through making simulating your own school of boids.
First feast your eyes on this beauty.
The framerate and resolution took a hit in trying to display it here. Here's a better version. Or You can clone this repo and cargo run
to see the simulation in a much better quality.
The blog is written as a three part series.
- A fistful of boids - Setting up the scene and basic animation
- For a few boids more - Generating boids and obstacle avoidance
- The school, the boid and the Rusty - Simulating a flock, parallelism and benchmarking performance
It is also divided into ten tagged stages to mark milestones. You can begin from anyone of them but I would suggest starting from the first post in the series. It should not take more than 1.5 hours to code through the whole series.
I'm a beginner at Rust so I will appreciate any suggestions for improving the code. Any questions and issues related to the blog are also welcome, just file an issue or mail me.
Here I try to address some of the common errors people face when trying to run the project.
failed to run custom build command for alsa-sys v0.1.2
: This error occours beacuse the ala-sys dependency requires an external package for compiling correctly. Refer here to solve the issue