AI-native historical interactive fiction. Enter the dreams of great pre-Qing historical figures, make hard choices at the turning points of their lives, and create your own shareable dream levels with AI. Creators can start from the official cast or define a custom pre-Qing historical figure.
Play the live demo · Read the architecture · View the roadmap
Most AI story products feel like chat. Most interactive fiction tools require a lot of authoring work. Dameng Qiangu sits between them:
- AI generates structured
DreamLeveldata, not executable code. - A deterministic game engine owns nodes, choices, stats, endings, and sharing.
- Official dreams are hand-authored, so the game is playable without any AI proxy.
- User-created dreams stay in
localStorageby default and can be shared through compressed URL links. - The theme is intentionally focused: great historical figures before the Qing dynasty.
The MVP ships with six official dreams:
| Figure | Era | Official dream |
|---|---|---|
| Confucius | Spring and Autumn | Apricot Altar: Asking Ritual |
| Qu Yuan | Warring States | The Waking Soul at Miluo |
| Zhuge Liang | Three Kingdoms | The Last Lamp at Wuzhang Plains |
| Li Bai | Tang | Drunken Moon over Chang'an |
| Yue Fei | Song | Iron Cavalry at Wind-Wave Pavilion |
| Wang Yangming | Ming | The Heart-Lamp at Longchang |
Each dream has 5-7 nodes, 2-4 choices per node, five mutable stats, and at least three reachable endings. Every choice now produces an immediate story consequence called Echo of the Last Thought, so different routes feel more dramatic even before the final ending.
Creators choose an official figure or define a custom pre-Qing historical figure, then set the theme, tone, length, and extra notes. The Vercel API proxy asks OpenAI for strict JSON and the frontend validates the result with Zod before saving it.
The AI is limited to:
- pre-Qing historical figure dreams,
- official or custom historical figures,
- structured
DreamLevelJSON, - playable branching nodes and endings,
- narrative text only, never executable logic.
Without a configured AI proxy, players can still play official dreams and save a local sample dream.
- Frontend: Vite, React, TypeScript, Tailwind CSS
- Validation: Zod schemas for all dream data
- Sharing:
lz-stringcompressed URL hash payloads - AI proxy: Vercel Serverless Function + OpenAI Responses API Structured Outputs
- Testing: Vitest and Playwright
- Hosting: GitHub Pages for the static app
npm install
npm run devRun the main checks:
npm run build
npm run test
npm run lint
npm run test:e2eThe frontend never stores an OpenAI API key. Deploy api/generate-dream.ts to Vercel and configure:
OPENAI_API_KEY=your_openai_key
OPENAI_MODEL=gpt-4o-mini
ALLOWED_ORIGIN=https://your-github-username.github.ioThen set the frontend variable:
VITE_AI_PROXY_URL=https://your-vercel-project.vercel.app/api/generate-dreamFor GitHub Pages, add VITE_AI_PROXY_URL as a repository variable so the deploy workflow can inject it during build.
api/generate-dream.ts # Vercel AI proxy
public/covers/ # Official SVG cover art
src/App.tsx # Hash-routed app shell
src/data/dreams.ts # Official dream levels
src/data/figures.ts # Historical figure catalog
src/lib/game.ts # Deterministic game engine
src/lib/schemas.ts # Zod schema contracts
src/lib/share.ts # URL sharing codec
src/lib/storage.ts # localStorage persistence
tests/unit/game.test.ts # Engine/schema/share tests
tests/e2e/app.spec.ts # Core browser flows
- V1: Supabase login, public dream plaza, likes, collections, moderation states.
- V1.5: Creator pages, remix flow, graph editor, quality scoring.
- V2: More pre-Qing figures, hidden endings, achievements, figure traits.
- V3: Creator marketplace, monetization experiments, full moderation workflow.
Good first contributions:
- Add a new pre-Qing official dream.
- Improve the mobile reading experience.
- Add validation for edge-case dream graphs.
- Expand Playwright coverage for sharing and creation flows.
- Improve English translations for the official dreams.
Read CONTRIBUTING.md before opening a pull request.
MIT. See LICENSE.