darkpanda
Dark Prince
- Joined
- Oct 28, 2007
- Messages
- 843
This thread is intended to store all available information about the format of Civ 1's SVE savegame files.
As time passes, I am now reposting latest findings as a SVE data reference table available here: http://forums.civfanatics.com/showthread.php?p=12422448#post12422448
The original first post of this thread is kept hereunder for reference.
--------
As a first post, I am attaching 2 text files used internally by JCivED (zipped in View attachment SVE_memory_map.zip because of .txt size limitations on this forum) that map every offset of the SVE byte data to the corresponding in-game data:
The structure of the files follows a tab-separated table format, and contains 6 columns:
The data IDs are completely arbitrary, and decided by me as I saw fit for usage in JCivED
However, there is some kind of naming standard, especially the usage of prefixes to highlight the data hierarchy, for example:
Also, some data ranges need more detailed description, such as the replay data... I hope to provide as much as possible through this thread, as time allows, and all contributions correct mistakes or enhance coverage are welcome !
The picture below illustrates how much of SVE is already deciphered in blue (80.6%) compared with how much is still unknown, in red (21.4%):
Cheers
As time passes, I am now reposting latest findings as a SVE data reference table available here: http://forums.civfanatics.com/showthread.php?p=12422448#post12422448
The original first post of this thread is kept hereunder for reference.
--------
As a first post, I am attaching 2 text files used internally by JCivED (zipped in View attachment SVE_memory_map.zip because of .txt size limitations on this forum) that map every offset of the SVE byte data to the corresponding in-game data:
- many data ranges or bytes are not identified yet, by lack of time or understanding, and always contain the tag word "unknown"
- there 1 file per supported version:
- Civ EN 475.01 (37856 bytes)
- Civ FR 474.05 (37912 bytes)
- the only difference between those 2 versions is the length of Unit Type names: 12 for english ones, and 14 for french ones; this makes up for the total SVE length difference between the 2 versions: 28 types * 2 chars = 56 bytes = 37912 - 37856;
The structure of the files follows a tab-separated table format, and contains 6 columns:
- id: an arbitrary data element ID meant to uniquely identify the element
- native_type: type of the data element, with possible values as below:
- byte: a single, signed, 8-bit byte (value range: from -128[0x80] to 127[0x7F])
- ubyte: a single, unsigned, 8-bit byte (value range: from 0[0x00] to 255[0xFF])
- short: a 2-byte / 16-bit, signed, integer (value range: from -32768[0x8000] to 32767[0x7FFF])
- ushort: a 2-byte / 16-bit, unsigned, integer (value range: from 0[0x0000] to 65535[0xFFFF])
- string: a character string, usually terminated with a [0x0] char, but not always; for the French version, the exact used codepage looks like either IBM850 or IBM437, but for some reasons, some chars are still off
- data: an otherwise untyped data block; used mainly to cover unknown data areas, or complex data parts (score graph, replay)
- flagbyte: an 8-bit byte used as a set of 8 boolean flags by Civ: each bit is used to represent a TRUE or FALSE value
- flagshort: same as flagbyte but with 16-bit; there is no difference between specifying 2 flgabytes or 1 flagshort, except to try keeping the memory map shorter
- byte: a single, signed, 8-bit byte (value range: from -128[0x80] to 127[0x7F])
- computed_offset: the decimal offset where the data element is located in the SVE
- byte_length: the length, in bytes, of the data element: always 1 for *bytes and 2 for *shorts, can be any value for string or data
- bit: just ignore this one at the moment
- hex_offset: same as computed_offset, but expressed in hexadecimal code
The data IDs are completely arbitrary, and decided by me as I saw fit for usage in JCivED

However, there is some kind of naming standard, especially the usage of prefixes to highlight the data hierarchy, for example:
- game: all IDs start with this prefix. Period.
- game.civ<X>: replacing <X> by a value form 0 to 7, IDs starting with this prefix are specific to the related Civ; <X> then stands for:
- <X> = 0: Barbarians
- <X> = 1: white civ (Romans or Russians)
- <X> = 2: green civ (Babylonians or Zulus)
- <X> = 3: blue civ (German or French)
- <X> = 4: yellow civ (Egyptians or Aztecs)
- <X> = 5: cyan civ (Americans or Chinese)
- <X> = 6: magenta civ (English or Greek)
- <X> = 7: grey civ (Mongols or Indians)
- game.civ<X>.unit<Y>: IDs starting with this prefix are specific to unit with ID <Y> of Civ with ID <X>; the range of <Y> is 0 to 127, i.e. 128 active units per Civ
- game.unit_def<X>: replacing <X> by a value form 0 to 27, IDs starting with this prefix are specific to Unit Types
- game.city<X>: replacing <X> by a value form 0 to 127, IDs starting with this prefix are specific to Cities; note the limitation of 128 total cities in the world
- etc...
Also, some data ranges need more detailed description, such as the replay data... I hope to provide as much as possible through this thread, as time allows, and all contributions correct mistakes or enhance coverage are welcome !

The picture below illustrates how much of SVE is already deciphered in blue (80.6%) compared with how much is still unknown, in red (21.4%):
Cheers