feat(examples): fantasy-dungeon reference asset plugin (Asset-Plugins P2) - #587
Conversation
… P2, #728)
The Phase-2 acceptance fixture + reference vendor plugin for the
Asset-Plugins epic (labelle-engine#725, RFC-ASSET-PLUGINS rev 4). A game
attaches ONE plugin (`local:./plugin`) and gets a whole dungeon content kit
with ZERO manual `.resources` edits — that emptiness is the acceptance
criterion.
The `fantasy_dungeon` plugin exercises the full P1+P2 surface end to end:
- `.packs` — two packs BUNDLED at `plugin/packs/<name>/` (`tiles`, `props`),
each discovered as a first-class pack flowing through the same copy / scan /
`pack__` namespace / resource-merge machinery as a game-local pack.
- pack `.resources` (Phase 1) — `tiles__tileset` / `props__atlas` merged +
repathed into `packs/<pack>/assets/…`, atlas frame keys rewritten to
`<pack>/<frame>` and each pack's own prefab `sprite_name` refs rewritten to
match.
- plugin `.resources` (Phase 2) — a plugin-level `banner` atlas merged as
`fantasy_dungeon__banner`.
- `.license`/`.author` provenance metadata.
- scene auto-wiring — `scenes/main.jsonc` names no pack atlas; referencing the
namespaced pack prefabs pulls each pack's atlas into the scene manifest.
- a generator = an ordinary dir-scanned pack script (RFC's "tiles are
entities, tilesets are just atlases" — no new engine machinery).
Verified: `labelle-assembler generate` produces the namespaced+merged atlas
registrations (`register*("tiles__tileset", @embedfile("packs/tiles/assets/…"))`),
the auto-wired scene manifest, on-disk namespaced frame keys, and the rewritten
pack-prefab sprite refs. A new `examples-integration` CI step asserts all of
this, then builds + runs the headless `.null` binary so the pack generator
script fires.
Assets are minimal solid-colour placeholder PNGs (generated programmatically) —
the reference is about the resource MECHANISM, not the art.
Closes labelle-toolkit/labelle-engine#728
Claude-Session: https://claude.ai/code/session_017pW3ifKf9wgxNg4viy6okw
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
📝 WalkthroughWalkthroughAdds the ChangesFantasy Dungeon Plugin
Estimated code review effort: 3 (Moderate) | ~20 minutes Possibly related issues
Possibly related PRs
Sequence Diagram(s)sequenceDiagram
participant CI
participant Assembler
participant GeneratedDemo
participant DungeonGenerator
CI->>Assembler: generate fantasy-dungeon
Assembler-->>CI: generated main.zig and namespaced pack resources
CI->>GeneratedDemo: fix fingerprint, build, and run
GeneratedDemo->>DungeonGenerator: tick in playing state
DungeonGenerator-->>GeneratedDemo: log dungeon rows
GeneratedDemo-->>CI: run.log
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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 |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
.github/workflows/ci.yml (1)
595-598: 🩺 Stability & Availability | 🔵 Trivial | ⚡ Quick winConsider adding
$ASM installbeforegeneratefor self-sufficiency.This step uses the
.nullbackend (output path.labelle/null_desktop) but skips$ASM install --project-root ., unlike the asset-streaming-smoke (line 213), flows-smoke (line 388), and packs-demo (line 456) steps. Those steps' comments explicitly note that.nullis an extracted external backend whosebackend.manifest.zonmust be in the package cache beforegeneratecan splice codegen, and thatinstallmakes the fixture "self-sufficient and order-independent."This step currently relies on earlier steps having populated the cache. That's consistent with the null (line 313) and plugin-controllers (line 521) steps, but those predate the explicit guidance. If the asset-streaming-smoke or flows-smoke steps are ever removed or reordered, this step will fail.
🔧 Suggested addition
- name: Generate + build + run the fantasy-dungeon asset-plugin example run: | cd labelle-assembler/examples/fantasy-dungeon - $GITHUB_WORKSPACE/labelle-assembler/zig-out/bin/labelle-assembler generate --project-root . + ASM=$GITHUB_WORKSPACE/labelle-assembler/zig-out/bin/labelle-assembler + $ASM install --project-root . + $ASM generate --project-root .🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In @.github/workflows/ci.yml around lines 595 - 598, Add an `$ASM install --project-root .` command before `generate` in the fantasy-dungeon asset-plugin workflow step, matching the setup used by asset-streaming-smoke, flows-smoke, and packs-demo so the fixture independently populates the external `.null` backend cache.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In @.github/workflows/ci.yml:
- Around line 595-598: Add an `$ASM install --project-root .` command before
`generate` in the fantasy-dungeon asset-plugin workflow step, matching the setup
used by asset-streaming-smoke, flows-smoke, and packs-demo so the fixture
independently populates the external `.null` backend cache.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 0669b054-23be-4486-ad9d-f193d7b3dea7
⛔ Files ignored due to path filters (3)
examples/fantasy-dungeon/plugin/assets/banner.pngis excluded by!**/*.pngexamples/fantasy-dungeon/plugin/packs/props/assets/props.pngis excluded by!**/*.pngexamples/fantasy-dungeon/plugin/packs/tiles/assets/tileset.pngis excluded by!**/*.png
📒 Files selected for processing (19)
.github/workflows/ci.ymlexamples/fantasy-dungeon/.gitignoreexamples/fantasy-dungeon/README.mdexamples/fantasy-dungeon/plugin/assets/banner.jsonexamples/fantasy-dungeon/plugin/build.zigexamples/fantasy-dungeon/plugin/build.zig.zonexamples/fantasy-dungeon/plugin/packs/props/assets/props.jsonexamples/fantasy-dungeon/plugin/packs/props/pack.labelleexamples/fantasy-dungeon/plugin/packs/props/prefabs/chest.jsoncexamples/fantasy-dungeon/plugin/packs/props/prefabs/torch.jsoncexamples/fantasy-dungeon/plugin/packs/tiles/assets/tileset.jsonexamples/fantasy-dungeon/plugin/packs/tiles/pack.labelleexamples/fantasy-dungeon/plugin/packs/tiles/prefabs/floor_tile.jsoncexamples/fantasy-dungeon/plugin/packs/tiles/prefabs/wall_tile.jsoncexamples/fantasy-dungeon/plugin/packs/tiles/scripts/playing/50_dungeon_generator.zigexamples/fantasy-dungeon/plugin/plugin.labelleexamples/fantasy-dungeon/plugin/src/root.zigexamples/fantasy-dungeon/project.labelleexamples/fantasy-dungeon/scenes/main.jsonc
The reference asset plugin + Phase-2 acceptance fixture for the Asset-Plugins epic (design labelle-engine#725, RFC #726 rev 4). Lands alongside the existing
plugin-controllersreference example underexamples/.P1 (
pack.labelle .resources) and P2 (plugin.labelle .resources+ nested.packs) are already merged in the assembler; this PR is the demo that exercises the mechanism end to end.What it is
examples/fantasy-dungeon/— a consuming game (project.labelle, headless.nullbackend) that attaches one vendor-style plugin (local:./plugin) and gets a whole dungeon content kit with zero manual.resourcesedits. That emptiness is the Phase-2 acceptance criterion.The
fantasy_dungeonplugin bundles:plugin/packs/{tiles,props}/— each with its ownpack.labelle .resourcesatlas + prefabs;tilesalso ships a generator script (an ordinary dir-scanned pack script).banner) viaplugin.labelle .resources..license/.authorprovenance.What it demonstrates (all verified at generate time)
registerAtlasFromMemory("tiles__tileset", @embedFile("packs/tiles/assets/tileset.json") …),"props__atlas","fantasy_dungeon__banner".floor.png→tiles/floor.png,banner.png→fantasy_dungeon/banner.png; the packs' own prefabsprite_namerefs rewritten to match.scenes/main.jsoncnames no pack atlas; referencingtiles__floor_tileetc. auto-wirestiles__tileset+props__atlasinto the scene manifest (pub const main = &.{ "fantasy_dungeon__banner", "tiles__tileset", "props__atlas" }).packs/tiles/scripts/playing/50_dungeon_generator.zigwired as aplaying-state pack script.CI
New
examples-integrationstep Generate + build + run the fantasy-dungeon asset-plugin example: runsgenerate, asserts the namespaced-merge shape in the generatedmain.zig+ copied atlases + rewritten prefab, then builds and runs the headless.nullbinary and checks the generator script's log lines.Assets
Minimal solid-colour placeholder PNGs, generated programmatically — the reference is about the resource mechanism, not the art. A real vendor plugin drops in packed sheets of the same shape with no manifest change.
Verification
labelle-assembler generate --project-root .is clean and produces every invariant above (asserted locally). A fullzig buildof the generated game needsengine ≥1.66 / gfx ≥1.20 / core ≥1.24(the assembler-0.73+renderMeshes/PackViewseam) — CI checks out freshmainof those; the stale local sibling checkouts used during development are behind, so the local build wall is environmental (the existingpacks-demoexample hits it too), not a defect in this fixture.Closes labelle-toolkit/labelle-engine#728
https://claude.ai/code/session_017pW3ifKf9wgxNg4viy6okw
Summary by CodeRabbit