Run DOOM PDF File
We know that DOOM runs on electric toothbrushes, but what about a PDF file? The answer to that would be a resounding yes, albeit a very pixelated version. This is made possible because C code can be compiled to run within a PDF using and old version of Emscripten that targets asm dot js instead of WebAssembly.



Since C code can be compiled to run within a PDF file, the next step was figuring out a way to get key inputs, and a framebuffer for the output. Github user Ading2210 utilized Chromium’s PDF engine to solve those issue, as it supports both text fields and buttons. However, achieving a good looking framebuffer that is fast enough for gameplay was a bit of a challenge. Have a few minutes to burn? Try it out here.

KAMRUI Mini PC with AMD Ryzen 7 5825U, 16GB DDR4 512GB M.2 SSD Mini Computer, Mini Gaming PC with USB...
  • Powerful Mini Computer: KAMRUI E3B Mini PC with AMD Ryzen 7 5825U (8 cores, 16 threads), Zen 3 architecture, 15W TDP, up to 28W, base clock frequency...
  • Full-Function Type-C Port: This Mini Gaming PC includes a full-function Type-C port that supports charging, data transfer (10Gbps), and 4K/60Hz...
  • Expandable Memory and Storage: The KAMRUI E3B Mini Computer is equipped with dual RAM slots (comes with 16GB DDR4 RAM) and is expandable up to 64GB (2...

The full specification for the JS in PDFs was only ever implemented by Adobe Acrobat, and it contains some ridiculous things like the ability to do 3D rendering, make HTTP requests, and detect every monitor connected to the user’s system. However, on Chromium and other browsers, only a tiny amount of this API surface was implemented, due to obvious security concerns. With this, we can do whatever computation we want, just with some very limited IO,” said the developer.

Author

When it comes to cars, video games or geek culture, Bill is an expert of those and more. If not writing, Bill can be found traveling the world.