Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Saved games

SAVE.C writes two files per save: CIVIL?.SVE for variables and arrays, and CIVIL?.MAP for the map page. Both are needed to restore a game.

State transfer

transfer_game() uses the same list of addresses and byte counts to read and write the SVE file. Values are stored in the DOS program’s representation: 16-bit little-endian integers, four-byte longs and packed record bytes. The file has no separate field-name or type metadata.

The transfer table gives exact offsets and lengths. It includes the city, unit-type and unit arrays, exploration masks, relations, replay history, spaceship layouts and palace design.

transfer_near() transfers shared-data buffers directly. transfer_far() copies through msgtext in chunks of at most 512 bytes to handle data in other segments.

The first eight two-byte values are:

OffsetVariableMeaning
0x00turn_tickTurn number
0x02civnowHuman civilization slot
0x04human_setHuman-controlled civilization mask
0x06map_rng_stateMap seed
0x08yearCalendar year
0x0acur_tierDifficulty, 0–4
0x0cplayersLiving civilization mask
0x0eselected_indexHuman research selection

Leader names occupy 0x10–0x7f, civilization names 0x80–0xdf, and adjectives 0xe0–0x137. The preview path in read_save_header() seeks to selected fields to build menu entries without loading the full state.

The map seed controls resource and hut patterns. Its presence in a save does not establish that the C runtime’s complete random-generator state has been saved.

Treaties are bit flags, not a numbered list of mutually exclusive diplomatic states.