Last week I built and published a multiplayer Game of Life with Rust + Datastar. You can play it on my Labs Server.
In this post we'll walk through a bit about how it works.
A multiplayer Game of Life hosted on my Labs Server.
I've been a longtime fan of Hypermedia Systems with tools like HTMX and Datastar. Like seriously I wrote several posts about building with these tools in this paradigm:
So of course I saw Anders Murphy's Game of Life in Clojure and wanted to build my own using my current favorite stack - high-level Rust.


The system basically works like this:
tokio::sync::watch, sends the current snapshot immediately, then streams changes.Not particularly. But it's also not that inefficient for my purposes - a small demo expected to be used by < 10 ppl at a time.
8 kB × 5 × 60 = 2.4 MB / minute per player, or 144 MB / hour. With 10 players that's 24 MB / minute. 2.4 mb is about the size of a large embedded web image so not that bad to serve to each player each minute.50 × 50 × 5 ticks / second = 12,500 cells per second, each checking up to 8 neighbors. We only compute the simulation tick once before sending out to subscribers. One sampled uncompressed HTML event was about 0.71 MB and is shared across every subscriber. So yeah a decent number of calculations but these are all simple boolean checks and cached / shared across subscribers so they mostly don't grow with users aside from connection overhead.So yeah a bit heavy to run a game like this but it's reasonable on basically any system built this millenium. If this ever does get wide usage may move to a small canvas drawn version and just send down game state deltas but we likely won't hit that.
Plus I'm running my machines on Hetzner so outbound bandwidth is pretty cheap so I don't mind too much. You can compare hosting options with CloudCompare.
So that's my multiplayer game of life with Rust + Datastar.
If you're curious about building high-level webapps with Rust, I've got a few posts onthe subject and I built CloudSeed to make spinning up a simple scalable fullstack webapp in Rust super easy.
If you liked this post you might also like: