2 Core Definitions & Types: Overview
This tour shows the fundamental types and definitions used throughout the Doom engine: integer limits, type aliases, game modes, key codes, events, commands, and player state.
Next weβll look at the core header files
that define DOOMβs basic types, game parameters, and player state.
2.0.1 π File: linuxdoom-1.10/doomtype.h
The doomtype.h
header defines platform-independent basic types and limits used throughout the engine.
2.0.2 π File: linuxdoom-1.10/doomdef.h
The file doomdef.h
defines global parameters and constants used throughout the DOOM engine.
2.0.3 π File: linuxdoom-1.10/doomdef.c
The file doomdef.c
includes doomdef.h
but contains no actual code.
2.0.4 π File: linuxdoom-1.10/d_event.h
The file d_event.h
declares input event types, event queues, and high-level game actions.
2.0.5 π File: linuxdoom-1.10/d_ticcmd.h
The file d_ticcmd.h
defines the per-tick input command structure used for local updates and network transmission.
2.0.6 π File: linuxdoom-1.10/d_player.h
The file d_player.h
encapsulates player-specific state, cheats, inventory, and intermission stats.
2.0.7 π File: doomtype.h
(lines 31β37)
Defines a boolean alias and a byte alias for unsigned char.
2.0.8 π File: d_player.h
(lines 109β110)
In the player_t
struct, boolean cards[NUMCARDS]
tracks key cards and boolean backpack
flags if the backpack has been picked up.
2.0.9 π File: d_ticcmd.h
(lines 42β43)
The ticcmd_t
struct uses byte chatchar
for ASCII typed chat and byte buttons
for input flags.
2.0.10 π File: doomtype.h
(lines 44β49)
Defines the maximum values for signed integer types: char
, short
, int
, long
.
2.0.11 π File: doomtype.h
(lines 50β55)
Defines minimum values for signed integer types.
2.0.12 π File: doomdef.h
(lines 33β47)
VERSION
defines the engine version. GameMode_t
identifies the DOOM release.
2.0.13 π File: doomdef.h
(lines 51β70)
GameMission_t
identifies the DOOM variant; Language_t
selects display language.
2.0.14 π File: doomdef.h
(lines 73β84)
RANGECHECK
enables debug checks. SNDSERV
toggles sound server use.
2.0.15 π File: doomdef.h
(lines 98β105)
BASE_WIDTH
, SCREEN_MUL
, and INV_ASPECT_RATIO
control screen scaling and shape.
2.0.16 π File: doomdef.h
(lines 110β113)
SCREENWIDTH
and SCREENHEIGHT
set the in-game resolution (320Γ200).
2.0.17 π File: doomdef.h
(lines 119β122)
MAXPLAYERS
caps multiplayer to 4. TICRATE
sets 35 ticks per second.
2.0.18 π File: doomdef.h
(lines 127β133)
gamestate_t
enumerates game states: play, intermission, finale, or demo.
2.0.19 π File: doomdef.h
(lines 139β154)
Monster flags (MTF_*
) and skill_t
define AI behavior and difficulty.
2.0.20 π File: doomdef.h
(lines 162β173)
card_t
enumerates access cards and skull keys.
2.0.21 π File: doomdef.h
(lines 180β240)
Enums for weapons (weapontype_t
), ammo (ammotype_t
), power-ups (powertype_t
), and their durations (powerduration_t
).
2.0.22 π File: doomdef.h
(lines 250β281)
Key codes mapping keyboard input to game actions.
Next weβll look at input event handling in d_event.h
, which defines how DOOM processes keyboard and mouse input into game actions.
2.0.23 π File: doomdef.c
(lines 29β33)
Includes doomdef.h
with no added logic, under a C++ pragma.
2.0.24 π File: d_event.h
(lines 35β50)
evtype_t
lists raw input types; event_t
encapsulates the event data.
2.0.25 π File: d_event.h
(lines 53β100)
gameaction_t
defines transitions; buttoncode_t
uses bit flags for inputs.
2.0.26 π File: d_event.h
(lines 108β115)
Global input queue: events[MAXEVENTS]
, eventhead
, eventtail
, and gameaction
.
2.0.27 π File: d_ticcmd.h
(lines 36β43)
ticcmd_t
input struct includes forwardmove
, sidemove
, angleturn
, and buttons
.
The following steps illustrate how ticcmd_t
is constructed, transmitted, and applied in Doomβs loop.
2.0.28 π File: g_game.c
(lines 249β253)
G_BuildTiccmd
creates game commands and sets consistency checks for sync.
2.0.29 π File: g_game.c
(lines 662β667)
In G_Ticker
, per-player cmd
fields are filled from netcmds
or demos.
2.0.30 π File: p_user.c
(lines 152β155)
In P_MovePlayer
, cmd->angleturn
rotates the playerβs angle.
2.0.31 π File: d_player.h
(lines 53β62)
playerstate_t
enumerates player states: alive, dead, or respawning.
2.0.32 π File: d_player.h
(lines 68β77)
cheat_t
flags enable modes like no-clip or god mode.
Next weβll look at the player data structures, which store both runtime state and level statistics.
2.0.33 π File: d_player.h
(lines 83β166)
player_t
holds all player state, resources, view, inventory, and progress.
2.0.34 π File: d_player.h
(lines 173β211)
Intermission data structs: - wbplayerstruct_t
: tracks player stats - wbstartstruct_t
: holds level-wide data
And there you have it β the core types and definitions that power Doomβs engine.