Header Ads

Show HN: Doom (1993) in a PDF https://ift.tt/8VsTZ2z

Show HN: Doom (1993) in a PDF I made a Doom source port that runs within a PDF file. I was inspired by the recent HN post about Tetris in a PDF ( https://ift.tt/ruqjXAa ) and I wondered if I could get Doom to run using a similar method. It turns out that old versions of Emscripten can compile C to asm.js code that will happily run inside the limited JS runtime of the PDF engine. I used the doomgeneric ( https://ift.tt/Hz3SZYx ) fork of the original Doom source, as that made writing the IO fairly easy. All I had to do was implement a framebuffer and keyboard inputs. Unlike previous interactive PDF demos, the output for DoomPDF is achieved by creating a text field for each row of pixels in the screen, then setting their contents to various ASCII characters. This gives me a 6 color monochrome display, that can be updated reasonably quickly (80ms per frame). The source code is available at: https://ift.tt/RPxCqgG Note that this PDF can only run in Chromium-based browsers that use the PDFium engine. https://ift.tt/JV8z1Bq January 13, 2025 at 01:50AM

No comments

Powered by Blogger.