Show HN: WasmBots – A WebAssembly-powered programming game

(shaneliesegang.com)

2 points by sjml 2 days ago | 0 comments

I've been working on a browser-based programming game where you write bots to explore procedurally generated dungeons in any WebAssembly-compatible language. It's like a minimalist roguelike where your character's brain is a program you write. There are pre-made libraries for C, Rust, Zig, Go, and AssemblyScript.

The game mechanics are intentionally simple for now, but the challenge comes from building up your bot's understanding of the world from limited local information. Your code needs to handle mapping, pathfinding, and strategy while dealing with monsters and potentially hostile other players.

Some interesting technical bits:

* Pure WebAssembly modules with no JavaScript dependencies (not even using wasm-bindgen for Rust)

* Cross-language development with native debugging support via language-specific trainer builds

* Custom messaging protocol implemented across the five example languages using code generation

The project started as a way for me to poke around WebAssembly, especially exploring its potential as a universal plug-in language. There were a lot of yaks to be shaved as I went, though, and I ended up also learning a bunch about various build systems, roguelike exploration mechanics, procedural generation, etc. It's been a fun experience so far and I feel like it's hit a nice point (decently polished presentation of bots exploring the dungeon) before I start the next phase of adding actual game mechanics.

Intro Video: <https://www.youtube.com/watch?v=DGkkTYJrflI>

Deployed site: <https://shaneliesegang.com/projects/wasmbots>

Auto-built: <https://sjml.github.io/wasmbots/>

Source (Monorepo): <https://github.com/sjml/wasmbots>

The whole thing so far has been a one-person show, and I was often learning bits of tech as I was building with them, so feedback (technical or otherwise) is very welcome.