32  Game State Management

This tour explores LinuxDOOM’s game state management in g_game.h and g_game.c, covering how new games are started, saves/loads handled, per-tick logic driven, and input events dispatched.

The header linuxdoom-1.10/g_game.h declares the core game lifecycle functions.

P_UnArchiveWorld restores each sector’s floor/ceiling geometry and lighting by loading the saved height values, textures, and light levels.

P_UnArchiveThinkers restores game objects (mobjs) from the save file by reading their data and reconstructing their memory structures and state pointers.

The next steps examine G_SaveGame in g_game.c, which handles saving the game state to disk.

G_Ticker handles per-tick game logic, while G_Responder manages input event routing.