Skip to content

[3/16] feat: load exported stages and sprite atlases - #116

Merged
arudaev merged 7 commits into
ci/25-game-checksfrom
chore/24-asset-loader
Oct 24, 2026
Merged

arudaev merged 7 commits into
ci/25-game-checksfrom
chore/24-asset-loader

Conversation

@Vatsal2005

@Vatsal2005 Vatsal2005 commented Oct 23, 2026 •

Copy link
Copy Markdown
Collaborator

What and why

Load exported stage manifests and the confirmed sprite board ids without hard-coded scene asset paths. Chunk coordinates place the 2160×720 grid, shared plates load once, and draw order and parallax come from the export. Development rejects missing assets with the URL; production reports the error and uses a bundled actor or plain stage plate. Placeholders are requested only on fallback.

Issue

Closes #24
Refs #110

Stack

Base: ci/25-game-checks. Human merges bottom up; retarget the next PR to main and merge origin/main into every open branch, never rebase.

Acceptance criteria

  • Rusty Creek's three anomaly chunks × seven layers render from the exporter manifest; clean state loads its six authored layers per chunk
  • Loads any export_atlas.py JSON-hash atlas and its animation table, including all 13 confirmed board ids
  • Missing assets reject in dev; production uses fallback assets

Verification

  • Node 22: npm run typecheck, npm test (49 tests), npm run build; includes main integration at e8577ab
  • py -3.13 scripts/check_docs.py
  • git diff --cached --check
  • Actual lane A stage exporter snapshots: all Rusty Creek states and the Hidden Garden reconstruct exactly with --verify; all verification data stayed in ignored tmp/
  • Browser: clean and anomaly Rusty Creek render; drag-pan crosses all three chunks with parallax and no console errors
  • Browser: deliberate missing hero-move.json rejects in dev with its URL; production still renders through fallback
  • Browser: missing production stage.json renders the plain stage placeholder
  • Vercel preview: GitHub states Vatsal2005 needs project access on Vercel to create deployments. A project owner must grant access; local checks pass.

Contract notes

Follow #110's exact stage.json shape and list order. Rusty Creek intentionally blends water last; sorting by z would break recomposition. The existing export uses its authored scroll factors (distance 0.2, rails 1.1, foreground 1.15), which differ from docs/04's general layer table. This loader preserves the export's values; any art tuning remains in the export config. No contract names or art files were changed.

Screenshots

Captured in ignored tmp/verification/: 24-rusty-creek-start.png, 24-rusty-creek-clean.png, 24-rusty-creek-end.png, 24-production-missing-stage.png. Images are included in the chat handoff; GitHub's browser is signed out, so upload through its UI is unavailable.

Read the stage manifest in its authored blend order, position the chunk grid and reuse shared textures with the exported scroll factors. Load the confirmed production board ids and retain their animation tables.

Reject missing or malformed assets in development and provide bundled actor or plain stage placeholders in production. Add pure validation and loading tests plus a development camera inspector.
Bring the human-merged stage exporter and collision data into the loader stack without rewriting published history.
@vercel

vercel Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
wincs Error Error Oct 24, 2026 12:27am UTC

Request Review

@Vatsal2005 Vatsal2005 self-assigned this Oct 23, 2026
@Vatsal2005
Vatsal2005 requested a review from arudaev October 23, 2026 21:08
@github-actions github-actions Bot added the area:stage Chunks, layers, collision, clean/anomaly states label Oct 23, 2026
@arudaev arudaev linked an issue Oct 23, 2026 that may be closed by this pull request
3 tasks
@Vatsal2005
Vatsal2005 marked this pull request as ready for review October 23, 2026 21:18
Retain the generated-stage build hook and registered lane A scenes while keeping the loader change isolated.
@vercel

vercel Bot commented Oct 23, 2026

Copy link
Copy Markdown

@Vatsal2005 must be a member of the arudaev's projects team on Vercel to deploy.
- Click here to add @Vatsal2005 to the team.
- If you initiated this build, request access.
- If you're already a member of the arudaev's projects team, make sure that your Vercel account is connected to your GitHub account.

Learn more about collaboration on Vercel and other options here.

