StudioHow-toFor authorsApplies from 4.4.0
Before and after captures
Cette page en françaisThis page on the GitHub wiki
Under the semantic diff, Capture the rooms (before / after) draws each room the changes name at both revisions, side by side, with the rectangle where they differ outlined: a moved placement, a font or a line that overflows shows at a glance.
What you get
For each room the diff names, two pictures (before, after) drawn by the real engine, the changed area boxed, or "no visible change" when no pixel moved. The PNGs are kept on disk.
Context and versions
The local Studio only (npm run studio, engine repository or created project), from 4.4.0.
Over HTTP this answer is a 501 { unavailable, reason }; the test calls the Studio directly.
Prerequisites
-
Playwright and its Chromium on your machine:
# in the engine repository or the created project npm i -D playwright && npx playwright install chromium -
The game's prepared assets (
npm run assets). -
Two revisions to compare: Semantic diff.
Where to run the commands
In the browser, on the Check tab, under Changes between revisions. The commands above run in the folder the Studio serves.
Steps
- Show the changes between two revisions (Semantic diff).
- Click Capture the rooms (before / after). "Building both revisions and drawing their rooms…" shows while it works: each side is a build of the game, seconds each.
- Read each pair: the room, why it is drawn, the before and after pictures, the rectangle where they differ, or "no visible change". A side that cannot be drawn says why (the revision does not build, the room is not there); the other side is still shown.
Which rooms, and how
- The rooms drawn: those whose layout, source or texts in a language (
room:<id>/…) the changes touch. A change to shared files alone (the cast, the items,site.json) draws the first room. Six rooms at most. With nothing to draw: "No room to capture: nothing these revisions changed is drawn." - Each revision is the game folder with the journal's later operations undone, built as a preview (in the worker's child process, never the Studio's own) and drawn in headless Chromium at 960 × 600, one device pixel, reduced motion, no CSS animation, fonts loaded, the editor's overlays hidden.
- The same pixel: a colour channel off by 16 or less counts as the same (an anti-aliased edge moves by 2 between two renders).
Expected result, and how to check it
Pairs of pictures with a box around what moved. The files are under .cache/studio/<game>-diff-<from>-<to>/.
Common errors
| Symptom | Cause | Fix |
|---|---|---|
Playwright is not installed (npm i -D playwright && npx playwright install chromium) | No Playwright | Install it as said |
Chromium does not start: … | Playwright's Chromium is missing or cannot run | npx playwright install chromium |
r<n> does not build: … on one side | That revision's game does not build | Read the message; the other side is still drawn |
| 501 on a hosted Studio | Captures are local only | Run the same revisions on a local Studio |
Files or data changed
PNGs under .cache/studio/<game>-diff-<from>-<to>/; nothing in the game.
References
studio-server/src/ops/diff-captures.ts,tools/studio/diff-rooms.ts,src/studio/diff-captures-view.ts.- The route
GET diff/<from>..<to>/captures: Studio API.