[[!sidebar content=""]] [[!meta title="asm-blox: a game based on WebAssembly that no one asked for"]] [[!meta copyright="Copyright © 2022 Zachary Romero"]] [[!inline pages="internal(2022/info/asmblox-nav)" raw="yes"]] # asm-blox: a game based on WebAssembly that no one asked for Zachary Romero () [[!inline pages="internal(2022/info/asmblox-before)" raw="yes"]] Over the past decade, programming games have risen in popularity and become a genre unto themselves. They are loved for their open-endedness and have helped people get into programming as well as help programmers hone their problem-solving skills. As a fan of the genre, I decided I wanted to recreate such an experience in Emacs. Looking at the already existing collection of games, TIS-100 by Zachtronics stood out as an especially good candidate for the base of a game, where the user is entering assembly code into a terminal to solve puzzles. The game asm-blox switches things around and instead of programming register machines, you program mini stack machines in a language similar to the WebAssembly text format. I'm still wondering if the game is actually any fun or not but either way it was an interesting project to make. In this talk, I'll demo the game as well as go over some of the Emacs Lisp tricks I used to make it work. The source code can be found at # Discussion ## Questions and answers - Q: Why did you choose an internal state versus many`state buffers`? (ie. actual windows)  Thanks! - A: A single internal state is easier to deal with in the context of the game. Windows would obviously be better for other normal applications to allow users to customize how they should behave. - Q:Do you have plans to port shenzhen io to emacs? - A:That would be cool, was also thinking about exopunks. - Q:Did this use wasm ? We call some wasm code from Emacs? - A:No, more similar to TIS-100, just a game. - Q: Why wasm rather than a more traditional Assembly dialect? It wouldn't be harder to implement, right? - A: It would have been easier, but less of a challenge and resemble TIS-100 too much. - Q:Any next projects on your mind? - A: Yes, a couple, hopefully more useful. I think tree-sitter is cool. There's a neovim plugin called neogen that generates documentation. Hopefully next year I'll be presenting something more useful. - Q: Does this work with any other paren-based editing packages? - A: Not at all (etc. tbd) - Q: What kind of tool could use this idea?  - A: So I think some sort of graph drawing tool in Emacs might have a similar idea. Like artist-mode but with graph drawing constructs. - Q:  How did you go about designing the puzzles? - A: With open-ended puzzles like this, coming up with random ideas that seem like they should be implementable usually works. If  you've seen some of Zachtronics games, the bar is extremely high for what is capable. - Q: What' are your favorite changes  in the upcoming emacs 29? - A: Definitely tree sitter. I've played around with it and it provides a nice interface for extracting syntax information. Like I can probably rewrite this plugin without any crazy regexs: - Q: Are there tools to add more puzzles? - A: So the game code itself has a asm-blox-puzzles.el file which defines each puzzle. It's pretty easy to add new puzzles but it involves digging into the code. - QLike a binding to graphviz? (assume this is a continuation of the "what kind of tool" question) - A: I was thinking more ASCII, like a tool I saw called diagon. Like artist mode but for graphs. But graphviz is amazing and a lot could be done with that.            the diagon tool: Other feedback from IRC: - Great presentation. Game actually looks quite fun - Thanks again for your answers. Du bist das Beste [[!inline pages="internal(2022/info/asmblox-after)" raw="yes"]] [[!inline pages="internal(2022/info/asmblox-nav)" raw="yes"]] [[!taglink CategoryFun]]