First of all, sorry for my english. Please feel free to contribute for a better translation <3
The Game Of Life is an automated cells simulation created by the mathematician John Conway. This project is an implementation build in Rust, he offer two differents GUI. Both of those GUI are propulsed by the Bevy motor. One GUI is in pure Rust and the other is also pure Rust but build in the WASM target. Thanks to those GUI you can try the project by typing in your terminal cargo run and by clicking on this link : gol.tonguechaude.fr
Nice question ! I already did that in Java but I don't like the fact that JVM take 2 GB of RAM, so I try in Rust
- GOL Simulation : Implementation of the classic algorithm
- GUI : Bevy provide a great 2D interactive interface
- WebAssembly version : You can play in your browser
To Run the project you need some tools :
- Your 🧠
- An internet connection
And a real list of prerequisites :
- Rust Toolchain :
rustc: (rust compiler)cargo: (Our god 🙏)rustup: (version manager)
- Other tools for WASM :
wasm32-unknown-unknown(additional target for WASM compilation)wasm-bindgen-cli(to generate JS bindings)wasm-server-runner(to run the project in local environment)
- Clone the repository :
git clone https://gitlab.com/Tonguechaude/gol.git
cd gol- Setup your environment :
rustup target add wasm32-unknown-unknown
cargo install wasm-bindgen-cli wasm-server-runnerTo compile and run in release mode :
cargo run --releaseFor running the project in your browser :
cargo run --target wasm32-unknown-unknownor
cargo serveurTo compile the project in WASM and generate JS files
cargo build --release --target wasm32-unknown-unknown
wasm-bindgen --no-typescript --out-dir ./webapp/ --target web ./target/wasm32-unknown-unknown/release/jeu_de_la_vie.wasm
wasm-opt -Oz -o ./webapp/jeu_de_la_vie_bg.wasm ./webapp/jeu_de_la_vie_bg.wasm # Optimize WASM file sizeTesting WASM in webserver environment : (You can't access from file:// cause Browsers dont allow import module to prevent malicious malware to access to your filesystem so you have to do this)
cd webapp
python3 -m http.server 8080Actually I exposed a docker image here : tonguechaude/rust-wasm-builder
This image exist just because my runner CPU is so bad :(, so I need to optimize compute time in CI.
We are doing free software here !! The code is under GNU GPL v3
Have fun with this project !