Skip to main content

Saved games (SAV)

File formats · Field reference · Schema

In brief​

A saved game, EOBDATA<n>.SAV for save slot n, is a direct copy of the parts of the game's memory that make up an adventure in progress: the party, the party and world variables, every item and one record for each dungeon level. The game writes the same layout to FINAL.SAV when it saves with slot −1, once, just before the ending; nothing in the game reads that file back, and its first part is not a description (see the end of the game). What the game does when it writes and reads these files is explained in saving and restoring.

The DOS game ships one saved game, EOBDATA0.SAV, described as QUICK START PARTY. It places the party at [11:05] on level 4 (column 11, row 5; block index = row × 32 + column). Its four characters are listed with the characters of the game.

From the file Saved games (SAV) to the game. The file holds, in order: Description (20 bytes); Characters (6 × 345 bytes); Party and world (92 bytes); Items (600 × 14 bytes); Level records (17 × 2,130 bytes); Options (3 bytes); Item types (6 × 16 bytes). The game: Read the whole file and check the size of each part; Settle the level, then restore each part. In memory: Characters, party variables, items, LEVELS.TMP, options and conjured-weapon types. Used by: The whole game.
The game turns it into characters, party variables, items, LEVELS.TMP, options and conjured-weapon types.

Organization​

The file has no header and no signature. It is seven parts, one after the other:1

PartOffsetSizeContents
10x000020Slot description, zero-padded text.
20x00146 × 345The six characters, with their timers as time remaining.
30x082a92Party and world variables, including which levels have a record.
40x0886600 × 14The item table, in the layout of ITEM.DAT items.
50x295617 × 2,130Level records, the same image as LEVELS.TMP.
60xb6c83Tunes, sounds and bar-graph options.
70xb6cb6 × 16Item types 51 to 56, in the layout of ITEMTYPE.DAT records.

A complete file is 46,891 bytes. The game checks only that each part is complete.2

Each level record holds the level's walls, compressed with the type-4 method of CPS containers, then its 30 monster slots and its five temporary walls. A record counts only if its level's bit is set in part 3: in the reference file only level 4 is marked, and the 16 other records hold leftover data that the game ignores. Such data comes from LEVELS.TMP, which saving copies whole and which a new game does not empty (lifetime of the file).3

Writing and reading the file​

Saving first settles the current level, packs it into its record and sets its bit, then writes the seven parts in order; the characters' timers are written as time remaining. The result of opening the file is not tested, the length of each write is.4

Loading reads the whole file and checks that each part is complete; a short part restores nothing. Otherwise the game settles the current level and restores the parts in order: the characters, the party and world variables, the items, the level records, written over LEVELS.TMP, the options and the six item types. The description is skipped. When the game is under way, it then loads the saved level and sublevel. See loading a saved game for what the player sees and what can fail.5

What it becomes in memory​

Each part is the image of a table of the game, copied without conversion apart from the characters' timers: the characters, the block of party and world variables that starts with the current level, the item table, the level records with their monster slots, the three option settings and types 51 to 56 of the item-type table. The four wall tables of the level are neither saved nor restored.45

Example​

The first part and the start of part 3 of EOBDATA0.SAV:

offset bytes meaning
0000 51 55 49 43 4b 20 53 54 41 52 54 20 "QUICK START "
000c 50 41 52 54 59 00 00 00 "PARTY", zero padding
...
082a 04 00 00 00 level 4, sublevel 0
082e ab 00 02 00 party block 171 = [11:05], direction 2
0832 00 00 no held item
0834 08 00 00 00 record bits: level 4 only

Sources​

Locations refer to the game executable reference; comparative sources are listed in the technical references (REF-SCUMM-013, REF-SCUMM-015). The reference file is listed in the file inventory.

Footnotes​

  1. The memory areas copied: the saved-game descriptions, the characters, the party and world variables, from the current level, with the party spell effects, the rest refusal flag, the level flags and the global flags, the item records, the monster slots, the temporary walls, the options (tunes, sounds, bar graphs) and the item-type records. ↩

  2. Save a game, read a saved game, the chunk lengths, the file names, the load menu and the FINAL.SAV writer. ↩

  3. Pack and unpack a level record (the unpacking half) and the saved-level bits. ↩

  4. Save a game. ↩ ↩2

  5. Read a saved game. ↩ ↩2