Doom Code Tweaking

Aaa .. the nostalgia … I remember first hearing that the Doom sources were to  be released .. wooow!!! back then I had little programming experience .. didn’t really know how different another OS could be. Little did I know that was a pretty big deal trying to port Linux sources to compile on Dos. But I tried .. and tried …until a couple of hours later I realized that I had hit libraries that I had no analogue for in Borland C++ 3.1.

DosDoom

You can imagine my joy when a few months later I got the DosDoom sources, a port made for Djgpp with the awesome Allegro library by Chi Hoang. On that I spent many hours, weeks of morning to evening passion. Trying to tweak stuff, to experiment, feeling so exciting about actually seeing the sources that John Carmack had worked on (he was a programming role model for me. I hope to get the chance to talk with him someday). I learned a lot of stuff by guessing & tweaking and re-re-re-re-compiling (I remember turning the doom guy’s face upside down for a tweak, and realising it wasn’t going to be as easy as I thought because everything in the code was superbly optimized, in this case memory was being saved with vertical spans & offsets which resulted in his head having the shape of his chin. This experience with the Doom code had a big impact on me as it taught me ways in which to think, and gave me sneak peeks at implementing simplified concepts of theories it would be years later until I would understand.

Tweaks

So, after a lot of tweaking I made a version for myself with a couple of modifications (though I never submitted it anywhere, so for a long time it stayed only on my backup cds). The changes included in this version (mentioned in the parameter list in Dosdoom.txt) consisted in adding to extra parameters:

-funrespawn   just a fun little item respawn tweak, but more importantly:

Motion blur

-blurr ???    enables motion blurr: valid numbers 0-9. Recomanded 5(only when you’re close to
walls), but don’t forget to try 0.

screenshot on the Savage map pack

I am still very proud of the motion blur, as though it isn’t a new technique, it was to me … so, from my point of view, I actually ‘discovered’ it. I was quite excited at the ways one could mix previous image buffers with the newly rendered ones, done in low level software mode as opposed to through some library and/or hardware acceleration.

The ‘Big Texels’ Issue

A lot of my experiments were oriented towards eliminating the huge texels you could see in the engines back then when going very close to walls (something that would later be fixed with hardware acceleration with another technique I loved: multitexturing). One of the approaches that came out pretty well was this one:

however the problem was that the solution only looks good in static pics, while in the game you saw the points moving and had the impression of something like ants or organized noise on the walls.

Download [1.5MB]

This is the version modified  by me. It requires DJGPP environment with the superb Allegro graphics library. Also includes the Linux sources of the Doom engine.

Worknotes

As I was trying to figure things out, and later trying to change them, I kept a kind of a journal of my exploration into the sources in the file worknote – Void lon iXaarii.txt, figured I’d share it here. Carmack’s code was quite brilliant. Ranging from amazing transform optimizations to data structures that it would be many years until I understood, it was a total inspiration to me. Plus there were so many moving parts working together to make a complete product, and sections which were so very different from eachother (I remember staring quite puzzled at the overlay map, to mention just one technology which was very impressive).

Thanks

Many thanks to ID for releasing the Doom sources and to Chi Hoang for porting them to Dos! I may never meet Carmack, or Chi Hoang, but in this way I would like to say they’ve made a big impact in my life. This is something I’ve been meaning to say for many years now (back when I was working on these sources Internet was a very rare privilege for me).