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://news.ycombinator.com/item?id=42645218) 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://github.com/ozkl/doomgeneric) 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://github.com/ading2210/doompdf
Note that this PDF can only run in Chromium-based browsers that use the PDFium engine.
Comments URL: https://news.ycombinator.com/item?id=42678754
Points: 83
# Comments: 15
Ak chcete pridať komentár, prihláste sa
Ostatné príspevky v tejto skupine

Article URL: https://gwern.net/blog/2025/perfume
Comments URL: https://news.ycombin

Since mozilla announced the sunsetting of pocket, I started looking for alternatives, including building a light version for my personal use. But nothing came out of my research.
What options ar

