In this topic I'm going to list and explain some data tables which can be found inside of civ.exe. These tables influence the behaviour of the game. They contain data such as in-game names, terrain/unit stats, or the tech tree. Since tables are relatively easy to edit, they are useful for modding Civilization I. For modding civ.exe you need a hex editor. I use http://mh-nexus.de/en/hxd/ While this is no doubt a very good editor, you can find many more on the web. Just pick one that you feel comfortable with When testing your changes, do not load a saved game. Savegames use some tables of their own, so most changes would not be visible. Instead, start a new game to test any modifications you do. Always make sure to have a backup before editing civilization. The information below applies to CivDOS v475.01. It may also apply to other versions of CivDOS, but I cannot guarantee for that. 1. Unpacking Civ.exe The file "Civ.exe" is actually a compressed executable. Although it's possible to edit many things in the packed file directly, it's still a good idea to decompress it first, because the tables are messed up in the compressed file. The program that was used for the compression is ExePack v3.65. To decompress civ.exe, you can used the UNP tool which can be downloaded here. The uncompressed .exe is about 10% larger than the compressed one. Also, after decompression, the executable can be analyzed with a disassembler (of course it must be one that can handle MS-DOS executables). All offsets listed below apply to the decompressed executable of CivDOS v475.01. Update: If you get an "Overlay not found" error whe trying to launch the unpacked executable, look here for a solution. 2. City Names The city names table starts at position 0x28900. It contains 256 entries, each consisting of a 12-byte string (the city name plus one or more blanks) followed by a null character (0x00). The entries are sorted by civs first (with a pool of additional city names like "Mecca" at the end) and then by the order in which they are founded. Note that a string must always be followed by a null character (this applies to all following sections as well). 3. Leader Names (Hall of Fame) At position 0x29600, right after the city names table, we have the names of historical characters for the "your civilization rating of... exceeds even..." message. This table has 20 entries, each 25 bytes in size. So the maximum length for such a name is 24 bytes. 4. Terrain Stats This is where things become a bit more interesting. While the first two tables were just made of strings, this one actually contains data which will have an influence on in-game values. The terrain stats table begins at position 0x2CBB2. It contains 24 entries (one entry for each terrain type; special resources are treated as separate terrains). Entries are each 19 bytes in size and are divided as follows: relative offset: 0x00 terrain name relative offset: 0x0C movement cost relative offset: 0x0D defense value (will be multiplied by 50%, for example 0x04 means 200% defense) relative offset: 0x0E food production relative offset: 0x0F resources production relative offset: 0x10 trade production relative offset: 0x11 unknown relative offset: 0x12 terrain ID 5. Terrain Improvement The next table controls how terrain can be improved by irrigation and/or mining. It starts at position 2CD7A and contains 12 entries (12 bytes per entry). The order of terrain types matches that of the terrain stats table, but this time, special resources are NOT treated as separate terrains. Instead, they share entries with their unbonused "counterparts". The order is Desert, Plains, Grassland, Forest, Hills, Mountains, Tundra, Arctic, Swamp, Jungle, Ocean, River. When entering negative numbers, keep in mind that these are 2-byte values, so for example, for -2 you have to enter "FE FF", not just "FE". Here's what each entry contains: relative offset: 0x00 effect of irrigation (if positive: terrain ID of resulting terrain; must be a valid terrain ID) (if negative: -1 = impossible to irrigate; -2 = +1 food; -3 = +2 food; -4 = +3 food; etc.) relative offset: 0x02 duration of irrigation (i.e. it will take a settler this many turns to irrigate a square) relative offset: 0x04 effect of mining (if positive: terrain ID of resulting terrain; must be a valid terrain ID) (if negative: -1 = impossible to mine; -2 = +1 shield; -3 = +2 shields; -4 = +3 shields; etc.) relative offset: 0x06 duration of mining (i.e. it will take a settler this many turns to mine a square) relative offset: 0x08 ability of the AI to irrigate/mine this terrain type under despotism (0 = no; 1 = yes) relative offset: 0x0A ability of the AI to irrigate/mine this terrain type under monarchy (or higher) (0 = no; 1 = yes) The "effect of irrigation" and "effect of mining" values can for example be used to enable settlers to change ocean squares into land squares and vice-versa. After turning a land square into an ocean square, the settlers unit is *not* destroyed and can move to any adjacent land square. To turn ocean squares into land squares, put the settlers on a ship and wake them. 6. Tech Tree The tech tree, which starts at position 0x2CE0A, consists of 72 entries (22 bytes each). Here the names and prerequisites of the technologies are stored. Each technology has its own ID, but this ID is not stored explicitly. Instead, the technologies are simply sorted by IDs, starting with Alphabet (ID 0). There are four dummy techs (IDs 68, 69, 70, 71). Note that some techs have special effects (such as making existing barracks obsolete). These effects only depend on the ID, i.e. the order of the techs. For dummy techs and for future technology, "0x7F" is used as both prerequisites. Contents of an entry: relative offset: 0x00 name of the technology relative offset: 0x14 tech ID of first prerequisite (-1 = no prerequisite) relative offset: 0x15 tech ID of second prerequisite (-1 = no prerequisite) With embasssies you can look at the techs of other civs. When doing so, the techs with the highest IDs are displayed first. List of tech IDs: 0x00 Alphabet 0x01 Code of Laws 0x02 Currency 0x03 Atomic Theory 0x04 Democracy 0x05 Monarchy 0x06 Astronomy 0x07 MapMaking 0x08 Navigation 0x09 Mathematics 0x0A Medicine 0x0B Physics 0x0C Engineering 0x0D University 0x0E Magnetism 0x0F Electronics 0x10 Masonry 0x11 Bronze Working 0x12 Iron Working 0x13 Bridge Building 0x14 Invention 0x15 Computers 0x16 Writing 0x17 Steam Engine 0x18 Trade 0x19 Ceremonial Burial 0x1A Mysticism 0x1B Nuclear Fission 0x1C Philosophy 0x1D Religion 0x1E Literacy 0x1F Horseback Riding 0x20 Feudalism 0x21 The Wheel 0x22 Gunpowder 0x23 Industrialization 0x24 Chemistry 0x25 Combustion 0x26 Flight 0x27 Advanced Flight 0x28 Space Flight 0x29 Mass Production 0x2A Pottery 0x2B Communism 0x2C The Republic 0x2D Construction 0x2E Rocketry 0x2F The Corporation 0x30 Metallurgy 0x31 RailRoad 0x32 Nuclear Power 0x33 Theory of Gravity 0x34 Steel 0x35 Banking 0x36 Electricity 0x37 Refining 0x38 Explosives 0x39 SuperConductor 0x3A Automobile 0x3B Genetic Engineering 0x3C Plastics 0x3D Recycling 0x3E Chivalry 0x3F Robotics 0x40 Conscription 0x41 Labor Union 0x42 Fusion Power 0x43 1 (dummy tech) 0x44 2 (dummy tech) 0x45 3 (dummy tech) 0x46 4 (dummy tech) 0x47 Future Tech. Give the dummy techs some valid prerequisites, and you can actually discover them. They won't appear in the Civilopedia without further editing, but that's just a cosmetic issue. On the other hand, I'd advise you to stay away from editing Future Technology. It's needed when there is nothing else to research. 7. AI Tech Values At position 0x2D43A there's a table (72 entries, 2 bytes per entry) which controls how "valuable" a technology will be in the "opinion" of the AI. Each technology has a base value and a modifier. For "civilized" leaders, the modifier is added to the base value. For "militaristic" leaders, it is subtracted instead. The result determines which technologies the AI will ask for during negotiations, and probably also what the AI decides to research next. The entries are sorted by tech IDs. An entry contains: relative offset: 0x00 base value relative offset: 0x01 value modifier Example: "Code of Laws" has a base value of 4 and a value modifier of +1. For a leader who is neither civilized nor militaristic, its value is 4. For a civilized leader, its value is 4+1=5, while for a militaristic leader its value is 4-1=3. 8. Buildings The building table (position 0x2D4CA, 46 entries, 30 ybtes per entry) starts with a dummy entry and contains all city improvements, including space ship parts and wonders of the world. The effects of buildings are hardcoded and depend on the position of the entry in this table. Each entry consists of the following data: relative offset: 0x00 name of the building relative offset: 0x18 construction cost (will be multiplied by 10 shields) relative offset: 0x1A maintenance cost (per turn) relative offset: 0x1C tech ID of the prerequite technology (-1 = no prerequisite, use "FF FF", not just "FF") 9. Wonder Expiration The table at position 0x2DA2E (21 entries, 2 bytes per entry) controls when wonders of the world become obsolete. The order of the entries is the same as the order of the wonders in the building table. Each entry contains just one value: relative offset: 0x00 tech ID of the tech which cancels the effect of the wonder (use 0x7F to make the effect of a wonder last for the whole game) 10. Unit Stats The unit table starts at position 0x2DA5A (28 entries, 34 bytes per entry) and allows for quite a few interesting modifications. However, the position of an entry in this table can have important effects, for example which units can be appear as barbarians. Each entry contains the following data: relative offset: 0x00 unit name relative offset: 0x0C tech ID of the advance which makes this unit obsolete (use 0x7F for units which do not become obsolete) relative offset: 0x0E domain (0 = land; 1 = air; 2 = ocean) relative offset: 0x10 movement rate relative offset: 0x12 fuel (air units only) (1 = must return to city or carrier each turn; 2 = must return to city or carrier each other turn; etc.) relative offset: 0x14 attack rating relative offset: 0x16 defense rating relative offset: 0x18 cost (will be multiplied by 10 shields) relative offset: 0x1A visibility (0 = one square; 2 = two squares; 3 = two sea squares) relative offset: 0x1C number of transport slots relative offset: 0x1E AI role (0 = colonization; 1 = attack; 2 = defense; 3 = sea superiority, 4 = air superiority, 5 = sea transport; 6 = diplomacy/trade) relative offset: 0x20 tech ID of the prerequite technology (-1 = no prerequisite, use "FF FF", not just "FF") 11. Civilization Leaders The leaders table is divided into two parts (position of 1st part: 0x2DE4C, position of 2nd part: 0x2E01C). Each part contains 7 entries (1 entry for each leader, 58 bytes per entry). Negative values for attitudes must be "FF FF" (i.e. 2 bytes). Each entry contains: relative offset: 0x00 name of the leader relative offset: 0x10 civilization name (plural) (this entry can be empty if the plural is formed by simply adding an "s" at the end) relative offset: 0x20 civilization name (singular) relative offset: 0x30 1st attitude (-1 = friendly, 0 = neutral, 1 = aggressive) relative offset: 0x32 2nd attitude (-1 = perfectionist, 0 = neutral, 1 = expansionistic) relative offset: 0x34 3rd attitude (-1 = militaristic, 0 = neutral, 1 = civilized) relative offset: 0x36 music ID (short tune, e.g. when discovering a new technology) relative offset: 0x38 music ID (long tune, e.g. during negotiations) 12. EARTH starting positions See http://forums.civfanatics.com/showthread.php?t=223182 In the decompressed .exe, the table starts at position 0x2FEBC.