How to get Doom running in Windows’ notepad.exe

Date:

Share:


Enlarge / Doom as it was meant to be played.


Hackers of a certain age are intimately familiar with the “Will it run Doom” meme and the wide array of ports it has engendered (including a game of Doom that runs inside an instance of Doom itself). Still, this week’s viral video and eventual itch.io release of a Doom port running in Windows’ standard notepad.exe text editor left us with a number of questions.

Chief among them: “How?” and “Why?”

“My favorite kind of magic trick”

When it comes to the “How?” DoomPad coder Sam Chiet told Ars that the hack is “my favorite kind of magic trick,” the kind that “seems wild, but it’s super simple.”

Building off a C# port of the open-sourced Doom source code (and later shifted to Chocolate Doom for public release), Chiet’s program first converts every successive frame from the game into ASCII text. That’s done using a simple algorithm that figures out the “brightness” of each pixel (by averaging out the RGB color channel data), then converting that to a similarly dark ASCII character using a pre-set lookup table (ranging from “$” and “@” for the darkest pixels to “” and “.” for the lightest).

“[The] conversion is super simple and probably ‘incorrect,’ but it works, and that’s what matters,” Chiet said. “Magic tricks [like this] are always equal parts disappointing and cool!”

Because “the Notepad font is twice as tall as it is wide,” DoomPad initially throws out every other row of generated text to keep the resulting ASCII in the correct proportions. From there, Windows makes it relatively easy to insert that 360×240 array of text into Notepad at whatever font size your window and monitor can handle, Chiet said.

“I’m stealing a reference to the internal textbox and just sticking my memory into it via an operating system ‘message’ and forcing it to re-draw,” he said. As for reading player input, that’s “just something you can steal from anywhere in Windows; you don’t need your specific program ‘open.'”

Chiet said he was somewhat inspired by previous projects like the ASCII-based <a href=
Enlarge / Chiet said he was somewhat inspired by previous projects like the ASCII-based 1337d00m, which has a key advantage of using color characters.





Source link

━ more like this

New report details ‘vast spying’ by China-linked telecom hackers

New details are continuing to surface about the hacking of US telecom companies by a China-linked group that US officials and campaign...

HP OmniBook Ultra Flip 14 vs. MacBook Air: meeting its match | Tech Reader

The MacBook Air has dominated the $1,000 price point for the past few years, and the most recent M3 upgrade (and subsequent bump...

Sling TV vs. Hulu Plus Live TV | Tech Reader

Picking a streaming service isn’t as easy as it used to be. With the most popular streaming services delivering a combination of classic...

Panasonic W95A mini-LED review: delicious brightness and color | Tech Reader

Panasonic W95A MSRP $1,300.00 “Panasonic is back in the US of A with what is easily one of the best mini-LED TVs you can buy.” Pros Bright, sparkling...

Sony will discontinue its pricey Airpeak S1 camera drone in March

Sony announced that it will stop selling the Airpeak S1 camera drone. Sales of the product will end on March 31, 2025. Sony...
spot_img