Prologue
This thread is intended to become a reference guide to the Civilization II savegame and scenario file format. It is a vital first step if we ever want to see a universal civ2 scenario editor. I started this thread to make it a more public and centralized effort, as opposed to Allard's Hex Editing document. While being an indispensable initiative, I believe it's become almost unmanageable. There never was one central place to post new discoveries, making it impossible to keep up to date.
But for this new effort to succeed, we need your help. So, please post your discoveries about the file format here.
However, this is mostly meant to be a raw file format reference, not (yet) a complete guide to how every single byte can be used in making your scenarios. When you do have a new discovery, please keep it concise and to the point. But feel free to add comments or ask questions, as long as they're specifically about this reference, and not about hex-editing in general.
Please do NOT ask your hex-editing questions here. If you have a question, post a new thread.
As you will notice, apart from the table of contents the file format is still mostly uncompleted. That's not because we know so little, but simply because I haven't added all of it yet. This thread will probably always remain a work in progress. And for the moment certainly not only for the file format itself. I will also be adding notes on the notation and some of the terms used. Notes will follow right after the table of contents, including notes on the table of contents itself.
Table of Contents
- Notes
- Credits
- File Format
- Header (12)
- Settings (CiC:558, FW/MGE:572, ToT:1238)
- Civilizations (13118, ToT:28478)
- Names (7 * 242 = 1694)
- Properties (8 * 1428 = 11424, ToT: 8 * 3348 = 26784)
- Transporters (ToT10: 4 + 14 * transporters, ToT11: 172 + 14 * transporters)
- Maps
- Header (14, ToT:16)
- Data, repeat for all maps in ToT (13 * surface, ToT: 13 * surface + 2)
- Visible Improvements (7 * surface)
- Map (6 * surface)
- Resource Seed (ToT:2)
- ??? (2 * 6th header value * 7th header value)
- ??? (1024, ToT:10240)
- Units (26 * units, MGE: 32 * units, ToT: 40 * units)
- Cities (84 * cities, MGE: 88 * cities, ToT: 92 * cities)
- ???
- Passwords (MGE/ToT: 224)
- ???
- Conquest History (338)
- Events
- Header (FW: 6, ToT: 8)
- Events (FW: 298 * events, ToT: 276 * events)
- String Heap
Notes
Table of Contents
Let me start off with some comments about the notational use in the table of contents. Due the differences between the various game versions, as well as the presence of variable-size sections I have refrained, and will refrain, from using file offsets. Instead, I indicate the size in bytes of all different parts of the file format. You should be able to calculate the exact position yourself.
So, in parentheses is mentioned the size in bytes of that (sub-)section. Differences between the game versions are marked with their respective abbreviations:
- CiC
- Civilization II Scenarios: Conflicts in Civilization and all prior versions, including the original "classic" Civilization II v2.42.
- FW
- Civilization II: Fantastic Worlds
- MGE
- Civilization II: Multiplayer Gold Edition with the latest patch version 1.3 and all equivalent versions, including Civilization II: Ultimate Classic Collection and the add-on Civilization II: Multiplayer
- ToT
- Civilization II: Test of Time
- ToT10
- More specifically, the unpatched version of Test of Time, version 1.0
- ToT11
- Patched Test of Time v1.1
A size unmarked by any abbreviation applies to all versions, with the possible exception of any marked sizes. E.g. Header (12)
means the header is 12 bytes for all versions, Header (14, ToT:16)
means the header is 14 bytes for all versions except Test of Time, for which it is 16 bytes. Passwords (MGE/ToT: 224)
means this section only exists in the MGE and ToT versions, where it is 224 bytes.
File Format
Data Types
Onto the file format notes. So far, there are three data types: The null-terminated string is a variable length type for text. It always ends with a byte value of zero, meaning a string of 9 bytes only has place for at most 8 characters. The signed short integer is a numeric data type taking up 2 bytes. It can take values from -32768 to +32767. The unsigned byte should be self-explanatory. It takes values from 0 to 255.
Description
If the specific order of a section with multiple values is not specified, you can assume the order as used in the RULES.TXT. This applies, for instance, to the technology and wonder sections.
Hexadecimals
I mark hexadecimals with the prefix "0x". In this guide I write them in big-endian notation. In other words, in the same way you'd see them in your Windows calculator. However, in the binary file format, the numeric data types use a reverse, little-endian, notation with the least significant value first. The bytes appear in reverse order. E.g. for a short integer value, your hexadecimal calculator might say 27
, which I would write in this guide as 0027
(since a short takes 2 bytes), but in the savegame file it would be written as 2700
.
Credits
In alphabetical order:
- AGRICOLA
- Captain Nemo
- Paul "Kull" Cullivan
- Carl "Gothmog" Fritz
- Allard Höfelt
- Andrew "Panda" Livings
- Mercator
- Javier "yaroslav" Muñ Kirschberg
- Dusty Reichwein
- Angelo Scotto
- SlowThinker
- Harlan Thompson
- Xin Yu
Comment