Difference between revisions of "Doom source code"

From DoomWiki.org

[unchecked revision][checked revision]
(See also: +license, +strife code)
(15 intermediate revisions by 11 users not shown)
Line 1: Line 1:
The '''Doom source code''' was released [[Timeline#1997|December 23, 1997]], initially under a not-for-profit license. Later, permission was granted to re-release the source code under the GNU [[Wikipedia:GPL|GPL]] in [[Timeline#1999|October 3, 1999]].
+
The '''Doom source code''' was released [[Timeline#1997|December 23, 1997]], initially under a not-for-profit license. Later, permission was granted to re-release the source code under the GNU [[Wikipedia:GPL|GPL]] on [[Timeline#1999|October 3, 1999]].
  
Before release, the source code was apparently tidied up by [[Bernd Kreimeier]]; the source release includes a changelog of his contributions. Several documentation files are also included. The original plan for the source code release involved a book Kreimeier was to write on the Doom engine; however, due to Doom's decreasing relevance in the gaming community, it was eventually judged not to be a marketable idea, and the project was abandoned. The source code was then released to the public.
+
Before release, the source code was tidied up by [[Bernd Kreimeier]]; the source release includes a changelog of his contributions. Several documentation files are also included. The original plan for the source code release involved a book Kreimeier was to write on the Doom engine; however, due to Doom's decreasing relevance in the gaming community, it was eventually judged not to be a marketable idea, and the project was abandoned. The source code was then released to the public.
  
Because of legal issues regarding the [[wikipedia:DMX|DMX]] [[sound]] library developed by [[Paul Radek]] which was used for Doom, the release was of the source code to the [[Linux]] port of Doom. Despite this, within several months, several ports had been made back to DOS. As a result, many [[source ports]] exist.
+
Because of legal issues regarding the [[DMX]] [[sound]] library developed by [[Paul Radek]] which was used for Doom, the release was of the source code to the [[Wikipedia:Linux|Linux]] port of Doom. Despite this, within several months, several ports had been made back to DOS. As a result, many [[source ports]] exist.
  
 
== Source code structure ==
 
== Source code structure ==
  
The source code can be divided into sections. Files and functions within the source code have one- or two-letter prefixes to denote their subsystem.
+
The source code can be divided into sections. Files and functions within the source code have one- or two-letter prefixes to denote their subsystem.
  
; AM_*:  [[Automap]] code
+
; AM_*
; D_*:  Initialisation/general code
+
:  [[Automap]] code
; F_*:  "Finale" (end of game) and "[[screen melt]]" code.
+
; D_*
; G_*:  Main game loop/control
+
:  Initialisation/general code
; HU_*:  [[Heads-up display]]
+
; F_*
; I_*:  System-specific code
+
:  "Finale" (end of game) and "[[screen melt]]" code.
; M_*:  Miscellaneous (includes the menu)
+
; G_*
; P_*:  Game logic/behaviour
+
:  Main game loop/control
; R_*:  [[Doom rendering engine|Rendering engine]]
+
; HU_*
; S_*:  [[Sound]] code
+
:  [[Heads-up display]]
; ST_*:  [[Status bar]]
+
; I_*
; V_*: General graphic rendering
+
:  System-specific code
; WI_*:  End-of level "intermission" screen
+
; M_*
; W_*:  [[WAD]] file loading  
+
:  Miscellaneous (includes the menu)
; Z_*:  [[Zone memory|Zone memory allocation system]]
+
; P_*
 +
:  Game logic/behaviour
 +
; R_*
 +
:  [[Doom rendering engine|Rendering engine]]
 +
; S_*
 +
:  [[Sound]] code
 +
; ST_*
 +
:  [[Status bar]]
 +
; V_*
 +
: General graphic rendering
 +
; WI_*
 +
:  End-of level "intermission" screen
 +
; W_*
 +
:  [[WAD]] file loading
 +
; Z_*
 +
:  [[Zone memory|Zone memory allocation system]]
  
 
The following are common prefixes for functions, although they do not denote a particular subsystem, and there are no files with these prefixes:
 
The following are common prefixes for functions, although they do not denote a particular subsystem, and there are no files with these prefixes:
  
; A_*:  Action functions invoked in sprite movement frames (these are the functions used in [[Dehacked]] "code pointers")
+
; A_*
; PIT_*: Callback functions passed to P_BlockThingsIterator (see p_maputl.c)
+
:  Action functions invoked in sprite movement frames (these are the functions used in [[Dehacked]] "code pointers")
; T_*: "Thinker" functions set to be called each clock [[tic]] for some purpose (eg, moving platforms or flickering lights)
+
; PIT_*
 +
: Callback functions passed to P_BlockThingsIterator (see p_maputl.c)
 +
; T_*
 +
: "[[Thinker]]" functions set to be called each clock [[tic]] for some purpose (eg, moving platforms or flickering lights)
  
 
A detailed list of files and their purposes can be found in [[Doom source code files]].
 
A detailed list of files and their purposes can be found in [[Doom source code files]].
 +
 +
==Doom Classic==
 +
''[[Doom 3: BFG Edition]]'' incorporates the "Doom Classic" port allowing to play [[The Ultimate Doom]] and [[Doom II]] on 32- and 64-bit Windows, on the [[Xbox 360]] and on the [[PlayStation 3]]. There are a few changes done to the source code and packaging here. Notably:
 +
* Bugs introduced in the LinuxDoom code by Bernd Kreimeier's cleanup and changes are absent
 +
* [[MUS|MUS2MIDI]] and [[TiMidity]] are incorporated for MIDI playback, instead of using [[DMX]]
 +
* A few [[static limits]] have been raised, notably [[visplane]]s and [[drawseg]]s to accommodate for [[No Rest for the Living]]'s levels
 +
* Several #defines have been moved out of their original files and into either Precompiled.h or defs.h (both new files)
 +
* The [[Master Levels]] and No Rest for the Living are handled as mission packs like [[TNT: Evilution]] and [[Plutonia]]
 +
* The French language file is still present but emptied, French is removed from the language_t enum
 +
* The code is available under the GPLv3 or later
 +
 +
Note: this should not be confused with the iOS port also named [[Doom Classic (iOS)|Doom Classic]].
 +
 +
== See also ==
 +
* [[Doom Source License]]
 +
* [[Heretic source code]]
 +
* [[Hexen source code]]
 +
* [[Strife source code]]
 +
* [[Doom 3 source code]]
  
 
== External links ==
 
== External links ==
* [http://www.doomworld.com/10years/ports/ports01_1.php Doomworld - 10 years of Doom] - some history of the Doom source release.
+
* [https://www.doomworld.com/10years/ports/ports01_1.php Doomworld - 10 years of Doom] - some history of the Doom source release.
* [http://www.3ddownloads.com/showfile.php3?file_id=7430 Original Doom Source Code] - The source code as [[id Software]] released it.
+
* {{idgames|id=8802|title=Doom source code}} (Original [[Licences#Source code release|DOOM Source Licensed]] version)
[[Category:Doom_engine]]
+
* {{idgames|id=14576|title=Doom source code}} (Revised [[Licences#GNU_General_Public_License_.28GPL.29|GPL]] version)
 +
* [https://github.com/id-Software/DOOM GitHub repository for Doom]
 +
* [https://github.com/id-Software/DOOM-3-BFG/tree/master/doomclassic GitHub repository for Doom Classic]
 +
 
 +
[[Category:Doom engine]]
 
[[Category:Code]]
 
[[Category:Code]]

Revision as of 16:36, 17 March 2018

The Doom source code was released December 23, 1997, initially under a not-for-profit license. Later, permission was granted to re-release the source code under the GNU GPL on October 3, 1999.

Before release, the source code was tidied up by Bernd Kreimeier; the source release includes a changelog of his contributions. Several documentation files are also included. The original plan for the source code release involved a book Kreimeier was to write on the Doom engine; however, due to Doom's decreasing relevance in the gaming community, it was eventually judged not to be a marketable idea, and the project was abandoned. The source code was then released to the public.

Because of legal issues regarding the DMX sound library developed by Paul Radek which was used for Doom, the release was of the source code to the Linux port of Doom. Despite this, within several months, several ports had been made back to DOS. As a result, many source ports exist.

Source code structure

The source code can be divided into sections. Files and functions within the source code have one- or two-letter prefixes to denote their subsystem.

AM_*
Automap code
D_*
Initialisation/general code
F_*
"Finale" (end of game) and "screen melt" code.
G_*
Main game loop/control
HU_*
Heads-up display
I_*
System-specific code
M_*
Miscellaneous (includes the menu)
P_*
Game logic/behaviour
R_*
Rendering engine
S_*
Sound code
ST_*
Status bar
V_*
General graphic rendering
WI_*
End-of level "intermission" screen
W_*
WAD file loading
Z_*
Zone memory allocation system

The following are common prefixes for functions, although they do not denote a particular subsystem, and there are no files with these prefixes:

A_*
Action functions invoked in sprite movement frames (these are the functions used in Dehacked "code pointers")
PIT_*
Callback functions passed to P_BlockThingsIterator (see p_maputl.c)
T_*
"Thinker" functions set to be called each clock tic for some purpose (eg, moving platforms or flickering lights)

A detailed list of files and their purposes can be found in Doom source code files.

Doom Classic

Doom 3: BFG Edition incorporates the "Doom Classic" port allowing to play The Ultimate Doom and Doom II on 32- and 64-bit Windows, on the Xbox 360 and on the PlayStation 3. There are a few changes done to the source code and packaging here. Notably:

  • Bugs introduced in the LinuxDoom code by Bernd Kreimeier's cleanup and changes are absent
  • MUS2MIDI and TiMidity are incorporated for MIDI playback, instead of using DMX
  • A few static limits have been raised, notably visplanes and drawsegs to accommodate for No Rest for the Living's levels
  • Several #defines have been moved out of their original files and into either Precompiled.h or defs.h (both new files)
  • The Master Levels and No Rest for the Living are handled as mission packs like TNT: Evilution and Plutonia
  • The French language file is still present but emptied, French is removed from the language_t enum
  • The code is available under the GPLv3 or later

Note: this should not be confused with the iOS port also named Doom Classic.

See also

External links