Skip to content

Getting grip on the blockmap #11

@nyfrk

Description

@nyfrk

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions