Skip to content

[1/4] feat: split composed stage chunks into the layer stack - #104

Merged
arudaev merged 3 commits into
mainfrom
chore/64-layer-split
Oct 23, 2026
Merged

arudaev merged 3 commits into
mainfrom
chore/64-layer-split

Conversation

@arudaev

@arudaev arudaev commented Oct 23, 2026 •

Copy link
Copy Markdown
Member

What and why

scripts/split_layers.py cuts a composed 2160×720 stage chunk into the docs/04 layer stack (z0 sky … z7 foreground) and proves the cut is exact. The Hidden Garden (#65) needs this; until now only Rusty Creek had layers, made by its own creek_layers.py.

  • Rules. A region's layers.json lists its chunks, their composed art per state, and ordered mask rules: rectangles, polygons, a colour within an area, or another image's alpha. A rule can apply to one state only.
  • Exactness. Every pixel goes to exactly one layer: the last rule that claims it, else the chunk's default. Because layers never overlap, stacking them rebuilds the art pixel for pixel. The script asserts this before writing.
  • Shared layers. A layer identical in clean and anomaly is written once (<chunk>.<layer>.png); one the anomaly changes gets a file per state.
  • CI. --check (no arguments = every region with a layers.json) proves the committed layers still rebuild the art, and now runs in the art workflow.

Issue

Closes #64

Stack

Merge bottom up with merge commits; retarget the next PR to main before merging it.

Same result as creek_layers.py?

The test splits the composed Rusty Creek left chunk, using the creek's own plate alphas as rules in its draw order. Every pixel lands in the layer creek_layers.py drew on top there, and the stack rebuilds after-left.png exactly.

The colours can't match the creek plates, and no splitter of a finished image could match them. Those plates are soft: the bank, for example, has 27 fully opaque pixels and 313,892 partial ones, so the composed art is a blend. Rusty Creek keeps creek_layers.py; new regions use the split.

Verification

  • python -m unittest discover -s scripts -p "test_*.py": 6 new tests in test_split_layers.py:
    • exact recomposition with shared layers;
    • layers never overlap;
    • --check catches a stale layer;
    • state-only and colour rules;
    • bad config;
    • Rusty Creek.
  • python scripts/split_layers.py --check and python scripts/check_docs.py

@github-actions github-actions Bot added area:delivery Build, Vercel, CI, workflows, the board area:pipeline Rerunnable art and export scripts area:docs Design docs, README, contributor guides labels Oct 23, 2026
@arudaev arudaev changed the title feat: split composed stage chunks into the layer stack [1/2] feat: split composed stage chunks into the layer stack Oct 23, 2026
@arudaev arudaev changed the title [1/2] feat: split composed stage chunks into the layer stack [1/3] feat: split composed stage chunks into the layer stack Oct 23, 2026
@arudaev
arudaev added this pull request to stack #108 October 23, 2026 20:27
@arudaev
arudaev marked this pull request as ready for review October 23, 2026 20:27
@arudaev arudaev changed the title [1/3] feat: split composed stage chunks into the layer stack [1/4] feat: split composed stage chunks into the layer stack Oct 23, 2026
# Conflicts:
#	.github/workflows/art-pipeline.yml
@arudaev
arudaev merged commit 99786ca into main Oct 23, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:delivery Build, Vercel, CI, workflows, the board area:docs Design docs, README, contributor guides area:pipeline Rerunnable art and export scripts

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[M0-S6] Split any composed chunk into the layer stack

1 participant