Skip to content

A town simulation in pale isometric line art, implemented with Ritmo ECS and PixiJs 3D

README: a 30-second film of a living town, today's pictures, and a play link

SandroMaglionef8f836a3fa88
diff --git a/.gitignore b/.gitignore
index e6b1670..a020a51 100644
--- a/.gitignore
+++ b/.gitignore
@@ -10,3 +10,4 @@ output/balance-rules/
output/mobile-review/
output/upgrades/
output/look-ui/
+output/look-readme/
diff --git a/DEVELOPMENT.md b/DEVELOPMENT.md
index 53d5b3e..3100d97 100644
--- a/DEVELOPMENT.md
+++ b/DEVELOPMENT.md
@@ -178,7 +178,24 @@ in the page's save slot from the console and press **load**:
localStorage.setItem("inkline-town/save/manual", /* the file's contents */)
```
-That is how the README's screenshots of grown towns were made.
+`scripts/look-readme.ts` takes the README's pictures and film from such a
+save, through the real page with the news, overlays and camera buttons
+hidden. It runs on Playwright's clock, so the film steps the town exactly
+two thirtieths of a second a frame however slow the screenshot:
+
+```sh
+node scripts/balance.ts --size large --land rich --term 90 --seeds 3 --snapshot 80 --out snapshots
+SAVE=snapshots/large-rich-1000-80min.json RECKON=1 node scripts/look-readme.ts # charter, town, street, panels, reckoning
+MODE=wide WIDE=0.75 NAME=large SAVE=... node scripts/look-readme.ts # one wide view of another town
+MODE=film SIZE=1600x900 SCALE=1 SAVE=... node scripts/look-readme.ts # 900 frames to output/look-readme/frames
+ffmpeg -framerate 30 -i output/look-readme/frames/%04d.png -vf "scale=960:-2,format=yuv420p" \
+ -c:v libsvtav1 -preset 4 -crf 46 -g 300 -f avif -loop 0 docs/media/inkline-town.avif
+ffmpeg -framerate 30 -i output/look-readme/frames/%04d.png -vf scale=1280:-2 \
+ -c:v libx264 -preset veryslow -tune animation -pix_fmt yuv420p -crf 28 -movflags +faststart docs/media/inkline-town.mp4
+```
+
+The README shows the film as an animated AVIF, because GitHub plays no
+`<video>` from the repository; browsers without AVIF see the still.
## Code
@@ -259,6 +276,18 @@ rendered pixels, checks phone layout and exports a five-second MP4 to
`output/inkline-3d/house-effects/`. The runtime and this preview share the
same instanced renderer and effect code.
+The complete proportion comparison is at
+[`/proportion-review.html`](http://localhost:5232/proportion-review.html): 36
+building appearances and nine shared-prop examples, with the approved
+originals beside the revised geometry. Both sides share a camera and an
+unchanged walker. Turn, zoom, choose one scale across the catalogue, or save a
+comparison PNG. `/model-review.html?collection=handoff` turns the carpenter
+and building upgrades, compares scaffolding as materials arrive, and downloads
+their GLBs. `?collection=milestones` sets the town hall, guildhall and city
+hall side by side; `?collection=works` shows the one reusable construction
+scaffold on six building forms, its bays, platforms, ladders and supplies set
+by plot size, building height and delivered share.
+
The original 2D menu drawings remain in `art.ts` for comparison. The live
3D town uses the new geometry, including equipped service workers and cured
fish cargo. The game has no audio, so winter music is outside this model work.
diff --git a/README.md b/README.md
index c3a6762..38aed2b 100644
--- a/README.md
+++ b/README.md
@@ -6,7 +6,16 @@ stands. Lay the roads, house the settlers, build the chains that feed and
clothe them, and raise a hamlet to a village, a town, and a city of
burghers. Or watch it go bankrupt, revolt, or empty out.
-![A complete town at the end of its fifth year: hundreds of homes, farms, mills, and workshops on a pale island](docs/screenshots/town-complete.webp)
+<p align="center"><a href="https://inkline.typeonce.dev"><b>▶ Play Inkline Town in your browser</b></a> · free, nothing to install, saves stay on your device</p>
+
+<a href="docs/media/inkline-town.mp4">
+ <picture>
+ <source srcset="docs/media/inkline-town.avif" type="image/avif">
+ <img src="docs/screenshots/town-complete.webp" alt="Thirty seconds over a town in its sixth year: the camera turns over the whole island, dives to the clock-towered town hall, and follows carts and walkers down streets of townhouses">
+ </picture>
+</a>
+
+<p align="center"><sub>Thirty seconds in a town 80 minutes old, as it plays at double speed. <a href="docs/media/inkline-town.mp4">Watch it in full quality</a>.</sub></p>
Inkline Town plays like a small Anno in a small box. Every building, cart, and
person is drawn live in thin 3D line art. Pan, zoom and rotate the island;
@@ -23,12 +32,12 @@ makes a different island, with a wandering coast and capes reaching out.
<table>
<tr>
- <td><img src="docs/screenshots/map-small-rich.webp" alt="A small, rich town 25 minutes in: farms, a windmill, and homes around the town hall"></td>
- <td><img src="docs/screenshots/map-large-harsh.webp" alt="A large, harsh island 50 minutes into a 90-minute term, the town clustered in the middle while the crown asks for tools"></td>
+ <td><img src="docs/screenshots/map-small-rich.webp" alt="A small, rich town 25 minutes in: rows of townhouses and a fountain around the town hall, raised in scaffolding as it becomes a guildhall"></td>
+ <td><img src="docs/screenshots/map-large-rich.webp" alt="A large, rich island 80 minutes into a 90-minute term: workshops, farms and mills spread around the clock-towered town hall"></td>
</tr>
<tr>
- <td align="center"><sub>small land, rich: farms and mills by year three</sub></td>
- <td align="center"><sub>large land, harsh: thin woods, little stone, and the crown wants tools</sub></td>
+ <td align="center"><sub>small land, 25 minutes in: townhouses round a fountain, the town hall in scaffolding</sub></td>
+ <td align="center"><sub>large land, 80 minutes in: a village of 350 spread across the island</sub></td>
</tr>
</table>
@@ -42,7 +51,7 @@ settlers. You never move a crate yourself: carriers push their carts along
the roads, each loaded with what it carries, and markets send walkers
through the streets with baskets of fish, bread, and cloth.
-![A close look at a busy street: carts of planks and logs, a market walker, residents out walking, the town hall and the chapel](docs/screenshots/street.webp)
+![A close look at the town hall: its clock tower and banners, carts of goods on the paved streets, residents out walking, a fire watch and a market behind](docs/screenshots/street.webp)
Settlers need food. Give them bread, cloth, and a chapel's faith, and their
cottages grow into two-story citizens' homes that hold and pay twice as
@@ -83,8 +92,8 @@ how much to keep, which buildings to pause, and when to answer the crown.
<table>
<tr>
- <td><img src="docs/screenshots/ui-town-panel.webp" alt="The town panel: goals, approval and what drives it, the treasury, and tax rates"></td>
- <td><img src="docs/screenshots/ui-build-menu.webp" alt="The build menu: each building pictured with its cost, workers, and upkeep"></td>
+ <td><img src="docs/screenshots/ui-town-panel.webp" alt="The town panel: the goals of the next rank, approval and what drives it, the treasury and what is left on the table, and tax rates"></td>
+ <td><img src="docs/screenshots/ui-build-menu.webp" alt="The build menu: each building pictured by its own model, with its cost, workers, desirability, and upkeep"></td>
</tr>
<tr>
<td align="center"><sub>the town panel: goals, approval, treasury, taxes, trade</sub></td>
@@ -92,7 +101,7 @@ how much to keep, which buildings to pause, and when to answer the crown.
</tr>
</table>
-![A mill selected: working, two workers, 261 batches of flour made](docs/screenshots/ui-building.webp)
+![A mill selected: working with two of two workers, grinding wheat into flour, run down to 5% so it works at half pace until a builder mends it](docs/screenshots/ui-building.webp)
## Every term ends, the town goes on
@@ -117,7 +126,7 @@ The reckoning shows how the term went: residents, coins, and approval
across it, with the winters shaded, and the chronicle of everything that
happened.
-<p align="center"><img src="docs/screenshots/reckoning.webp" width="640" alt="The reckoning of a complete town: 581 residents, 352 citizens, 9000 coins, a chart of the term, and its chronicle"></p>
+<p align="center"><img src="docs/screenshots/reckoning.webp" width="640" alt="The reckoning of a 90-minute term: a village of 227 residents and 19096 coins, declining at the end, with a chart of the term and its chronicle"></p>
## Drawn in ink
@@ -129,55 +138,33 @@ different on every cell.
![All 24 building kinds, including the carpenter, plus the market hall and church](docs/screenshots/sheet-buildings.webp)
-The carpenter and building upgrades can be inspected in the model review.
-The complete proportion comparison is at `/proportion-review.html`: 36 building
-appearances and nine shared-prop examples, with the approved originals beside
-the revised geometry. Both sides share a camera and an unchanged walker.
-Turn, zoom, choose one scale across the catalogue, or save a comparison PNG.
-The park comparison is at `/proportion-review.html?collection=parks`: twelve
-before/after views cover furnishings, planting, paths, paving and the assembled
-park. The same walker and camera appear on both sides. `/park-lab.html` shows
-the revised park with running water.
-Run `pnpm dev`, then open `/model-review.html?collection=handoff` to turn the models, compare
-scaffolding as materials arrive, and download their GLBs.
-
-The civic milestones have their own comparison at
-`/model-review.html?collection=milestones`. The guildhall's clock tower,
-steep roof and guild banners give way to the city hall's domed centre,
-lower wings and columned entrance.
+As the town rises, its buildings rise with it. The town hall becomes a
+guildhall with a clock tower and banners, then a city hall with a dome and
+columns. Scaffolding goes up around every upgrade, with its bays and ladders
+filling as the carts bring the materials.
![Town hall, guildhall and city hall at one camera scale](docs/screenshots/sheet-civic.webp)
-`/model-review.html?collection=works` shows one reusable construction
-scaffold on six building forms. Plot size, building height and delivered
-share determine its bays, platforms, ladders and supplies.
-
![Reusable scaffolding on civic buildings, a carpenter, warehouse, quarry and farm](docs/screenshots/sheet-works.webp)
![Carpenter, civic and workplace upgrades, scaffolding progress and furniture cargo](docs/screenshots/sheet-upgrades.webp)
-![Carriers pushing handcarts and barrows, each loaded with its good: logs, planks, stone, ore, tools, fish, wheat, flour, bread, wool, cloth](docs/screenshots/sheet-walkers.webp)
-
-![A market walker with a basket, a chapel walker with a bell, settlers, and citizens in top hats](docs/screenshots/sheet-people.webp)
-
-![Homes for settlers and citizens](docs/screenshots/sheet-homes.webp)
-
-![Trees, rocks and ore, and fields as they ripen](docs/screenshots/sheet-land.webp)
-
## Play
-Inkline Town runs in the browser. Saves stay in your browser, and the town
-autosaves every two minutes of play. Share a picture of your town, or a link
-that opens it running for anyone, who can then play on from where you left it.
+**[Play Inkline Town at inkline.typeonce.dev](https://inkline.typeonce.dev).**
+It runs in the browser, on a computer or a phone. Saves stay in your browser,
+and the town autosaves every two minutes of play. Share a picture of your
+town, or a link that opens it running for anyone, who can then play on from
+where you left it.
+
+New to the game? [How to play](docs/how-to-play.md) covers the controls, the
+rules of a term, and how the town works underneath. To run it yourself:
```sh
pnpm install
pnpm dev
```
-Then open the address it prints. New to the game? [How to play](docs/how-to-play.md)
-covers the controls, the rules of a term, and how the town works underneath.
-
---
[How to play](docs/how-to-play.md) · [Developing](DEVELOPMENT.md) · [The design behind the term](docs/mayor-plan.md)
diff --git a/docs/media/inkline-town.avif b/docs/media/inkline-town.avif
new file mode 100644
index 0000000..dd2e5f1
Binary files /dev/null and b/docs/media/inkline-town.avif differ
diff --git a/docs/media/inkline-town.mp4 b/docs/media/inkline-town.mp4
new file mode 100644
index 0000000..c07e291
Binary files /dev/null and b/docs/media/inkline-town.mp4 differ
diff --git a/docs/screenshots/charter.webp b/docs/screenshots/charter.webp
index 29bff4e..72826f0 100644
Binary files a/docs/screenshots/charter.webp and b/docs/screenshots/charter.webp differ
diff --git a/docs/screenshots/map-large-harsh.webp b/docs/screenshots/map-large-harsh.webp
deleted file mode 100644
index f9ab300..0000000
Binary files a/docs/screenshots/map-large-harsh.webp and /dev/null differ
diff --git a/docs/screenshots/map-large-rich.webp b/docs/screenshots/map-large-rich.webp
new file mode 100644
index 0000000..72e03b3
Binary files /dev/null and b/docs/screenshots/map-large-rich.webp differ
diff --git a/docs/screenshots/map-small-rich.webp b/docs/screenshots/map-small-rich.webp
index 5f4161e..5bf2aa1 100644
Binary files a/docs/screenshots/map-small-rich.webp and b/docs/screenshots/map-small-rich.webp differ
diff --git a/docs/screenshots/reckoning.webp b/docs/screenshots/reckoning.webp
index 92770d6..4a86b1d 100644
Binary files a/docs/screenshots/reckoning.webp and b/docs/screenshots/reckoning.webp differ
diff --git a/docs/screenshots/sheet-homes.webp b/docs/screenshots/sheet-homes.webp
deleted file mode 100644
index 304f4b3..0000000
Binary files a/docs/screenshots/sheet-homes.webp and /dev/null differ
diff --git a/docs/screenshots/sheet-land.webp b/docs/screenshots/sheet-land.webp
deleted file mode 100644
index 39ff443..0000000
Binary files a/docs/screenshots/sheet-land.webp and /dev/null differ
diff --git a/docs/screenshots/sheet-people.webp b/docs/screenshots/sheet-people.webp
deleted file mode 100644
index 29f2ff4..0000000
Binary files a/docs/screenshots/sheet-people.webp and /dev/null differ
diff --git a/docs/screenshots/sheet-walkers.webp b/docs/screenshots/sheet-walkers.webp
deleted file mode 100644
index 55ef16e..0000000
Binary files a/docs/screenshots/sheet-walkers.webp and /dev/null differ
diff --git a/docs/screenshots/street.webp b/docs/screenshots/street.webp
index 3025962..f445d72 100644
Binary files a/docs/screenshots/street.webp and b/docs/screenshots/street.webp differ
diff --git a/docs/screenshots/town-complete.webp b/docs/screenshots/town-complete.webp
index 5a0e009..c040ab1 100644
Binary files a/docs/screenshots/town-complete.webp and b/docs/screenshots/town-complete.webp differ
diff --git a/docs/screenshots/ui-build-menu.webp b/docs/screenshots/ui-build-menu.webp
index 05a8a9c..6410756 100644
Binary files a/docs/screenshots/ui-build-menu.webp and b/docs/screenshots/ui-build-menu.webp differ
diff --git a/docs/screenshots/ui-building.webp b/docs/screenshots/ui-building.webp
index 866a5b2..1013391 100644
Binary files a/docs/screenshots/ui-building.webp and b/docs/screenshots/ui-building.webp differ
diff --git a/docs/screenshots/ui-town-panel.webp b/docs/screenshots/ui-town-panel.webp
index 730223e..26b252c 100644
Binary files a/docs/screenshots/ui-town-panel.webp and b/docs/screenshots/ui-town-panel.webp differ
diff --git a/scripts/look-readme.ts b/scripts/look-readme.ts
new file mode 100644
index 0000000..245c1e4
--- /dev/null
+++ b/scripts/look-readme.ts
@@ -0,0 +1,158 @@
+/**
+ * The README's pictures and its film: a grown town loaded through the real
+ * page, shot at desktop size, with the news, overlays and camera buttons
+ * hidden. The film runs on Playwright's clock and steps the town itself, so
+ * every frame is two thirtieths of a second of the town's time (double
+ * speed), however slow the screenshot. Pictures go to `output/look-readme`.
+ *
+ * node scripts/balance.ts --size large --land rich --term 90 --seeds 1 --snapshot 80 --out snapshots
+ * pnpm dev --host 127.0.0.1 --port 5232 &
+ * SAVE=snapshots/large-rich-1000-80min.json RECKON=1 node scripts/look-readme.ts stills (RECKON plays to the term's end)
+ * MODE=wide WIDE=0.75 NAME=large SAVE=... node scripts/look-readme.ts one wide view at that zoom
+ * MODE=film SIZE=1600x900 SCALE=1 SAVE=... node scripts/look-readme.ts 30 s of frames for the film
+ */
+import { existsSync } from "node:fs"
+import { mkdir, readFile } from "node:fs/promises"
+import { chromium } from "playwright"
+
+const executable = process.env.BROWSER_EXECUTABLE_PATH ?? ["/Applications/Brave Browser.app/Contents/MacOS/Brave Browser", "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome"].find(existsSync)
+const browser = await chromium.launch({ headless: true, ...(executable ? { executablePath: executable } : {}) })
+const out = process.env.OUT ?? "output/look-readme"
+await mkdir(out, { recursive: true })
+if (!process.env.SAVE) throw new Error("SAVE=<a save file, as `pnpm balance --snapshot` writes>")
+const save = await readFile(process.env.SAVE, "utf8")
+const [width = 1440, height = 900] = (process.env.SIZE ?? "1440x900").split("x").map(Number)
+const errors: Array<string> = []
+
+const page = await browser.newPage({ viewport: { width, height }, deviceScaleFactor: Number(process.env.SCALE ?? 2) })
+page.on("pageerror", (e) => errors.push(e.message))
+await page.clock.install()
+await page.goto(process.env.GAME_BASE_URL ?? "http://127.0.0.1:5232")
+await page.evaluate((text) => localStorage.setItem("inkline-town/save/manual", text), save)
+await page.reload()
+const run = (ms: number) => page.clock.runFor(ms)
+const until = async (test: () => Promise<boolean>) => { for (let i = 0; i < 400 && !(await test()); i++) await run(50) }
+await until(() => page.evaluate(() => !!(window as any).town))
+const mode = process.env.MODE ?? "stills"
+const settle = (ms = 800) => run(ms)
+if (mode === "stills") {
+ // The charter, as a new mayor sees it first: a large, rich land.
+ await page.getByRole("button", { name: "large", exact: true }).click()
+ await page.getByRole("button", { name: "rich", exact: true }).click()
+ await settle()
+ await page.locator(".sheet.wide").screenshot({ path: `${out}/charter.png` })
+}
+await page.getByRole("button", { name: /Continue/ }).first().click()
+await until(() => page.evaluate(() => !(window as any).town.ui.founding))
+await page.evaluate(() => (window as any).town.ui.guide.push({ type: "off" }))
+// The news, the overlay list, the camera buttons, and the "loaded" toast stay out of the pictures.
+await page.addStyleTag({ content: ".ticker, .views, .camera-controls, .toast { display: none !important; }" })
+await run(1000)
+
+type Camera = { x: number; y: number; zoom: number; heading: number; elevation: number }
+const camera = (c: Camera) => page.evaluate((c) => {
+ const v = (window as any).town.view
+ v.heading = c.heading; v.elevation = c.elevation
+ v.camera.zoom = c.zoom; v.camera.updateProjectionMatrix()
+ v.focus(c.x, c.y)
+}, c)
+const town = () => page.evaluate(() => (window as any).town.runtime.snapshot()) as Promise<any>
+const hall = (await town()).entities.find((e: any) => e.components["Town/TownHall"]).components["Town/Tile"]
+console.log(JSON.stringify({ hall }))
+
+// The middle of the town: the mean of its buildings and homes.
+const built = (await town()).entities.filter((e: any) => (e.components["Town/Building"] || e.components["Town/House"]) && e.components["Town/Tile"]).map((e: any) => e.components["Town/Tile"])
+const middle = { x: built.reduce((a: number, t: any) => a + t.x, 0) / built.length, y: built.reduce((a: number, t: any) => a + t.y, 0) / built.length }
+// The busiest corner: the cell with the most buildings and homes within four cells, away from the town hall.
+const busiest = built.map((a: any) => ({ x: a.x + 1, y: a.y + 1, n: built.filter((b: any) => Math.abs(b.x - a.x) <= 4 && Math.abs(b.y - a.y) <= 4).length }))
+ .filter((c: any) => Math.hypot(c.x - hall.x, c.y - hall.y) > 7)
+ .sort((a: any, b: any) => b.n - a.n)[0]
+console.log(JSON.stringify({ middle, busiest, built: built.length }))
+
+if (mode === "film") {
+ // One take: the whole town turning, down to the town hall and along its streets, then back out.
+ const fps = 30, seconds = Number(process.env.FILM_SECONDS ?? 30)
+ const h = { x: hall.x + 1.5, y: hall.y + 1.5 }
+ const q = Math.PI / 4
+ const keys: Array<[number, Camera]> = [
+ [0, { ...middle, zoom: 0.62, heading: q - 0.4, elevation: 0.64 }],
+ [7, { ...middle, zoom: 0.78, heading: q - 0.1, elevation: 0.58 }],
+ [13, { ...h, zoom: 2.3, heading: q + 0.2, elevation: 0.52 }],
+ [20, { x: busiest.x, y: busiest.y, zoom: 2.5, heading: q + 0.4, elevation: 0.5 }],
+ [24, { x: (busiest.x + middle.x) / 2, y: (busiest.y + middle.y) / 2, zoom: 1.5, heading: q + 0.2, elevation: 0.56 }],
+ [seconds, { ...middle, zoom: 0.66, heading: q - 0.25, elevation: 0.64 }]
+ ]
+ const ease = (t: number) => t * t * (3 - 2 * t)
+ const at = (s: number): Camera => {
+ const i = Math.max(0, keys.findIndex(([k], j) => s >= k && s <= (keys[j + 1]?.[0] ?? Infinity)))
+ const [k0, a] = keys[i]!, [k1, b] = keys[Math.min(i + 1, keys.length - 1)]!
+ const t = k1 > k0 ? ease((s - k0) / (k1 - k0)) : 0
+ // Zoom is eased in log space, so the dolly feels even.
+ const mix = (p: number, q: number) => p + (q - p) * t
+ return { x: mix(a.x, b.x), y: mix(a.y, b.y), heading: mix(a.heading, b.heading), elevation: mix(a.elevation, b.elevation), zoom: Math.exp(mix(Math.log(a.zoom), Math.log(b.zoom))) }
+ }
+ // The page's own loop is held (its speed buttons hidden), and the town is stepped here at twice its pace, exactly
+ // two thirtieths of a second a frame: under Playwright's clock the loop's frames come unevenly.
+ await page.addStyleTag({ content: ".toolbar .speed, .paused-tag { display: none !important; }" })
+ await page.evaluate(() => { (window as any).town.ui.speed = 0 })
+ await mkdir(`${out}/frames`, { recursive: true })
+ for (let f = 0; f < fps * seconds; f++) {
+ await camera(at(f / fps))
+ await page.evaluate((s) => (window as any).town.advance(s), 2 / fps)
+ await run(1000 / fps)
+ await page.screenshot({ path: `${out}/frames/${String(f).padStart(4, "0")}.png` })
+ if (f % 60 === 0) console.log(`frame ${f}`)
+ }
+}
+if (mode === "wide") {
+ await camera({ ...middle, zoom: Number(process.env.WIDE ?? 0.8), heading: Math.PI / 4, elevation: Math.PI / 6 })
+ await settle()
+ await page.screenshot({ path: `${out}/${process.env.NAME ?? "wide"}.png` })
+}
+if (mode === "stills") {
+ const shot = async (name: string) => { await settle(); await page.screenshot({ path: `${out}/${name}.png` }) }
+ const view = { heading: Math.PI / 4, elevation: Math.PI / 6 }
+ await camera({ ...middle, zoom: Number(process.env.WIDE ?? 0.8), ...view })
+ await shot("town")
+ await camera({ x: hall.x + 2.5, y: hall.y + 2, zoom: 2.4, ...view, heading: Math.PI / 4 + 0.4 })
+ await shot("street")
+
+ await camera({ ...middle, zoom: 1, ...view })
+ await page.locator(".toolbar button").filter({ hasText: /^town/ }).first().click()
+ await shot("ui-town-panel")
+ await page.keyboard.press("Escape")
+ await page.locator(".toolbar button").filter({ hasText: /^build/ }).first().click()
+ await shot("ui-build-menu")
+ await page.keyboard.press("Escape")
+ await settle()
+
+ // A mill, picked on the map.
+ const mill = (await town()).entities.find((e: any) => e.components["Town/Building"]?.kind === (process.env.PICK ?? "mill") && !e.components["Town/Site"])
+ if (mill) {
+ const t = mill.components["Town/Tile"]
+ await camera({ x: t.x + t.size / 2 + 1, y: t.y + t.size / 2, zoom: 2.2, ...view })
+ await settle(300)
+ const p = await page.evaluate(([x, y]) => (window as any).town.view.project(x, y, 10), [t.x + t.size / 2, t.y + t.size / 2])
+ await page.mouse.click(p.x, p.y)
+ await page.mouse.move(width / 3, height - 160)
+ await shot("ui-building")
+ await page.keyboard.press("Escape")
+ }
+
+ // The end of the term, and its reckoning.
+ if (process.env.RECKON) {
+ await page.evaluate(() => {
+ const { runtime } = (window as any).town
+ const s = runtime.snapshot()
+ return s.resources["Town/Time"]
+ }).then((t) => console.log(JSON.stringify({ time: t })))
+ for (let i = 0; i < 40 && !(await page.locator(".dialog.open").count()); i++) {
+ await page.evaluate(() => (window as any).town.advance(30))
+ await settle(200)
+ }
+ await settle()
+ await page.locator(".dialog.open").first().screenshot({ path: `${out}/reckoning.png` })
+ }
+}
+console.log(JSON.stringify({ errors }))
+await browser.close()