Make your own free website on Tripod.com

Hacking the .SAV Files

Back to The Unofficial Microprose Colonization Homepage

[JUL01] .SAV Hacking by kcsaff from the CivFanatics Colonization Forum

Related page:Hacking the Text Files

I was playing with the Colonization SAV files and a hex editor trying to recreate EdBigHead's experience of playing the Sioux. I doubt that's possible (by just hexing .SAV files), but I did find a few things I found interesting.

(This is for the DOS version of Colonization, v.2.25, I have no idea about other versions.)

There is a flag for each European power, which is on if the power is AI-controlled. In other words, you can turn multiple flags off for (single-terminal) multiplayer Colonization!

There would probably be some unexpected effects as independence approaches, since there appears to be a relationship between a withdrawn power and the king's troops. I altered the withdrawn English to play as them, and my newly independent French onto AI. I became the Tories, but I couldn't attack unless I turned the French AI off, to play as both Tories and Rebels.

Diplomacy would also be odd, because the game would have its own ideas about who's at peace, and who's at war.

The bytes where this flag reside are, in hex:

&0CF English
&103 French
&137 Spanish
&16B Dutch


Just set this byte to "&00" to control the power, or "&01" to let AI control it. "&02" appears related to whether the power has withdrawn, and the byte before this one appears related to diplomacy, but I'm not sure yet.

Byte "&36" controls the game level. The levels I've tried so far include:

&00 Discoverer
&01 Explorer
&02 Conquistador
&03 Governor
&04 Viceroy
&05 Spring (Harder than viceroy, but includes tutorial?)
&06 Tundra (No tutorial for this or any additional level I tried)
&07 Ocean
&08 " "*,*****
&09 Spring (Repeated title; Colonies inefficient at size 1,*****)
&0A Spring (Crashed on colony founding: "DIVIDE BY ZERO",*****)
&0B Spring (Colonies "inefficient"** at -1, crashed after some time,*****)
&10 Spring (Colonies "inefficient"*** at -6,*****)
&11 Spring (Colonies "inefficient"*** at -7,*****)
&FF Spring (Colonies "inefficient"*** at -245, ****,*****)


* Title is just one blank space instead of word.

**"Inefficiency" at this level gives +1 benefits for every Tory citizen, so a size 4 colony got +4 work from each person! This would be strange to play, since your colonies would become less efficient the closer you got to declaring independence. Unfortunately it crashed, "DIVIDE BY ZERO", after I had a colony of 4 extremely efficient workers. Of course, I had to keep my Elder Statesman out of City Hall to keep them working so hard!

***On these levels, "inefficiency" had no noticeable effect.

****REF grows every turn, with extremely high native alarm; however, the king of Netherlands gave me 3 soldiers and an artillery for -$644, giving a much needed boost to my army and treasury!

*****At these levels, other European powers gained Independence before I reached landfall, although they had no rebel sympathizers.


[SEP02] Gramphos

Have you tried to run opening -d:0? That makes an AI only play.

It is also interesting that the text-files contains Multiplayer strings.

[Dec03] .SAV hacking - disband Stockaded colonies by Stormreaver from the
CivFanatics Colonization Forum

Just started a recent game of Colonization, as I happened to get in a discussion with a mate about the superior strategy. Then of course we both had to play a game right away to show the other who was the superior Col player.

Anyway, somewhere around 1600 I had captured a Dutch colony with that hated stockade. Since it was founded too close an already existing colony and had no use at all, I wanted to disband it. Turns out it's quite possible to get rid of that stockade through .SAV hacking.

If you open a .SAV in a hex editor, you'll discover that each colony is represented by 202 bytes, and the colonies follow each other in a certain segment of the .SAV file. You can easily find the colony by searching for its name. When you have finally found it, the bytes describe the following stuff (from now on all numbers in hex unless noted Xd (X decimal number), and byte 00 is the initial byte the colony is described by.)

