Hacker News new | ask | show | jobs
by ejones 484 days ago
Amazing work. I'm interested in the choice of WASM - presumably any target that can run DOOM could've been used? Of which there are innumerable choices I assume. Was it for symbolic reasons or genuinely the most useful target?
3 comments

love this feedback - will definitely talk about it in the next videos.

you're gonna laugh.. but the answer is "ignorance". I had no idea what I was doing and had literally never touched WebAssembly before but thought it'd be a good place to start. Then it just stuck.

Hilariously, later a friend explained to me "Dimitri, this would have been a LOT easier if you had just targeted ASSEMBLY. IT WAS RIGHT THERE IN THE NAME". haha. oh well! ignorance is bliss

Ah nice! Well, hats off this is really impressive. As other commenters mentioned the extent to which it's documented and the restricted scope probably helped.
exactly! knowing what I know now, actually WebAssembly was probably just about the best thing I could have accidentally picked!
WASM is one of the easier platforms to port as the Virtual Machine is well documented and there are actual implementations in many languages that can be used for debugging and comparing the results.

even in pure JS: https://github.com/evanw/polywasm

WASM is the easiest target because you don't have to emulate an entire computer.
But in this case he kind of did anyway (at least the video makes reference to "L1 Instructions Cache").
But that's all CPU -- he doesn't have to emulate the rest of the computer (video card, IO systems, etc). You provide WASM with your own interface to the outside world.
(not arguing, really just want to hear your thoughts to this!) so re: video card - but I did write what I don't know what else to call other than "a graphics driver" (i.e. it takes Doom palette pixel values and converts them to something the user sees on their screen with ASCII art). what else would you call that? or are you saying video card would have to be at the level of VSCode or my operating system that actually lights up physical pixels on my screen.
If instead of WASM you decided to emulate a different DOOM target like a PC then you'd have to emulate the actual VGA graphics hardware and enough of the other PC hardware to run the game. That level of emulation is a difficult project on it's own.
got it, ok sweet. thank you so much for explaining. I don't know a ton about these programming circles, so I don't want to say the wrong thing if I can avoid it. Sounds like you're saying that no WASM runtime is, in this sense, qualifying - which makes sense!