In a delightful twist of creativity, Mark Russinovich, the Chief Technology Officer of Microsoft Azure, has unveiled a project that marries nostalgia with modern technology: DoomPaint. This innovative endeavor allows the classic game DOOM to be displayed within the confines of Microsoft Paint, though it is essential to clarify that Paint itself is not running the game. Instead, it serves as a canvas for the game, which operates through the ViZDoom engine, rendering frames headlessly and transferring them to Paint via the Windows clipboard.
Russinovich humorously notes, “Paint renders the game but does not compute it. Paint computes nothing. Paint has never computed anything. That’s the joke.” The project, now available on GitHub, boasts full keyboard controls, sound effects, and even a MIDI soundtrack, all while maintaining a frame rate that hovers around DOOM’s original 35 FPS.
<figure id="attachment93296″ aria-describedby=”caption-attachment-93296″ class=”wp-caption aligncenter”><figcaption id="caption-attachment93296″ class=”wp-caption-text”>Running DOOM in MS Paint. Image Credit: WindowsLatest.com
How to run DOOM inside Microsoft Paint
- Visit the DoomPaint GitHub page and download the project as a ZIP file, or clone it if you prefer using Git.
- Ensure Python is installed on your PC, as it is necessary for the project to function.
- Extract the folder and double-click
run.bat. - Upon first launch, the program will automatically create a virtual environment and install all required dependencies; simply wait for this process to complete.
- Once setup is finished, Microsoft Paint will open automatically.
- Keep Paint in focus and dive into the gameplay immediately.
The default controls for navigating DOOM within Paint are straightforward:
- W / S or ↑ / ↓ – move forward and back
- A / D or ← / → – turn
- Q / E – strafe
- Ctrl or F – fire
- Space – use, open doors
- Shift – run
- F12 – quit
How does DoomPaint compare to earlier “Doom in Paint” tricks
DoomPaint is not the first attempt to integrate DOOM into Paint; however, previous projects typically ran the game in a separate window, capturing that window’s output in Paint. In contrast, DoomPaint uniquely utilizes Paint’s canvas as the sole display for the game, ensuring that every input is processed through Paint itself.
The engine powering this experience is ViZDoom, a ZDoom-based fork designed for AI and reinforcement learning research, allowing it to render without a visible window. Russinovich’s clever implementation hides the window immediately upon creation, ensuring a seamless experience. The project uses the shareware DOOM1.WAD for the initial episode, with additional maps sourced from Freedoom due to licensing restrictions on the original game.
Controls and setup
- Movement is controlled using WASD or arrow keys, with strafing assigned to Q and E, and firing linked to both Ctrl and F.
- Interestingly, the Undo function (Ctrl+Z) acts as a rewind button, allowing players to reverse their in-game deaths by reverting to previous frames.
- Saving at any moment generates a PNG of the current frame, as Paint remains unaware that it is rendering a video game.
- The project requires Python, which builds a virtual environment and installs dependencies automatically.
- No separate purchase is needed for the first episode, but adding a full doom.wad or doom2.wad file unlocks additional soundtracks for later maps.
How Mark Russinovich got Doom running inside Paint
The process of transferring frames to the clipboard may seem straightforward, yet it presents significant challenges, particularly in maintaining performance without errors.
The clipboard race condition that almost sank the project
Paint asynchronously reads the clipboard, which complicates the task of updating it multiple times per second. The initial approach of clearing the clipboard and writing new image data led to errors when Paint attempted to read from an empty clipboard. To resolve this, Russinovich implemented a solution that allows the application to own the clipboard as a reference-counted OLE data object, thereby avoiding the race condition entirely.
Getting the paste to happen without stealing your keystrokes
DoomPaint employs two methods for triggering the paste function, selecting the most effective one based on the version of Paint in use. The preferred method sends a synthetic Ctrl+V keystroke, while a fallback option utilizes Paint’s UI Automation menu for reliability.
How DoomPaint makes sound inside MS Paint
Sound effects are sourced from ViZDoom through OpenAL, with Russinovich opting for a newer build to ensure compatibility with audio devices. Music playback is handled by a separate module that extracts and converts raw music data from the WAD file, looping it through the Windows MIDI sequencer. The project also includes safeguards against audio bugs, resetting the sound system as needed to maintain an immersive experience.
Fable 5 helped build this, and it shows where software development is headed
In a recent LinkedIn post, Russinovich shared that he utilized Claude Fable 5 for this project, highlighting its effectiveness in enhancing productivity. The DoomPaint project exemplifies how AI tools can facilitate real engineering work, showcasing a playful yet technically sophisticated approach to software development. As Microsoft continues to explore the integration of AI in its products, projects like DoomPaint serve as a testament to the creative possibilities that lie ahead.