Want to read Slashdot from your mobile device? Point it at m.slashdot.org and keep reading!

 



Forgot your password?
typodupeerror
×
First Person Shooters (Games) Games

Doom Runs At 60 FPS In Notepad (tomshardware.com) 52

Game developer Sam Chiet has found another use for Microsoft Notepad. The ingenious creator has gotten Doom (1993) to run at 60 FPS through the boring text editor in Windows. Tom's Hardware reports: Chiet highlighted that he didn't have to modify the Notepad application. Dubbed "NotepadDOOM," the project is fully playable. Although Chiet didn't explain how the mod works, has committed to launching NotepadDOOM for other Doom fans to try out. Chiet said in a subsequent tweet that "it'll take some work to polish NotepadDOOM into something releasable, but it'll almost certainly happen over the next couple days." John Romero, one of Doom's creators, was impressed and replied to Chiet in a tweet that the mod was "incredible."

You can see the iconic 1993 shooter running in its full glory on Chiet's YouTube channel. It's Notepad, so obviously, Chiet replaced the graphics with characters and numbers. The gameplay looks pretty smooth, although we did catch some screen tearing. However, that could be because Notepad can't write the text fast enough on screen.

This discussion has been archived. No new comments can be posted.

Doom Runs At 60 FPS In Notepad

