Add original artwork for all 26 nonfaction achievements
This commit is contained in:
parent
0099fa11cd
commit
384bcbe254
8 changed files with 900 additions and 12 deletions
|
|
@ -126,32 +126,38 @@ pub fn definitions() -> Manifest {
|
|||
id: format!("complete-{id}"),
|
||||
name: format!("Complete {name}"),
|
||||
description: format!("Finish a {name} game without dropping out."),
|
||||
icon: None,
|
||||
icon: Some(Icon::Asset {
|
||||
key: format!("achievement-complete-{id}"),
|
||||
}),
|
||||
});
|
||||
definitions.push(Definition {
|
||||
id: format!("win-{id}"),
|
||||
name: format!("Win {name}"),
|
||||
description: format!("Finish a {name} game as the sole highest-ranked non-dropped human seat, including score tiebreakers; tied games do not count as wins."),
|
||||
icon: None,
|
||||
icon: Some(Icon::Asset { key: format!("achievement-win-{id}") }),
|
||||
});
|
||||
}
|
||||
definitions.extend(FEATS.map(|(id, name, description)| Definition {
|
||||
id: id.into(),
|
||||
name: name.into(),
|
||||
description: description.into(),
|
||||
icon: None,
|
||||
icon: Some(Icon::Asset {
|
||||
key: format!("achievement-{id}"),
|
||||
}),
|
||||
}));
|
||||
definitions.extend(WONDERS.map(|(_, id, name)| Definition {
|
||||
id: id.into(),
|
||||
name: format!("{name}: Recorded as Built"),
|
||||
description: format!("Finish with {name} recorded as built by your civilization. Destroyed wonders and merely owning captured wonders do not count."),
|
||||
icon: None,
|
||||
icon: Some(Icon::Asset { key: format!("achievement-{id}") }),
|
||||
}));
|
||||
definitions.push(Definition {
|
||||
id: "complete-builder".into(),
|
||||
name: "Complete Builder".into(),
|
||||
description: "Finish a Builder variant game without dropping out.".into(),
|
||||
icon: None,
|
||||
icon: Some(Icon::Asset {
|
||||
key: "achievement-complete-builder".into(),
|
||||
}),
|
||||
});
|
||||
definitions.extend(FACTIONS.map(|(name, slug)| Definition {
|
||||
id: format!("win-{slug}"),
|
||||
|
|
@ -160,7 +166,7 @@ pub fn definitions() -> Manifest {
|
|||
icon: Some(Icon::Asset { key: format!("achievement-faction-{slug}") }),
|
||||
}));
|
||||
Manifest {
|
||||
revision: 2,
|
||||
revision: 3,
|
||||
achievements: definitions,
|
||||
}
|
||||
}
|
||||
|
|
@ -313,7 +319,7 @@ mod tests {
|
|||
#[test]
|
||||
fn manifest_and_real_end_turn_for_all_lengths() {
|
||||
let manifest = definitions();
|
||||
assert_eq!(manifest.revision, 2);
|
||||
assert_eq!(manifest.revision, 3);
|
||||
assert_eq!(manifest.achievements.len(), 41);
|
||||
assert_eq!(
|
||||
manifest
|
||||
|
|
@ -439,7 +445,7 @@ mod tests {
|
|||
FACTIONS.iter().map(|(name, _)| (*name).into()).collect()
|
||||
);
|
||||
let manifest = serde_json::to_value(definitions()).unwrap();
|
||||
assert_eq!(manifest["revision"], 2);
|
||||
assert_eq!(manifest["revision"], 3);
|
||||
assert_eq!(manifest.as_object().unwrap().len(), 2);
|
||||
let entries = manifest["achievements"].as_array().unwrap();
|
||||
assert_eq!(entries.len(), 41);
|
||||
|
|
@ -458,8 +464,11 @@ mod tests {
|
|||
);
|
||||
assert_eq!(entry.as_object().unwrap().len(), 4);
|
||||
} else {
|
||||
assert!(entry.get("icon").is_none());
|
||||
assert_eq!(entry.as_object().unwrap().len(), 3);
|
||||
assert_eq!(
|
||||
entry["icon"]["key"],
|
||||
format!("achievement-{}", entry["id"].as_str().unwrap())
|
||||
);
|
||||
assert_eq!(entry.as_object().unwrap().len(), 4);
|
||||
}
|
||||
}
|
||||
assert!(!manifest.to_string().contains("four-cities"));
|
||||
|
|
@ -576,7 +585,12 @@ mod tests {
|
|||
"Finish with {name} recorded as built by your civilization. Destroyed wonders and merely owning captured wonders do not count."
|
||||
)
|
||||
);
|
||||
assert!(entry.icon.is_none());
|
||||
assert_eq!(
|
||||
entry.icon,
|
||||
Some(Icon::Asset {
|
||||
key: format!("achievement-{id}")
|
||||
})
|
||||
);
|
||||
}
|
||||
assert!(
|
||||
manifest.achievements.iter().all(
|
||||
|
|
|
|||
114
web-client/release/achievement-artwork-coverage.md
Normal file
114
web-client/release/achievement-artwork-coverage.md
Normal file
|
|
@ -0,0 +1,114 @@
|
|||
# Clash achievement artwork — review evidence
|
||||
|
||||
Issue: https://codeberg.org/boardgamers/boardgamers/issues/595
|
||||
|
||||
Canonical GitHub origin/main fetched and fast-forward integration confirmed at
|
||||
`0099fa11cd697080bc8dccda629d8d4f5c92aae5`. Engine 0.4.151 → 0.4.152;
|
||||
achievement revision 2 → 3. Protocol remains 0.11. No publication performed.
|
||||
|
||||
## Exhaustive coverage
|
||||
|
||||
|
||||
Live gameinfo v1; engine 0.4.151; manifest revision 2.
|
||||
|
||||
| Exact achievement ID | Current icon | Decision / semantic design |
|
||||
|---|---|---|
|
||||
| `complete-shorter` | Omitted → game fallback | Four-age city frieze with completion seal, not a winner crown. |
|
||||
| `win-shorter` | Omitted → game fallback | Four-age city frieze with prominent gold victory crown, distinct from completion variant. |
|
||||
| `complete-standard` | Omitted → game fallback | Six-age city frieze with completion seal, not a winner crown. |
|
||||
| `win-standard` | Omitted → game fallback | Six-age city frieze with prominent gold victory crown, distinct from completion variant. |
|
||||
| `complete-roll-to-end` | Omitted → game fallback | Age procession ending at rolled die with completion seal, not a winner crown. |
|
||||
| `win-roll-to-end` | Omitted → game fallback | Age procession ending at rolled die with prominent gold victory crown, distinct from completion variant. |
|
||||
| `complete-wonderful-ending` | Omitted → game fallback | Age procession ending at completed monument with completion seal, not a winner crown. |
|
||||
| `win-wonderful-ending` | Omitted → game fallback | Age procession ending at completed monument with prominent gold victory crown, distinct from completion variant. |
|
||||
| `complete-epic` | Omitted → game fallback | Extended eight-age civilization panorama with completion seal, not a winner crown. |
|
||||
| `win-epic` | Omitted → game fallback | Extended eight-age civilization panorama with prominent gold victory crown, distinct from completion variant. |
|
||||
| `score-30` | Omitted → game fallback | Civilization scoring panorama combining city, knowledge and monument; secondary 30. |
|
||||
| `score-40` | Omitted → game fallback | Higher-relief expanded civilization panorama, secondary 40; structural progression beyond numeral. |
|
||||
| `seven-cities` | Omitted → game fallback | Seven city groups spread over connected territory. |
|
||||
| `twenty-advances` | Omitted → game fallback | Branching regular-advance research tableau, secondary 20; no special-advance substitution. |
|
||||
| `three-objectives` | Omitted → game fallback | Three different objective tablets bearing completion seals. |
|
||||
| `two-wonders-built` | Omitted → game fallback | Two distinct wonders rising from construction foundations; not captured monuments. |
|
||||
| `captured-leader` | Omitted → game fallback | Leader bust or standard detained in enclosure, not a dead leader. |
|
||||
| `built-great-arena` | Omitted → game fallback | Oval arena with tiered seating. |
|
||||
| `built-great-pyramids` | Omitted → game fallback | Architectural pyramid group, not generic mountains. |
|
||||
| `built-great-gardens` | Omitted → game fallback | Terraced architectural gardens with cascading vegetation. |
|
||||
| `built-great-library` | Omitted → game fallback | Monumental library with shelves/tablets integrated into facade. |
|
||||
| `built-great-lighthouse` | Omitted → game fallback | Coastal lighthouse tower casting beam. |
|
||||
| `built-great-mausoleum` | Omitted → game fallback | Tiered monumental tomb. |
|
||||
| `built-great-statue` | Omitted → game fallback | Monumental standing statue on substantial plinth. |
|
||||
| `built-great-wall` | Omitted → game fallback | Crenellated wall traversing terrain. |
|
||||
| `complete-builder` | Omitted → game fallback | Peaceful construction scene with tools and growing city, no military victory claim. |
|
||||
| `win-rome` | achievement-faction-rome | PRESERVE existing achievement-faction-rome unchanged. |
|
||||
| `win-greece` | achievement-faction-greece | PRESERVE existing achievement-faction-greece unchanged. |
|
||||
| `win-china` | achievement-faction-china | PRESERVE existing achievement-faction-china unchanged. |
|
||||
| `win-vikings` | achievement-faction-vikings | PRESERVE existing achievement-faction-vikings unchanged. |
|
||||
| `win-babylonia` | achievement-faction-babylonia | PRESERVE existing achievement-faction-babylonia unchanged. |
|
||||
| `win-india` | achievement-faction-india | PRESERVE existing achievement-faction-india unchanged. |
|
||||
| `win-egypt` | achievement-faction-egypt | PRESERVE existing achievement-faction-egypt unchanged. |
|
||||
| `win-phoenicia` | achievement-faction-phoenicia | PRESERVE existing achievement-faction-phoenicia unchanged. |
|
||||
| `win-maya` | achievement-faction-maya | PRESERVE existing achievement-faction-maya unchanged. |
|
||||
| `win-persia` | achievement-faction-persia | PRESERVE existing achievement-faction-persia unchanged. |
|
||||
| `win-japan` | achievement-faction-japan | PRESERVE existing achievement-faction-japan unchanged. |
|
||||
| `win-huns` | achievement-faction-huns | PRESERVE existing achievement-faction-huns unchanged. |
|
||||
| `win-celts` | achievement-faction-celts | PRESERVE existing achievement-faction-celts unchanged. |
|
||||
| `win-aztecs` | achievement-faction-aztecs | PRESERVE existing achievement-faction-aztecs unchanged. |
|
||||
| `win-carthage` | achievement-faction-carthage | PRESERVE existing achievement-faction-carthage unchanged. |
|
||||
|
||||
|
||||
## Implementation and provenance
|
||||
|
||||
The 26 new keys are `achievement-<exact ID>`. Original editable procedural SVG
|
||||
geometry lives in `scripts/nonfaction-art.mjs` under the repository MIT licence.
|
||||
No external image, wonder PNG, photograph, traced artwork, or uncertain licence
|
||||
is reused. Generic system sans-serif renders only supplementary score numerals.
|
||||
Four/six/eight city marks denote ages, not a city-award count; seven-cities has
|
||||
exactly seven house groups, twenty-advances has exactly twenty research nodes,
|
||||
and three-objectives has exactly three completed tablets. Wonders use oval
|
||||
arches, pyramid faces, planted terraces, shelved facade, coastal light tower,
|
||||
tiered tomb, standing figure and crenellated terrain respectively. Victory crowns
|
||||
are used only for wins; completion uses a check. Builder depicts a crane and house.
|
||||
|
||||
The 15 faction keys, legacy manifest, inputs validator, publisher and underlying
|
||||
source inputs are untouched. They are NOT regenerated or included in the new
|
||||
26-asset output directory/envelope. Prior public URL/full hashes are pinned in
|
||||
the local publication envelope; fresh public verification is still required at
|
||||
release time. Existing licences are not newly asserted or broadened.
|
||||
|
||||
## Reproduction and checks
|
||||
|
||||
From web-client: `npm ci --ignore-scripts`, then
|
||||
`node scripts/build-achievement-assets.mjs --nonfaction`.
|
||||
`--nonfaction --check` validates source hash, output hash, exact key coverage,
|
||||
unique outputs and dimensions. This branch performs no uploads and requires no
|
||||
HTTP service: Chromium renders inline original SVG and PNG data URLs.
|
||||
|
||||
`cargo test -p server --lib achievements --locked`: 14 passed.
|
||||
`bash web-client/scripts/build-bridge.sh`: release WASM build succeeded.
|
||||
`node scripts/package-engine.mjs`: packs exactly the built bridge.
|
||||
`node --test scripts/nonfaction-assets.test.mjs`: predicate byte comparison,
|
||||
legacy preservation, packed 41-row manifest, protocol hooks, image decoding.
|
||||
`npm run test:achievement-assets`: legacy guard regression suite.
|
||||
|
||||
## Review artifacts and release gate
|
||||
|
||||
Under `web-client/.engine/achievement-assets-nonfaction/`:
|
||||
26 editable SVG exports, 26 PNGs at 256px, receipt.json, contact-sheet.html,
|
||||
contact-sheet.png (32/48/64 circular display on light/dark), publication-envelope.json.
|
||||
Manifest: `web-client/release/achievement-assets-nonfaction.json`.
|
||||
|
||||
Exact tested package: `.engine/releases/boardgamers-clash-server-0.4.152.tgz`
|
||||
SHA256 `61a7f537d547cd0d4baea74f5d1331ffca0804779dcdb59bb566742fc59427db`.
|
||||
The .engine artifacts are intentionally untracked; retain this worktree.
|
||||
|
||||
The old faction publisher remains intact. Use the coordinator's narrow asset-only
|
||||
publisher with this exact 26-key envelope AFTER fresh independent code and actual
|
||||
visual review approval. No credentials have been read. No asset PUT, engine POST,
|
||||
activation, metadata changes or source push has been made. Engine POST immediately
|
||||
activates: only do so after all 26 hosted images are fetched anonymously, hash
|
||||
verified and decoded and preservation of all 15 old assets is rechecked.
|
||||
|
||||
Release source target: nonforce canonical GitHub origin/main. Coordination issue
|
||||
is on Codeberg; no Codeberg git mirror is configured in this worktree. Refresh
|
||||
origin/main and re-review/retest concurrent changes before release. Commit source
|
||||
and sanitized publication receipts together in the approved publication task.
|
||||
371
web-client/release/achievement-assets-nonfaction.json
Normal file
371
web-client/release/achievement-assets-nonfaction.json
Normal file
|
|
@ -0,0 +1,371 @@
|
|||
{
|
||||
"revision": 3,
|
||||
"width": 256,
|
||||
"height": 256,
|
||||
"assets": [
|
||||
{
|
||||
"key": "achievement-complete-shorter",
|
||||
"source": {
|
||||
"type": "original-svg",
|
||||
"path": "web-client/scripts/nonfaction-art.mjs",
|
||||
"sha256": "e21abca9d448c2ee7022370c1be643b4d47d64f339d58d8fbd31e1048a6ca40a",
|
||||
"provenance": {
|
||||
"type": "original-geometry",
|
||||
"license": "MIT",
|
||||
"author": "Clash project contributors",
|
||||
"evidence": "New procedural geometry; no reused external image or traced input. Repository LICENSE."
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"key": "achievement-win-shorter",
|
||||
"source": {
|
||||
"type": "original-svg",
|
||||
"path": "web-client/scripts/nonfaction-art.mjs",
|
||||
"sha256": "e21abca9d448c2ee7022370c1be643b4d47d64f339d58d8fbd31e1048a6ca40a",
|
||||
"provenance": {
|
||||
"type": "original-geometry",
|
||||
"license": "MIT",
|
||||
"author": "Clash project contributors",
|
||||
"evidence": "New procedural geometry; no reused external image or traced input. Repository LICENSE."
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"key": "achievement-complete-standard",
|
||||
"source": {
|
||||
"type": "original-svg",
|
||||
"path": "web-client/scripts/nonfaction-art.mjs",
|
||||
"sha256": "e21abca9d448c2ee7022370c1be643b4d47d64f339d58d8fbd31e1048a6ca40a",
|
||||
"provenance": {
|
||||
"type": "original-geometry",
|
||||
"license": "MIT",
|
||||
"author": "Clash project contributors",
|
||||
"evidence": "New procedural geometry; no reused external image or traced input. Repository LICENSE."
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"key": "achievement-win-standard",
|
||||
"source": {
|
||||
"type": "original-svg",
|
||||
"path": "web-client/scripts/nonfaction-art.mjs",
|
||||
"sha256": "e21abca9d448c2ee7022370c1be643b4d47d64f339d58d8fbd31e1048a6ca40a",
|
||||
"provenance": {
|
||||
"type": "original-geometry",
|
||||
"license": "MIT",
|
||||
"author": "Clash project contributors",
|
||||
"evidence": "New procedural geometry; no reused external image or traced input. Repository LICENSE."
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"key": "achievement-complete-roll-to-end",
|
||||
"source": {
|
||||
"type": "original-svg",
|
||||
"path": "web-client/scripts/nonfaction-art.mjs",
|
||||
"sha256": "e21abca9d448c2ee7022370c1be643b4d47d64f339d58d8fbd31e1048a6ca40a",
|
||||
"provenance": {
|
||||
"type": "original-geometry",
|
||||
"license": "MIT",
|
||||
"author": "Clash project contributors",
|
||||
"evidence": "New procedural geometry; no reused external image or traced input. Repository LICENSE."
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"key": "achievement-win-roll-to-end",
|
||||
"source": {
|
||||
"type": "original-svg",
|
||||
"path": "web-client/scripts/nonfaction-art.mjs",
|
||||
"sha256": "e21abca9d448c2ee7022370c1be643b4d47d64f339d58d8fbd31e1048a6ca40a",
|
||||
"provenance": {
|
||||
"type": "original-geometry",
|
||||
"license": "MIT",
|
||||
"author": "Clash project contributors",
|
||||
"evidence": "New procedural geometry; no reused external image or traced input. Repository LICENSE."
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"key": "achievement-complete-wonderful-ending",
|
||||
"source": {
|
||||
"type": "original-svg",
|
||||
"path": "web-client/scripts/nonfaction-art.mjs",
|
||||
"sha256": "e21abca9d448c2ee7022370c1be643b4d47d64f339d58d8fbd31e1048a6ca40a",
|
||||
"provenance": {
|
||||
"type": "original-geometry",
|
||||
"license": "MIT",
|
||||
"author": "Clash project contributors",
|
||||
"evidence": "New procedural geometry; no reused external image or traced input. Repository LICENSE."
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"key": "achievement-win-wonderful-ending",
|
||||
"source": {
|
||||
"type": "original-svg",
|
||||
"path": "web-client/scripts/nonfaction-art.mjs",
|
||||
"sha256": "e21abca9d448c2ee7022370c1be643b4d47d64f339d58d8fbd31e1048a6ca40a",
|
||||
"provenance": {
|
||||
"type": "original-geometry",
|
||||
"license": "MIT",
|
||||
"author": "Clash project contributors",
|
||||
"evidence": "New procedural geometry; no reused external image or traced input. Repository LICENSE."
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"key": "achievement-complete-epic",
|
||||
"source": {
|
||||
"type": "original-svg",
|
||||
"path": "web-client/scripts/nonfaction-art.mjs",
|
||||
"sha256": "e21abca9d448c2ee7022370c1be643b4d47d64f339d58d8fbd31e1048a6ca40a",
|
||||
"provenance": {
|
||||
"type": "original-geometry",
|
||||
"license": "MIT",
|
||||
"author": "Clash project contributors",
|
||||
"evidence": "New procedural geometry; no reused external image or traced input. Repository LICENSE."
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"key": "achievement-win-epic",
|
||||
"source": {
|
||||
"type": "original-svg",
|
||||
"path": "web-client/scripts/nonfaction-art.mjs",
|
||||
"sha256": "e21abca9d448c2ee7022370c1be643b4d47d64f339d58d8fbd31e1048a6ca40a",
|
||||
"provenance": {
|
||||
"type": "original-geometry",
|
||||
"license": "MIT",
|
||||
"author": "Clash project contributors",
|
||||
"evidence": "New procedural geometry; no reused external image or traced input. Repository LICENSE."
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"key": "achievement-score-30",
|
||||
"source": {
|
||||
"type": "original-svg",
|
||||
"path": "web-client/scripts/nonfaction-art.mjs",
|
||||
"sha256": "e21abca9d448c2ee7022370c1be643b4d47d64f339d58d8fbd31e1048a6ca40a",
|
||||
"provenance": {
|
||||
"type": "original-geometry",
|
||||
"license": "MIT",
|
||||
"author": "Clash project contributors",
|
||||
"evidence": "New procedural geometry; no reused external image or traced input. Repository LICENSE."
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"key": "achievement-score-40",
|
||||
"source": {
|
||||
"type": "original-svg",
|
||||
"path": "web-client/scripts/nonfaction-art.mjs",
|
||||
"sha256": "e21abca9d448c2ee7022370c1be643b4d47d64f339d58d8fbd31e1048a6ca40a",
|
||||
"provenance": {
|
||||
"type": "original-geometry",
|
||||
"license": "MIT",
|
||||
"author": "Clash project contributors",
|
||||
"evidence": "New procedural geometry; no reused external image or traced input. Repository LICENSE."
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"key": "achievement-seven-cities",
|
||||
"source": {
|
||||
"type": "original-svg",
|
||||
"path": "web-client/scripts/nonfaction-art.mjs",
|
||||
"sha256": "e21abca9d448c2ee7022370c1be643b4d47d64f339d58d8fbd31e1048a6ca40a",
|
||||
"provenance": {
|
||||
"type": "original-geometry",
|
||||
"license": "MIT",
|
||||
"author": "Clash project contributors",
|
||||
"evidence": "New procedural geometry; no reused external image or traced input. Repository LICENSE."
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"key": "achievement-twenty-advances",
|
||||
"source": {
|
||||
"type": "original-svg",
|
||||
"path": "web-client/scripts/nonfaction-art.mjs",
|
||||
"sha256": "e21abca9d448c2ee7022370c1be643b4d47d64f339d58d8fbd31e1048a6ca40a",
|
||||
"provenance": {
|
||||
"type": "original-geometry",
|
||||
"license": "MIT",
|
||||
"author": "Clash project contributors",
|
||||
"evidence": "New procedural geometry; no reused external image or traced input. Repository LICENSE."
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"key": "achievement-three-objectives",
|
||||
"source": {
|
||||
"type": "original-svg",
|
||||
"path": "web-client/scripts/nonfaction-art.mjs",
|
||||
"sha256": "e21abca9d448c2ee7022370c1be643b4d47d64f339d58d8fbd31e1048a6ca40a",
|
||||
"provenance": {
|
||||
"type": "original-geometry",
|
||||
"license": "MIT",
|
||||
"author": "Clash project contributors",
|
||||
"evidence": "New procedural geometry; no reused external image or traced input. Repository LICENSE."
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"key": "achievement-two-wonders-built",
|
||||
"source": {
|
||||
"type": "original-svg",
|
||||
"path": "web-client/scripts/nonfaction-art.mjs",
|
||||
"sha256": "e21abca9d448c2ee7022370c1be643b4d47d64f339d58d8fbd31e1048a6ca40a",
|
||||
"provenance": {
|
||||
"type": "original-geometry",
|
||||
"license": "MIT",
|
||||
"author": "Clash project contributors",
|
||||
"evidence": "New procedural geometry; no reused external image or traced input. Repository LICENSE."
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"key": "achievement-captured-leader",
|
||||
"source": {
|
||||
"type": "original-svg",
|
||||
"path": "web-client/scripts/nonfaction-art.mjs",
|
||||
"sha256": "e21abca9d448c2ee7022370c1be643b4d47d64f339d58d8fbd31e1048a6ca40a",
|
||||
"provenance": {
|
||||
"type": "original-geometry",
|
||||
"license": "MIT",
|
||||
"author": "Clash project contributors",
|
||||
"evidence": "New procedural geometry; no reused external image or traced input. Repository LICENSE."
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"key": "achievement-built-great-arena",
|
||||
"source": {
|
||||
"type": "original-svg",
|
||||
"path": "web-client/scripts/nonfaction-art.mjs",
|
||||
"sha256": "e21abca9d448c2ee7022370c1be643b4d47d64f339d58d8fbd31e1048a6ca40a",
|
||||
"provenance": {
|
||||
"type": "original-geometry",
|
||||
"license": "MIT",
|
||||
"author": "Clash project contributors",
|
||||
"evidence": "New procedural geometry; no reused external image or traced input. Repository LICENSE."
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"key": "achievement-built-great-pyramids",
|
||||
"source": {
|
||||
"type": "original-svg",
|
||||
"path": "web-client/scripts/nonfaction-art.mjs",
|
||||
"sha256": "e21abca9d448c2ee7022370c1be643b4d47d64f339d58d8fbd31e1048a6ca40a",
|
||||
"provenance": {
|
||||
"type": "original-geometry",
|
||||
"license": "MIT",
|
||||
"author": "Clash project contributors",
|
||||
"evidence": "New procedural geometry; no reused external image or traced input. Repository LICENSE."
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"key": "achievement-built-great-gardens",
|
||||
"source": {
|
||||
"type": "original-svg",
|
||||
"path": "web-client/scripts/nonfaction-art.mjs",
|
||||
"sha256": "e21abca9d448c2ee7022370c1be643b4d47d64f339d58d8fbd31e1048a6ca40a",
|
||||
"provenance": {
|
||||
"type": "original-geometry",
|
||||
"license": "MIT",
|
||||
"author": "Clash project contributors",
|
||||
"evidence": "New procedural geometry; no reused external image or traced input. Repository LICENSE."
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"key": "achievement-built-great-library",
|
||||
"source": {
|
||||
"type": "original-svg",
|
||||
"path": "web-client/scripts/nonfaction-art.mjs",
|
||||
"sha256": "e21abca9d448c2ee7022370c1be643b4d47d64f339d58d8fbd31e1048a6ca40a",
|
||||
"provenance": {
|
||||
"type": "original-geometry",
|
||||
"license": "MIT",
|
||||
"author": "Clash project contributors",
|
||||
"evidence": "New procedural geometry; no reused external image or traced input. Repository LICENSE."
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"key": "achievement-built-great-lighthouse",
|
||||
"source": {
|
||||
"type": "original-svg",
|
||||
"path": "web-client/scripts/nonfaction-art.mjs",
|
||||
"sha256": "e21abca9d448c2ee7022370c1be643b4d47d64f339d58d8fbd31e1048a6ca40a",
|
||||
"provenance": {
|
||||
"type": "original-geometry",
|
||||
"license": "MIT",
|
||||
"author": "Clash project contributors",
|
||||
"evidence": "New procedural geometry; no reused external image or traced input. Repository LICENSE."
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"key": "achievement-built-great-mausoleum",
|
||||
"source": {
|
||||
"type": "original-svg",
|
||||
"path": "web-client/scripts/nonfaction-art.mjs",
|
||||
"sha256": "e21abca9d448c2ee7022370c1be643b4d47d64f339d58d8fbd31e1048a6ca40a",
|
||||
"provenance": {
|
||||
"type": "original-geometry",
|
||||
"license": "MIT",
|
||||
"author": "Clash project contributors",
|
||||
"evidence": "New procedural geometry; no reused external image or traced input. Repository LICENSE."
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"key": "achievement-built-great-statue",
|
||||
"source": {
|
||||
"type": "original-svg",
|
||||
"path": "web-client/scripts/nonfaction-art.mjs",
|
||||
"sha256": "e21abca9d448c2ee7022370c1be643b4d47d64f339d58d8fbd31e1048a6ca40a",
|
||||
"provenance": {
|
||||
"type": "original-geometry",
|
||||
"license": "MIT",
|
||||
"author": "Clash project contributors",
|
||||
"evidence": "New procedural geometry; no reused external image or traced input. Repository LICENSE."
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"key": "achievement-built-great-wall",
|
||||
"source": {
|
||||
"type": "original-svg",
|
||||
"path": "web-client/scripts/nonfaction-art.mjs",
|
||||
"sha256": "e21abca9d448c2ee7022370c1be643b4d47d64f339d58d8fbd31e1048a6ca40a",
|
||||
"provenance": {
|
||||
"type": "original-geometry",
|
||||
"license": "MIT",
|
||||
"author": "Clash project contributors",
|
||||
"evidence": "New procedural geometry; no reused external image or traced input. Repository LICENSE."
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"key": "achievement-complete-builder",
|
||||
"source": {
|
||||
"type": "original-svg",
|
||||
"path": "web-client/scripts/nonfaction-art.mjs",
|
||||
"sha256": "e21abca9d448c2ee7022370c1be643b4d47d64f339d58d8fbd31e1048a6ca40a",
|
||||
"provenance": {
|
||||
"type": "original-geometry",
|
||||
"license": "MIT",
|
||||
"author": "Clash project contributors",
|
||||
"evidence": "New procedural geometry; no reused external image or traced input. Repository LICENSE."
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@boardgamers/clash-server",
|
||||
"version": "0.4.151",
|
||||
"version": "0.4.152",
|
||||
"description": "Clash of Cultures: Monumental edition engine for Boardgamers Space",
|
||||
"license": "MIT",
|
||||
"type": "commonjs",
|
||||
|
|
|
|||
|
|
@ -16,6 +16,10 @@ import {
|
|||
} from './achievement-asset-inputs.mjs';
|
||||
import assert from 'node:assert/strict';
|
||||
|
||||
if (process.argv.includes('--nonfaction')) {
|
||||
await (await import('./nonfaction-assets.mjs')).build();
|
||||
process.exit(0);
|
||||
}
|
||||
const manifest = await validateInputs();
|
||||
if (process.argv.includes('--check')) {
|
||||
await validateOutputs();
|
||||
|
|
|
|||
197
web-client/scripts/nonfaction-art.mjs
Normal file
197
web-client/scripts/nonfaction-art.mjs
Normal file
|
|
@ -0,0 +1,197 @@
|
|||
// Original geometry, authored for Clash achievements. MIT (repository LICENSE).
|
||||
// No external images, traced symbols, or fonts are used in the geometry.
|
||||
export const modes = ['shorter', 'standard', 'roll-to-end', 'wonderful-ending', 'epic'];
|
||||
export const wonders = [
|
||||
'arena',
|
||||
'pyramids',
|
||||
'gardens',
|
||||
'library',
|
||||
'lighthouse',
|
||||
'mausoleum',
|
||||
'statue',
|
||||
'wall',
|
||||
];
|
||||
export const ids = [
|
||||
...modes.flatMap((m) => [`complete-${m}`, `win-${m}`]),
|
||||
'score-30',
|
||||
'score-40',
|
||||
'seven-cities',
|
||||
'twenty-advances',
|
||||
'three-objectives',
|
||||
'two-wonders-built',
|
||||
'captured-leader',
|
||||
...wonders.map((w) => `built-great-${w}`),
|
||||
'complete-builder',
|
||||
];
|
||||
const path = (d) => `<path d="${d}"/>`;
|
||||
const rect = (x, y, w, h) => `<rect x="${x}" y="${y}" width="${w}" height="${h}" rx="2"/>`;
|
||||
const circle = (x, y, r) => `<circle cx="${x}" cy="${y}" r="${r}"/>`;
|
||||
const group = (x, y, s, body) => `<g transform="translate(${x} ${y}) scale(${s})">${body}</g>`;
|
||||
const city = () => path('M-15 16V-5L0-18 15-5V16Z M-5 16V3H5V16');
|
||||
const check = () => path('M-13 0L-3 10 15-12');
|
||||
const book = () => path('M-24-14Q-12-20 0-12Q12-20 24-14V17Q12 11 0 20Q-12 11-24 17Z M0-12V20');
|
||||
export function monument(w) {
|
||||
switch (w) {
|
||||
case 'arena':
|
||||
return (
|
||||
'<ellipse cx="0" cy="15" rx="70" ry="34"/><ellipse cx="0" cy="-17" rx="70" ry="31"/>' +
|
||||
path('M-70-17V15 M70-17V15') +
|
||||
[-50, -25, 0, 25, 50].map((x) => path(`M${x - 6} 32V9Q${x} 0 ${x + 6} 9V32`)).join('')
|
||||
);
|
||||
case 'pyramids':
|
||||
return (
|
||||
path('M-75 40L-18-48 38 40Z M-18-48L-4 40 M10-5L38-43 79 40H38 M38-43L48 40') +
|
||||
path('M-50 10H-9 M-40-6H-12')
|
||||
);
|
||||
case 'gardens':
|
||||
return (
|
||||
rect(-69, 24, 138, 20) +
|
||||
rect(-52, -8, 104, 32) +
|
||||
rect(-30, -42, 60, 34) +
|
||||
[-52, -20, 18, 50]
|
||||
.map(
|
||||
(x, i) =>
|
||||
`<g fill="#67b5a1">${path(`M${x} ${i % 2 ? -28 : 5}q-20-23-24-2q3 14 24 10q18-26 28-5q-1 17-28 15v25`)}</g>`,
|
||||
)
|
||||
.join('')
|
||||
);
|
||||
case 'library':
|
||||
return (
|
||||
path('M-70-23L0-56 70-23Z') +
|
||||
rect(-65, -17, 130, 68) +
|
||||
[-51, -23, 5, 33].map((x) => rect(x, -8, 18, 48) + path(`M${x + 5}-2V33 M${x + 12}-2V33`)).join('') +
|
||||
rect(-73, 49, 146, 12)
|
||||
);
|
||||
case 'lighthouse':
|
||||
return (
|
||||
path('M-28 49L-20-36H20L28 49Z M-27-36H27L16-54H-16Z M-20-18H20 M-24 20H24') +
|
||||
rect(-7, -32, 14, 13) +
|
||||
`<g fill="#f7cc6c">${path('M27-29L76-48V-8Z')}</g>` +
|
||||
path('M-78 62Q-58 44-38 62T2 62T42 62T82 62')
|
||||
);
|
||||
case 'mausoleum':
|
||||
return (
|
||||
rect(-70, 42, 140, 15) +
|
||||
rect(-57, 26, 114, 16) +
|
||||
rect(-42, -25, 84, 51) +
|
||||
path('M-53-25L0-59 53-25Z M-27-14V18 M-9-14V18 M9-14V18 M27-14V18') +
|
||||
rect(-9, -73, 18, 14)
|
||||
);
|
||||
case 'statue':
|
||||
return (
|
||||
rect(-49, 42, 98, 20) +
|
||||
rect(-34, 28, 68, 14) +
|
||||
circle(0, -52, 13) +
|
||||
path('M-17-34L-30 6-15 10-10-9-16 28H17L10-9 22 1 39-28 28-34 15-17 13-34Z M-1-23V16')
|
||||
);
|
||||
case 'wall':
|
||||
return (
|
||||
path(
|
||||
'M-77 44V-7H-60V-22H-43V-7H-25V19L15-9V-35H32V-50H49V-35H67V14L25 32-19 59Z M-25 19V48 M15-9V22 M-60 5V24 M33-21V-2',
|
||||
) + path('M-84 65L-50 54 M36 47L76 27')
|
||||
);
|
||||
}
|
||||
}
|
||||
function motif(id) {
|
||||
const mode = modes.find((m) => id === `complete-${m}` || id === `win-${m}`);
|
||||
if (mode) {
|
||||
const count = { shorter: 4, standard: 6, epic: 8 }[mode];
|
||||
let body = '';
|
||||
if (count)
|
||||
for (let i = 0; i < count; i++)
|
||||
body += group(72 + (i % 4) * 37, 100 + Math.floor(i / 4) * 43, 0.8, city());
|
||||
else {
|
||||
body = group(88, 112, 1.1, city()) + path('M110 112H136L128 104 M136 112L128 120');
|
||||
body +=
|
||||
mode === 'roll-to-end'
|
||||
? rect(145, 86, 51, 51) +
|
||||
[
|
||||
[158, 99],
|
||||
[183, 99],
|
||||
[170, 112],
|
||||
[158, 125],
|
||||
[183, 125],
|
||||
]
|
||||
.map(([x, y]) => circle(x, y, 3))
|
||||
.join('')
|
||||
: group(177, 112, 0.38, monument('mausoleum'));
|
||||
}
|
||||
if (id.startsWith('win-'))
|
||||
body +=
|
||||
`<g fill="#e9b34c">${path('M89 177L85 155 110 167 128 145 146 167 171 155 167 177Z')}</g>` +
|
||||
path('M63 158Q43 129 55 86 M193 158Q213 129 201 86');
|
||||
else body += group(128, 184, 0.8, check());
|
||||
return body;
|
||||
}
|
||||
if (id.startsWith('built-great-')) return group(128, 126, 1, monument(id.slice(12)));
|
||||
if (id === 'seven-cities')
|
||||
return (
|
||||
path('M72 90L128 66 184 90 184 150 128 178 72 150Z M72 90L128 121 184 90 M128 121V178') +
|
||||
[
|
||||
[128, 66],
|
||||
[72, 90],
|
||||
[184, 90],
|
||||
[128, 121],
|
||||
[72, 150],
|
||||
[184, 150],
|
||||
[128, 178],
|
||||
]
|
||||
.map(([x, y]) => group(x, y, 0.65, city()))
|
||||
.join('')
|
||||
);
|
||||
if (id === 'twenty-advances')
|
||||
return (
|
||||
path('M128 174V71 M62 88H194 M62 118H194 M62 148H194') +
|
||||
[0, 1, 2, 3]
|
||||
.flatMap((row) => [0, 1, 2, 3, 4].map((col) => circle(62 + col * 33, 64 + row * 30, 7)))
|
||||
.join('') +
|
||||
group(128, 190, 0.6, book())
|
||||
);
|
||||
if (id === 'three-objectives')
|
||||
return [0, 1, 2]
|
||||
.map((i) =>
|
||||
group(
|
||||
64 + i * 64,
|
||||
118,
|
||||
1,
|
||||
rect(-24, -40, 48, 84) +
|
||||
group(0, -15, 0.55, [city(), book(), path('M-19 12L0-18 19 12Z')][i]) +
|
||||
group(0, 22, 0.55, check()),
|
||||
),
|
||||
)
|
||||
.join('');
|
||||
if (id === 'two-wonders-built')
|
||||
return (
|
||||
group(82, 116, 0.55, monument('pyramids')) +
|
||||
group(174, 116, 0.55, monument('lighthouse')) +
|
||||
path('M47 171H209 M60 171V187 M196 171V187 M76 171V184 M180 171V184')
|
||||
);
|
||||
if (id === 'captured-leader')
|
||||
return (
|
||||
circle(128, 100, 21) +
|
||||
path('M91 153Q91 121 128 121Q165 121 165 153Z') +
|
||||
'<g fill="none">' +
|
||||
rect(72, 63, 112, 112) +
|
||||
'</g>' +
|
||||
path('M85 69V169 M171 69V169 M73 155H183') +
|
||||
rect(119, 165, 18, 23)
|
||||
);
|
||||
if (id === 'complete-builder')
|
||||
return (
|
||||
group(149, 143, 1.5, city()) +
|
||||
path('M69 177V69H172 M69 89L89 69 M149 69V94 M135 94H163V109H135Z M54 181H87') +
|
||||
group(129, 194, 0.65, check())
|
||||
);
|
||||
const high = id === 'score-40';
|
||||
return (
|
||||
group(high ? 91 : 89, 132, high ? 1.3 : 1.1, city()) +
|
||||
group(high ? 165 : 162, 127, high ? 0.55 : 0.45, monument(high ? 'library' : 'pyramids')) +
|
||||
group(128, 166, 0.65, book()) +
|
||||
(high ? path('M59 87H197 M68 80V94 M188 80V94') : '') +
|
||||
`<text x="128" y="211" text-anchor="middle" stroke="none" fill="#f7cc6c" font-family="sans-serif" font-weight="bold" font-size="29">${high ? '40' : '30'}</text>`
|
||||
);
|
||||
}
|
||||
export function svg(id) {
|
||||
if (!ids.includes(id)) throw Error('Unknown achievement');
|
||||
return `<svg xmlns="http://www.w3.org/2000/svg" width="256" height="256" viewBox="0 0 256 256"><circle cx="128" cy="128" r="124" fill="#132e3b"/><circle cx="128" cy="128" r="114" fill="none" stroke="#b99050" stroke-width="3"/><g fill="#527b78" stroke="#f4dfb1" stroke-width="5" stroke-linejoin="round" stroke-linecap="round">${motif(id)}</g></svg>`;
|
||||
}
|
||||
109
web-client/scripts/nonfaction-assets.mjs
Normal file
109
web-client/scripts/nonfaction-assets.mjs
Normal file
|
|
@ -0,0 +1,109 @@
|
|||
import assert from 'node:assert/strict';
|
||||
import { readFile, writeFile, mkdir } from 'node:fs/promises';
|
||||
import path from 'node:path';
|
||||
import { chromium } from 'playwright';
|
||||
import { ids, svg } from './nonfaction-art.mjs';
|
||||
import { root, sha256, pngDimensions } from './achievement-asset-inputs.mjs';
|
||||
export const outputDir = path.join(root, 'web-client/.engine/achievement-assets-nonfaction');
|
||||
export const manifestPath = path.join(root, 'web-client/release/achievement-assets-nonfaction.json');
|
||||
export async function validateInputs() {
|
||||
const manifest = JSON.parse(await readFile(manifestPath));
|
||||
assert.equal(manifest.revision, 3);
|
||||
assert.deepEqual(
|
||||
manifest.assets.map((a) => a.key),
|
||||
ids.map((id) => `achievement-${id}`),
|
||||
);
|
||||
assert.equal(manifest.assets.length, 26);
|
||||
for (const a of manifest.assets) {
|
||||
assert.equal(a.source.type, 'original-svg');
|
||||
assert.equal(a.source.path, 'web-client/scripts/nonfaction-art.mjs');
|
||||
assert.equal(a.source.sha256, sha256(await readFile(path.join(root, a.source.path))));
|
||||
}
|
||||
return manifest;
|
||||
}
|
||||
export async function validateOutputs() {
|
||||
const manifest = await validateInputs();
|
||||
const receipt = JSON.parse(await readFile(path.join(outputDir, 'receipt.json')));
|
||||
assert.equal(receipt.revision, 3);
|
||||
assert.equal(receipt.manifestSha256, sha256(await readFile(manifestPath)));
|
||||
assert.deepEqual(
|
||||
receipt.assets.map((a) => a.key),
|
||||
manifest.assets.map((a) => a.key),
|
||||
);
|
||||
assert.equal(new Set(receipt.assets.map((a) => a.sha256)).size, 26);
|
||||
for (const a of receipt.assets) {
|
||||
assert.equal(a.file, `${a.key}.png`);
|
||||
const b = await readFile(path.join(outputDir, a.file));
|
||||
assert.equal(sha256(b), a.sha256);
|
||||
assert.deepEqual(pngDimensions(b), { width: 256, height: 256 });
|
||||
}
|
||||
return receipt;
|
||||
}
|
||||
export async function build() {
|
||||
if (process.argv.includes('--check')) return validateOutputs();
|
||||
await mkdir(outputDir, { recursive: true });
|
||||
const source = {
|
||||
type: 'original-svg',
|
||||
path: 'web-client/scripts/nonfaction-art.mjs',
|
||||
sha256: sha256(await readFile(new URL('./nonfaction-art.mjs', import.meta.url))),
|
||||
provenance: {
|
||||
type: 'original-geometry',
|
||||
license: 'MIT',
|
||||
author: 'Clash project contributors',
|
||||
evidence: 'New procedural geometry; no reused external image or traced input. Repository LICENSE.',
|
||||
},
|
||||
};
|
||||
const manifest = {
|
||||
revision: 3,
|
||||
width: 256,
|
||||
height: 256,
|
||||
assets: ids.map((id) => ({ key: `achievement-${id}`, source })),
|
||||
};
|
||||
await writeFile(manifestPath, JSON.stringify(manifest, null, 2) + '\n');
|
||||
const browser = await chromium.launch({ headless: true });
|
||||
try {
|
||||
const page = await browser.newPage();
|
||||
const assets = [];
|
||||
for (const id of ids) {
|
||||
const key = `achievement-${id}`,
|
||||
vector = svg(id);
|
||||
await writeFile(path.join(outputDir, `${key}.svg`), vector);
|
||||
const render = () =>
|
||||
page.evaluate(async (vector) => {
|
||||
const i = new Image();
|
||||
i.src = 'data:image/svg+xml;base64,' + btoa(vector);
|
||||
await i.decode();
|
||||
const c = document.createElement('canvas');
|
||||
c.width = c.height = 256;
|
||||
c.getContext('2d').drawImage(i, 0, 0);
|
||||
return c.toDataURL().split(',')[1];
|
||||
}, vector);
|
||||
const a = await render();
|
||||
assert.equal(await render(), a);
|
||||
const bytes = Buffer.from(a, 'base64');
|
||||
await writeFile(path.join(outputDir, `${key}.png`), bytes);
|
||||
assets.push({ key, file: `${key}.png`, sha256: sha256(bytes), width: 256, height: 256 });
|
||||
}
|
||||
const receipt = {
|
||||
revision: 3,
|
||||
manifestSha256: sha256(await readFile(manifestPath)),
|
||||
renderer: browser.version(),
|
||||
assets,
|
||||
};
|
||||
await writeFile(path.join(outputDir, 'receipt.json'), JSON.stringify(receipt, null, 2) + '\n');
|
||||
const cards = ids
|
||||
.map(
|
||||
(id) =>
|
||||
`<figure><figcaption>${id}</figcaption>${[32, 48, 64].map((size) => `<img width="${size}" height="${size}" src="data:image/svg+xml;base64,${Buffer.from(svg(id)).toString('base64')}">`).join('')}</figure>`,
|
||||
)
|
||||
.join('');
|
||||
const html = `<!doctype html><title>Clash 26 original achievements</title><style>body{font:13px sans-serif}section{display:grid;grid-template-columns:repeat(4,1fr);gap:8px;padding:16px}figure{margin:0;padding:10px}img{margin:5px;border-radius:50%}.dark{background:#101722;color:white}</style><h1>Clash — 32 / 48 / 64px circular review</h1><section>${cards}</section><section class="dark">${cards}</section>`;
|
||||
await writeFile(path.join(outputDir, 'contact-sheet.html'), html);
|
||||
await page.setViewportSize({ width: 1100, height: 900 });
|
||||
await page.setContent(html);
|
||||
await page.screenshot({ path: path.join(outputDir, 'contact-sheet.png'), fullPage: true });
|
||||
await validateOutputs();
|
||||
} finally {
|
||||
await browser.close();
|
||||
}
|
||||
}
|
||||
79
web-client/scripts/nonfaction-assets.test.mjs
Normal file
79
web-client/scripts/nonfaction-assets.test.mjs
Normal file
|
|
@ -0,0 +1,79 @@
|
|||
import test from 'node:test';
|
||||
import assert from 'node:assert/strict';
|
||||
import { execFileSync } from 'node:child_process';
|
||||
import { readFile, mkdtemp } from 'node:fs/promises';
|
||||
import { tmpdir } from 'node:os';
|
||||
import path from 'node:path';
|
||||
import { createRequire } from 'node:module';
|
||||
import { chromium } from 'playwright';
|
||||
import { inspectEngine } from '@boardgamers/protocol/engine';
|
||||
import { ids } from './nonfaction-art.mjs';
|
||||
import { validateOutputs, outputDir } from './nonfaction-assets.mjs';
|
||||
import { root } from './achievement-asset-inputs.mjs';
|
||||
const baseline = '0099fa11cd697080bc8dccda629d8d4f5c92aae5';
|
||||
test('evaluation body and existing faction manifest remain byte identical', async () => {
|
||||
const file = 'server/src/achievements.rs';
|
||||
const old = execFileSync('git', ['show', `${baseline}:${file}`], { cwd: root, encoding: 'utf8' });
|
||||
const current = await readFile(path.join(root, file), 'utf8');
|
||||
const body = (s) => s.split('pub fn achievements(game: &Game)')[1].split('#[cfg(test)]')[0];
|
||||
assert.equal(body(current), body(old));
|
||||
for (const file of [
|
||||
'web-client/release/achievement-assets.json',
|
||||
'web-client/scripts/publish-achievement-assets.mjs',
|
||||
'web-client/scripts/achievement-asset-inputs.mjs',
|
||||
])
|
||||
assert.equal(
|
||||
await readFile(path.join(root, file), 'utf8'),
|
||||
execFileSync('git', ['show', `${baseline}:${file}`], { cwd: root, encoding: 'utf8' }),
|
||||
);
|
||||
});
|
||||
test('exact packed engine schema, complete stable catalogue and 26 asset refs', async () => {
|
||||
const dir = await mkdtemp(path.join(tmpdir(), 'clash-packed-'));
|
||||
execFileSync('tar', [
|
||||
'xzf',
|
||||
path.join(root, 'web-client/.engine/releases/boardgamers-clash-server-0.4.152.tgz'),
|
||||
'-C',
|
||||
dir,
|
||||
]);
|
||||
const engine = createRequire(import.meta.url)(path.join(dir, 'package/server.js'));
|
||||
assert.ok(inspectEngine(engine).compatible);
|
||||
const m = engine.achievementDefinitions();
|
||||
assert.equal(m.revision, 3);
|
||||
assert.equal(m.achievements.length, 41);
|
||||
const factions = JSON.parse(
|
||||
await readFile(path.join(root, 'web-client/release/achievement-assets.json')),
|
||||
).assets;
|
||||
assert.deepEqual(
|
||||
m.achievements.map((a) => a.id),
|
||||
[...ids, ...factions.map((a) => 'win-' + a.key.slice('achievement-faction-'.length))],
|
||||
);
|
||||
for (const a of m.achievements)
|
||||
assert.deepEqual(a.icon, {
|
||||
type: 'asset',
|
||||
key: ids.includes(a.id) ? `achievement-${a.id}` : `achievement-faction-${a.id.slice(4)}`,
|
||||
});
|
||||
const raw = await engine.init(2, [], {}, 'artwork-package-test', {});
|
||||
assert.deepEqual(engine.achievements(raw), []);
|
||||
assert.deepEqual(engine.timeIncrements(raw), [0, 0]);
|
||||
});
|
||||
test('all 26 unique outputs decode, dimensions and hashes match', async () => {
|
||||
const r = await validateOutputs();
|
||||
const browser = await chromium.launch({ headless: true });
|
||||
try {
|
||||
const page = await browser.newPage();
|
||||
for (const a of r.assets) {
|
||||
const b = await readFile(path.join(outputDir, a.file));
|
||||
assert.deepEqual(
|
||||
await page.evaluate(async (b) => {
|
||||
const i = new Image();
|
||||
i.src = 'data:image/png;base64,' + b;
|
||||
await i.decode();
|
||||
return [i.naturalWidth, i.naturalHeight];
|
||||
}, b.toString('base64')),
|
||||
[256, 256],
|
||||
);
|
||||
}
|
||||
} finally {
|
||||
await browser.close();
|
||||
}
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue