I don't recall noticing any documents of the save game file format here in Apolyton's forums (I haven't checked CivFanatics). Earlier tonight I went through and determined the Palace section for my own enjoyment (Yeah, I wanted to see a fully upgraded one for once...)
I took some time playing with Civilization 3 saved game files, to figure out the format for the palace section.
I had a saved game just before I was awarded an upgrade. I made a few saves after choosing various upgrades and
got my start, from which I was able to feel the rest of the way to get this data. I did crash the game a few times
with invalid data. (Particularly, if you have the bitmask on for a piece and you don't have the data for that piece
set -- boom.) Sometimes the palace button from the control strip in the bottom right corner of the screen would
disappear, but F9 would still bring up the palace. I don't think that variable is contained within this section.
Those of you out there who have written or are working on save game editors, here's the information for the palaces.
Here's a clip from a save game I was playing, as the French:
+----------------------------------------------+
| 5041 4C56 9000 0000 0080 2010 | PALV...... . |
| FFFF FFFF FFFF FFFF FFFF FFFF | ............ |
| FFFF FFFF FFFF FFFF FFFF FFFF | ............ |
| FFFF FFFF FFFF FFFF FFFF FFFF | ............ |
| FFFF FFFF FFFF FFFF FFFF FFFF | ............ |
| FFFF FFFF FFFF FFFF FFFF FFFF | ............ |
| FFFF FFFF FFFF FFFF FFFF FFFF | ............ |
| FFFF FFFF FFFF FFFF FFFF FFFF | ............ |
| FFFF FFFF FFFF FFFF FFFF FFFF | ............ |
| FFFF FFFF FFFF FFFF FFFF FFFF | ............ |
| FFFF FFFF FFFF FFFF FFFF FFFF | ............ |
| FFFF FFFF FFFF FFFF 0000 0000 | ............ |
| 0000 0000 0000 0000 | ........ |
+----------------------------------------------+
There are 32 152(0x98)-byte sections like this within the save game file. The player's section starts at 0x0037F2D4.
The entire palace section starts at 0x0037F23C. In the saved games I worked with anyway (from v1.17f).
The first 8 bytes seem to stay constant for each palace entry, as a header with the values:
5041 4C56 9000 0000
The next 4 bytes are unidentified. The only values I've seen while looking at the few saves I have are:
0080 2010 (my side, unique)
0000 0000 (default value)
0000 0004 (frequent)
0000 0014 (not uncommon)
0010 0014 (rare)
0000 0044 (common)
My guess is that these may have something to do with timing the upgrades. Though, has anyone ever seen the computer
players have an upgraded palace?
32 x 4 bytes each. PalaceView.txt says that the game can handle up to 32 upgrades per culture, even though it only
comes with graphics and information for 17. These bytes set the culture for each piece:
0000 0000 = AMERICAN
0100 0000 = EUROPEAN
0200 0000 = MEDITERRANEAN
0300 0000 = MIDEAST
0400 0000 = ASIAN
This makes me wonder, how many cultures could be added? When I've tried values other than these, the game has crashed.
These values are in the order as they appear in PalaceView.txt
The next 8 bytes are unknown. They never show any variance, though I don't recall any crashes happening when I changed
them to reasonable values.
The next (last) 4 bytes make a bitmask of which pieces have been added and which haven't. Again, since the comments
in PalaceView.txt say there can be 32 pieces, 4 bytes times 8 bits per byte = 32 possible pieces. However, when I put
any values into the last one, or greater than 03 in the second-to-last-one, the game would crash. It only allowed me
to toggle on up to 18 bits:
00000000000000000 = 0x000000 = (no parts)
11111111111111111 = 0xFFFF01 = (all parts present)
111111111111111111 = 0xFFFF03 = (highest value without crash)
00000000000000001 = 0x010000 = lawn
00000000000000010 = 0x020000 = right wing
00000000000000011 = 0x030000 = lawn and right wing
Note that the game will crash if you have the toggle for a piece on, but you do not have the culture selection
information set. The masks are as they are in PalaceView.txt
00000000000000001 = 0x01000000 = lawn
00000000000000010 = 0x02000000 = wing right
00000000000000100 = 0x04000000 = wing left
00000000000001000 = 0x08000000 = steps
00000000000010000 = 0x10000000 = wing tower right
00000000000100000 = 0x20000000 = wing tower left
00000000001000000 = 0x40000000 = hall right
00000000010000000 = 0x80000000 = hall left
00000000100000000 = 0x00010000 = hall tower right
00000001000000000 = 0x00020000 = hall tower left
00000010000000000 = 0x00040000 = center ground
00000100000000000 = 0x00080000 = center 1st above ground
00001000000000000 = 0x00100000 = arch and mini pillars
00010000000000000 = 0x00200000 = tall pillars
00100000000000000 = 0x00400000 = center 2nd above ground
01000000000000000 = 0x00800000 = trees
10000000000000000 = 0x00000100 = center 3rd above ground
100000000000000000 = 0x00000200 = (no visible addition)
1000000000000000000 = 0x00000400 = (crash)
Yes, it is possible to have pieces added in to the save game that do not have their prerequisites, as set in the text
file met. I did not, however, get a chance to test whether or not the game crashes on the next upgrade in the game if
you hurry it along and give yourself a floating center 3rd above ground.
Comment