No description
  • TypeScript 82.8%
  • CSS 10.9%
  • JavaScript 3.9%
  • HTML 2.4%
Find a file
amayakase 1d24c584dd Bootstrap Task 01 web foundation prototype
Set up the initial browser app scaffold with Vite, React, TypeScript, Zustand, ESLint, and project scripts for dev/build/typecheck/test. Added the Task 01 shell UI, bootstrap app state, runtime provider config loading/validation, and world-data height contracts with tests to enforce safe config handling and explicit “terrain unavailable” behavior. Updated README and docs to reflect implemented scope, validation evidence, and roadmap/decision-log status while keeping renderer/camera/gameplay work deferred.
2026-10-09 00:50:44 +02:00
apps/web Bootstrap Task 01 web foundation prototype 2026-10-09 00:50:44 +02:00
codex-tasks Add Codex-ready project specification 2026-10-09 00:43:18 +02:00
docs Bootstrap Task 01 web foundation prototype 2026-10-09 00:50:44 +02:00
.gitignore Bootstrap Task 01 web foundation prototype 2026-10-09 00:50:44 +02:00
AGENTS.md Add Codex-ready project specification 2026-10-09 00:43:18 +02:00
eslint.config.js Bootstrap Task 01 web foundation prototype 2026-10-09 00:50:44 +02:00
LICENSE Initial commit 2026-10-09 00:42:05 +02:00
package-lock.json Bootstrap Task 01 web foundation prototype 2026-10-09 00:50:44 +02:00
package.json Bootstrap Task 01 web foundation prototype 2026-10-09 00:50:44 +02:00
README.md Bootstrap Task 01 web foundation prototype 2026-10-09 00:50:44 +02:00
START-HERE-FOR-CODEX.md Add Codex-ready project specification 2026-10-09 00:43:18 +02:00
tsconfig.json Bootstrap Task 01 web foundation prototype 2026-10-09 00:50:44 +02:00

Railway Simulator — Codex-ready project specification

Status: Design baseline v0.1 · 2026-10-09 · Task 01 browser foundation implemented; gameplay and renderer pending

A worldwide, semi-3D railway construction and operating sandbox. Inspiration: the network-building scope and automatic service schedules of NIMBY Rails, the physical rail-building feel of Transport Fever 2, and the free, terrain-centered camera controls of Cities: Skylines. These are design references, not assets or code to reproduce.

North star

Build plausible real-world rail alignments on a real map, assign trains to lines, and watch the network operate automatically under honest physics, signalling, and capacity constraints. The player designs the railway, not individual timetables.

The main player loop

  1. Move around a 3D map with the free camera (default mode).
  2. Construct tracks with nodes, tangent/radius continuation, vertical profiles, and protected committed geometry.
  3. Add stations and lines. Assign a chosen number of trains; the game generates a continuous service schedule and initial evenly time-spaced positions.
  4. Trains run according to physical speed limits, braking, signal authority, and scheduled stop times, recovering delays only within available margins.
  5. Observe delays/bottlenecks, improve the layout; optionally follow any train in first or third person later.

Read this first (for Codex and developers)

Read only the topic-specific document needed for your task; do not inject the entire pack into every Codex prompt.

Documentation index

File Topic
01-PRODUCT-REQUIREMENTS.md Vision, gameplay, scope, non-goals, definitions and acceptance principles
02-FEATURE-REGISTER.md Full category-grouped feature table with P0–P3 / difficulty
03-ARCHITECTURE.md Technology choices, module boundaries, simulation loop, rendering spike
04-WORLD-DATA.md OSM, DEM, tiles, offline mode, attribution, coordinate strategy
05-CAMERA-AND-RENDERING.md Free orbit camera, later train cameras, terrain/depth/LOD
06-TRACK-EDITOR.md Node editor, curvature, snapping, immutable segments, elevation, turnouts
07-INFRASTRUCTURE.md Bridges/tunnels, proximity merging, catenary, structures
08-TRAINS-AND-PHYSICS.md Trains, carriages, speed, acceleration, braking, footprint
09-ROUTING-SIGNALLING.md Direction restrictions, pathfinding, blocks, interlocking, dispatch
10-LINES-AND-TIMETABLES.md Line generation, 24-hour service, delay recovery, resets
11-DATA-MODEL-AND-SAVES.md Entities, IDs, graph, schema concepts, save consistency
12-UX-AND-TOOLS.md Modes, controls, editing feedback, observability
13-ROADMAP.md Incremental milestones, Codex-sized tickets and acceptance gates
14-TESTING.md Invariant tests, scenario tests, smoke tests and performance targets
15-DECISIONS-AND-RISKS.md Confirmed decisions, proposals, open questions, rendering risk
16-REFERENCES.md First-party technical sources and licensing notes

