sourcehold / sourcehold-maps

Reverse engineering the map file format of Stronghold
GNU General Public License v3.0
20 stars 3 forks source link

Manipulate AIV info in map/sav file #17

Open gynt opened 4 years ago

gynt commented 4 years ago

As discussed on Discord, AIV info seems to be in the sav file. Meaning that a sav can function normally,, and the AI continues to build the pre-specified AIV, even after AIV files in the game folder have been replaced.

This needs verification, and we need to identify key AIV info in the sav file. Specifically, we need:

Current progress (updated)

An aiv file is burnt into a sav file by making all relative coordinates absolute map positions, and removing any building/placement instructions that are illegal from the aiv in the .sav file. Building placement including walls and moats is stored in section 1107. Troop unit locations is stored in section 1022.

To do: Manipulate:

J-T-de commented 4 years ago

how to verify 1:

my scents to 2 (aiv specs are here)

and you mentioned, that in safe files, sections 1129-1136 are added compared to map files, so my best guess is this data is saved in section 1134 and/or 1135.

gynt commented 4 years ago

The AI continues to build their (custom AIV) castle even though I removed sections 1129 - 1136. Thus, the AIV is not stored in these sections.

gynt commented 4 years ago

Wiping section 1107 makes every AI build an random/default village? Nobody builds walls.

J-T-de commented 4 years ago

this random/default village is kinda known to exist (https://github.com/Sh0wdown/UnofficialCrusaderPatch/issues/451), this could be the thing :)

gynt commented 4 years ago

An update on the progress we made. An aiv file is burnt into a sav file by making all relative coordinates absolute map positions, and removing any building/placement instructions that are illegal from the aiv in the .sav file. Building placement including walls and moats is stored in section 1107. Troop unit locations is stored in section 1022.

To do: Manipulate: