Jump to content
Setting up an AI agent? ReverseEngineering.wiki skill (works from the command line, no configuration): https://reverseengineering.wiki/skill/rewiki/SKILL.md · setup for every client, including MCP: https://reverseengineering.wiki/llms.txt · REWiki:Connect

Format:Doom savegame (DSG)

From ReverseEngineering.wiki
Format
Developer id Software
Magic version string at offset 0x18: "version 109" (v1.9) or "version 110" (source release), NUL-padded to 16 bytes
Extensions .dsg
Endianness little
On this wiki Facts · Code · Notes · Topics

Saved game of Software:Doom (DOOMSAV0.DSG to DOOMSAV5.DSG): a 50-byte header (24-byte description, 16-byte version string, skill, episode, map, players present, level time) followed by raw dumps of players, sectors and lines, thinkers and specials, ending with the byte 0x1D.

Structure

Offset Size Field
0x00 24 description typed in the save menu, NUL-padded
0x18 16 version NNN, NUL-padded; a mismatch makes the engine silently refuse the save
0x28 1 skill
0x29 1 episode
0x2A 1 map
0x2B 4 player present flags
0x2F 3 level time in tics, big-endian 24-bit
0x32 ... archived players, world (sectors, lines, sides), thinkers (map objects), specials (moving floors, doors, lights)
end 1 0x1D consistency marker

The level is reloaded from the WAD first and the archived state is laid over it, so a save is only valid with the same map data.

Pitfalls

  • The player and map-object sections are memory dumps of the in-memory structures, padded to 4-byte boundaries, including pointer fields that are replaced by indices on save and fixed up on load. Their layout therefore depends on the exact build (and on 32-bit pointers); a 64-bit port compiled from the source does not produce compatible saves without explicit serialisation.
  • The engine builds the save in a screen buffer region and aborts with "Savegame buffer overrun" when the result exceeds its fixed maximum size.

Evidence & references

  • linuxdoom-1.10/g_game.c (G_DoSaveGame, G_DoLoadGame, SAVESTRINGSIZE 24, VERSIONSIZE 16) and p_saveg.c (PADSAVEP, player pointer stored as index + 1). Not checked against a retail save file.