Byte index 00-01, X,Y-coordinates
The coordinates (in hex) of the colonies. Note that colonies does not work well in water...

Byte index 02-17, Colony name
Name of colony in ASCII, max length 22d characters (obviously)

Byte index 1F, Number of colonists
The amount of colonists currently _in_ the colony, max 32d=20

Byte index 20-3F, Colonist occupation
The colonists are "numbered" 00-1F and for each colonist their occupation is described here. Note that for the colonists working in the fields, the actual tile is not noted here, only what they are extracting from it.

00 Farmer
01 Sugar planter
02 Tobacco planter
03 Cotton planter
04 Fur trapper
05 Lumberjack
06 Ore miner
07 Silver miner
08 Fisherman
09 Distiller
0A Tobacconist
0B Weaver
0C Fur Trader
0D Carpenter
0E Blacksmith
0F Gunsmith
10 Preacher
11 Statesman
12 Teacher

Byte index 40-5F, Colonist specialization
Each byte corresponding to the colonist in the same position as above, but now denoting the expertise of the colonist. Here you can choose some unexpected values (some included below), but most of them will probably crash the game sooner or later. The list below isn't complete, I haven't researched all possibilities.

00-11 Exactly as above
14 Pioneer
15 Vet. Soldier
16 Scout
18 Missionary
19 Ind. Servant
1A Criminal
1B Indian convert
1C Free colonist

12 Teacher (has been found in game in other ways as well)
17 Veteran dragoon (yup, unit with horses and all inside colony..)
1D Armed brave
1E Mounted brave

Byte index 60-6F, Colonist time in spot
Here each byte is for two colonists (one hex digit/colonist). The order is inversed though, so the four least significant bits in the first byte (2nd digit) denotes the first colonist. Also mapped to above. Each turn the colonist stays in the same place his value here is increased by one. I think the only use of this variable is to decide when a teacher teaches a teachable colonist his profession. Max 15d=F.

Byte index 70-77, Colonists working tiles
These 8 bytes each represent one tile of the 8 surrounding the colony, and in the order N, E, S, W, NW, NE, SE, SW.
If there is a colonist working a tile, the byte is the corresponding "index", if not the byte is FF.

Summing up colonists:
A free colonist farming in the northern tile as the first colonist would be represented by a 00 in byte 20, 1C in byte 40 and byte 70 would be 00.
An seasoned scout generating bells (as 2nd colonist) would be a 11 in byte 21, and a 16 in byte 41. No "tile byte" would be set for him.

Byte index 84-89, Buildings
The target that started this "project". Here an existing building is denoted by a single bit being set to 1. The starting set of buildings is: 00 02 20 09 89 00. This corresponds to 7 set bits (houses for distiller, tobacconist, weaver, fur trader, carpenter and a town hall).

By setting these bytes to 00 00 00 00 00 00 you get a colony with absolutely no buildings (works in game, as far as I can tell). You can even build these basic buildings (39 hammers for Carpenters House, 56 for Fur Traders House and 64 for the other specialist houses, as well as town hall).

A quick fix to get no stockade/fort/fortress would be to set the second digit in byte 84 to 0 (no armory) or 8 (with armory). I haven't tried this with Sieur de La Salle yet (I refrain from choosing him until I absolutely have to, for disbanding reasons). Hopefully the "La Salle"-stockade is only ever added when you change the population to 3+, so removing colonists down to 3, editing savefile, loading, and then removing the rest of the colonists should do the trick. But as said, not tested, I'll update here when I am forced to add La Salle.

The game "keeps" the former building when you build it's successor, for example the game says you have stockade+fort when you've built the fort. I have not played around a lot with this, but at least if you set to ONLY fort/fortress the map shows only a stockade, but the colony screen shows the appropriate building. There's also a few buildings not available.

The full set of buildings (allowed by game) would be: FF F3 FF 3F FF 03

Here are the buildings, bit for bit.
Buildings

