ancatrusca

ancatrusca

The setup

Hernán Rivas Acosta (Erlang Solutions) built Spawndemonium, a top-down multiplayer shooter shown at Code BEAM Europe. The simulation is Rust compiled to WebAssembly, running in the browser and inside a GenServer through Wasmex.

Points for Elixir developers

  • One GenServer per match, eight players max (a gameplay choice, not a performance one). The tick handler stays small: drain inputs, call Wasm, decode events, write to sockets.

  • Pick a tick interval that is a whole number of milliseconds. 30 Hz (33.3 ms) drifted; 40 Hz (25 ms) didn’t.

  • Skip JSON on hot paths. A custom binary protocol tagged with the tick lets binary pattern matching extract what the server needs, including the client timestamp used for ping.

  • Wasmex over Rustler for isolation: a broken match crashes alone.

  • Treat bots like laggy players. The demons decide five ticks ahead, which keeps them in sync across clients and gives humans time to dodge.

Try it

Clone Spawndemonium from GitHub and run make run. make release builds for a server, with an ARM target included.

Related episodes

Episode 15 with Elise Sedeno on MMO servers, episode 10 on Rust and Elixir, and the Bandit episode with Mat Trudeau.

Where Next? Top

Trending in Podcasts Top

ancatrusca
The setup Hernán Rivas Acosta (Erlang Solutions) built Spawndemonium, a top-down multiplayer shooter shown at Code BEAM Europe. The simu...
New
PJUllrich
The eMudhra root certificates were compromised, and we cover how to check whether your Elixir app is affected. Elixir 1.20.5 fixes three ...
New
ancatrusca
What Bondy is A declarative, statically typed language for the BEAM that combines Datalog and Constraint Handling Rules, created by Alej...
New
ancatrusca
Mike Hostetler joined Allen and Francesco to talk about Jido 2.0, what he rebuilt from 1.0, and why the framework still keeps the LLM out...
New
PJUllrich
Hex 2.6.0 adds Workflow Identify aka. Trusted Publishing, staged publishing, scoped API keys, and an emergency approval mode to reduce pa...
New

Other Trending Topics Top

dominicletz
Hey there, I haven’t seen a list of useful Elixir specific skills for the popular AI tools yet so I’m starting one here with my first. ...
New
raa-ziq
Hi everyone :waving_hand: I wanted to share something I’ve been building — NowBlind, a random chat app designed to help people discover ...
New
mudasobwa
I fully migrated to my own harness from Anthropic/Gemini and I think it’s time to share it. Welcome DSH, the DeepSeek Harness, fully writ...
New
OndrejValenta
(I just needed to vent somewhere and LinkedIn is full of hope, or hype, I’m not sure which exactly) AI dream has many faces, but general...
New
kip
Localize is the next generation localisation library for Elixir. Think of it as ex_cldr version 3.0. The first version will be released ...
New
jimsynz
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews