DOOM is a classic game to implement on a variety of platforms, but doompdf by [ading2210] is one we didn’t see coming. It runs a bit slow and controls are a little awkward but it does run. Entirely within a PDF file, at that.
How is this possible? PDFs are technically capable of much more than just displaying static content, and support JavaScript with their own library of functions. Adobe Acrobat implements the full spec, but modern web browsers implement at least a subset of the functionality in a sandboxed JavaScript runtime environment. Input and output are limited to things one might expect from a fancy PDF form (text input boxes, clickable buttons, things of that nature) but computation-wise, just about anything goes.