Bit Byte 1 Byte 2 Byte 3 Byte 4 Byte 5 Byte 6
1 Stockade Shipyard Warehouse Exp Tobacconists house Fur traders house Blacksmiths shop
2 Fort Town hall Stable Tobacconists shop Fur traders shop Iron works
4 Fortress Town hall* Custom house Cigar factory Fur factory -
8 Armory Town hall* Printing press Rum distillers house Carpenters shop -
16 Magazine Schoolhouse Newspaper Rum distillers shop Lumber mill -
32 Arsenal College Weavers house Rum factory Church -
64 Docks University Weavers shop Capitol** Cathedral -
128 Drydock Warehouse Textile mill Capitol Exp** Blacksmiths house -


*Apparently this is buildings that was not included in the final game - The mouseover says town hall, there is no graphics and no bonus bell production.
**Not included in the final game. Replaces town hall, but no graphics for this one, mouseover says Capitol/Capitol Expansion, no bonus bell production.

Byte index 92-93, Accumulated hammers
Number of hammers accumulated in build progress. Byte order is reversed though. so FF 00 would be 255d hammers, but 00 01 would be 256d.

Byte index 94, Building in production
This byte denotes what the colony is currently building. You can actually build (for example) the Capitol here. Not much use though it seems.

00-29 (0d-41d) As in table above, 00=Stockade, 01=Fort, 02=Fortress, ...
2A Artillery
2B Wagon Train
2C Caravel
2D Merchantman
2E Galleon
2F Privateer
30 Frigate
31 Nothing (anything not recognized by the game seems to set it at Nothing)

Here is a minor disappointment, I had hoped for the ability to build the Man-o-war. Not 100% it's impossible though, maybe it's there, I haven't tried _all_ numbers.

Byte index 9A-B9, Storage
These bytes say what you have in store. Each good is denoted with 2 bytes, using the reversed denotation as in accumulated hammers (first byte 0-255, second byte value multiplied with 256). You can set to really big amounts here, even getting the number on screen to a negative number.

The order is the same as in the colony screen: Food (9A-9B), Sugar (9C-9D), Tobacco (etc.), Cotton, Furs, Lumber, Ore, Silver, Horses, Rum, Cigars, Cloth, Coats, Trade goods, Tools, Muskets.

Byte index C2-C3, Accumulated bells
The total number of bells ever produced in the colony.

From now on, it's mostly speculation, but this is how I THINK it works, I can't back it up (yet):
Every rebel colonist need a certain number of bells. If each rebel needs, say, 200 bells (haven't researched the exact number, might be different in different difficulties also), 101-300 bells means one rebel in the colony, 301-500 two rebels and so on. The percentage will still rise inside the intervals though, so 101 bells in a 5 colonist colony will result in a 10% freedom rating (5x200=1000 bells to get 100%), but one rebel.

The Simon Bolivar is added after this, for example: 8 colonists in colony, 700 accumulated bells = 3.5 rebels, 700/1600~=44%. 20% is added for Bolivar, meaning 64% and a total of 5.1 (rounded to 5) rebels.

Repeating: that number of 200 bells/rebel is (most likely) not accurate! Maybe this is researched somewhere else, I haven't read every post in the forum.



That's all I have, the unknown bytes should probably include custom house settings, nation, and more that I have no clue about. Units outside the colony I think are NOT saved together with the colony, but as independent units which must be somewhere else in the save file.

If I find time, I will complete this guide. For now, I have to apply my stockade-erasing abilities and go kick some French butt. They threaten to go independent if I don't reduce their numbers, and that I can't have, can I? One more note on this btw - capturing a foreign colony and removing the colonists (leaving the colony open for recapturing) is not very efficient, since the bells accumulated stays. If you raze the colony and let the foreigners rebuild it, they have to start over generating rebels instead of just adding on more colonists again. And you can get the extra 3 colonists of course, which can be put to better use in a colony near the rest of your empire.

Then again, another question arises - removing stockades, is that a function merely forgotten by the programmers, or is it cheating?