A House Divided A House DividedDocumentation
Changelog
Game Design/Platform

Wiki System

Last updated 2026-08-21
Source files

Overview#

The Wiki System provides in-game documentation and strategy guides. Page content is authored as TypeScript under src/lib/seeds/wiki/ and seeded into the wikiPages collection. It is not synced live from Markdown at runtime.

This ahd-docs repository is a separate developer-facing documentation site. Its build imports the game's seeded wiki pages for a read-only mirror, then renders the Markdown files under design/, engineering/, and api/. Editing one source does not update the other: player-facing mechanics belong in the AHDGame wiki seed, while implementation and integration documentation belongs here.

Location: src/lib/wiki/ (runtime read/search/render), src/lib/seeds/wiki/ (page content + seeding)

Key files:

Wiki Page Configuration#

Pages are configured in WIKI_SEED_PAGES array (), aggregated from category files in src/lib/seeds/wiki/pages/*.ts:

export const WIKI_SEED_PAGES: readonly WikiSeedPage[] = [
  ...gettingStartedPages,
  ...electionsPages,
  ...legislaturesPages,
  ...partiesPages,
  ...countriesPages,
  ...militaryPages,
  ...economyPages,
  ...advancedPages,
  ...resourcesPages,
  ...commoditiesPages,
  ...iterationsPages,
];

Each WikiSeedPage () defines:

Categories#

Pages are organized into categories:

Category Purpose
getting-started New player onboarding and first steps
elections Primaries, generals, campaigns, and election history
legislatures Bills, voting, chamber leadership, and government formation
parties Parties, coalitions, endorsements, and NPP behavior
countries Country hubs and country-specific rules
military Conflicts, armed forces, occupation, and peace
economy Corporations, budgets, banking, currency, and finance
commodities Generated commodity-market reference pages
resources Deposits, extraction contracts, subsidies, and tariffs
advanced Strategy and detailed system references
iterations Historical recaps of numbered game iterations
reference Miscellaneous reference material
custom-pages, characters, corporations, player-parties, events Community-authored namespaces

Pages with featured: true are highlighted on the wiki home page:

Special Routes#

Some slugs use custom UI instead of markdown rendering. These special live routes are handled by dedicated page components and cannot be overridden by markdown files:

Content Seeding#

Wiki content lives as TypeScript WikiSeedPage objects (not markdown files) under src/lib/seeds/wiki/pages/*.ts, aggregated in WIKI_SEED_PAGES () and written to wikiPages by the seeder (, index.ts). Editing a page means editing its WikiSeedPage entry and re-seeding, there is no admin-panel "sync from docs/design" action.

Slug Migration#

syncPriorWikiSubmissions(db, moderatorId)#

Purpose: Rename legacy ObjectId-embedded wiki slugs to their current sequentialId-based form ().

Logic:

  1. Find every wikiPages document whose slug matches player-{hex}, corp-{hex}, or party-profile-{hex} (24-hex ObjectId).
  2. Resolve the embedded ObjectId to the live character/corporation/party and look up its sequentialId.
  3. Skip (recording a reason) if the entity no longer exists, has no sequentialId, or the new slug is already taken.
  4. Otherwise rename the page's slug to the current playerWikiSlug() / corporationWikiSlug() / partyWikiSlug() form.

Returns:

interface SyncPriorSubmissionsResult {
  renamed: SyncPriorRenamed[]; // { oldSlug, newSlug, kind }
  skipped: SyncPriorSkipped[]; // { oldSlug, reason }
}

This is a one-way cleanup pass for stale slugs, not a content-sync mechanism.

Wiki Page Schema#

interface WikiPage {
  _id: ObjectId;
  slug: string; // Unique identifier
  title: string;
  description: string;
  content: string; // Markdown content
  status: "draft" | "pending_review" | "published" | "archived";
  submittedBy: ObjectId; // User who created/edited
  tags: string[];
  featured: boolean;
  isAutoGenerated: boolean;
  editHistory: EditHistoryEntry[];
  createdAt: Date;
  updatedAt: Date;
}

interface EditHistoryEntry {
  userId: ObjectId;
  timestamp: Date;
  action: "created" | "edited" | "approved" | "rejected" | "archived";
  note?: string;
}

Auto-Update Triggers#

The wiki can auto-update on game events:

Election Results#

When elections resolve, wiki pages can be updated with new results.

Leadership Changes#

When party leadership or government leadership changes, relevant pages update.

Learning Paths#

Wiki pages can be organized into learning paths for new players:

  1. Getting Started Path:

    • getting-startedcore-systemsplayer-progressionstats-actions
  2. Elections Path:

    • election-mechanicscampaign-strategydemographics-targetingfundraising-ads
  3. Strategy Path:

    • state-level-powerparty-buildingmeta-strategymin-maxing

Integration Points#

API Routes#

Wiki pages are served via API:

GET / api / wiki / { slug };

Server Components#

Wiki data is fetched in server components:

const pageData = await getWikiPageData(slug);

Admin Panel#

Admins can trigger the legacy-slug rename pass (syncPriorWikiSubmissions) and manage page publish status from the admin panel.

Content Authoring#

Wiki page content is authored as WikiSeedPage TypeScript objects, organized by category file under src/lib/seeds/wiki/pages/. Long-form text usually lives in src/lib/seeds/wiki/content/ and is imported by its page record. The standalone docs in this repository are a separate developer-facing reference and do not propagate to the in-game wiki automatically.

Content Guidelines#

Featured pages should:

Categories#

Choose the most specific category:

Tags#

Tags enable cross-category discovery: