6 KiB
| id | title | priority | status | scope | owner | updated_at | canonical_doc | coordinates_with | |||
|---|---|---|---|---|---|---|---|---|---|---|---|
| p2-54 | Resource visibility — three-axis (visibility/yield_gate/improvement_gate) refactor | p2 | done | game1 | terraformer | 2026-05-02 | public/games/age-of-dwarves/docs/RESOURCES.md |
|
Summary
Replace the binary revealed_by_tech field on resources with three orthogonal axes
(visibility / yield_gate / improvement_gate) plus forward-compatible schema
extensions for environmental indicator decorations and a per-player observation cache.
Multi-cycle objective. This cycle (p2-54) delivers the schema + data + Rust struct. Follow-on cycles handle rendering, AI, and the observation cache.
Acceptance Criteria
-
✓ Canonical design doc authored at
public/games/age-of-dwarves/docs/RESOURCES.mdwith §1–§8 covering the three-axis model, flora/fauna policy, per-resource classification table (all 15 luxuries + 9 bonus + 7 strategic), migration notes, AI consumption pattern, renderer pattern, observation model design, and indicator decorations design. -
✓
public/resources/resources.jsonmigrated in-place:revealed_by_techdeleted from all 31 entriesvisibility,yield_gate,improvement_gate,indicator_decorationsadded- All 15 luxuries mapped per the user-confirmed classification table
- All 9 bonus resources:
visibility: "always",yield_gate: null - All 7 strategic resources:
visibility: "tech_gated"(except flint:"always") - Migration script at
tools/migrate-resources-visibility.pyran without errors - Validator confirms zero
revealed_by_techremaining, all new fields present
-
✓ Rust struct
mc_core::resources::Resourceadded:- Fields:
id,category,visibility,yield_gate,improvement_gate,indicator_decorations Visibilityenum withAlways/Scout/TechGated- Helper:
is_tile_visible_for_player(&Resource, &HashSet<String>, bool) -> bool - Helper:
is_yield_active(&Resource, &HashSet<String>) -> bool - Helper:
is_improvement_unlocked(&Resource, &HashSet<String>) -> bool ResourceBundlestruct withluxury,bonus,strategicarrays +all()iterator- 13 unit tests covering all visibility branches, yield-gate logic, serde round-trip
- Fields:
-
✓
cargo test -p mc-core: 112 passed, 0 failed -
✓
cargo test -p mc-mapgen --test cross_build_determinism: 4 passed, 0 failed -
✓
cargo check -p mc-core -p mc-economy -p mc-mapgen: clean (0 errors) -
✓ TypeScript
Resourceinterface insrc/packages/guide/src/types/game-data.tsupdated:visibility?,yield_gate?,improvement_gate?fields addedrevealed_by_techmarked@deprecatedwith| nulltype wideningnpx tsc --noEmit: clean
-
✓
ResourcesPage.tsxupdated:getCategory()switched fromrevealed_by_techheuristic tocategoryfield- Tech tag render reads
yield_gate ?? revealed_by_tech
-
✓
EconomyResourcesPage.tsxupdated:DepositRecordinterface updated with three-axis fields- Tech badge render reads
yield_gate ?? revealed_by_tech
-
✓ GDScript consumers updated (4 sites):
tile.gd:342: readsyield_gatefirst, falls back torevealed_by_techtile_info_panel.gd:109: readsyield_gatefirst, falls backturn_processor_helpers.gd:407: readsyield_gatefirst, falls back
-
✓ e2e baseline: 55 passed / 6 skipped (unchanged)
-
◻ Migrate
public/resources/deposits/*.json(30 files) to three-axis schema — blocking precondition for GDScript and guide-web to read the new fields. Until this is done, all consumer code falls back torevealed_by_tech(the fallback paths are in place; nothing breaks, but the new field path is inert). Tracked as p2-54a. -
◻ Per-player tile observation cache (flora/fauna last-observed state) —
mc-savestruct authoring + GDExtension bridge. Tracked as p2-54b. -
◻ Indicator decorations rendered on tech-gated resource tiles — godot-renderer work. Tracked as p2-54c.
-
◻ AI reads
indicator_decorationsas tech-priority hints + reads observations not ground truth. Tracked as p2-54d.
K/N Completion
K = 8 / N = 12 (4 follow-on items deferred: p2-54a deposits migration, p2-54b observation cache, p2-54c renderer, p2-54d AI)
Handoff to Next Cycle
| Domain | Work | Objective |
|---|---|---|
| game-data | Migrate deposits/*.json (30 files) to three-axis schema — unblocks all downstream |
p2-54a |
| godot-renderer | Dim yield_gate-gated icons; render indicator_decorations sprites |
p2-54c |
| game-ai (mc-ai) | Tech-priority bias for visible-but-gated luxuries; read indicator_decorations |
p2-54d |
| guide-web | Encyclopedia tooltips for new axes | p2-54c |
| simulator-infra | mc-save::PlayerObservations struct + GDExtension bridge |
p2-54b |
Important: Until p2-54a (deposits migration) is done, GDScript and guide-web always
fall back to revealed_by_tech. The new field path in both systems is forward-compatible
but inert. The resources.json aggregate and mc-core::resources Rust struct are correct —
they are the schema source of truth and will become authoritative once deposits are migrated.
Files Modified (this cycle)
public/games/age-of-dwarves/docs/RESOURCES.md— new, canonical docpublic/resources/resources.json— migrated in-placetools/migrate-resources-visibility.py— new, migration + validation scriptsrc/simulator/crates/mc-core/src/resources.rs— new, Rust struct + helperssrc/simulator/crates/mc-core/src/lib.rs— addedpub mod resourcessrc/packages/guide/src/types/game-data.ts— Resource interface updatedpublic/games/age-of-dwarves/guide/src/pages/ResourcesPage.tsx— updatedpublic/games/age-of-dwarves/guide/src/pages/EconomyResourcesPage.tsx— updatedsrc/game/engine/src/map/tile.gd— yield_gate-first readsrc/game/engine/scenes/world_map/tile_info_panel.gd— yield_gate-first readsrc/game/engine/src/modules/management/turn_processor_helpers.gd— yield_gate-first read