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.