Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Manipulate AIV info in map/sav file #17

Open
2 of 8 tasks
gynt opened this issue Aug 29, 2020 · 5 comments
Open
2 of 8 tasks

Manipulate AIV info in map/sav file #17

gynt opened this issue Aug 29, 2020 · 5 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@gynt
Copy link
Collaborator

gynt commented Aug 29, 2020

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:

  • 1. verification an AI builds an AIV that has been loaded from the sav file.
  • 2. key information from an AIV we can hunt down in a sav file (or many sav files).

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:

  • 1. building locations
  • 2. building order
  • 3. building type
  • 4. troop type
  • 5. troop location
  • 6. know how exactly to convert from relative coordinates in the aiv file to absolute coordinates in the sav file (the reference point is probably the center of the keep)
@gynt gynt added enhancement New feature or request help wanted Extra attention is needed labels Aug 29, 2020
@J-T-de
Copy link
Contributor

J-T-de commented Aug 30, 2020

how to verify 1:

  • prepare any map with aivs and save it (easiest save with semi-finished aiv)
  • rename aiv folder (or back it up or smth)
  • load save file

my scents to 2 (aiv specs are here)

  • data is redundant and unnecassary data is saved in *aiv files
  • to minimize the aiv in size, it is enough to save
    • building-id, building-position, and the associated building step (or best save it in an array, where the index corresponds to the building
    • troop placement in some kind
    • building pause steps and pause (even though there are doubt they are safed

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
Copy link
Collaborator Author

gynt commented Aug 30, 2020

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
Copy link
Collaborator Author

gynt commented Aug 30, 2020

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

@J-T-de
Copy link
Contributor

J-T-de commented Aug 30, 2020

this random/default village is kinda known to exist (UnofficialCrusaderPatch/UnofficialCrusaderPatch2#451), this could be the thing :)

@gynt
Copy link
Collaborator Author

gynt commented Sep 8, 2020

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:

  • building locations
  • building order
  • building type
  • troop type
  • troop location
  • know how exactly to convert from relative coordinates in the aiv file to absolute coordinates in the sav file (the reference point is probably the center of the keep)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants