Learning to Fly: Simulating Evolution with Rust and WebAssembly
This project is inspired by the "Learning to Fly" series by Patryk Wychowaniec . It demonstrates how to simulate evolution using neural networks and genetic algorithms in Rust, compiled to WebAssembly. The simulation features virtual birds navigating a 2D world to find food, with each bird's behavior controlled by a neural network that evolves over time. Designed for Rust beginners, the series introduces key concepts and guides you through building an interactive ecosystem from scratch.
Explore the live simulation: https://shorelark.pwy.io
Make sure you have the following installed:
Install wasm-pack if you haven't already:
cargo install wasm-packNavigate to the Rust crate and compile it using wasm-pack:
cd libs/simulation-wasm
wasm-pack build Go to the www folder and install JavaScript dependencies:
cd www
npm installnpm run startnpx webpack serveIf you make changes to the Rust code, rebuild the WebAssembly package:
cd libs/simulation-wasm
wasm-pack build