How jasonwarrenuk/those-who-came-before works
Purpose and Status
Those Who Came Before is an archaeological artefact-discovery game whose future player interpretation system creates an unreliable narrative. The current implementation is a SvelteKit development shell plus a deterministic MVP artefact-generation pipeline; no playable game loop exists. Design and delivery authority live in docs/roadmaps/mvp.md and .claude/roadmaps.json.
Runtime, Delivery, and Entry Points
Deno runs TypeScript tasks, SvelteKit 2/Svelte 5 provides the UI, and Vite builds the application. The Deno Svelte adapter targets Deno Deploy; GitHub Pages publishing is configured separately in .github/workflows/pages.yml.
• Application shell: src/app.html, src/routes/+layout.svelte, src/routes/+page.svelte
• Runtime/dependencies: deno.json, svelte.config.js, vite.config.ts
• Development workbench route: src/routes/dev/explorer/+page.svelte
Domain Contract Layer
The type modules define the intended bounded contexts before full gameplay orchestration exists: generated artefacts/worlds, descriptions and interpretations, player lens and contradictions, scholarly careers/documents, corpus/visibility, and persistence.
• Core generated-world contracts: src/lib/types/artefact.ts, src/lib/types/world.ts, src/lib/types/grammar.ts
• Future interpretation/career boundary: src/lib/types/interpretation.ts, src/lib/types/lens.ts, src/lib/types/career.ts
• Save and publication-oriented state: src/lib/types/save.ts, src/lib/types/documents.ts, src/lib/types/corpus.ts
Deterministic Generation Foundation
Generation is seed-driven through xoshiro128**, with shared statistical utilities. Determinism permits reproducible artefacts, calibration, CLI sampling, and visual exploration. World naming/phonology is an adjacent deterministic subsystem, not yet integrated into a player loop.
• Randomness and distributions: src/lib/engine/prng.ts, src/lib/engine/statistics.ts
• World-language generation: src/lib/engine/world/naming.ts, src/lib/engine/world/phonology.ts, src/lib/engine/world/syllable.ts
• CLI stage probes: scripts/dev/sample-artefact.ts, scripts/dev/sample-materials.ts, scripts/dev/sample-classification.ts
Artefact Generation Pipeline
The primary pipeline transforms a seed and culture/phase context into a normalised artefact and derived readings:
1. Grammar selects weighted geometric components subject to culture/phase biases, complexity budgets, and accumulated constraints.
2. Plausibility validates physical and ergonomic implications.
3. Materials assign physical substances from affinity, technology, scarcity, and trade availability.
4. Decoration resolves motif layers and exchanged/introduced materials, grading execution against material properties.
• Structure and flattening: src/lib/engine/generation/grammar.ts, src/lib/data/grammars/core.ts, src/lib/data/grammars/primitives.ts
• Validation and materials: src/lib/engine/generation/plausibility.ts, src/lib/engine/generation/materials.ts, src/lib/data/materials.ts
• Decoration: src/lib/engine/generation/decoration.ts, src/lib/data/decorations.ts
Classification and Descriptions
Generated anatomy, materials, and decoration are converted into feature values, then tags scored by declarative rules. Culture-phase baseline sampling makes classifications relative to local norms rather than globally absolute. Prose then renders the artefact through distinct registers; observational templates are the current pipeline consumer.
• Feature and tag derivation: src/lib/engine/generation/classification.ts, src/lib/data/classification.ts, src/lib/engine/generation/baselines.ts
• Description assembly: src/lib/engine/generation/prose.ts, src/lib/data/descriptions/observational/index.ts
• Future interpretive/technical registers: src/lib/data/descriptions/interpretive/index.ts, src/lib/data/descriptions/technical/index.ts
Developer Exploration Boundary
/dev/explorer is a dev-only diagnostic UI, not gameplay. Its panels expose pipeline state, seed control, rule calibration, type graphs, and visual representations so generation behavior can be inspected before player-facing integration.
• Explorer coordination: src/routes/dev/explorer/+page.svelte, src/routes/dev/explorer/panels.ts, src/routes/dev/explorer/seed.ts
• Pipeline panels: src/routes/dev/explorer/structure/+page.svelte, src/routes/dev/explorer/materials/+page.svelte, src/routes/dev/explorer/tags/+page.svelte
• Calibration/shared cached baselines: src/routes/dev/explorer/calibration/ruleCalibration.ts, src/routes/dev/explorer/shared/baselineCache.ts
Architectural Gaps
The designed core loops—excavation, subjective observation filtered by lens, publishing, contradiction propagation, scholarly career/social systems, and save-backed longitudinal state—are primarily contracts and specifications, not connected runtime stages. Their intended behavior is documented in docs/03-core-loops-system-map.md, docs/06-knowledge-contradiction-model.md, and docs/07-career-social-systems.md.
Main entry points: prng.ts Seeded PRNG & statistics · grammar.ts Grammar & structure · classification.ts Features & classification · +page.svelte Pipeline & calibration panels
Components 19
Runtime & Delivery
- SvelteKit app shell · Current application entry and shell.
src/routes/+page.svelte - Deno + Vite build · Deno runtime with SvelteKit and Vite tooling.
deno.json - Deno Deploy
svelte.config.js - GitHub Pages publish · Separate static publishing configuration.
.github/workflows/pages.yml
Domain Contracts
Designed gameplay boundaries are mostly not runtime-connected.
- Artefact & world contracts · Generated-world and grammar domain model.
src/lib/types/artefact.ts - Interpretation & career contracts · Future lens, contradiction, career, corpus, and save boundaries.
src/lib/types/interpretation.ts - Future gameplay loops · Excavation, lens-filtered observation, publishing, careers, contradictions, and saves remain specified.
docs/03-core-loops-system-map.md
Deterministic Generation
- Seeded PRNG & statistics · xoshiro128** randomness and shared distributions.
src/lib/engine/prng.ts - World naming & phonology · Adjacent seed-driven language subsystem.
src/lib/engine/world/naming.ts - Grammar & structure · Selects constrained weighted geometry and flattens anatomy.
src/lib/engine/generation/grammar.ts - Physical plausibility · Validates physical and ergonomic implications.
src/lib/engine/generation/plausibility.ts - Material assignment · Assigns substances from affinity, technology, scarcity, and trade.
src/lib/engine/generation/materials.ts - Decoration resolution · Applies motifs, exchange materials, and execution grade.
src/lib/engine/generation/decoration.ts - Features & classification · Derives features and relative tags using culture-phase baselines.
src/lib/engine/generation/classification.ts - Observational prose · Renders current observational descriptions.
src/lib/engine/generation/prose.ts - CLI sampling probes · Samples artefacts, materials, and classifications.
scripts/dev/sample-artefact.ts
Developer Explorer
Diagnostic workbench, not player gameplay.
- /dev/explorer · Coordinates seed control, pipeline inspection, and visual diagnostics.
src/routes/dev/explorer/+page.svelte - Pipeline & calibration panels · Structure, materials, tags, and rule calibration views.
src/routes/dev/explorer/structure/+page.svelte
Other components
- MVP roadmap · Defines current delivery scope and intended systems.
docs/roadmaps/mvp.md
Connections 23
- MVP roadmap → SvelteKit app shell: scopes
- MVP roadmap → Future gameplay loops: plans
- Deno + Vite build → SvelteKit app shell: runs and builds
- Deno + Vite build → Deno Deploy: targets
- Deno + Vite build → GitHub Pages publish: also publishes via
- Artefact & world contracts → Grammar & structure: models
- Artefact & world contracts → Features & classification: types
- Interpretation & career contracts → Future gameplay loops: defines boundaries for
- Seeded PRNG & statistics → World naming & phonology: seeds
- Seeded PRNG & statistics → Grammar & structure: drives selection
- Grammar & structure → Physical plausibility: structured artefact
- Physical plausibility → Material assignment: validated structure
- Material assignment → Decoration resolution: material context
- Decoration resolution → Features & classification: derived anatomy and surface data
- Features & classification → Observational prose: features and tags
- Seeded PRNG & statistics → CLI sampling probes: reproducible sampling
- Observational prose → CLI sampling probes: sample output
- SvelteKit app shell → /dev/explorer: hosts route
- /dev/explorer → Pipeline & calibration panels: coordinates
- Seeded PRNG & statistics → /dev/explorer: seed control
- Grammar & structure → Pipeline & calibration panels: structure inspection
- Material assignment → Pipeline & calibration panels: material inspection
- Features & classification → Pipeline & calibration panels: tag calibration