Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
The diff you're trying to view is too large. We only load the first 3000 changed files.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ coverage
.local
/public/sprites/
/docs/art/review/*.png
/tools/sprites/.build/
3 changes: 2 additions & 1 deletion AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ OpenCoaster: browser-based, clean-room theme-park management game. Read CONTRIBU
- `predev` and `prebuild` run `tools/art/prepare.ts` and `tools/art/pack-cli.ts`. The smoke and e2e Playwright servers use `pnpm dev`; CI and GitHub Pages use `pnpm build`, so these paths prepare sprites automatically. `pnpm smoke:subpath` also builds before serving the generated output.
- Vite excludes `public/sprites/**` from its dev watcher because generation writes many files. The files remain available to the server and production build.
- See [tools/art/README.md](tools/art/README.md) for the art pipeline and regeneration details.
- Runtime sprites, atlases and manifests exist only in ignored paths. The committed generated files are the scenario previews in `public/scenario-previews/` (rewritten by `predev`/`prebuild` only when they change) and the documentation images and coverage tables listed in CONTRIBUTING.md. PR proof captures go to the PR or the `nori/pr-proofs` branch, not `main`. E2e specs save screenshots with `docsScreenshot` ([e2e/support/docs-screenshot.ts](e2e/support/docs-screenshot.ts)): test output by default, committed docs images with `UPDATE_SCREENSHOTS=1`. See "Where files go" in CONTRIBUTING.md.

## Conventions

Expand All @@ -44,4 +45,4 @@ OpenCoaster: browser-based, clean-room theme-park management game. Read CONTRIBU
- Renderers read `Snapshot`/`MapData` only, never sim state.
- Comments describe the code, not its history. Prefer third-party libraries to hand-rolled ones (ask before adding a dependency).
- Never push to `main`; PRs only. Never commit original game assets or copied OpenRCT2 code.
- GitHub session tokens cannot push `.github/workflows/`; ask an admin-elevated session to change CI (`.github/workflows/ci.yml`).
- Changes under `.github/workflows/` need a maintainer with workflow permission; automation tokens without the `workflows` scope cannot push them.
11 changes: 11 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,17 @@ OpenCoaster re-implements the _gameplay ideas_ of 1999–2004 era roller-coaster

If unsure whether something is allowed, ask in the PR before merging.

## Where files go

| Kind | Examples | Rule |
| -------------------- | ----------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Source art | `tools/art/source/` sheets, `tools/art/prompts/`, `tools/sprites/` models and generators | Commit. Never original game assets. |
| Generated output | `public/sprites/`, `dist/`, `tools/sprites/.build/`, `.local/` | Ignored; `pnpm dev` and `pnpm build` regenerate it. Never commit. |
| Scenario previews | `public/scenario-previews/` | Commit. `pnpm dev` and `pnpm build` rewrite them only when scenario data changes; commit the result with that change. |
| Test fixtures | root `*-fixture.html` pages loaded by e2e/smoke on the dev server, `e2e/support/` save builders | Commit. Keep fixture URLs stable. |
| Documentation images | `docs/screenshots/`, `docs/playtest/assets/`, `docs/art/` contact sheets | Commit. Refresh deliberately with the generating command (`UPDATE_SCREENSHOTS=1`, a spec's documented output variable, `pnpm sprites:*`, `art:coverage`); do not add one-off review captures here. |
| Review artifacts | PR before/after proof captures | Attach to the PR or push to the `nori/pr-proofs` branch, never `main`. Specs write to Playwright output under `.local/`. |

## Workflow

- Never push to `main`; branch and open a PR. CI must pass: lint, format, typecheck, test, build.
Expand Down
2 changes: 1 addition & 1 deletion docs/DECISIONS.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,4 +82,4 @@ Source: [fidelity/rides.md](fidelity/rides.md). All of these are named constants

- Each workstream owns its module directory under `src/sim/<module>` (or `src/render`, `src/ui`). Edits to `src/sim/core` (World, Command union, constants, `SYSTEM_ORDER`) must be small and additive; rebase on `main` before opening a PR.
- Every PR keeps `pnpm lint`, `format:check`, `typecheck`, `test`, `build` and `bench --guests 5000` green, and adds determinism tests (same seed, same `hashWorld`).
- Sessions cannot push `.github/workflows/`; ask the coordinator for CI changes.
- Changes under `.github/workflows/` need a maintainer with workflow permission; automation tokens without the `workflows` scope cannot push them, so propose CI changes in the PR description.
Binary file removed docs/art-scale/after-desktop-canvas2d.png
Binary file not shown.
Binary file removed docs/art-scale/after-desktop.png
Binary file not shown.
Binary file removed docs/art-scale/after-pixel.png
Binary file not shown.
Binary file removed docs/art-scale/before-desktop-canvas2d.png
Binary file not shown.
Binary file removed docs/art-scale/before-desktop.png
Binary file not shown.
Binary file removed docs/art-scale/before-pixel.png
Binary file not shown.
Binary file removed docs/audio-evidence/after-bed-only.wav
Binary file not shown.
Binary file removed docs/audio-evidence/after-ride-music.wav
Binary file not shown.
Binary file removed docs/audio-evidence/before-ride-static.wav
Binary file not shown.
Binary file removed docs/audio-evidence/options-sound.png
Binary file not shown.
Binary file removed docs/audio-evidence/spectrogram-before-after.png
Binary file not shown.
2 changes: 1 addition & 1 deletion docs/mechanics/rides.md
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ Suggested dispatch state machine (design, not a claimed engine formula): `Closed
- Common documented failure names include safety cut-out/emergency stop, restraints stuck open/closed, vehicle malfunction, brakes failure, and control failure; some rides have a subset, and some do not break down. RCT1 labels the station-brake failure differently; RCT2 calls it brakes failure. **Confidence: single fan wiki.**
- Crash reports describe high-speed collisions and track/design failures; one fan wiki gives a combined collision speed threshold of 30 mph / 48 km/h. Treat this number as unverified. Station/brakes failure can remove normal stopping behavior and cause a collision. **Confidence: single source; exact threshold open.**
- Crashes can kill/remove riders, close the ride, and create a lasting safety/reputation consequence; repair/reopen behavior and guest fear should be modeled as distinct from ordinary breakdown recovery. **Confidence: single fan wiki.**
- The implemented model (gap 4 in [gap-audit.md](gap-audit.md)) follows OpenRCT2 `src/openrct2/ride/Ride.cpp`, `ride/rtd/*` and `entity/Staff.cpp` for behaviour only: reliability on a 0-25,855 scale checked every 256 ticks for open rides, per-type unreliability plus an age penalty, a `25,857 - reliability` roll out of 2^21, per-type breakdown sets, a repair that restores reliability, and downtime kept as eight 8192-tick windows. The sim runs 40 ticks/s like RCT2, so RCT2 tick counts apply unconverted (an inspection minute is 2048 ticks). Constants are in [DECISIONS.md](DECISIONS.md). Repair durations, explosion/crash behaviour, and RCT2's extra unreliability terms are not sourced or not modelled; do not claim exact RCT probabilities until measured. **Confidence: behaviour read from public source; not verified against vanilla RCT2.**
- The implemented model (gap 4 in [gap-audit.md](gap-audit.md)) follows OpenRCT2 `src/openrct2/ride/Ride.cpp`, `ride/rtd/*` and `entity/Staff.cpp` for behaviour only: reliability on a 0-25,855 scale checked every 256 ticks for open rides, per-type unreliability plus an age penalty, a `25,857 - reliability` roll out of 2^21, per-type breakdown sets, a repair that restores reliability, and downtime kept as eight 8192-tick windows. The sim runs 40 ticks/s like RCT2, so RCT2 tick counts apply unconverted (an inspection minute is 2048 ticks). Constants are in [DECISIONS.md](../DECISIONS.md). Repair durations, explosion/crash behaviour, and RCT2's extra unreliability terms are not sourced or not modelled; do not claim exact RCT probabilities until measured. **Confidence: behaviour read from public source; not verified against vanilla RCT2.**

### 2.6 Ride catalog and capacity

Expand Down
3 changes: 0 additions & 3 deletions docs/pr-proofs/ambient-trees/README.md

This file was deleted.

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed docs/proofs/rct2-economy-six-month-finances.png
Binary file not shown.
7 changes: 2 additions & 5 deletions e2e/area-tools.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { mkdir } from 'node:fs/promises';
import { test } from './support/test';
import type { Locator, Page } from './support/test';
import { docsScreenshot } from './support/docs-screenshot';
import { ElementType, PathFlag } from '../src/sim/map/tile-map';
import type { TileMap } from '../src/sim/map/tile-map';
import {
Expand Down Expand Up @@ -92,10 +92,7 @@ function benchAt(map: TileMap, x: number, y: number): boolean {
/** Writes to the test output; set UPDATE_SCREENSHOTS=1 to refresh the committed copies. */
async function shot(page: Page, name: string, mobile: boolean): Promise<void> {
const file = `${mobile ? 'pixel-8' : 'desktop'}-${name}.png`;
if (process.env.UPDATE_SCREENSHOTS) {
await mkdir(SHOTS, { recursive: true });
await page.screenshot({ path: `${SHOTS}/${file}` });
} else await page.screenshot({ path: test.info().outputPath(file) });
await docsScreenshot(page, `${SHOTS}/${file}`);
}

