10 i_system: Core System Interface
This tour examines i_system.h
and its implementations β the core system interface providing platform-specific services to the Doom engine.
It covers system initialization, memory management, timing, input, and error handling.
Next weβll look at I_Init
for system startup and I_ZoneBase
for memory allocation setup.
10.0.1 π File: i_system.h
(lines 34β36)
I_Init
prototype for system-wide initialization.
10.0.2 π File: i_system.c
(lines 104β111)
I_Init
implementation β prepares platform systems. Note: graphics are initialized separately.
10.0.3 π File: i_system.h
(lines 40β41)
I_ZoneBase
provides a memory pointer and size for zone allocator use.
10.0.4 π File: i_system.c
(lines 76β80)
I_ZoneBase
allocates the engineβs heap, defaulting to 6MB.
Next weβll look at DOOMβs timing and input functions, which handle game synchronization and event processing.
10.0.5 π File: i_system.h
(lines 44β45)
I_GetTime
returns game time in tics.
10.0.6 π File: i_system.c
(lines 88β100)
I_GetTime
converts system time to tics using TICRATE
.
10.0.7 π File: i_system.h
(lines 56β64)
I_StartFrame
and I_StartTic
handle frame and tic timing; trigger input processing.
10.0.8 π File: i_video.c
(lines 181β187)
I_StartFrame
is a no-op in the X11 port.
10.0.9 π File: i_video.c
(lines 307β338)
I_StartTic
processes X11 events, and recenters the mouse if needed.
10.0.10 π File: i_system.h
(lines 70β74)
I_BaseTiccmd
prepares an empty input command structure (ticcmd_t
).
10.0.11 π File: d_ticcmd.h
(lines 36β44)
ticcmd_t
contains player input: movement, angle, chat, buttons, network sync.
10.0.12 π File: i_system.c
(lines 64β68)
I_BaseTiccmd
returns a zero-initialized command structure.
10.0.13 π File: i_system.h
(lines 77β79)
I_Quit
prototype for game shutdown sequence.
10.0.14 π File: i_system.c
(lines 116β124)
I_Quit
implementation: network cleanup, sound/music stop, graphics shutdown.
10.0.15 π File: i_system.h
(lines 82β87)
I_AllocLow
and I_Tactile
β memory allocation and haptics interface.
10.0.16 π File: i_system.c
(lines 147β154)
I_AllocLow
wraps malloc
+ memset
on Unix.
10.0.17 π File: i_system.c
(lines 54β62)
I_Tactile
is a stub under Linux β all params unused.
10.0.18 π File: i_system.h
(lines 88β90)
I_Error
prototype β variadic error reporter.
10.0.19 π File: i_system.c
(lines 162β172)
I_Error
shows a fatal message, performs cleanup, and exits.
10.0.20 π File: i_system.c
(lines 167β171)
Formats error messages using vfprintf
with variadic args.
10.0.21 π File: i_system.c
(lines 173β177)
Flushes stderr, ends demo recording via G_CheckDemoStatus
.
10.0.22 π File: i_system.c
(lines 179β182)
Final shutdown steps: network and graphics termination.
10.0.23 π File: d_main.c
(lines 611β614)
At startup, if $HOME
isnβt set, I_Error
prompts and exits.
10.0.24 π File: d_net.c
(lines 131β134)
I_Error
used to report invalid tick state in ExpandTics
.
10.0.25 π File: r_data.c
(lines 365β368)
Renderer uses I_Error
to abort if a texture exceeds 64KB β prevents memory corruption.
The system interface cleanly abstracts platform-specific details from Doomβs engine logic, supporting portability across OSes.