Technology recommendation (conditional)

Candidate, not yet validated: TypeScript + Vite + MapLibre GL JS + Three.js + React/Zustand + Electron; Vitest/Playwright tests; SQLite saves when desktop storage is introduced; tiled map/terrain packages (e.g., PMTiles). Start in a browser and defer Electron until the renderer is proven. Gate: a real free-ground-orbit camera, very low-pitch/near-ground views, depth interaction between track meshes/buildings/terrain, and accurate 3D picking must be demonstrated before the renderer is locked in. If MapLibre camera/depth constraints are unacceptable, revisit the renderer rather than forcing gameplay compromises.

Conventions

  • Confirmed means explicitly requested by the game designer during this conversation.
  • Proposed means a recommended implementation or default, not yet a final design decision.
  • Deferred means planned as an extension, not required for the first playable build.
  • P0 = earliest prototype, P1 = core playable railway, P2 = realism/polish, P3 = later extension.
  • Difficulty = Low / Medium / High / Very High, qualitative and relative, not a calendar estimate.
  • MUST denotes a product invariant; SHOULD denotes a recommendation; MAY denotes an option.

First implementation instruction

Open codex-tasks/01-foundation.md, give it to Codex, and work one milestone at a time. This pack describes a target product; it does not imply that dependencies are installed or that a runnable repository already exists.

Run the Task 01 prototype

Prerequisite: Node.js 22.16+ (Node 22.16.0 and npm 10.9.2 used for validation). From the repository root:

npm ci
npm run dev

Open the local URL printed by Vite (normally http://127.0.0.1:5173).

Command Purpose
npm run dev Start the browser prototype on loopback
npm run typecheck Strict TypeScript validation
npm run lint ESLint and React Hooks checks
npm test Run Vitest unit tests once
npm run build Typecheck and build into apps/web/dist

Runtime provider configuration

No provider is selected by default. Optionally copy apps/web/public/runtime-config.example.json to apps/web/public/runtime-config.json (gitignored), then replace its contents:

{
  "provider": {
    "id": "your-approved-provider",
    "vectorStyleUrl": "https://example.invalid/style.json",
    "demTileJSONUrl": "https://example.invalid/dem.json",
    "attribution": "Provider credit and dataset licence text",
    "offlineAllowed": false,
    "redistributionAllowed": false
  }
}

These are illustrative endpoints, not a working provider. URLs are optional, absolute HTTP(S), without embedded username/password. Attribution and explicit permission flags are required. Use { "provider": null } for an unconfigured shell. The app loads this JSON at startup without rebuilding; after deployment, place it beside index.html. A missing file is allowed; malformed JSON or failed requests display an error. Attribution is plain text, with expandable credits. Runtime browser configuration is public: never put private API secrets here. Provider permissions must reflect verified terms; these flags do not grant rights.

Implemented scope and boundaries

Task 01 provides the viewport placeholder, status/credits, error handling, Zustand bootstrap state, provider validation and pure TypeScript GeoPoint / HeightSampler contracts. A missing height has status: unavailable and no height value; genuine 0 m terrain remains a distinct ready result.

Source lives in apps/web/src: world-data owns provider/height contracts, state owns UI bootstrap state, and React renders the shell. There are no map/DEM requests, geometry, simulation, persistence, Electron or backend services. MapLibre/Three.js and all camera claims remain deferred to Task 02 and its gate.

See Task 01 validation for evidence and the remaining browser checks.