Skip to content

UstymUkhman/webDOOM

Repository files navigation

DOOM and DOOM II games compiled for web with WebAssembly.

You can try it here.

webDOOM uses PrBoom open source DOOM code, classic game assets like Doom1.wad and Doom2.wad files, original music in MP3 format and sound effects in WAV format.

Big thanks to all sites in links above for providing required assets to make it feel like original games and especially to the WebAssembly comunity that keeps working on this amazing tool!

Building webDOOM on Debian

You can build it on your own by following these steps:

  • First of all, PrBoom (v2.5.0) requires a 32-bit Linux distro (better if Debian based), so I would recomend you to install this one for your Virtual Machine if you're running a 64-bit based OS.

  • Once it's done, follow these steps to be sure to have all necessary packages to compile PrBoom code (actually you can skip libsdl-net1.2-dev and SDL_net packages since online game is not supported).

  • Be also sure to have git, autoconf and automake tools.

  • Now you can download and install the emscripten compiler by following these instructions.

  • Finally, clone this repo.

  • Run ./configure script in the root folded (it can take a while) and when all the Makefiles have been created, be sure to set correct compiler paths for emcc's CC; CPP; LIBS; RANLIB and SDL options based on the location of emsdk's folder on your machine in all Makefiles of this repository.

  • Make sure to have the required music files in here (or here if you're building DOOM II) as well as the SFX files (for convenience of downloaded SFX files, their names are preceded by ds characters as you can see here).

  • Alternatively, you can build with -nosound flag by adding it to your Module object as explained here.

  • With active emcc compiler (run ./emsdk activate latest and source ./emsdk_env.sh in your emsdk directory), navigate to the root folder of this repo and run ./build.sh to compile DOOM or ./build.sh doom2 to compile DOOM II. When running ./build.sh the first time, it can take a while because emscripten's cache hasn't been set yet, but at the end you should see the HTML application in web folder here.

Building webDOOM on Windows

I was not able to compile PrBoom on Windows because of some issues:

  • PrBoom needs to be compiled by using its Makefile which requires a make command to be executed from your console in the project folded.

  • There are several ways to have a make command even if you're using a Windows machine and those are to install one of the following consoles: MinGW; Cygwin or WSL.

  • Besides that, PrBoom's code is strictly related to the compiler's architecture, so you'll have to use a mingw32 bash (for example) in order to avoid all the errors that will come if you'll try to build it directly on a x64 CPU.

  • Another pain in the ass refers to the SDL version you'll have to use (1.2.x) which is pretty old and can cause some problems when trying to install it for a mingw32 compiler.

  • So, even if you'll figure out all the requirements above, you'll find out that unfortunately, emcc does not support MinGW or Cygwin enviroments (at least I faced this problem with v1.38.13) and there's no Windows Subsystem for Linux that emulates an x32 architecture.

  • Despite that, you can install emscripten; clone this repo and run build.bat (for DOOM) or build.bat doom2 (for DOOM II) on Windows that will produce you a valid HTML application from this LLVM code.