Skip to main content

Saving and restoring

Home · The engine in ten minutes · The world · The game clock · Saved games (SAV)

In brief​

A saved game is a snapshot of the whole adventure: the six characters, the party's position, every item in the game, the script flags, the game options and one record per dungeon level. A level's record keeps what changes there during play: its walls, its 30 monsters and its temporary walls. The game uses the same records when the party leaves a level: the level being left is written to a temporary file, LEVELS.TMP, and restored from it when the party comes back. Everything else about a level is read again from the level files each time the level is loaded.

Positions are written [XX:YY], column then row, both counted from 00; block index = YY × 32 + XX.

The seven parts of a saved game, one after the other, in bytes: description 20; six characters 2,070; party and world variables 92; items 8,400; level records 36,210; options 3; conjured-weapon item types 96; 46,891 bytes in all. The level records take more than three quarters of the file.
The level records take more than three quarters of a saved game.

What a saved game holds​

The save menu writes slot n to EOBDATA<n>.SAV. The file has no header: it is seven parts, one after the other, each a copy of part of the game's memory.1

PartSize in bytesContents
120The slot's description, as typed in the save menu. Loading ignores it.
26 × 345The six characters, with each timer stored as the time it has left.
392Party and world variables: current level and sublevel, the party's block and direction, the held item, which levels have a record, the level and global script flags, the rest refusal flag, a spell-related value and one byte whose role is not established.
4600 × 14Every item, wherever it is: on any level, carried, or unused.
517 × 2,130One level record per level; only the levels marked in part 3 are used.
63The options: tunes, sounds and bar graphs.
76 × 16The six item types the game creates at run time for conjured weapons, types 51 to 56.

Every field of each part is described by the saved-game schema. The only other call to the writer found in the game passes slot −1, which writes the same layout to FINAL.SAV at the end of the game.2

What persists, at a glance​

StateWhen the party changes levelIn a saved game
Characters, their timers and inventoriesKeptSaved; timers keep the time they have left
Party block and directionSet by the level changeSaved
Held itemKeptSaved
Level and global script flags, rest refusalKeptSaved
Items, on every levelKept in the shared table; block lists rebuiltSaved
Walls, including doors and scripted changesKept in the level's recordSaved in the level records
MonstersKept in the level's recordSaved in the level records
Temporary wallsKept in the level's record, with the time leftSaved in the level records
Flying objectsEnded before the changeEnded before saving
Doors in motionFinished before the changeFinished before saving
Timed block scripts, step counterRestarted from the new level's filesNot saved; restarted on loading
Scripts, cell bindings, wall properties, monster update intervalsRead again from the level filesNot saved; read again on loading
Game counter and periodic updatesCarry onNot saved; character timer updates scheduled again
Move count that scrolls the messagesCarries onNot saved; loading leaves it as it is
OptionsKeptSaved
Conjured-weapon item typesKeptSaved

The pages of this chapter​

PageWhat it covers
Level records and level changesSettling a level, its record, a new game, changing level.
Loading, failures and the end of the gameLoading, failed saves and loads, FINAL.SAV, edge cases.

Sources​

Locations refer to the game executable reference; comparative sources are listed in the technical references. File sizes and hashes are in the file inventory.

Footnotes​

  1. Save a game, reached from the save menu; the file names, slot descriptions, characters, party and world variables, items, option settings and item types, with the conjured-weapon types; the character timers are converted. Schema: SAV.ksy. Comparative source: REF-SCUMM-015, readOriginalSaveFile and saveAsOriginalSaveFile. ↩

  2. Write FINAL.SAV, called by kill a monster before the ending and the exit; the save writer, the file names and the slot descriptions, with the description address for slot −1 (ANOMALY-72). ↩