Skip to content

Add building auto-detection for map preview overlays and fix incorrect starting locations - #1023

Draft
11EJDE11 wants to merge 1 commit into
CnCNet:developfrom
11EJDE11:add-auto-building-overlays
Draft

Add building auto-detection for map preview overlays and fix incorrect starting locations#1023
11EJDE11 wants to merge 1 commit into
CnCNet:developfrom
11EJDE11:add-auto-building-overlays

Conversation

@11EJDE11

Copy link
Copy Markdown
Member

Adds automatic detection of building for overlays on the map preview. These are defined in ClientDefinitions.ini:

[AutoMapOverlays]
;BuildingID,ImageFile,OwnerFilter,CellOffsetX,CellOffsetY[,Toggleable]
0=CAOILD*,oilderrick.png,Neutral,1,1,true
1=CAAIRP,airport.png,Neutral,1,1,true

To do it properly we need to read IsoMapPack to get the building's level, otherwise the overlays will be offset if the buildings are on cliffs. Because we're reading IsoMapPack, we can also fix the issue where starting locations are incorrect due to cliffs.

Adds a new cache map_tile_levels_v1 shared across official and custom maps. Invalidated with size+last write time.
Performance wise, we directly scan the maps for IsoMapPack5 and Structures. It takes about 11 seconds to build a cache for 6,000 maps on my system. No noticeable impact on startup time once cached.

The building ID allows for a wildcard. Some blitz maps for example have several types of oils so you can catch all with CAOILD*:

[CAOILD]
[CAOILD1]
...
[CAOILD6]

You can also specify an owner. So setting to Neutral would ignore pre-captured oils, and you'd only get overlays on capturable ones.

The tile offset parameters help with centering the overlay better on the building - but the whole centering thing probably needs a second look. The info might already be available without needing to manually specify it.

I still need to test downloaded/sharing maps.

And note we can't get it perfect for every map. Some previews are just incorrectly scaled (not our fault) - all the main ones shipped in YR seem OK, or at least within range.

CC: #775

image techToggle

@github-actions

Copy link
Copy Markdown

Nightly build for this pull request:

  • artifacts.zip
    This comment is automatic and is meant to allow guests to get latest automatic builds without registering. It is updated on every successful build.

@SadPencil SadPencil changed the title Add building auto-detection for map preview overlays and and fix incorrect starting locations Add building auto-detection for map preview overlays and fix incorrect starting locations Jul 19, 2026
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

Successfully merging this pull request may close these issues.

1 participant