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

Getting grip on the blockmap #11

Open
nyfrk opened this issue Mar 31, 2021 · 0 comments
Open

Getting grip on the blockmap #11

nyfrk opened this issue Mar 31, 2021 · 0 comments

Comments

@nyfrk
Copy link
Owner

nyfrk commented Mar 31, 2021

We need access to the blockmap to be able to tell whether a building can be placed at a specific position on the map.

Possible candidates

BYTE **blockmap = S4_Main.exe + 0x11630E8;

  • A possible blockmap is defined as: BYTE **blockmap = S4_Main.exe + 0x11630E8;
    • The precise meaning of the bits in each field is unknown.
    • It is known that there is a road-spawn-counter. If a settler walks on grass this counter is increased and if a certain threshold is reached a dirt road or cobble road is spawned.
    • Objects such as piles or shapes of buildings (including mines) are somehow represented in this map although they do not necessary contribute to road creation
    • Sea (positions where ships can move) or any non-buildable terrain types do not seem to be represented in this map
    • Settlers do not seem to be represented in this map (i.e. no repelling map)
    • Cobbled or Dirt Road tiles that were created using the map editor seem to be represented
    • The repelling masks of buildings is represented ?

A visual representation (heatmap) of the map:

image

WORD **blockmap = S4_Main.exe + 0x11630D0;

  • A possible blockmap is defined as: WORD **blockmap = S4_Main.exe + 0x11630D0;
    • Sea and Land is represented (including coast)
    • Spots that are occupied by buildings (including mines) are represented
    • No piles, settlers or other objects seem to be represented on this map

A visual representation of the map (Test_Trojan map):
image

BYTE **blockmap = S4_Main.exe + 0x11630D8;

  • A possible blockmap is defined as: BYTE **blockmap = S4_Main.exe + 0x11630D8;
    • Objects like trees or CStones are represented with a large blob
    • Spots occupied by buildings are represented
    • Spots owned by a player are represented
    • No Piles or Settlers are represented

A visual representation of the map (Test_Trojan map):

image

WORD **blockmap = S4_Main.exe + 0x11630E0;

  • A possible blockmap is defined as: WORD **blockmap = S4_Main.exe + 0x11630E0;
    • Goods, Trees and CStone Objects are represented at a single position
    • Maps probably coordinates to entity id

image

Other Remarks

The game uses probably the function at S4_Main.exe + 0x2483F0 for calculating building places with a DynList. Thanks to @oberstrike for this info.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant