A DOOM®-based CAPTCHA for the web¹
The project works by leveraging Emscripten to compile a minimal port of Doom to WebAssembly and enable intercommunication between the C-based game runloop and the JavaScript-based CAPTCHA UI.
Some extensions were made to the game to introduce relevant events needed for its usage in the context of a CAPTCHA.
- Started out with a minimal, SDL-based port of Doom that can be efficiently compiled to WebAssembly by Lorti.
 - Tweaked the build to make it compatible with the shareware version of wad (
doom1.wad) for legal use - Introduced new unofficial process flags:
-nomenuto skip the main menu and jump straight into the game (m_menu.c)-autorebornto automatically rebirth the player after a 2s delay (m_player.c)
 - Introduced callbacks into JS land to be used by the CAPTCHA UI:
onPlayerBornwhen the player is born or rebornonPlayerKilledwhen the player is killedonEnemyKilledwhen the main player kills an enemy
 - Tweaked the default process flags to make the game more challenging and skip all the menus:
-skill 5sets the difficulty to "Nightmare!"-fastmakes it even harder-warp e1m1jumpstarts the game to where the action is-nomenudoesn't let the player trigger the main menu
 
- Install Emscripten
- On macOS, 
brew install emscriptendoes the trick 
 - On macOS, 
 - Place 
doom1.wadin thesdldoom-1.10directory (Shareware version) - Run 
build.sh- Get the DOOM® shareware WAD URL and save it to 
$DOOM_WAD_URL - During development, I recommend running 
watchexec -- ./build.shto make the process automatic (install watchexec withbrew install watchexec) 
 - Get the DOOM® shareware WAD URL and save it to 
 - Run 
vercel dev 
- SDLDoom 1.10
 - sdldoom.wasm by Lorti
 - Emscripten
 - Doom Shareware WAD
 - DOOM® is a registered trademark of id Software LLC, a ZeniMax Media company
 - Stylized as a reference to Google's reCAPTCHA
 - Prior art in spirit by vivirenremoto
 
¹ for educational and entertainment purposes only