Blake Jones' projects and writings

Conway’s Game of Life using wgpu

This is an implementation of Conway’s Game of Life. There are lots of other implementions out there; this one is written in Rust using the wgpu library. It’s a demo of how to use a compute shader together with a fragment shader to create pixel-granularity generative art using wgpu.

I’m excited about wgpu because it allows programs to be compiled into WebAssembly, which lets them run in a browser. Right now (July 9, 2021), browser support for wgpu is under active development, which in practice means that it only works using pre-release versions of the browser, and then only sometimes. I’ll update this page to use the WebAssembly version once that’s available, but for now, here’s a snapshot from the running system:

Having a single pixel per cell isn’t the best resolution for most Life simulations, since it’s hard to observe the details, but it’s a useful model for other systems that are more compute-heavy.

The colors are inspired by the old Sun screensaver version of Life:

where cells start out red and move along the rainbow toward blue/purple as they age.

The source code is available on Github.