Anyhow, this makes up for the last officially "unknown" byte in the SVE file format...
Congratulations! May your Future Tech be plentiful and lacking pollution bugs.
Anyhow, this makes up for the last officially "unknown" byte in the SVE file format...
Cities
(back to table)
Data range/length: [5384:8967] / 3584 bytes - (hex: [0x1508:0x2307]/0xE00)
- each City data is a 28-byte data block, as described below:
unknown
- Bytes whose usage is still unknown yet
unknown27 : 7 6 | 5 4 3 2 1 0
unknown28 : 7 6 | 5 4 3 2 1 0
usage : flags | 6-bit-encoded Unit Type
game.civ0.unit0.unknown_unitbyte9 ubyte 9928 1 0 26C8
Update about this value:
It's a map direction, coded as a value between 1 and 8. It's set to -1 when there's no direction to save.
However, I still don't know what this direction is used for. It seems to have something to do with the GoTo coordinates. Maybe it's just the current GoTo direction of the unit.
I think the latter is the correct one, it also matches the order in which roads and railroads sprites are stored in SP257.PIC
Maybe it's a "cached" value for AI units in GoTo mode, for example "next move" ?
From my experience, Civ will determine that a unit is in GoTo mode if its "GoToX" attribute is not -1 (0xFF), in which case it uses GoToX and GoToY as the GoTo destination... Some trial and error needed here, I guess.
Diplomacy
(back to table)
Data range/length: [1608:1735] / 128 bytes - (hex: [0x648:0x6C7]/0x80)
Diplomatic status of a Civ:- this is a series of 8 shorts (8*2 = 16 bytes)
- each of the 8 short describe the status between the Civ and one of the 8 other Civs (seems to include Barbarians )
- each short value is a bitflag whose bits describe a particular diplomatic status
- currently known bits are as follows:
Code:bit | meaning of bit value = 1 0 | at war 1 | at peace 2 | alliance 3 | vendetta 4 | ? 5 | ? 6 | embassy established 7 | ? 8 | ? 9 | ? 10 | ? 11 | ? 12 | ? 13 | ? 14 | ? 15 | ?
- this series of 16 bytes is repeated 8 times, once for each Civ (totally 8*16 = 128 bytes)
Cities
(back to table)
Data range/length: [5384:8967] / 3584 bytes - (hex: [0x1508:0x2307]/0xE00)
Cities- there are totally 128 data blocks representing the 128 possible cities supported by CIV
- each City data is a 28-byte data block, as described below:
Diplomatic status flags which I've identified so far:
0x01 = War
0x02 = Peace
0x04 = Alliance
0x08 = Vendetta
0x40 = Embassy
Wonders
(back to table)
Data range/length: [34418:34461] / 44 bytes - (hex: [0x8672:0x869D]/0x2C)
Wonders- this data element is a short integer (2 bytes) that occurs 21 times, once for each Wonder
- it is the ID of the City where the Wonder with the current offset ID (TODO: ref table of Wonders) is built
- if the wonder is not built yet, this value is 0xFFFF (-1)
- if this city ID is *not* 0xFFFF and the city corresponding to this ID has size '0' (city destroyed), then the Wonder is marked as Destroyed by CIV
Looks like there might be 2 bytes missing... 21x2 = 42. Are there actually 22 wonders?
Wow, I finally found this info! (of course I read this thread before but I totally forgot about it!). I used approximate numbers from many tests. It was almost right. Almost.This is actually the next turn when Civ Rankings will be displayed (when a famous anthologist finishes his epics...).
This value is calculated by Civ as follows:
- At the start of the game, it is a random value between 0 and 50 (exc.)
- Whenever the turn is reached, the next turn is computed as: current turn + 20 + a random value between 0 and 40 (exc.)
During my journey inside the map generation code, I figured out this code was also setting up the values of the data block unknown25, which is apparently some kind of high-level path-finding data, i.e. data meant to help the Civ AI moving units around the map in an optimal way.
The funny thing is that the Civ code setting up this data seems to wrong - although it may not matter in the end...
[...]
5. Can it be fixed? Should it be fixed?
I am actually very interested in discovering what Civ would do if accessing the data properly...
But then I am also wondering: if this bug has always been here, in all versions of Civ (to be confirmed) is this data actually used at all by the Civ's AI code? In oterh words, even if it is corrected, is it going to change anything in the game?
I guess answers to those questions will come in the next episode...
Yes, but as @darkpanda mentioned before that this table is generated with wrong data anyway, so, it serves no purpose for any kind of movement. The AI movement is basically: I want to move from point A to point B and that's it. Will need to rewrite the entire GoTo code to make things behave correctly and stable!GoTo command as cosmetics for the human player may indeed have been added at the last minute. But AI uses the same pathfinding for its movement and some pathfinding is necessary for AI so I think it was added early.