Generate the co-op mission previews the API already points at - #330
Open
TimMasalme wants to merge 1 commit into
Open
Generate the co-op mission previews the API already points at#330TimMasalme wants to merge 1 commit into
TimMasalme wants to merge 1 commit into
Conversation
Every co-op mission has a thumbnail URL and none of them had a file
behind it. CoopMapEnricher mints
maps/previews/{small,large}/<folder>.vNNNN.png out of the zip name and
never checks that it exists; the vault upload path writes previews in
MapService.generatePreview, but co-op missions do not go through it,
they come through this deployer, which never wrote one. Measured
against the live CDN on 2026-08-21: of 42 mission folders, zero had the
file the API points at.
What clients show instead is whatever art happens to sit in the map
folder, which is why some missions have a preview, some have none, and
two have the wrong one. Operation Red Revenge arrived complete in #417
with preview art from an earlier draft of its own terrain. Tha Atha
Aez is worse: #417 replaced its .scmap and left the .png and .dds from
2017 untouched, so its preview is seven years older than the map and
shows a different one, letterboxed because that map was not square.
Previews are now produced here, from three sources in a fixed order:
- the preview embedded in the mission's own .scmap (31 missions),
which is the only source that cannot disagree with the terrain
- the .dds beside the map (12), for the missions whose map is not in
this repository at all but part of the game install. Same 256 by
256 BGRA layout, so the same decoder reads it, and it beats the
100 by 100 .png next to it
- the stock map the mission's own _scenario.lua names (1), for Novax
Station Assault, which has no image of its own anywhere. Its map is
X1MP_012, whose vault preview already sits in this directory
The order is the point. Both missions with wrong art have a *matching
pair* of wrong sidecars, so a sidecar that could win over a map file
would preserve exactly those two bugs.
Not com.faforever.commons' PreviewGenerator: run over all 44 missions,
all 44 fail. It reads marker art from resources the published data
artifact does not contain (ImageIO gets a null stream), and it takes
marker positions from evaluating _save.lua, which a third of the
campaign missions refuse. Both are the marker overlay, not the picture,
so this takes the picture. The .scmap layout it needs is the one
ScmapPathFixer already walks and CI already verifies byte for byte.
Sizes follow the current vault convention, 128 and 512. The CDN still
carries older 100 and 256 files from before it, which is why the stock
map fall back re-renders rather than copies.
An unchanged mission is never rezipped, so ensureMapPreviews fills in
what is missing on any run: the existing missions get their previews
without waiting to be edited.
verifyCoopPreviews renders every mission in a MAPS_REPO checkout and
reports the source, size and colour count per mission. It fails if a
mission with a real map file produces nothing, if an image is a single
flat colour, or if no mission rendered from its own map file at all.
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Team Run ID: Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Every co-op mission has a thumbnail URL and none of them has a file behind it.
CoopMapEnrichermintsmaps/previews/{small,large}/<folder>.vNNNN.pngout of the zip name and never checks that it exists. The vault upload path writes previews inMapService.generatePreview, but co-op missions do not go through it, they come through this deployer, which never wrote one. Measured against the live CDN on 2026-08-21: of 42 mission folders, zero had the file the API points at.What clients show instead is whatever art happens to sit in the map folder. That is why some missions have a preview, some have none, and two have the wrong one, which is what prompted this:
.scmapand left the.pngand.ddsuntouched; those are still from 2017-09-24. Its preview is seven years older than the map it claims to show, and letterboxed, because the map it does show was not square.What this does
Previews are produced here, from three sources in a fixed order:
.scmap.ddsbeside the map.pngnext to it_scenario.luanamesX1MP_012, whose vault preview already sits in this directoryThe order is the point. Both missions with wrong art have a matching pair of wrong sidecars,
.pngand.ddswrong in the same way. A sidecar that could win over a map file would preserve exactly those two bugs.Why not
PreviewGeneratorfrom faf-commonsIt is the obvious candidate and it does not survive contact with the co-op missions. Run over all 44, all 44 fail, for two independent reasons:
images/map_markers, and the publishedcom.faforever.commons:dataartifact contains no images at all, soImageIO.readgets a null stream ("input == null!"). Those files are in the API's own resources._save.lua, and a third of the campaign missions fail that outright ("attempt to index ? (a nil value)"): a co-op save file is a script, not a data table.Both are the marker overlay, not the picture. So this takes the picture and leaves the overlay, which needs no marker art, no Lua, and nothing that can fail per mission. The
.scmaplayout it reads is the oneScmapPathFixeralready walks and CI already verifies byte for byte, so no new parsing knowledge enters the repo, and no new dependency.Sizes
128 and 512, matching
FafApiProperties. Note the CDN carries two conventions:dualgap_adaptive.v0012is 128/512 whiletheta_passage_5.v0001andx1mp_012are still 100/256 from before it. That is why the stock map fall back re-renders rather than copies, so an old file cannot leak the old size back in.Backfill
An unchanged mission is never rezipped, so
ensureMapPreviewsfills in whatever is missing on any run. The existing missions get their previews on the next deployment without waiting to be edited, and there is no separate migration to run.Verification
verifyCoopPreviewsrenders every mission in aMAPS_REPOcheckout and reports source, size and colour count per mission:It fails if a mission with a real map file produces nothing, if an image is a single flat colour (a map with no embedded preview still yields an image, just a uniformly black one, which would reach the CDN looking like a working file), or if no mission rendered from its own map file at all. Run headless, since the deployment job has no display.
The extraction was checked against the shipped art rather than assumed correct: of the 24 missions that have both, 17 agree to within 1.6 of 255 on a mean per-channel comparison. The outliers are the two above. As a second, independent check, the edge structure of each candidate was correlated against the map's own heightmap, which is the terrain itself and independent of any image:
Known limits
_scenario.luanamingX1MP_012. That the mission is really played on that map is taken from the scenario, not verified..pngand.ddsin faf-coop-maps. After this they are unused, but replacing them there would be tidier.