diff --git a/.changes/claude-project-thread-vpvjev.md b/.changes/claude-project-thread-vpvjev.md new file mode 100644 index 0000000000..5437c0ec32 --- /dev/null +++ b/.changes/claude-project-thread-vpvjev.md @@ -0,0 +1,7 @@ +--- +app: minor +crate: none +--- +## Player +- The Player's Manual now has the game's menu bar across the top, as in the game: File goes back to the game or prints the page, Edit finds a page or copies its link, Options picks light, dark or your device's look, and Help has What's New, Report a Problem and Sponsor. +- The Player's Manual has its own address, help.verticopolis.com, with shorter page addresses like help.verticopolis.com/rooms/. Old verticopolis.com/help links still work and take you to the same page. In the installed app on Android, Help now opens over the game instead of in its place. diff --git a/.github/ISSUE_TEMPLATE/parity_report.yml b/.github/ISSUE_TEMPLATE/parity_report.yml index 4e48d66d07..adfa3950f0 100644 --- a/.github/ISSUE_TEMPLATE/parity_report.yml +++ b/.github/ISSUE_TEMPLATE/parity_report.yml @@ -50,7 +50,7 @@ body: options: - label: This is about a **Classic**-mode tower (Modern-mode differences are intentional; use a Feature request for those). required: true - - label: I checked the [list of known differences](https://verticopolis.com/help/differences/) and this one is not on it as intentional. + - label: I checked the [list of known differences](https://help.verticopolis.com/differences/) and this one is not on it as intentional. required: true - label: I searched existing issues and this is not a duplicate. required: true diff --git a/.github/workflows/deploy-production.yml b/.github/workflows/deploy-production.yml index 20b9e7c510..dfb0ad7c0f 100644 --- a/.github/workflows/deploy-production.yml +++ b/.github/workflows/deploy-production.yml @@ -45,6 +45,8 @@ permissions: env: PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: "1" PRODUCTION_URL: https://verticopolis.com + # The player's manual's own host (scripts/vercel-build.sh, vercel.json). + HELP_URL: https://help.verticopolis.com jobs: # Decides whether to deploy, without the production environment's secrets. @@ -316,14 +318,21 @@ jobs: # Every file of the build, byte for byte, as production serves it. # Source maps are left out: production answers 403 to them (the # project keeps them from the public), though the list and the - # release zip still carry them. + # release zip still carry them. The manual (dist/help/) is served + # from its own host, help.verticopolis.com, at the root + # (vercel.json), and verticopolis.com/help only redirects there, + # so its files are checked on that host. bad=0 checked=0 while read -r want path; do case "$path" in *.map) continue ;; esac + case "$path" in + help/*) url="$HELP_URL/${path#help/}" ;; + *) url="$PRODUCTION_URL/$path" ;; + esac checked=$((checked + 1)) - got="$(curl -fsS --compressed --max-time 30 "$PRODUCTION_URL/$path" | sha256sum | cut -d' ' -f1 || true)" - if [ "$got" != "$want" ]; then echo "::error::$PRODUCTION_URL/$path does not match the build."; bad=$((bad + 1)); fi + got="$(curl -fsS --compressed --max-time 30 "$url" | sha256sum | cut -d' ' -f1 || true)" + if [ "$got" != "$want" ]; then echo "::error::$url does not match the build."; bad=$((bad + 1)); fi done < web-SHA256SUMS if [ "$checked" = 0 ]; then echo "::error::The build's checksum list names no file to check."; exit 1; fi if [ "$bad" != 0 ]; then echo "::error::$bad of $checked files differ from the build."; exit 1; fi diff --git a/.github/workflows/help-site.yml b/.github/workflows/help-site.yml index 51d2c6b2af..7bfb89ba4f 100644 --- a/.github/workflows/help-site.yml +++ b/.github/workflows/help-site.yml @@ -94,3 +94,14 @@ jobs: # Every link between help pages reaches a real page, and a real section. - name: Check the links run: node help-site/scripts/check-links.mjs + + # Production builds the manual for its own host, help.verticopolis.com, + # at the root (scripts/vercel-build.sh). Build it that way too and check + # its links: no page may still point under /help. + - name: Check the links of the help host build + env: + VC_HELP_ORIGIN: https://help.verticopolis.com + run: | + npm run build --prefix help-site + if grep -rlE '(href|src)="/help(/|")' dist/help --include=*.html; then echo "::error::a page above still links under /help"; exit 1; fi + node help-site/scripts/check-links.mjs diff --git a/PARITY.md b/PARITY.md index f379b5c1db..014565eba0 100644 --- a/PARITY.md +++ b/PARITY.md @@ -2,7 +2,7 @@ The developer's checklist of how a **Classic** tower matches the 1994 game, one line per mechanic. Players read the same story in the manual: -**[Differences from the 1994 game](https://verticopolis.com/help/differences/)**. +**[Differences from the 1994 game](https://help.verticopolis.com/differences/)**. The rules themselves live in the Rust engine (`engine-rs/`), and its catalog publishes the prices, sizes and caps, so this page names mechanics and issues rather than copying numbers. Status: ✅ implemented · ◑ a faithful @@ -70,18 +70,18 @@ other does not. - ✅ Mobile layout with touch pan and pinch ## Deliberate divergences -- Commuters are individually pathfound, with an aggregate congestion model underneath and a capped on-screen crowd. [Help](https://verticopolis.com/help/differences/#every-commuter-is-a-real-person) -- The Cathedral is a religion-agnostic Wedding Hall. [Help](https://verticopolis.com/help/differences/#the-wedding-hall) -- The census counts occupants (hotel guests until 4★, shoppers inside venues), with the TOWER at the canon 15,000 on the 375-tile lot. [Help](https://verticopolis.com/help/differences/#who-counts-toward-population) -- Housekeeping fields six simulated maids per unit on stairs and service elevators, with no 1994 long-trip pathfinding decay and no housekeeping build cap (1.54, 1.57). [Help](https://verticopolis.com/help/differences/#housekeeping-maids) -- Cockroach infestations are visible rooms with a full lifecycle; Classic cures only by bulldozing (1.53). [Help](https://verticopolis.com/help/differences/#cockroaches-you-can-see) -- Shop and restaurant patronage comes from the reachable nearby population; the original's opaque per-venue counters are not reproduced (#393). [Help](https://verticopolis.com/help/differences/#shoppers-come-from-nearby-floors) -- A rule-set (Classic or Modern) is chosen at founding and fixed for the tower's life; saves with no mode load as Classic. [Help](https://verticopolis.com/help/differences/#two-ways-to-play) -- Modern builds while paused; Classic refuses, as 1994 does (#1936). [Help](https://verticopolis.com/help/differences/#building-while-paused) +- Commuters are individually pathfound, with an aggregate congestion model underneath and a capped on-screen crowd. [Help](https://help.verticopolis.com/differences/#every-commuter-is-a-real-person) +- The Cathedral is a religion-agnostic Wedding Hall. [Help](https://help.verticopolis.com/differences/#the-wedding-hall) +- The census counts occupants (hotel guests until 4★, shoppers inside venues), with the TOWER at the canon 15,000 on the 375-tile lot. [Help](https://help.verticopolis.com/differences/#who-counts-toward-population) +- Housekeeping fields six simulated maids per unit on stairs and service elevators, with no 1994 long-trip pathfinding decay and no housekeeping build cap (1.54, 1.57). [Help](https://help.verticopolis.com/differences/#housekeeping-maids) +- Cockroach infestations are visible rooms with a full lifecycle; Classic cures only by bulldozing (1.53). [Help](https://help.verticopolis.com/differences/#cockroaches-you-can-see) +- Shop and restaurant patronage comes from the reachable nearby population; the original's opaque per-venue counters are not reproduced (#393). [Help](https://help.verticopolis.com/differences/#shoppers-come-from-nearby-floors) +- A rule-set (Classic or Modern) is chosen at founding and fixed for the tower's life; saves with no mode load as Classic. [Help](https://help.verticopolis.com/differences/#two-ways-to-play) +- Modern builds while paused; Classic refuses, as 1994 does (#1936). [Help](https://help.verticopolis.com/differences/#building-while-paused) ## Known parity gaps -- Lobby-distance pressure: Verticopolis drops the 1994 mid-block cap once every legal sky lobby is built (owner ruling 2026-07-16, #394); re-keying it on elevator reach is #436. [Help](https://verticopolis.com/help/differences/#lobby-distance) -- Other actions while paused: whether 1994 also refuses bulldozing, elevator or rent edits and the inspector, and whether a loaded tower starts paused, waits on a PC check (#1974). [Help](https://verticopolis.com/help/differences/#other-actions-while-paused) +- Lobby-distance pressure: Verticopolis drops the 1994 mid-block cap once every legal sky lobby is built (owner ruling 2026-07-16, #394); re-keying it on elevator reach is #436. [Help](https://help.verticopolis.com/differences/#lobby-distance) +- Other actions while paused: whether 1994 also refuses bulldozing, elevator or rent edits and the inspector, and whether a loaded tower starts paused, waits on a PC check (#1974). [Help](https://help.verticopolis.com/differences/#other-actions-while-paused) The gaps from the 2026-07-15 r/SimTower optimization-thread review have shipped (#393, #395 to #401); the review is diff --git a/README.md b/README.md index 2b475ac75f..69ed035323 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,9 @@ # 🏙️ Verticopolis™: a browser SimTower clone **Play it: [verticopolis.com](https://verticopolis.com)** · -[How to play](https://verticopolis.com/help/) · +[How to play](https://help.verticopolis.com/) · [Engine docs](https://docs.verticopolis.com/) · -[Release notes](https://verticopolis.com/help/changelog/) · +[Release notes](https://help.verticopolis.com/changelog/) · [Sponsor](https://github.com/sponsors/maniator) A from-scratch, browser-native homage to the classic **SimTower** (1994): a @@ -27,29 +27,29 @@ drawn in code. - **Two ways to play.** *Classic* is the 1994 game, rule for rule; *Modern* keeps it and adds what the original couldn't do. - ([Classic and Modern](https://verticopolis.com/help/classic-vs-modern/)) + ([Classic and Modern](https://help.verticopolis.com/classic-vs-modern/)) - **Every room from the original**: offices, condos, hotels, shops and restaurants, the cinema and party hall, services, the metro and the Wedding - Hall, each one drawn on the [Rooms](https://verticopolis.com/help/rooms/) + Hall, each one drawn on the [Rooms](https://help.verticopolis.com/rooms/) pages of the manual. - **Stairs, escalators and three kinds of elevator**, with cars and stops you - set yourself. ([Elevators](https://verticopolis.com/help/building/elevators/)) + set yourself. ([Elevators](https://help.verticopolis.com/building/elevators/)) - **A living tower** on one game clock: rush hours, quiet nights, people riding the cars, lights in the windows, the metro train pulling in. - ([People](https://verticopolis.com/help/tower/people/)) + ([People](https://help.verticopolis.com/tower/people/)) - **Stars, events and the TOWER**: fires, bomb threats, the VIP and the final - inspection. ([Stars and the TOWER](https://verticopolis.com/help/tower/stars/), - [Events](https://verticopolis.com/help/tower/events/)) + inspection. ([Stars and the TOWER](https://help.verticopolis.com/tower/stars/), + [Events](https://help.verticopolis.com/tower/events/)) - **Your towers, kept**: the Auto-save, a My Towers folder with classic Open and Save As windows, `.vctower` files, and the original game's `.TDT` saves (opened here, and written back out from a Classic tower). - ([Saving and loading](https://verticopolis.com/help/your-towers/saving/)) + ([Saving and loading](https://help.verticopolis.com/your-towers/saving/)) - **Installable and offline** on desktop and phone. - ([Installing and updates](https://verticopolis.com/help/your-towers/installing/)) + ([Installing and updates](https://help.verticopolis.com/your-towers/installing/)) Where a Classic tower differs from the original, on purpose or not yet, is on -[Differences from the 1994 game](https://verticopolis.com/help/differences/); +[Differences from the 1994 game](https://help.verticopolis.com/differences/); the developer's checklist is [PARITY.md](PARITY.md). ## Quick start @@ -68,12 +68,12 @@ it in one step. | Playing | Building it | | --- | --- | -| [Your first tower](https://verticopolis.com/help/first-tower/) | [CONTRIBUTING.md](CONTRIBUTING.md): setup, quality gates, tests and coverage, versioning, review | -| [Controls](https://verticopolis.com/help/controls/) (mouse, touch, keyboard) | [ARCHITECTURE.md](ARCHITECTURE.md): source layout, the frame loop, input, saves, the PWA | -| [Rooms](https://verticopolis.com/help/rooms/) | [engine-rs/README.md](engine-rs/README.md): working on the simulation | -| [Map and windows](https://verticopolis.com/help/tower/map-and-windows/) | [docs.verticopolis.com](https://docs.verticopolis.com/): the engine package, crate, API and conformance | -| [Importing and exporting](https://verticopolis.com/help/your-towers/importing-exporting/) | [docs/canon/tdt-format.md](docs/canon/tdt-format.md): the `.TDT` save format | -| [The whole manual](https://verticopolis.com/help/) | [docs/screenshots.md](docs/screenshots.md): the screenshot gallery and how it is rendered, including the [1★ to TOWER ladder](docs/screenshots/milestones/) | +| [Your first tower](https://help.verticopolis.com/first-tower/) | [CONTRIBUTING.md](CONTRIBUTING.md): setup, quality gates, tests and coverage, versioning, review | +| [Controls](https://help.verticopolis.com/controls/) (mouse, touch, keyboard) | [ARCHITECTURE.md](ARCHITECTURE.md): source layout, the frame loop, input, saves, the PWA | +| [Rooms](https://help.verticopolis.com/rooms/) | [engine-rs/README.md](engine-rs/README.md): working on the simulation | +| [Map and windows](https://help.verticopolis.com/tower/map-and-windows/) | [docs.verticopolis.com](https://docs.verticopolis.com/): the engine package, crate, API and conformance | +| [Importing and exporting](https://help.verticopolis.com/your-towers/importing-exporting/) | [docs/canon/tdt-format.md](docs/canon/tdt-format.md): the `.TDT` save format | +| [The whole manual](https://help.verticopolis.com/) | [docs/screenshots.md](docs/screenshots.md): the screenshot gallery and how it is rendered, including the [1★ to TOWER ladder](docs/screenshots/milestones/) | ## License diff --git a/docs/engine-site/title-bar.mjs b/docs/engine-site/title-bar.mjs index 9e077f736b..3e6f95cacf 100644 --- a/docs/engine-site/title-bar.mjs +++ b/docs/engine-site/title-bar.mjs @@ -1,5 +1,5 @@ // The title bar the three docs surfaces share: the player help site at -// verticopolis.com/help, the engine docs at docs.verticopolis.com, and the +// help.verticopolis.com, the engine docs at docs.verticopolis.com, and the // Rust API reference cargo doc writes under docs.verticopolis.com/rust/. // Both Starlight sites draw it with src/components/TitleBar.astro (each // site's Header override), scripts/rustdoc-chrome.mjs writes the same markup diff --git a/e2e/aboutHelpButtons.spec.ts b/e2e/aboutHelpButtons.spec.ts index d3bb35fcff..fe2d76e29e 100644 --- a/e2e/aboutHelpButtons.spec.ts +++ b/e2e/aboutHelpButtons.spec.ts @@ -68,13 +68,13 @@ test("offline, Help and About's privacy link say where the page is and open no t await context.setOffline(true); try { await pickFromHelp(page, "#btn-help"); - await expect(page.getByText("The manual needs an internet connection. It is at verticopolis.com/help.").first()).toBeVisible(); + await expect(page.getByText("The manual needs an internet connection. It is at help.verticopolis.com.").first()).toBeVisible(); await pickFromHelp(page, "#btn-about"); const about = page.getByRole("dialog", { name: /About this game/ }); await about.locator('a[data-act="privacy"]').click(); await expect(about.locator(".help-links-status")).toHaveText( - "The privacy page needs an internet connection. It is at verticopolis.com/help/privacy.", + "The privacy page needs an internet connection. It is at help.verticopolis.com/privacy.", ); await expect(about).toBeVisible(); expect(popups).toEqual([]); diff --git a/help-site/astro.config.mjs b/help-site/astro.config.mjs index d62e0e123e..5dc87eb527 100644 --- a/help-site/astro.config.mjs +++ b/help-site/astro.config.mjs @@ -1,4 +1,4 @@ -// The player help site at verticopolis.com/help: the player's manual, written +// The player help site at help.verticopolis.com: the player's manual, written // in src/content/docs/. The game shows one of its pages itself, the Classic and // Modern summary when you found a tower (src/ui/templates/compare.ts, compiled by // src/build/helpMarkdown.ts), so the two never disagree. The look is the @@ -6,17 +6,20 @@ // few help-only rules in src/styles/help.css. // // It builds into the game's dist/help/ (scripts/vercel-build.sh runs it after -// the game's own build), so /help and its pages ship with every deploy, from -// the same origin as the game. The game's service worker leaves /help/ to the -// network, so nothing here is precached. +// the game's own build), so the manual ships with every deploy of the game. +// A production build puts it at the root of help.verticopolis.com +// (VC_HELP_ORIGIN, site.mjs), which vercel.json serves from dist/help/; every +// other build keeps it under /help on the game's own host. The game's service +// worker leaves /help/ to the network, so nothing here is precached. import { readFileSync } from "node:fs"; import { execSync } from "node:child_process"; import { dirname, join, resolve } from "node:path"; import { fileURLToPath } from "node:url"; import { defineConfig } from "astro/config"; import starlight from "@astrojs/starlight"; +import { satteri } from "@astrojs/markdown-satteri"; import { GITHUB } from "../docs/engine-site/title-bar.mjs"; -import { HELP_BASE, OLD_ANCHORS, oldAnchorRedirects, sharedHead, sidebar } from "./site.mjs"; +import { HELP_BASE, OLD_ANCHORS, SITE_ORIGIN, oldAnchorRedirects, sharedHead, sidebar, siteHref } from "./site.mjs"; const site = dirname(fileURLToPath(import.meta.url)); const repo = resolve(site, ".."); @@ -32,17 +35,36 @@ try { // Outside a checkout the build still works; the SHA reads "unknown". } +/** The help pages write /help/... for a manual page and / for the game, as + * the game's own Help window reads them; this points every link in a page at + * this build's address for it ({@link siteHref}). A no-op in a /help build. */ +const siteLinks = { + name: "verticopolis-site-links", + element: { + filter: ["a"], + visit(node, ctx) { + const href = node.properties?.href; + if (typeof href !== "string") return; + const to = siteHref(href); + if (to !== href) ctx.setProperty(node, "href", to); + }, + }, +}; + export default defineConfig({ - site: "https://verticopolis.com", + site: SITE_ORIGIN, base: HELP_BASE, outDir: join(repo, "dist", "help"), trailingSlash: "ignore", + // Starlight adds its own plugins (asides, heading links) to this processor. + markdown: { processor: satteri({ hastPlugins: [siteLinks] }) }, vite: { define: { __APP_VERSION__: JSON.stringify(appVersion), __APP_SHA__: JSON.stringify(appSha), // The help site is never a tooling build (no window.game handle). __TOOLING_BUILD__: "false", + __HELP_ORIGIN__: JSON.stringify(process.env.VC_HELP_ORIGIN ?? ""), }, server: { fs: { allow: [repo] } }, }, @@ -66,6 +88,7 @@ export default defineConfig({ join(repo, "src/styles/retro-tokens.css"), join(repo, "docs/engine-site/src/styles/theme.css"), join(repo, "docs/engine-site/src/styles/title-bar.css"), + join(repo, "src/styles/menu-bar.css"), "./src/styles/help.css", ], head: [...sharedHead, { tag: "script", content: oldAnchorRedirects(OLD_ANCHORS) }], diff --git a/help-site/package-lock.json b/help-site/package-lock.json index 05de0658c9..79d569afe9 100644 --- a/help-site/package-lock.json +++ b/help-site/package-lock.json @@ -6,6 +6,7 @@ "": { "name": "verticopolis-help", "dependencies": { + "@astrojs/markdown-satteri": "0.4.9", "@astrojs/starlight": "0.42.7", "astro": "7.4.12" } diff --git a/help-site/package.json b/help-site/package.json index 7c4001805f..2be48dbcd8 100644 --- a/help-site/package.json +++ b/help-site/package.json @@ -1,7 +1,7 @@ { "name": "verticopolis-help", "private": true, - "description": "The player help site at verticopolis.com/help, a Starlight site over the help pages the game also reads", + "description": "The player help site at help.verticopolis.com, a Starlight site over the help pages the game also reads", "type": "module", "scripts": { "sync": "node scripts/sync-assets.mjs", @@ -9,6 +9,7 @@ "build": "node scripts/sync-assets.mjs && astro build" }, "dependencies": { + "@astrojs/markdown-satteri": "0.4.9", "@astrojs/starlight": "0.42.7", "astro": "7.4.12" } diff --git a/help-site/public/cards/building-bulldoze-and-undo.png b/help-site/public/cards/building-bulldoze-and-undo.png index 61f8ff6453..c90c245385 100644 Binary files a/help-site/public/cards/building-bulldoze-and-undo.png and b/help-site/public/cards/building-bulldoze-and-undo.png differ diff --git a/help-site/public/cards/building-elevators.png b/help-site/public/cards/building-elevators.png index 79464a503f..fee5c8dfbf 100644 Binary files a/help-site/public/cards/building-elevators.png and b/help-site/public/cards/building-elevators.png differ diff --git a/help-site/public/cards/building-floors-and-lobbies.png b/help-site/public/cards/building-floors-and-lobbies.png index 511d269f93..6555840908 100644 Binary files a/help-site/public/cards/building-floors-and-lobbies.png and b/help-site/public/cards/building-floors-and-lobbies.png differ diff --git a/help-site/public/cards/building-limits.png b/help-site/public/cards/building-limits.png index 2dcca9699e..63e31f28d0 100644 Binary files a/help-site/public/cards/building-limits.png and b/help-site/public/cards/building-limits.png differ diff --git a/help-site/public/cards/building-stairs-and-escalators.png b/help-site/public/cards/building-stairs-and-escalators.png index a3e2a130cc..22c77c806c 100644 Binary files a/help-site/public/cards/building-stairs-and-escalators.png and b/help-site/public/cards/building-stairs-and-escalators.png differ diff --git a/help-site/public/cards/changelog.png b/help-site/public/cards/changelog.png index 10607de88b..7e3badc95f 100644 Binary files a/help-site/public/cards/changelog.png and b/help-site/public/cards/changelog.png differ diff --git a/help-site/public/cards/classic-vs-modern.png b/help-site/public/cards/classic-vs-modern.png index adf1dd3b43..5634455744 100644 Binary files a/help-site/public/cards/classic-vs-modern.png and b/help-site/public/cards/classic-vs-modern.png differ diff --git a/help-site/public/cards/controls.png b/help-site/public/cards/controls.png index 1d102ffd43..eefb9ed8d4 100644 Binary files a/help-site/public/cards/controls.png and b/help-site/public/cards/controls.png differ diff --git a/help-site/public/cards/differences.png b/help-site/public/cards/differences.png index ac049bb381..b19b1a0632 100644 Binary files a/help-site/public/cards/differences.png and b/help-site/public/cards/differences.png differ diff --git a/help-site/public/cards/first-tower.png b/help-site/public/cards/first-tower.png index 826457cd85..d205723418 100644 Binary files a/help-site/public/cards/first-tower.png and b/help-site/public/cards/first-tower.png differ diff --git a/help-site/public/cards/index.png b/help-site/public/cards/index.png index 1ccdff606a..9893b31a27 100644 Binary files a/help-site/public/cards/index.png and b/help-site/public/cards/index.png differ diff --git a/help-site/public/cards/privacy.png b/help-site/public/cards/privacy.png index b898331060..a97891c3a3 100644 Binary files a/help-site/public/cards/privacy.png and b/help-site/public/cards/privacy.png differ diff --git a/help-site/public/cards/rooms-food-and-shops.png b/help-site/public/cards/rooms-food-and-shops.png index e10181c98a..4e4423ca75 100644 Binary files a/help-site/public/cards/rooms-food-and-shops.png and b/help-site/public/cards/rooms-food-and-shops.png differ diff --git a/help-site/public/cards/rooms-homes.png b/help-site/public/cards/rooms-homes.png index 17af04c368..facf56c6f8 100644 Binary files a/help-site/public/cards/rooms-homes.png and b/help-site/public/cards/rooms-homes.png differ diff --git a/help-site/public/cards/rooms-hotels.png b/help-site/public/cards/rooms-hotels.png index 991607bc7b..3da3093ac9 100644 Binary files a/help-site/public/cards/rooms-hotels.png and b/help-site/public/cards/rooms-hotels.png differ diff --git a/help-site/public/cards/rooms-offices.png b/help-site/public/cards/rooms-offices.png index fed895ba20..566ef2dc05 100644 Binary files a/help-site/public/cards/rooms-offices.png and b/help-site/public/cards/rooms-offices.png differ diff --git a/help-site/public/cards/rooms-services.png b/help-site/public/cards/rooms-services.png index 6bc5e2cd4d..e158d235c1 100644 Binary files a/help-site/public/cards/rooms-services.png and b/help-site/public/cards/rooms-services.png differ diff --git a/help-site/public/cards/rooms-venues.png b/help-site/public/cards/rooms-venues.png index 3f00d948c2..60cfcedbb3 100644 Binary files a/help-site/public/cards/rooms-venues.png and b/help-site/public/cards/rooms-venues.png differ diff --git a/help-site/public/cards/rooms-wedding-hall.png b/help-site/public/cards/rooms-wedding-hall.png index fe36afdd13..a18ada691c 100644 Binary files a/help-site/public/cards/rooms-wedding-hall.png and b/help-site/public/cards/rooms-wedding-hall.png differ diff --git a/help-site/public/cards/rooms.png b/help-site/public/cards/rooms.png index f5507e23dc..6322bb952e 100644 Binary files a/help-site/public/cards/rooms.png and b/help-site/public/cards/rooms.png differ diff --git a/help-site/public/cards/tower-clock.png b/help-site/public/cards/tower-clock.png index 9b9f98b7dd..47abbb6b5b 100644 Binary files a/help-site/public/cards/tower-clock.png and b/help-site/public/cards/tower-clock.png differ diff --git a/help-site/public/cards/tower-events.png b/help-site/public/cards/tower-events.png index 7efde64805..60dc9565e9 100644 Binary files a/help-site/public/cards/tower-events.png and b/help-site/public/cards/tower-events.png differ diff --git a/help-site/public/cards/tower-map-and-windows.png b/help-site/public/cards/tower-map-and-windows.png index 6ccd080c22..9ed94fa827 100644 Binary files a/help-site/public/cards/tower-map-and-windows.png and b/help-site/public/cards/tower-map-and-windows.png differ diff --git a/help-site/public/cards/tower-money.png b/help-site/public/cards/tower-money.png index eaafbef378..98ffacce2f 100644 Binary files a/help-site/public/cards/tower-money.png and b/help-site/public/cards/tower-money.png differ diff --git a/help-site/public/cards/tower-people.png b/help-site/public/cards/tower-people.png index b6dcd187ac..a8c6fc3d1e 100644 Binary files a/help-site/public/cards/tower-people.png and b/help-site/public/cards/tower-people.png differ diff --git a/help-site/public/cards/tower-ratings.png b/help-site/public/cards/tower-ratings.png index b5ef2f8aa6..0e50c79fc4 100644 Binary files a/help-site/public/cards/tower-ratings.png and b/help-site/public/cards/tower-ratings.png differ diff --git a/help-site/public/cards/tower-stars.png b/help-site/public/cards/tower-stars.png index 936ada16a4..84c022c850 100644 Binary files a/help-site/public/cards/tower-stars.png and b/help-site/public/cards/tower-stars.png differ diff --git a/help-site/public/cards/your-towers-importing-exporting.png b/help-site/public/cards/your-towers-importing-exporting.png index ed12aa2e0e..3e58870423 100644 Binary files a/help-site/public/cards/your-towers-importing-exporting.png and b/help-site/public/cards/your-towers-importing-exporting.png differ diff --git a/help-site/public/cards/your-towers-installing.png b/help-site/public/cards/your-towers-installing.png index f99483e848..4563315d79 100644 Binary files a/help-site/public/cards/your-towers-installing.png and b/help-site/public/cards/your-towers-installing.png differ diff --git a/help-site/public/cards/your-towers-saving.png b/help-site/public/cards/your-towers-saving.png index e8ec299ea9..06771ed47a 100644 Binary files a/help-site/public/cards/your-towers-saving.png and b/help-site/public/cards/your-towers-saving.png differ diff --git a/help-site/public/cards/your-towers-settings.png b/help-site/public/cards/your-towers-settings.png index b1fcb9ff74..d9a49130cf 100644 Binary files a/help-site/public/cards/your-towers-settings.png and b/help-site/public/cards/your-towers-settings.png differ diff --git a/help-site/public/robots.txt b/help-site/public/robots.txt new file mode 100644 index 0000000000..d8cf2ccb69 --- /dev/null +++ b/help-site/public/robots.txt @@ -0,0 +1,6 @@ +# The Verticopolis player's manual (https://help.verticopolis.com/). Every +# page is public; let every well-behaved crawler index it. +User-agent: * +Allow: / + +Sitemap: https://help.verticopolis.com/sitemap-index.xml diff --git a/help-site/scripts/check-links.d.mts b/help-site/scripts/check-links.d.mts index f897937d11..9fcfd7f8bc 100644 --- a/help-site/scripts/check-links.d.mts +++ b/help-site/scripts/check-links.d.mts @@ -1,2 +1,2 @@ -export function servedPath(file: string): string; -export function brokenLinks(pages: Map): string[]; +export function servedPath(file: string, base?: string): string; +export function brokenLinks(pages: Map, base?: string): string[]; diff --git a/help-site/scripts/check-links.mjs b/help-site/scripts/check-links.mjs index dcb79cb4fc..0857f69dab 100644 --- a/help-site/scripts/check-links.mjs +++ b/help-site/scripts/check-links.mjs @@ -1,13 +1,16 @@ // Checks every link between help pages in the built site (dist/help): each // page a link names exists, and each #section it names is an id on that page. -// Run after `astro build`: node help-site/scripts/check-links.mjs +// Run after `astro build`: node help-site/scripts/check-links.mjs. With +// VC_HELP_ORIGIN set, as for a build of the manual's own host, the pages sit +// at the root instead of under /help (help-site/site.mjs). import { readFileSync, readdirSync, statSync } from "node:fs"; import { join, relative, resolve, dirname } from "node:path"; import { fileURLToPath } from "node:url"; -/** The path a built page is served at: `rooms/venues/index.html` → `/help/rooms/venues/`. */ -export function servedPath(file) { - return "/help/" + file.replace(/\\/g, "/").replace(/(^|\/)index\.html$/, "$1").replace(/\.html$/, "/"); +/** The path a built page is served at: `rooms/venues/index.html` → + * `/help/rooms/venues/`, or `/rooms/venues/` when `base` is the root (""). */ +export function servedPath(file, base = "/help") { + return base + "/" + file.replace(/\\/g, "/").replace(/(^|\/)index\.html$/, "$1").replace(/\.html$/, "/"); } /** Every id on a page. */ @@ -17,15 +20,16 @@ function idsOf(html) { /** Links that point at a missing help page or a missing section, as * "from → to" lines. `pages` maps each served path to its HTML. */ -export function brokenLinks(pages) { +export function brokenLinks(pages, base = "/help") { const ids = new Map([...pages].map(([path, html]) => [path, idsOf(html)])); const broken = []; for (const [from, html] of pages) { for (const [, href] of html.matchAll(/\shref="([^"]+)"/g)) { const url = new URL(href.replace(/&/g, "&"), "https://site" + from); - if (url.origin !== "https://site" || !url.pathname.startsWith("/help/")) continue; + if (url.origin !== "https://site" || !url.pathname.startsWith(base + "/")) continue; // Built files and the catalog aren't pages. - if (/^\/help\/(_astro|pagefind)\//.test(url.pathname) || /\.[a-z0-9]+$/i.test(url.pathname)) continue; + const inSite = url.pathname.slice(base.length); + if (/^\/(_astro|pagefind)\//.test(inSite) || /\.[a-z0-9]+$/i.test(inSite)) continue; const path = url.pathname.endsWith("/") ? url.pathname : url.pathname + "/"; const target = ids.get(path); if (!target) broken.push(`${from} → ${href} (no such page)`); @@ -44,8 +48,9 @@ function walk(dir) { if (process.argv[1] && resolve(process.argv[1]) === fileURLToPath(import.meta.url)) { const root = resolve(dirname(fileURLToPath(import.meta.url)), "../../dist/help"); - const pages = new Map(walk(root).map((file) => [servedPath(relative(root, file)), readFileSync(file, "utf8")])); - const broken = brokenLinks(pages); + const base = process.env.VC_HELP_ORIGIN ? "" : "/help"; + const pages = new Map(walk(root).map((file) => [servedPath(relative(root, file), base), readFileSync(file, "utf8")])); + const broken = brokenLinks(pages, base); for (const line of broken) console.error(`::error::broken help link: ${line}`); console.log(`${pages.size} pages checked, ${broken.length} broken links`); process.exit(broken.length ? 1 : 0); diff --git a/help-site/site.d.mts b/help-site/site.d.mts index 4e718f0abe..41aaa116b0 100644 --- a/help-site/site.d.mts +++ b/help-site/site.d.mts @@ -1,6 +1,11 @@ // Types for site.mjs, for the TypeScript test that reads it // (src/tests/helpSite.test.ts). +export const HELP_ORIGIN: string; export const HELP_BASE: string; +export const GAME_ORIGIN: string; +export const SITE_ORIGIN: string; +/** A link as the help pages write it (/ for the game, /help/... for the manual) as this build serves it. */ +export function siteHref(href: string, base?: string, gameOrigin?: string): string; export const ENGINE_DOCS: string; export const GITHUB_ISSUES: string; export const SPONSOR_URL: string; @@ -12,9 +17,9 @@ export type SidebarEntry = export const sidebar: SidebarEntry[]; export function isSponsorLink(href: string): boolean; export function sponsorTapListener(track: () => void): (e: MouseEvent) => void; -export function landingAction(pathname: string, referrer: string, origin: string): "page_help" | "page_changelog" | null; +export function landingAction(pathname: string, referrer: string, origin: string, base?: string): "page_help" | "page_changelog" | null; /** The page a help page view reports: "rooms/hotels", "home" or "other". */ -export function helpPageDetail(pathname: string): string; +export function helpPageDetail(pathname: string, base?: string): string; /** Where each section of the old one-page /help went. */ export const OLD_ANCHORS: Record; export function oldAnchorRedirects(helpIds: Record): string; diff --git a/help-site/site.mjs b/help-site/site.mjs index ac61397502..a1a813ee58 100644 --- a/help-site/site.mjs +++ b/help-site/site.mjs @@ -1,8 +1,36 @@ // What the help site's config and its tests share: where it lives, its side // menu, and the script that sends an old /help#section link to its new page. -/** The site's path on verticopolis.com. */ -export const HELP_BASE = "/help"; +/** The manual's own host, help.verticopolis.com, in a production build + * (scripts/vercel-build.sh sets VC_HELP_ORIGIN there), or empty in every + * other build: a preview, staging, CI and a local build keep the manual under + * /help on the game's host, which is the only host they have. Read at build + * time; in a page's script `process` is absent and this is empty, so browser + * code takes the base from Astro (`import.meta.env.BASE_URL`) instead. */ +export const HELP_ORIGIN = globalThis.process?.env?.VC_HELP_ORIGIN ?? ""; + +/** The site's path: the root of its own host, or /help on the game's. */ +export const HELP_BASE = HELP_ORIGIN ? "" : "/help"; + +/** The game's address as the manual links it: the game's own host when the + * manual has a host of its own, else the same host (an empty prefix). */ +export const GAME_ORIGIN = HELP_ORIGIN ? "https://verticopolis.com" : ""; + +/** + * A link as the help pages write it, `/` and other root paths for the game + * and `/help/...` for the manual, as this build serves it: a manual path + * moves under {@link HELP_BASE}, and a game path goes to {@link GAME_ORIGIN}. + * Any other link (another site, a #section, a relative path) is left alone. + * The Markdown keeps writing /help/... because the game's own Help window + * reads the same files. + */ +export function siteHref(href, base = HELP_BASE, gameOrigin = GAME_ORIGIN) { + if (!href.startsWith("/") || href.startsWith("//")) return href; + const manual = href.match(/^\/help(?=[/?#]|$)(.*)$/); + if (!manual) return gameOrigin + href; + const rest = manual[1].startsWith("/") ? manual[1] : `/${manual[1]}`; + return base + rest; +} /** The engine developer docs (docs/engine-site), for players who want the * rules as code. */ @@ -26,7 +54,7 @@ export const sharedHead = [ { tag: "meta", attrs: { property: "og:image:width", content: "1200" } }, { tag: "meta", attrs: { property: "og:image:height", content: "630" } }, { tag: "meta", attrs: { name: "theme-color", content: "#c0c0c0" } }, - { tag: "link", attrs: { rel: "apple-touch-icon", href: "/apple-touch-icon.png" } }, + { tag: "link", attrs: { rel: "apple-touch-icon", href: `${GAME_ORIGIN}/apple-touch-icon.png` } }, ]; /** Starlight's sidebar. A `slug` entry takes its label from the page's title. @@ -151,10 +179,10 @@ export function sponsorTapListener(track) { /** * The analytics landing a page view counts as: `page_changelog` on the release * notes, `page_help` on any other page, or null for a step from one help page - * to another (a referrer under /help on the same site), so a visit counts once + * to another (a referrer under the site's base on the same host), so a visit counts once * however many pages it reads, as the old one-page /help did. */ -export function landingAction(pathname, referrer, origin) { +export function landingAction(pathname, referrer, origin, base = HELP_BASE) { let from = null; try { const ref = new URL(referrer); @@ -162,9 +190,9 @@ export function landingAction(pathname, referrer, origin) { } catch { // No referrer, or not a URL: a landing. } - const inSite = (path) => path === HELP_BASE || path.startsWith(HELP_BASE + "/"); + const inSite = (path) => path === base || path.startsWith(base + "/"); if (from !== null && inSite(from)) return null; - return /^\/help\/changelog\/?$/.test(pathname) ? "page_changelog" : "page_help"; + return /^\/changelog\/?$/.test(pathname.slice(base.length)) ? "page_changelog" : "page_help"; } /** The longest page path `helpPageDetail` reports; today's longest is @@ -173,7 +201,7 @@ const MAX_PAGE_DETAIL = 80; /** * The page a help page view reports in its `help_page_view` event's `detail`: - * the path under /help without its slashes ("rooms/hotels"), "home" for the + * the path under the site's base (`base`, /help or the root) without its slashes ("rooms/hotels"), "home" for the * front page, or "other" for a path that is not a plain lowercase page path. * The pattern checks only the format, so a well-formed but unknown slug * passes it. What keeps a mistyped or crafted address out of @@ -184,16 +212,17 @@ const MAX_PAGE_DETAIL = 80; * page list first. Only the path is read: the query (the game's ?from=game * mark) and the hash stay out of it. */ -export function helpPageDetail(pathname) { - const inSite = pathname === HELP_BASE || pathname.startsWith(HELP_BASE + "/"); +export function helpPageDetail(pathname, base = HELP_BASE) { + const inSite = pathname === base || pathname.startsWith(base + "/"); if (!inSite) return "other"; - const slug = pathname.slice(HELP_BASE.length).replace(/^\/+|\/+$/g, ""); + const slug = pathname.slice(base.length).replace(/^\/+|\/+$/g, ""); if (slug === "") return "home"; return slug.length <= MAX_PAGE_DETAIL && /^[a-z0-9-]+(\/[a-z0-9-]+)*$/.test(slug) ? slug : "other"; } -/** The site's address, for the structured data below. */ -const SITE_ORIGIN = "https://verticopolis.com"; +/** The site's address, for its canonical links and the structured data + * below: its own host, or the game's with the manual under /help. */ +export const SITE_ORIGIN = HELP_ORIGIN || "https://verticopolis.com"; /** The section folders and the names a breadcrumb shows for them. Only a * folder with an index page of its own (rooms) gets a crumb, since every diff --git a/help-site/src/components/Header.astro b/help-site/src/components/Header.astro index a1f5b8db30..cb614b4a8c 100644 --- a/help-site/src/components/Header.astro +++ b/help-site/src/components/Header.astro @@ -1,8 +1,10 @@ --- -// The help site's header: the shared title bar (docs/engine-site's +// The help site's header: the game's menu bar on top (MenuBar.astro), then +// the shared title bar (docs/engine-site's // TitleBar.astro, the same bar the engine docs and the Rust API reference // draw), handed this site's own Starlight search and theme switch, with its -// game button pointed at the game on this same origin. In a +// game button pointed at the game (verticopolis.com from the manual's own +// host, this same host in a /help build). In a // tab the game opened (?from=game, src/ui/fromGame.ts) that button and the // front page's Play button both read Back to game and close this tab instead // of loading a second copy of the game; the note below says so when the @@ -11,10 +13,13 @@ import Search from "@astrojs/starlight/components/Search.astro"; import ThemeSelect from "@astrojs/starlight/components/ThemeSelect.astro"; import TitleBar from "../../../docs/engine-site/src/components/TitleBar.astro"; +import MenuBar from "./MenuBar.astro"; import logo from "../assets/logo.png"; +import { siteHref } from "../../site.mjs"; --- - + + @@ -26,12 +31,15 @@ import logo from "../assets/logo.png"; import { trackAppAction } from "../../../src/analytics"; import { helpPageDetail, landingAction, sponsorTapListener } from "../../site.mjs"; + // The site's base as Astro built it: "" at the root of the manual's own + // host, "/help" on the game's. + const base = import.meta.env.BASE_URL.replace(/\/+$/, ""); injectPageTelemetry(); - const landing = landingAction(location.pathname, document.referrer, location.origin); + const landing = landingAction(location.pathname, document.referrer, location.origin, base); if (landing) trackAppAction(landing); // Every page view, landing or not, names its page, so the help pages // people read show up in PostHog and not only where they arrived. - trackAppAction("help_page_view", helpPageDetail(location.pathname)); + trackAppAction("help_page_view", helpPageDetail(location.pathname, base)); // A tap on any link to the Sponsors page counts once as sponsor_click // (help-site/site.mjs sponsorTapListener); the link itself opens as before. const noteSponsorTap = sponsorTapListener(() => trackAppAction("sponsor_click", "help")); diff --git a/help-site/src/components/MenuBar.astro b/help-site/src/components/MenuBar.astro new file mode 100644 index 0000000000..eaec762f6a --- /dev/null +++ b/help-site/src/components/MenuBar.astro @@ -0,0 +1,77 @@ +--- +// The game's Win95 menu bar across the top of every help page, above its title bar, so the manual +// looks like the game (owner, 2026-11-15). The markup matches the game's +// (src/index.html #menubar) and shares its stylesheet +// (src/styles/menu-bar.css); src/ui/helpSiteMenu.ts says what each item does, +// and each item's data-help-item is the code its pick reports. The game item +// reads "Play Verticopolis" until the script finds a tab the game opened, +// where it becomes "Back to Game". +import { GITHUB_ISSUES, SPONSOR_URL, siteHref } from "../../site.mjs"; +--- + + + + diff --git a/help-site/src/components/TitleScreen.astro b/help-site/src/components/TitleScreen.astro index 8f2ad75baa..c4d2b2b27f 100644 --- a/help-site/src/components/TitleScreen.astro +++ b/help-site/src/components/TitleScreen.astro @@ -5,6 +5,8 @@ // the game's own title screen (src/ui/splashTemplate.ts, splash.css). Starlight renders it from the page's `hero` front matter. // A button that starts the game (link "/") is marked `data-game-link`, so in a // tab the game opened it reads Back to game and closes the tab (Header.astro). +// Each link goes through siteHref, which points it at this build's address. +import { siteHref } from "../../site.mjs"; const { data } = Astro.locals.starlightRoute.entry; const { tagline, actions = [] } = data.hero || {}; --- @@ -27,7 +29,7 @@ const { tagline, actions = [] } = data.hero || {}; {actions.map((action) => ( {action.text} diff --git a/help-site/src/content/docs/rooms/index.mdx b/help-site/src/content/docs/rooms/index.mdx index 90eb17c15e..f031f8c32b 100644 --- a/help-site/src/content/docs/rooms/index.mdx +++ b/help-site/src/content/docs/rooms/index.mdx @@ -5,6 +5,7 @@ description: Every room, shop, venue and service you can build in Verticopolis, import RoomTable from "../../../components/RoomTable.astro"; import Sprite from "../../../components/Sprite.astro"; +import { siteHref } from "../../../../site.mjs"; A tower is only as good as what you put in it. Offices pay the bills, homes and hotels fill the upper floors with people, shops and restaurants feed them, and a handful of services keep the whole place safe, clean and growing. This part of the manual takes each kind of room in turn: what it costs, what it earns, what its tenants ask of you, and how it changes the rooms around it. @@ -13,13 +14,13 @@ Every number here comes straight from the game, so when the game changes, these ## The rooms, a page at a time
- - - - - - - + + + + + + +
- **[Offices](/help/rooms/offices/)** pay rent by the quarter and bring the weekday crowd. diff --git a/help-site/src/styles/help.css b/help-site/src/styles/help.css index 34c0117a19..4b8ea7e889 100644 --- a/help-site/src/styles/help.css +++ b/help-site/src/styles/help.css @@ -136,3 +136,33 @@ /* Leave room for the sticky bars and the room's own heading above the box. */ scroll-margin-top: calc(var(--sl-nav-height, 4rem) + var(--sl-mobile-toc-height, 0rem) + 4rem); } + +/* The game's menu bar (src/styles/menu-bar.css) as the top row of the fixed + header, above the navy title bar, where the game draws it: the header grows + by the bar's height, and the title bar and the phone's menu button keep + their old size and move down under it. */ +:root { + --vc-menubar-h: 24px; + --sl-nav-height: calc(3.5rem + var(--vc-menubar-h)); +} +@media (min-width: 50rem) { + :root { + --sl-nav-height: calc(4rem + var(--vc-menubar-h)); + } +} +.header { + padding-top: calc(var(--sl-nav-pad-y) + var(--vc-menubar-h)); +} +.vc-bar-title img { + height: calc(var(--sl-nav-height) - var(--vc-menubar-h) - 2 * var(--sl-nav-pad-y)); +} +.sl-menu-button { + top: calc(var(--vc-menubar-h) + (var(--sl-nav-height) - var(--vc-menubar-h) - var(--sl-menu-button-size)) / 2); +} +.help-menubar { + position: absolute; + inset-inline: 0; + top: 0; + height: var(--vc-menubar-h); + box-sizing: border-box; +} diff --git a/scripts/gen-help-cards.mjs b/scripts/gen-help-cards.mjs index 059febe3cf..f9fc5dea2b 100644 --- a/scripts/gen-help-cards.mjs +++ b/scripts/gen-help-cards.mjs @@ -58,7 +58,7 @@ function backdrop() { /** The card's page: the backdrop, the wordmark, the title, the description and the address. */ function cardHtml(page) { - const path = `verticopolis.com/help/${page.slug ? `${page.slug}/` : ""}`; + const path = `help.verticopolis.com/${page.slug ? `${page.slug}/` : ""}`; return `