Hacker News new | past | comments | ask | show | jobs | submit login
Someone Got Doom Running in Notepad at 60 FPS, Somehow (escapistmagazine.com)
80 points by sandebert on Oct 10, 2022 | hide | past | favorite | 48 comments



See also: http://thesiteformerlyknownas.zachtronicsindustries.com/note... with http://thesiteformerlyknownas.zachtronicsindustries.com/imag... linked in the comments.

I had a lot of fun writing a few small games with this method, don't think I ever shared them anywhere though.

Here are the key bits:

    char* c = "Hello World!";
    HWND hwnd = FindWindow("Notepad", NULL);
    HWND edit = FindWindowEx(hwnd, NULL, "Edit", NULL);
    SendMessage(edit, WM_SETTEXT, NULL, (LPARAM)c);


It's rather unlikely to get you anywhere close to 60 fps. I'd guess that they do wm_settext once and then update notepad's copy of the text directly, triggering a repaint after each update.


Banding suggests this.


Doom is not running in Notepad, it’s being displayed in Notepad. Just like that pregnancy test display; it wasn’t actually running Doom, it was just used as a display.


The pregnancy test thing comes up in every one of these threads about "Doom running on XYZ" - the "Doom running on a pregnancy test" was (effectively) totally fake. He removed the internals from the pregnancy test and put in a tiny OLED screen where the pregnancy test's LCD indicator had been. It wasn't even used as a display, it was simply where the display was.

(It was still cool because of the tiny OLED screen, and it was a funny story, but it's become some kind of legend because I think people took the story as "he ran Doom on the CPU and screen inside a pregnancy test!" which it's clear you saw through but I guess some people didn't)


Oh, so it was even more fake than I thought, then.


Do note that foone uses they/them pronouns, please use those if possible :)

Also, afaik, the pregnancy test would actually have the performance necessary to run the test, just no hardware to display it.


No, it was just the plastic shell of the pregnancy test that was "original"; IGN says: "it's important to note that Foone did replace the display and microcontroller, so the only part of the original tester is the shell. However, getting Doom running and playable on a 128x32 pixel monochrome display at 1bpp is still an impressive feat."


You are stating the obvious.


Since I haven't seen the source, I don't know how this one was made, but if you want to do something like that, there are some high performance libraries for converting images into ascii. Mainly libcaca (http://caca.zoy.org/wiki/libcaca) and aalib (https://en.wikipedia.org/wiki/AAlib) Both have integration as codecs for ffmpeg, so you can easily convert whole movies (if you really want...).


> at 60 fps!!!

Poor copy editors couldn't display their ignorant disdain for all that geeky gaming stuff better than stating that game that had a fixed 35 updates per second loop (to match 70 Hz video mode) ran at 60 fps.

(I know that interpolated rendering has been available in ports for a long time. The engine still runs at 35, because interpolating it would drop all compatibility, and rely on arbitrary decisions on how to resample and predict trajectories defined by original constants.)

Also, something in the narcissist manner of presentation tells me the whole thing can be just a gameplay video processed with libcaca, seemingly without even aligning the source and output resolution, if we pay attention to the edges.


If this is "just" sending keystrokes to notepad.exe, as in "ctrl-a, del, lots of keystrokes until one frame is done", then I'm actually more impressed by the speed keystrokes and redrawing are handled in the good ol' Win32 EDIT field.


>I'm actually more impressed by the speed keystrokes and redrawing are handled in the good ol' Win32 EDIT field.

I wonder what went wrong. I can't see today's MS ever living up to what the NT and desktop team delivered ~20 years ago.

Its baffling to think that the same company is responsible for Teams.


Microsoft lost the OS war and is defending Office as best they can, which includes cross-platform tooling.


2nd behind Android if we're counting mobile OS's. But still ahead of computer/laptop/desktop OS's.

https://gs.statcounter.com/os-market-share


Microsoft has 75% market share on desktop OS, and is doing a lot to keep it that way (including the windows subsystem for linux and VScode remote that make it easy to develop linux code on Windows)


They lost the server OS war, but desktop Linux seems like it will never overtake Windows and macOS.


They lost every OS market except for the Desktop. Where it is at 75% to 80%, trending downwards. Give it another decade.


Is the market share largely being taken by macOS or something else? Chromebooks perhaps?


In the corporate world, there seems to be a shift towards thin clients running whatever OS works best (homegrown Linux, ChromeOS, macOS) and beefy Citrix servers, as well as another shift to SaaS/on-prem/on-own-cloud web applications.

Guess we're in a revival of the 70s/80s mainframes with dumb terminals again.


macOS is the important one - if Microsoft support for office on Mac wasn’t as good as it is, they could be in existential danger.

Already Google Apps has made a strong play, and Microsoft is doing quite a good job defending. Teams is only a part of it.

And there’s also mobile, which they lost entirely. That could be a risk, too, and they know it.


I don’t know. I bought office for my Mac 4 years ago and used it maybe twice. Google docs might not be quite as good but good enough for most things. I also hate looking at the ribbon (but that is just personal preference).


Yeah, for home/personal use they're all the same, and many people don't own anything Microsoft in that arena - Google docs from a iPhone/Mac/Chromebook are often "good enough".

Businesses they still have a stranglehold, but even there I've noticed it loosening.


Did they lose the OS war? last I checked Windows has higher marketshare than macOS.


Over the long run, mobile is king, and windows isn’t there. If Apple or Android figure out how to take advantage of their situation on this, they could overtake windows in 40-50 years.


> they could overtake windows in 40-50 years.

Is that also your overall estimate on how long the mobile paradigm will overtake the desktop one? I would guesstimate that to a decade, or a decade and a half at most, with the degeneration of written language following closely.


I say they did, in that they have to treat other OSes as "real" - if they had dominated as they did in the 90s and early 2000s they would have just made Office for Windows and left everyone else on some Web version.


Comparing a windows-only minimum viable visual text editor with a cross-platform videoconferencing software which integrates with a ton of other productivity software. Sounds legit.

I get it, Teams may not work perfectly on every setup. But the same goes with practically all enterprise-level videoconferencing solutions.


> Its baffling to think that the same company is responsible for Teams.

In an absolutely symmetric comparison, the Germans first gave us Goethe, and then..

Same company, but different teams I guess :)


