2022-09-17.Demo.for.README.mov
- This is an implementation of the Boids algorithm in the Bevy game engine.
- This was a learning project for me as I was new to both Bevy and Rust.
- This is not a terribly clean or directly re-usable implementation of Boids (so sorry), but you're welcome to cherry pick anything you find interesting.
Boids is a simple algorithm for simulating flocking behaviour. It has applications in videogames and nature simulations, and is a common subject for little tech demos such as this one :)
You will find many excellent outlines of the algorithm on the web, so one is not provided here.
When the demo starts up, you will see some crows flying around somewhat randomly. Over time, they will coalesce into several small flocks or even merge into one large one.
You can adjust several properties of the simulation:
- separation — how strongly the birds try to keep distance from their neighbours
- alignment — how strongly the birds try to keep the same direction as their neighbours
- cohesion — how strongly the birds try to keep close to their neighbours
- keep in bounds — how strongly the birds want to keep from going out of bounds (the rectangular area)
- keep level — how strongly the birds want to avoid up and down movement
Play around with these and give them time to have an impact on the birds' formations.
Download a native build under Releases. I have only tested on macOS, but the Windows and Linux builds should work 🤷
If you have Rust installed, you should be able to clone the repo and build and run the demo yourself with cargo run
.
Not at all. Although the crow asset used here was inspired by the commonness of the birds in Batticaloa (where I was staying while working on this project), the behaviour here is nothing much beyond a demo of the Boids algorithm and is not a realistic of the behaviour of real crows.
There is a house crow model created for this project, which you will find here: assets/house_crow.blend. It's a pretty basic, low-poly model with vertex colours and only the crudest animations, but it's also my third model ever so I'm fine with it 😊
Everything in this repo (including the house crow and agouti models under assets) is provided to the public domain and you are free to use or modify as you like without restriction.
This project was created during Dinacon 2022 in Batticaloa, Sri Lanka. Although it fails to capture the actual behaviour of any wildlife as I had hoped to achieve, I did learn a lot about Rust and Bevy while doing it :)
I've been a Unity developer for more than a decade and decided it's time to learn something new, something using modern software paradigms, something more open and free, and something without gross ties to the US military. There are a myriad of free and open source game engines being worked on, including some others in Rust, but Bevy seemed like the most promising candidate.