@Vatsal2005 Vatsal2005 changed the title [3/4] feat: load exported stages and sprite atlases [3/5] feat: load exported stages and sprite atlases Oct 23, 2026
@Vatsal2005 Vatsal2005 changed the title [3/5] feat: load exported stages and sprite atlases [3/6] feat: load exported stages and sprite atlases Oct 23, 2026
@Vatsal2005 Vatsal2005 changed the title [3/6] feat: load exported stages and sprite atlases [3/7] feat: load exported stages and sprite atlases Oct 23, 2026
@Vatsal2005 Vatsal2005 changed the title [3/7] feat: load exported stages and sprite atlases [3/8] feat: load exported stages and sprite atlases Oct 23, 2026
Carry the reviewed lane B foundation and latest human-merged integration upward without rewriting published history.
@arudaev
arudaev added this pull request to stack #129 October 23, 2026 22:12
@Vatsal2005 Vatsal2005 changed the title [3/8] feat: load exported stages and sprite atlases [3/9] feat: load exported stages and sprite atlases Oct 23, 2026
@Vatsal2005 Vatsal2005 changed the title [3/9] feat: load exported stages and sprite atlases [3/10] feat: load exported stages and sprite atlases Oct 23, 2026
Carry human-merged lane A changes upward without rewriting published commits.
@Vatsal2005 Vatsal2005 changed the title [3/10] feat: load exported stages and sprite atlases [3/11] feat: load exported stages and sprite atlases Oct 23, 2026
Carry human-merged lane A changes upward without rewriting published commits.
@arudaev

arudaev commented Oct 23, 2026

Copy link
Copy Markdown
Member

Parallax on chunks after the first lands off-screen (lane A, found while layering the Hidden Garden for #139/#142; I'm not pushing to this stack).

stageLayers gives every layer x = chunk.x * 2160, and drawStage then applies setScrollFactor(layer.scroll). A layer is drawn at screen x − camera.scrollX × scroll. So when the camera reaches chunk i (scrollX = i × 2160), a scroll-0.2 plate sits at i × 2160 × 0.8: chunk 1 at 1728 px, chunk 2 at 3456 px. Rusty Creek's 01-distance (0.2) on rc-1-0 and rc-2-0 is never on screen, and the sky disappears past the first chunk.

Suggested fix: place a layer at x = chunk.x × chunkWidth × scroll (same for y). At the chunk's left edge it then lines up exactly as drawn. With scroll < 1, neighbouring plates overlap by chunkWidth × (1 − scroll). Drawing them in chunk order is fine for sky and far scenery, and lane A will paint far plates that tolerate that overlap. A test: stageLayers for a chunk at x = 2 with scroll 0.2 gives x = 864.

The Hidden Garden is getting 00-sky 0.1, 01-far 0.25, 02-mid 0.6 and a 1.2 foreground (#142). It has a single chunk, so it's correct either way, but more chunks are coming.

@Vatsal2005 Vatsal2005 changed the title [3/11] feat: load exported stages and sprite atlases [3/12] feat: load exported stages and sprite atlases Oct 23, 2026
@Vatsal2005
Vatsal2005 marked this pull request as draft October 23, 2026 23:24
@Vatsal2005 Vatsal2005 changed the title [3/12] feat: load exported stages and sprite atlases [3/13] feat: load exported stages and sprite atlases Oct 23, 2026
@Vatsal2005 Vatsal2005 changed the title [3/13] feat: load exported stages and sprite atlases [3/14] feat: load exported stages and sprite atlases Oct 23, 2026
@Vatsal2005 Vatsal2005 changed the title [3/14] feat: load exported stages and sprite atlases [3/15] feat: load exported stages and sprite atlases Oct 24, 2026
@arudaev

arudaev commented Oct 24, 2026

Copy link
Copy Markdown
Member

Correction to my comment above: no loader change is needed. Lane A now ships every layer that scrolls at ≠ 1 as one region-wide plate, quilted from the chunks' plates and cut into 2160 px tiles; tile j is listed on chunk j (#148). With x = chunk.x × 2160 and setScrollFactor(scroll), each tile then shows exactly its part of the plate. Your current stageLayers is right for that. Rusty Creek's per-chunk 0.2 / 1.1 / 1.15 layers still need the same treatment on my side; I'll do it next.

@Vatsal2005 Vatsal2005 changed the title [3/15] feat: load exported stages and sprite atlases [3/16] feat: load exported stages and sprite atlases Oct 24, 2026
Carry human-merged lane A changes upward without rewriting published commits.
@arudaev
arudaev marked this pull request as ready for review October 24, 2026 01:34
@arudaev
arudaev merged commit 2cb1f6d into main Oct 24, 2026
8 of 9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:stage Chunks, layers, collision, clean/anomaly states

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[M0-S5] Load stage chunks and sprite atlases in the game

2 participants