Top Related Projects
Quake GPL Source Release
Chocolate Doom is a Doom source port that is minimalist and historically accurate.
GZDoom is a feature centric port for all Doom engine games, based on ZDoom, adding an OpenGL renderer and powerful scripting capabilities
Quick Overview
The id-Software/DOOM repository contains the source code for the iconic first-person shooter game DOOM, originally released in 1993. This open-source release allows developers to study, modify, and port the game to various platforms, contributing to its longevity and continued popularity.
Pros
- Historical significance: Access to the source code of one of the most influential games in history
- Educational value: Provides insights into game development techniques from the early 1990s
- Modding potential: Allows for extensive modifications and custom content creation
- Cross-platform compatibility: Can be ported to numerous platforms and devices
Cons
- Outdated codebase: Written in C, which may be challenging for modern developers accustomed to newer languages
- Limited documentation: Lack of comprehensive documentation for the codebase
- Complex architecture: May be difficult to understand for beginners due to its age and optimization techniques
- Potential licensing issues: Some versions may have restrictions on commercial use
Code Examples
// Example 1: Drawing a line on the screen
void R_DrawColumn (void)
{
int count;
byte* dest;
fixed_t frac;
fixed_t fracstep;
count = dc_yh - dc_yl;
// Zero length, column does not exceed a pixel.
if (count < 0)
return;
#ifdef RANGECHECK
if ((unsigned)dc_x >= SCREENWIDTH
|| dc_yl < 0
|| dc_yh >= SCREENHEIGHT)
I_Error ("R_DrawColumn: %i to %i at %i", dc_yl, dc_yh, dc_x);
#endif
// Framebuffer destination address.
// Use ylookup LUT to avoid multiply with ScreenWidth.
// Use columnofs LUT for subwindows?
dest = ylookup[dc_yl] + columnofs[dc_x];
// Determine scaling,
// which is the only mapping to be done.
fracstep = dc_iscale;
frac = dc_texturemid + (dc_yl-centery)*fracstep;
// Inner loop that does the actual texture mapping,
// e.g. a DDA-lile scaling.
// This is as fast as it gets.
do
{
// Re-map color indices from wall texture column
// using a lighting/special effects LUT.
*dest = dc_colormap[dc_source[(frac>>FRACBITS)&127]];
dest += SCREENWIDTH;
frac += fracstep;
} while (count--);
}
// Example 2: Playing a sound effect
void S_StartSound
( void* origin,
int sfx_id )
{
int rc;
int sep;
int cnum;
int volume;
int pitch;
int priority;
sfxinfo_t* sfx;
int i;
mobj_t* origin_p;
origin_p = (mobj_t *) origin;
// check for bogus sound #
if (sfx_id < 1 || sfx_id > NUMSFX)
I_Error("Bad sfx #: %d", sfx_id);
sfx = &S_sfx[sfx_id];
// Initialize sound parameters
if (sfx->link)
{
pitch = sfx->pitch;
priority = sfx->priority;
volume = sfx->volume;
if (origin_p)
{
sep = S_SoundDistance(origin_p);
// Separation, that is, orientation/stereo.
// range is: 1 - 256
sep += 1;
}
else
{
sep = 128;
}
}
else
{
// These are set as default for all sounds.
pitch =
Competitor Comparisons
Quake GPL Source Release
Pros of Quake
- More advanced 3D graphics engine, supporting true 3D environments
- Improved networking capabilities for multiplayer gameplay
- Modular design allowing for easier modding and custom content creation
Cons of Quake
- Higher system requirements due to more complex graphics
- Less accessible to casual players compared to DOOM's simpler gameplay
- Darker, more atmospheric art style may not appeal to all players
Code Comparison
DOOM (C):
void P_SpawnMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype_t type)
{
mobj_t* mobj;
state_t* st;
mobjinfo_t* info;
Quake (C):
void SV_SpawnServer (char *server, char *startspot)
{
edict_t *ent;
int i;
static char dummy[8] = { 0,0,0,0,0,0,0,0 };
Both codebases use C, but Quake's engine is more complex and modular. DOOM's code focuses on 2D sprite-based object spawning, while Quake handles full 3D entity management and server initialization.
Chocolate Doom is a Doom source port that is minimalist and historically accurate.
Pros of Chocolate Doom
- More actively maintained with regular updates and bug fixes
- Focuses on accurate source port with minimal changes to original gameplay
- Cross-platform support for modern operating systems
Cons of Chocolate Doom
- Less feature-rich compared to other source ports
- May lack some modern enhancements and quality-of-life improvements
- Stricter adherence to original limitations may not appeal to all players
Code Comparison
DOOM (original):
void P_DamageMobj
( mobj_t* target,
mobj_t* inflictor,
mobj_t* source,
int damage )
{
unsigned ang;
int saved;
player_t* player;
fixed_t thrust;
int temp;
Chocolate Doom:
void P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, int damage)
{
unsigned int ang;
int saved;
player_t *player;
fixed_t thrust;
The code structure remains similar, with Chocolate Doom maintaining close compatibility with the original DOOM codebase. Minor differences include updated variable declarations and coding style improvements in Chocolate Doom.
GZDoom is a feature centric port for all Doom engine games, based on ZDoom, adding an OpenGL renderer and powerful scripting capabilities
Pros of gzdoom
- Enhanced graphics and rendering capabilities, including support for modern OpenGL features
- Expanded modding support with advanced scripting and customization options
- Cross-platform compatibility (Windows, macOS, Linux)
Cons of gzdoom
- Larger codebase and more complex architecture, potentially harder to maintain
- May require more system resources due to advanced features
- Potential compatibility issues with some classic DOOM mods
Code Comparison
DOOM (original):
void R_DrawColumn (void)
{
int count;
byte* dest;
fixed_t frac;
fixed_t fracstep;
gzdoom:
void R_DrawColumn(const wallcol_t &column)
{
const int count = column.length;
uint8_t *dest = ylookup[column.yl] + column.x + dc_destorg;
fixed_t frac = column.texturefrac;
fixed_t fracstep = column.texturestep;
The gzdoom code shows a more modern C++ approach with improved parameter passing and data structures, while the original DOOM code uses a simpler C-style implementation.
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual CopilotREADME
Here it is, at long last. The DOOM source code is released for your non-profit use. You still need real DOOM data to work with this code. If you don't actually own a real copy of one of the DOOMs, you should still be able to find them at software stores.
Many thanks to Bernd Kreimeier for taking the time to clean up the project and make sure that it actually works. Projects tends to rot if you leave it alone for a few years, and it takes effort for someone to deal with it again.
The bad news: this code only compiles and runs on linux. We couldn't release the dos code because of a copyrighted sound library we used (wow, was that a mistake -- I write my own sound code now), and I honestly don't even know what happened to the port that microsoft did to windows.
Still, the code is quite portable, and it should be straightforward to bring it up on just about any platform.
I wrote this code a long, long time ago, and there are plenty of things that seem downright silly in retrospect (using polar coordinates for clipping comes to mind), but overall it should still be a usefull base to experiment and build on.
The basic rendering concept -- horizontal and vertical lines of constant Z with fixed light shading per band was dead-on, but the implementation could be improved dramatically from the original code if it were revisited. The way the rendering proceded from walls to floors to sprites could be collapsed into a single front-to-back walk of the bsp tree to collect information, then draw all the contents of a subsector on the way back up the tree. It requires treating floors and ceilings as polygons, rather than just the gaps between walls, and it requires clipping sprite billboards into subsector fragments, but it would be The Right Thing.
The movement and line of sight checking against the lines is one of the bigger misses that I look back on. It is messy code that had some failure cases, and there was a vastly simpler (and faster) solution sitting in front of my face. I used the BSP tree for rendering things, but I didn't realize at the time that it could also be used for environment testing. Replacing the line of sight test with a bsp line clip would be pretty easy. Sweeping volumes for movement gets a bit tougher, and touches on many of the challenges faced in quake / quake2 with edge bevels on polyhedrons.
Some project ideas:
Port it to your favorite operating system.
Add some rendering features -- transparency, look up / down, slopes, etc.
Add some game features -- weapons, jumping, ducking, flying, etc.
Create a packet server based internet game.
Create a client / server based internet game.
Do a 3D accelerated version. On modern hardware (fast pentium + 3DFX) you probably wouldn't even need to be clever -- you could just draw the entire level and get reasonable speed. With a touch of effort, it should easily lock at 60 fps (well, there are some issues with DOOM's 35 hz timebase...). The biggest issues would probably be the non-power of two texture sizes and the walls composed of multiple textures.
I don't have a real good guess at how many people are going to be playing with this, but if significant projects are undertaken, it would be cool to see a level of community cooperation. I know that most early projects are going to be rough hacks done in isolation, but I would be very pleased to see a coordinated 'net release of an improved, backwards compatable version of DOOM on multiple platforms next year.
Have fun.
John Carmack 12-23-97
Copyright (c) ZeniMax Media Inc. Licensed under the GNU General Public License 2.0.
Top Related Projects
Quake GPL Source Release
Chocolate Doom is a Doom source port that is minimalist and historically accurate.
GZDoom is a feature centric port for all Doom engine games, based on ZDoom, adding an OpenGL renderer and powerful scripting capabilities
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual Copilot