<< Index

My easy-to-build DOOM port

Have you ever thought about playing around with the original DOOM source code? I’d recommend it, it is really nice. But if you grab the original source code release, it is not very easy to get it to build. So I wanted to share this quick fix-up for it, making it very easy to build.

The code repo is here: github.com/mattiasgustavs and to build it, you just go:

  cl doom.c 

from a Visual Studio Developer command prompt or

  tcc doom.c 

if using Tiny C Compiler. There is no need to install any dependencies or use any build systems, just compiling this single C file is all that’s needed. This version is for windows and wasm, but might not be too difficult to port to mac/linux.

I also made it so you can build it for WebAssembly, so you can run it in a browser. Try it here: mattiasgustavsson.com/wasm/doom-crt Full instructions for building for WASM is in the README in the repo (it is just another one-liner, and a build tool you just download and unzip).

There are a lot of great windows ports, fixing bugs and adding features, and most of them would be a better choice if you want a DOOM which runs well on windows, or if you want some code to do serious work on top of. My port won’t try to compete with those efforts.

I think it might be useful to make available a simple and minimalistic port. One which modifies the original code as little as possible, uses as few dependencies as possible (no large external frameworks) and which can be built without a complex build system.

I am applying my CRT shader to it, because, well, I think it looks nice, and it makes it easy to apply aspect ratio correction. I also wanted to make both music and sound effects work, as I’ve noticed that’s something that is sometimes missing from some quickly ported versions.

One cool thing about the web build, is that if you just open it in your browser mattiasgustavsson.com/wasm/doom-crt and then just save the html file, you get a single, fully self-contained html file that you can run locally. And it is about the same size as the doom.exe+doom1.wad. Cool!

And one thing I specifically wanted to do for this, is to make it as an actual fork from the id Software github code for DOOM https://github.com/id-Software/DOOM I didn’t move files around, or change things if I didn’t need to. And all changes I did can be seen in the history.

If you want to learn more about how DOOM works, how the code and engine is structured, and just in general want a really good read, I really recommend Game Engine Black Book: DOOM by Fabien Sanglard, available here: https://fabiensanglard.net/three_books_update. It is really great, as is his other books.

 

© Copyright Mattias Gustavsson. All Rights Re­ser­ved.

<< Index

Leave a Reply

Your email address will not be published. Required fields are marked *