Comments Filter:
  • by HotNeedleOfInquiry ( 598897 ) on Monday October 10, 2022 @08:49PM (#62954955)
    That's weird AF.
    • (Also a feature Linux has already had for about 2 decades now.)

      • Linux could run Doom in Windows notepad without modifying notepad?
        • Well, yes it probably could do exactly this through wine just as easily as they're doing it in Windows, but I was actually talking about this [wikipedia.org].

          • > AAlib is a software library which allows applications to automatically convert still and moving images into ASCII art. It was released by Jan Hubicka as part of the BBdemo project in 1997.

            I don't see the words "text editor" or "notepad" in that wiki page anywhere. It's almost like you're comparing an application built specifically to convert graphic outputs to ASCII, to a text editor. Weird. I'm sure you're not one of those unhinged Linux zealots who make the entire community experience insufferable at

          • by wed128 ( 722152 )

            It's entirely possible (and I don't know, I haven't seen the code) that he used AAlib (or one of the forks of AAlib) to do the rendering, implemented a virtual keyboard driver, and ran the text through the driver into notepad. Although AAlib was originally written for linux, it is pretty portable (and specifically was ported to DOS a very long time ago).

  • by rsilvergun ( 571051 ) on Monday October 10, 2022 @08:56PM (#62954961)
    So this is useless to me. I'm sticking with doom in a bash prompt.
    • I think being able to use the standard ANSI control codes from bash for 8 colors will really improve the overall experience.

      • My rig isn't powerful enough to drive high detail settings like that at 144 HZ. Maybe I should buy a GTX 4090....
      • Ugh... Vt320 is much more than that and Xterm is true color and sixel renders the rest stupid
      • That's way too many colors - Doom's color pallet is black, brown, grey and a splash of red.
      • by GoTeam ( 5042081 )

        I think being able to use the standard ANSI control codes from bash for 8 colors will really improve the overall experience.

        Only if you can turn it into "matrix" style text. More than two colors is just garish.

  • I never knew of sound effects in Notepad.
    • by larwe ( 858929 ) on Monday October 10, 2022 @10:36PM (#62955111)
      The sound isn't being played by Notepad. Notepad is basically acting as a video streaming surface for the display - the game itself is running elsewhere and that's where ths sound is coming from.
      • by Toad-san ( 64810 )

        I'm glad you mentioned that. The video was purely 'orrible, but I was thinking favorably about the sound. But it's not in Notepad. Okay ... It's not DOOM to me.

  • Ten seconds of that video and I already have a headache. Even if I had a Windows machine, I couldn't play this.

  • Notepad hacking (Score:5, Informative)

    by bettodavis ( 1782302 ) on Monday October 10, 2022 @09:16PM (#62954995)
    I recall someone in Youtube showing how to access Notepad.exe's window for doing automation with its contents a few years back, by injecting data into its memory buffers. They could play tetris or some such with it.

    I presume this is just one step ahead, and uses it for displaying the game images using text, similar to other Linux apps doing it with ncurses/libcaca.
    • With how slow the refresh is it looks like they're simply abusing the copy/paste buffer

      • At first I was thinking "Oh crap, why would M$ add scripting to what is supposed to be a bare bones, no frills text editor?", and then I thought what you wrote.

          60 FPS, that is a lot of text to be dumping into any text editor and I can't imagine this being able to run for long before Notepad crashes, or the whole system becomes a big paging fest. Hopefully it clears the pasted text per frame update so this won't be an issue.

  • Why so slow?
  • by larwe ( 858929 ) on Monday October 10, 2022 @10:33PM (#62955105)

    This topic started a bit of an argument in another forum, because I assert that the 60Hz rendering isn't really exciting at all - because there's very little data being manipulated, and no realtime calculation at all - a LUT works fine. Less than a minute of thinking led me to this how-to, hence I conclude that while the idea is really cool and silly in the best engineering way, actually implementing it is trivially easy:

    I don't remember if Doom ran preferentially in int 10h mode 13h MCGA 320x200x8bpp palettized, or an X-mode but I think the former. It was definitely designed for 5:5:5 RAMDACs because 5:6:5 and 8:8:8 weren't part of the original VGA/MCGA spec. Anyway let's assume 320x200x8 on a 5:5:5 RAMDAC.

    Onetime tasks:

    We know the palette contents because we have the game sourcecode. That was in color. So our first task is to transform the 5:5:5 palette to grayscale. You can get fancy and do gamma correction here to generate maybe 6bpp of grayscales, but the easiest way to do this is to do what a monochrome VGA monitor would have done: ignore R, B and only use G. So we have 32 possible grayscales, or 64 if you've gotten fancy. (From the video, the author is, in fact, doing it the slightly more complex way).

    Our next task is to create a LUT that selects font characters to match each grayscale value. Again the simplest thing to do is simply rasterize each character (in the specified/selected font) and perform pixel counting to determine the ratio of off to on, and match it to the desired gray level. We wind up with an array lut[32] that directly maps a palette's G value to the desired character to put into notepad. At this point I should note that a _better_ approach is to use a 9-dimensional LUT so that you choose the character to be placed, based on the pixel of interest and the 8 pixels around it, but we're still talking simplest case here. (If we go this route, we either render to 318x198 or we have to special-case the edges of the screen).

    We now launch Notepad and use EnumWindows() to locate its hwnd. We can at this point be fancy and user friendly and send it simulated menu and WM_SIZE messages to select the right font and resize the border so no word wrap occurs, but that's optional.

    Per-frame tasks:

    The Doom engine gives us a 320x200 array of 8-bit integers that reference into the palette. Using the simple case above, our output character for each pixel is lut[palette[pixel].g], or if you like lut[(palette[pixel] >> 5) & 0x1f]. So we store that character at the top left of our "frame buffer" and proceed to EOL, at which point we insert a carriage return and start processing the next "scanline" until we reach the end of the last scanline. (This step is a little more complex if we did the "gamma correction" enhancement in the palette-to-character conversion, but the algorithm is the same).

    We now copy the "framebuffer" to the Windows clipboard, send the Notepad hWnd a select-all message followed by WM_PASTE to paste in the new frame.

    About the Author:

    Wrote firmware for several digital picture frames (Digi-Frame models DF-560, DF-390, DF-1710, DF-2300, DF-57) including JPEG/JFIF decoding, filesystem, comms and color palette conversion filters, also programmed DOS/Win16/Win32 for quite some years, ported System16 arcade emulator rendering code from original C to PowerPC asm. I am also an insufferable pedant and general a**hole-about-town.

    • Does anyone really just throw away R and B to go monochrome? I can see it for a proof of concept demo, or under extreme computational limits, but it means all shades of red and blue are simply rendered as black, horrible for most scenes.

      Typically the standard luminosity equation is used in any real application: Y = 0.299 R + 0.587 G + 0.114 B, which models the eye's color sensitivity to preserve perceived relative brightness across colors for typical viewers (I would assume some inaccuracies for the colorb

      • by larwe ( 858929 ) on Tuesday October 11, 2022 @12:43AM (#62955311)

        Does anyone really just throw away R and B to go monochrome?

        That's how monochrome VGA monitors, contemporaneous to the original DOOM, worked - they didn't have any physical connection to R/B. The choice of green was a) because of how eyes work (which is also why 5:6:5) but also b) because of historical sync on green. Which come to think of it probably has antecedents in a) anyway. You're right that it's a suboptimal experience, though - and from the video, the author isn't doing this, he's combining RGB in some way, possibly with the canonical formula.

        I am a little bit dubious about the overhead of using the Windows clipboard though

        It appeared from the video that this is how the author's code is working, because of the flickeriness (due to select-all). I could be wrong. But it is certainly _a_ way to perform the required task without getting too deep into inter-app memory hacking. If you update the character buffer inside Notepad, you also have to know how to stimulate it to redraw, and that might be even more invasive/slow than simply giving it new text to display.

        Hardly seems fair to say it's running in Notepad though - at best it's being rendered there.

        Right, and that's what attracted me to the headline in the first place - I was like "oh NO, is Notepad now being updated to execute active content?" Turns out it is really just being used as a streaming video surface for the game - which is running elsewhere.

    • by AmiMoJo ( 196126 )

      I wonder what font he us using. A bitmap font would render pretty fast, but it's still 3.8 million characters per second. I believe that TTF font rendering is GPU accelerated now.

      Microsoft must have improved the performance of the standard Windows textbox control too, because it used to be pretty slow and crappy. I tried to use it for a terminal emulator with a USB CDC device and it couldn't keep up with the speed at which characters were coming in, which was only about 1 million/second max. So if he is get

      • by larwe ( 858929 )

        Microsoft must have improved the performance of the standard Windows textbox control too

        If I get any more interested in this, I'll have no choice but to write a couple test apps and see what's what.

        • by AmiMoJo ( 196126 )

          Please share the results if you do.

          Back in the day I ended up using the Windows console window instead, because it could handle massive amounts of text coming in really fast. Even then I had to slow the USB side down a bit.

          Then Windows 10 introduced a new console window that caused my app to crash if you resized it. It was a vertical app for support staff and I never got a Windows 10 machine to debug it with, before leaving the company. I have no idea if the new console is as fast as the old one.

    • > We now copy the "framebuffer" to the Windows clipboard, send the Notepad hWnd a select-all message followed by WM_PASTE to paste in the new frame. You can do way better than that. EM_GETHANDLE (might need to be done in process, but one can inject code into the process to do that) "Gets a handle of the memory currently allocated for a multiline edit control's text." See: https://learn.microsoft.com/en... [microsoft.com]
  • It used AALib and SVGALib [archive.org] (screenshot [homeunix.net]). And that was on hundred-MHz Pentiums.
    • by Anonymous Coward

      1998 isn't normally what we'd call "the early 90's" AAlib was released in 1997, which also isn't the early 90's. Hell, Quake came out well-after the early 90's.

      "The early 90's" caps out at 1994 at most, and that's clearly cutting into mid-90's territory. 1998 is solidly late-90's.

  • Even the VAX-11 in the basement can run Doom on 60FPS

  • can it run notepad?
  • run windows in notepad, inside of which run doom on notepad
  • I thought you measured fps at whatever the fastest rate is that no tearing happens...?

You knew the job was dangerous when you took it, Fred. -- Superchicken

Working...