for (const profile of ['desktop', 'pixel-8'] as const) {
Expand Down
7 changes: 3 additions & 4 deletions e2e/deferred-ui.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { expect, test } from './support/test';
import { mkdir } from 'node:fs/promises';
import { docsScreenshot } from './support/docs-screenshot';

test('management windows, desktop resizing, options and screenshot shortcut', async ({ page }) => {
await page.setViewportSize({ width: 1280, height: 800 });
Expand All @@ -16,8 +16,7 @@ test('management windows, desktop resizing, options and screenshot shortcut', as
.filter({ hasText: 'Starter Park' })
.getByRole('button', { name: 'Start', exact: true })
.click();
await mkdir('docs/screenshots', { recursive: true });
await page.screenshot({ path: 'docs/screenshots/deferred-ui-before.png' });
await docsScreenshot(page, 'docs/screenshots/deferred-ui-before.png');

const toolbar = page.locator('.game-toolbar');
await toolbar.getByRole('button', { name: 'Staff', exact: true }).click();
Expand Down Expand Up @@ -64,7 +63,7 @@ test('management windows, desktop resizing, options and screenshot shortcut', as
const afterWidth = await guestWindow.evaluate((el) => el.getBoundingClientRect().width);
expect(afterWidth).toBeGreaterThan(beforeWidth);

await page.screenshot({ path: 'docs/screenshots/deferred-ui-after.png' });
await docsScreenshot(page, 'docs/screenshots/deferred-ui-after.png');
const screenshot = page.waitForEvent('download');
await page.keyboard.press('Control+s');
const download = await screenshot;
Expand Down
4 changes: 2 additions & 2 deletions e2e/docs.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ Path: @/e2e
- When enabled with `E2E_RUN_YEAR=1`, the final stage runs at 4× speed until the year-one outcome dialog appears and captures whether the objective was met or missed.
- Scenario startup centers the camera on the park gate and up to three contiguous inward entrance-path tiles; when entrance coordinates are unavailable, it falls back to the map center. The playtest derives the Starter Park continuation tile from its scenario definition so the path action stays aligned with the configured entrance.
- [land-tool.spec.ts](land-tool.spec.ts) drives the Land window on desktop and emulated Pixel 8 through the UI only: hover previews (corner, edge, tile, 3×3), price tooltip, refusals with reasons, tap, drag up and down, flatten, smooth, and checks the saved game against what the preview announced. Tiles are located by calibrating on the overlay diamond under the pointer rather than reading the camera; phones centre the camera below the target because the tool sheets cover the lower half of the full-screen canvas.
- [area-tools.spec.ts](area-tools.spec.ts) drives the Clear scenery and Water windows on desktop and emulated Pixel 8 through the UI only: a Clear sweep previews and removes trees and path additions for the tooltip's price, Clear refuses unowned land, and Water refuses to cover a footpath. Results are checked against the saved game and HUD cash, and before/after screenshots are written to [docs/screenshots/area-tools](../docs/screenshots/area-tools).
- [area-tools.spec.ts](area-tools.spec.ts) drives the Clear scenery and Water windows on desktop and emulated Pixel 8 through the UI only: a Clear sweep previews and removes trees and path additions for the tooltip's price, Clear refuses unowned land, and Water refuses to cover a footpath. Results are checked against the saved game and HUD cash, and before/after screenshots refresh the committed copies in [docs/screenshots/area-tools](../docs/screenshots/area-tools) only with `UPDATE_SCREENSHOTS=1`.
- [water-basin.spec.ts](water-basin.spec.ts) imports the staged terrain of [support/water-scenes.ts](support/water-scenes.ts) and, on desktop and Pixel 8, fills a dug-out basin into a flat lake up to its rim, checks the spill refusal, drains it with Lower, and drives drag-to-repeat. [water-frames.spec.ts](water-frames.spec.ts) is a capture tool for review frames (flat land, dip, lake bank, shore with paths and trees, slope, map edge, all four rotations); it only runs with `WATER_FRAMES_DIR` set and its output is never committed.
- [context-menu.spec.ts](context-menu.spec.ts) right-clicks Meadowbrook Green's prebuilt rides: in Select the browser menu is suppressed (`defaultPrevented`) and the ride window opens, and with the Patrol tool a right-click removes the patrol tile.
- [support/park.ts](support/park.ts) holds helpers shared by the Land and area tool specs and the context-menu spec: starting a scenario, building a local copy of the scenario's world to find tiles, centring the camera on a tile, calibrating tile positions from the overlay diamond, hovering until a preview appears, reading HUD cash, and loading the exported save.
Expand All @@ -66,7 +66,7 @@ Path: @/e2e
- Scenario startup centers the camera on the park gate and up to three contiguous inward entrance-path tiles; when entrance coordinates are unavailable, it falls back to the map center. The playtest derives the Starter Park continuation tile from its scenario definition so the path action stays aligned with the configured entrance.
- `pnpm e2e` runs against the Vite development server and does not build the app. The Starter Park save round-trip completes without advancing a full year; set `E2E_RUN_YEAR=1` to opt into the longer year-one objective outcome run.
- Manual browser contexts must use `createTestContext`; the shared auto fixture closes registered contexts between tests. This prevents contexts and their WebGL resources from accumulating across the single-worker suite.
- Repository screenshots captured by the UI flow are stored in [docs/screenshots](../docs/screenshots). The Starter Park ride-access runs attach their screenshots to the Playwright report; those attachment files are test artifacts rather than committed repository assets. P1 construction and ride-window before/after images are committed in [docs/playtest/assets](../docs/playtest/assets).
- Specs that keep committed documentation images (area tools, deferred UI, P1 UI fidelity, land ownership) capture through `docsScreenshot` in [support/docs-screenshot.ts](support/docs-screenshot.ts). It writes to the test output directory by default, so ordinary runs leave the working tree unchanged; `UPDATE_SCREENSHOTS=1` instead writes the committed copies under [docs/screenshots](../docs/screenshots) and [docs/playtest/assets](../docs/playtest/assets). Capture specs with their own output variable (such as `README_SHOT_DIR` or `FOOTPRINT_SHOTS_DIR`) write committed images only when it is set; all other captures, such as the Starter Park ride-access attachments and the placement-ghost screenshots, stay in the test output.
- The README screenshot spec launches Chromium with `--disable-accelerated-2d-canvas` and `--disable-gpu-rasterization`: a developed park loads every flat-ride sprite page, which otherwise exhausts browser memory.
- WebGL2 under headless SwiftShader can crash the page on whole-map views of the larger parks (remixed or not), so hard-park proof shots of built parks are taken with `CANVAS2D=1`.
- Mobile profiles and SwiftShader are browser emulation; their screenshots and FPS samples verify the browser integration path but do not characterize physical phone GPU performance.
Expand Down
Binary file removed e2e/evidence/after-iphone15.png
Binary file not shown.
Binary file removed e2e/evidence/before-iphone15.png
Binary file not shown.
5 changes: 3 additions & 2 deletions e2e/land-ownership.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { devices, expect, test, type Page } from './support/test';
import { docsScreenshot } from './support/docs-screenshot';
import { createTestContext } from './support/test-contexts';

async function startStarterPark(page: Page): Promise<void> {
Expand Down Expand Up @@ -63,7 +64,7 @@ test('shows land rights in Park information with purchase prices and distinct sa
).not.toBe(
await rightsSwatch.evaluate((node) => getComputedStyle(node).getPropertyValue('--sale-color')),
);
await page.screenshot({ path: 'docs/playtest/assets/p1-land-rights-after.png' });
await docsScreenshot(page, 'docs/playtest/assets/p1-land-rights-after.png');

const buyLand = landRights.getByRole('button', { name: 'Buy land' });
const landOffer = landRights.locator('.land-rights-count').nth(0);
Expand Down Expand Up @@ -131,7 +132,7 @@ test('shows an explanatory red build preview while hovering over unowned land',
return redPixels;
});
expect(redPreviewPixels).toBeGreaterThan(0);
await page.screenshot({ path: 'docs/playtest/assets/p1-unowned-hover-after.png' });
await docsScreenshot(page, 'docs/playtest/assets/p1-unowned-hover-after.png');

await page.getByRole('button', { name: 'Land', exact: true }).click();
await page.mouse.move(x, y);
Expand Down
5 changes: 3 additions & 2 deletions e2e/p1-ui-fidelity.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { writeFile } from 'node:fs/promises';
import { readFileSync } from 'node:fs';
import { expect, test, type Page, type TestInfo } from './support/test';
import { docsScreenshot } from './support/docs-screenshot';
import { World } from '../src/sim/core/world';
import { parseScenarioFile } from '../src/sim/scenario/scenario-file';
import { prepareScenario } from '../src/sim/scenario/scenario-layout';
Expand Down Expand Up @@ -96,7 +97,7 @@ test('desktop construction controls fit above the fold', async ({ page }, testIn
const build = await panel.getByRole('button', { name: 'Build piece' }).boundingBox();
expect(build).not.toBeNull();
expect(build!.y + build!.height).toBeLessThanOrEqual(800);
await page.screenshot({ path: 'docs/playtest/assets/p1-after-coaster-controls.png' });
await docsScreenshot(page, 'docs/playtest/assets/p1-after-coaster-controls.png');

await page.getByRole('button', { name: 'Pause', exact: true }).click();
await expect(panel.getByRole('button', { name: 'Build piece' })).toBeEnabled();
Expand All @@ -113,7 +114,7 @@ test('desktop construction controls fit above the fold', async ({ page }, testIn
await page.locator('[data-panel="ride-list"] .list-row').first().click();
await expect(page.locator('[data-panel="ride-0"] .ride-preview')).toBeVisible();
await expect(page.locator('[data-panel="ride-0"] [role="tab"]')).toHaveCount(8);
await page.screenshot({ path: 'docs/playtest/assets/p1-after-ride-preview.png' });
await docsScreenshot(page, 'docs/playtest/assets/p1-after-ride-preview.png');
});

test('options controls stay above the status bar', async ({ page }) => {
Expand Down
Loading
Loading