A demo using the rust wgpu implementation of the WebGPU API to compute and render the Game of Life and Life-like simulations.
See the online version in a WebGPU capable browser at https://wgpu-game-of-life.fornwall.net or run a checkout locally using cargo run
.
It's based on WebGPU Samples, ported to rust and wgpu
(with the help of Learn Wgpu) and having some additional features for demonstration purposes. It uses winit for cross-platform windowing functionality.
- Change generations per second:
Q
to go slower,W
to speed up - Change grid size:
-
/+
- Change initial density:
Left
/Right
arrows - Change rule:
Up
/Down
arrows - Download image:
I
(web version only) - Play/Pause:
Space
- Reset:
R
- Toggle controls:
Tab
/C
(web version only) - Toggle fullscreen:
F
Use cargo-ndk to build and run (release builds requires the CARGO_APK_RELEASE_KEYSTORE
and CARGO_APK_RELEASE_KEYSTORE_PASSWORD
environment variables to be set).
make [RELEASE=1] build-android
: Build apk attarget/[debug/release]/apk/wgpu-game-of-life.apk
make [RELEASE=1] run-android
: Run app on connected device or emulator.
Run make run-ios-simulator
to run inside the iOS simulator.
Run make run-web
to build, serve and open the web version in a browser.