Almost certainly writing direct to memory, as per http://kylehalladay.com/blog/2020/05/20/Rendering-With-Notep...


I thought it might be using the windows equivalent of PTRACE_POKETEXT, to poke data into notepad's memory.

I've altered the contents of the gedit text editor within a linux VM, via PTRACE_ATTACH and PTRACE_PEEKTEXT/PTRACE_POKETEXT, to find and modify the text.


Notepad opens files using memory mapping, so an alternative might be to open the same file also using memory mapping, and then you have shared memory directly with notepad.

Except, that would mean notepad updates the display as the file changes, and I didn't think it did that. So I think I've got something wrong.


Maybe the edit buffer is a different area of memory to the mapped file. This would make sense as editing a file doesn't update it on disk until you choose to Save.


Some hacker just needs to wire the output up to Visual Studio Code


Capture the output of DOOM (typically the dos port where the screen is super simple to read as a byte array). Do some filters on it. Render it somewhere else. YAWN.


Why the negativity? Better whimsical projects like this than another cynical moneygrubbing attempt or polluting gadgetry


Just getting tired of the "DOOM running on xyz" posts I guess.


For me, it is more about just the low-effort "ports" like this (e.g. where they just render it there).

However, I enjoy seeing more creative and actually novel ways of "DOOM running on xyz". One such example would be DOOM actually implemented in Excel. Back when it came out, it was genuinely cool and novel. This is the type of stuff that I would not mind seeing more of at all.


Lol. Do it yourself then


I'm glad notepad.exe has avoided the modernisation trends in other Windows utilities. I wonder if there was ever a push to have a UWP replacement implemented. If so, I'm thankful to whoever knocked it back.



That already exists!


So it is constantly sending text to the opened notepad, won't he eventually run out of memory and slow down the whole system? (or hang up)


If it really is a playable version of Doom running in Notepad.exe, that seems like quite literal black magic to me. (I am not a game dev)


Notepad doesn't really have a way to execute code as far as I know. In this case, Doom is running on the machine, but it has been modified to copy and paste the display to notepad very quickly as ASCII text.


I wonder how it reliably captures the key input if notepad is the window with focus.


I guess it 'renders' the whole frame in some buffer, and then copy-pasting it to Notepad takes less than 1ms, leaving you with at least 940ms of each second waiting for key input (assuming 60fps). And might have overestimated the copying time by few orders of magnitude, maybe copying takes just a microsecond ?

Another thought: do you even need to bring notepad to focus in order to copy contents to it? Maybe it's not in focus at all, and just happens to be the only thing on the screen?


Although technically this is really cool, I worry that there is something more important we could be doing with our best minds?




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: