Turning a novel into a game is a road where “generation” is the cheapest thing available. Give a model a passage and it will produce plausible dialogue, scene description, even a whole side quest. What actually blocks you is a different class of question: in chapter 137, is this person in the room? Who said this line? Does he know that yet?

Get those wrong and everything downstream is wrong. A misattributed line teaches the character card the wrong voice; a missing name in a scene lets an NPC talk about something they never witnessed; a missing knower turns into a spoiler the moment the player asks. That is why chinese-novel-to-game puts its engineering weight on stage ② (extraction) and stage ⑤ (the ledger), not stage ⑥ (the game).

10stages
8gates
38offline tests
1,646chapters (largest)

Swap “convincing” for “sourced”

A line a model writes can read well and still be useless to a system. If an NPC is going to remember saying it, you first have to show that the line exists in the text, that this character said it, and that they were present when it happened.

Every stage of this skill produces the same kind of thing: intermediate data that the next stage can cite and a person can spot-check — not more prose. There is one test that matters: rerun it on another machine with another person and get the same checkable result.

Ten stages

One command per stage, each with its own artifact and gate. ⑤ comes before ④ because character cards consume the ledger's “who was present, who knew”.

StageWhat it doesArtifactGate
⓪ ProfileNarrative person, quote style, line wrapping, dialogue sharebook.json profileevery suggested value sampled against the text
① CleanEncoding, noise, repair, chapter split, numbering auditchapters.jsonlchapter count explainable, no dialogue deleted
② ExtractEntities, scene presence, speaker per quote, events, facts with knowersbuild/extract/*.jsoncoverage 1 · cue disagreement ≤2% · unverified ≤2%
③ ConsolidateAlias merge, tiers, lexicon, map nodescharacters.json · userdict.txt · places.jsonS tiers exist, protagonist found, goldens pass
⑤ LedgerWho knows which fact, from which chapterledger.jsonwitness_not_present ≤5%
④ CardsOne card per main character per story stagecards/<id>.jsoncoverage 1 · no rewrites pending · no leaks
⑥ GameScenes become readable beats, anchors, mapgame.jsonnode coverage, play share, anchor count
⑥b DesignStats, goal, intel, one choice per anchordesign.jsoncanon survives · winnable · losable
⑦ LooksDescriptions into enumerated appearance parameterslooks.jsonvalidator replaces illegal values and logs them
⑧ AcceptSpoiler and memory probes, manual playprobe_report.jsonall probes pass

① Cleaning: decide what not to delete

Before splitting chapters, profile the book. Is narration first person or third, are quotes curly or ASCII, is the body hard-wrapped at a fixed width, how much of it is dialogue. These are not style notes; they decide how the prompt and the validators are written. Guess wrong and the whole extraction run is wasted. So stage ⓪ writes its answers into book.json, and every later stage reads them.

Cleaning itself is deterministic code: encoding detection (one book was GB18030 with a truncated final byte), zero-width characters, inline URLs, site watermarks, short lines with no Chinese, common heading formats, chapters pasted twice. Noise rules live in noise_rules.json, and each rule is run over the whole book to report three things: how many lines it matches, how many of those are inside dialogue, and how many characters it deletes. Deleting a character's line is a bug.

Corruption gets repaired before it gets deleted. Some garbled runs were GBK text read one byte out of phase; a gbk_byte_shift repair recovers most of it. What cannot be decoded is left in place and marked unreadable during extraction. The ordering matters: deleting body text is irreversible; leaving noise only costs a little money.

Numbering anomalies are classified, not silently fixed. The 544-chapter book had 14 of them; the 1,646-chapter book had 282: missing chapters in the source, typo'd numbers, a line that looks like a heading, duplicated pastes, extra parts restarting at one. Every one is written down in the notes with a reason.

② Extraction: every fact returns to the text

This is the heaviest stage. Each chapter is numbered first: paragraphs as [p12], quotes as ⟨q7⟩. Paragraphs with broken quote direction — reversed throughout, reversed halfway, opening by continuing the previous quote — are re-paired from punctuation context, because otherwise the speaker is guaranteed to be wrong.

The model must return six things: paragraphs that are not story text, entities, scenes split by time and place (with a presence list), a speaker for every quote, events, and facts with knowers. Then the validator checks each one:

  • an entity name must occur in this chapter's text; a full name the model supplies that is absent gets replaced by the chapter's form and kept only as a merge hint;
  • every fact's quote must be found verbatim in the paragraph it cites;
  • every quote must have a speaker;
  • paragraph and quote numbers must exist and stay in range.

Failures go back to the model with the problem list, up to three rounds. Whatever still fails is marked unverified, and the ledger, the cards and the NPC memory refuse to treat it as evidence. Better one fact short than one fact false.

There is also a free check: “X said: …” and “… X laughed.” style cues are matched against the model's speakers. This only covers cued dialogue — roughly half of a classical chapter novel, far less in modern prose — but it is enough to catch systematic errors. Across four books the disagreement rate sat between 0.45% and 1.5%, and every disagreement was read.

Each book can carry an extract_guide.md with only what was observed in that book: a character usually called “the old man”, how to mark projected speech, what author notes look like. It is appended to every chapter prompt: a patch for one book, never foreknowledge of the plot.

Scale check: the 1,646-chapter book produced 13,737 facts, 8,394 events and 3,518 scenes; a 120-chapter book produced 1,533 facts and 1,057 scenes. Those are not token counts; they are the amount of data every later step has to consume.

③ Consolidation: surfaces into people

In one chapter, “the old man”, “the girl in red” and “the shopkeeper” may be three people or one. Across the book, a form like “second uncle” may point at different people in different chapters. Consolidation is where that gets decided.

First separate descriptors from names: descriptor tails, organisation suffixes and demonstrative-headed forms do not merge across chapters; a title only one person per organisation can hold is the exception. The vocabulary is per book; the framework keeps only grammar-level words.

Then merge by rule: identical proper names join directly; when an alias belongs to essentially one person across the book, scattered entries join it; near-identical names, one-character differences and full-name hints from extraction go to the model pair by pair. There is a trap here: the model judges pairs, so two “yes” answers can chain two people together through a third entry. Merges are therefore checked as groups — if two groups are listed separately twice or more in the same chapter, the merge is refused and recorded as blocked_by_conflict.

Tiering is by share of the book: S needs to appear in ≥20% of chapters with ≥2% of the lines, A in ≥5% or ≥1% of lines, and a character with no dialogue caps at B, because there is no voice to imitate. A 1,646-chapter book converged to 4 S-tier and 17 A-tier characters; a 120-chapter book to 10 and 88.

Places and the lexicon sit on the same layer. Place names lose direction and time prefixes, suffix variants unify, generic rooms hang under the region they occur in, and the jieba dictionary is validated on real sentences from the book. Neither calls a model.

⑤ The ledger: who knows what, by when

The ledger is the least “AI” part of the skill: it calls no model, rebuilds in seconds, and its input is stage ②.

The rule is plain: an event's witnesses are its participants plus everyone present in the scene; a fact's knowers come from the extraction's knowers (self, told, witnessed, overheard, inferred). A knower written as a crowd word, or a name that does not resolve, expands to everyone present. Facts and events carry chapter and paragraph numbers, because order inside a chapter matters too.

There is one metric: witness_not_present, the share of knowers marked as having seen or overheard something while absent from the scene list; the gate is 5%. Scattered errors are acceptable. A concentration on one character means the book has a form of presence the extractor cannot represent: a companion living inside the protagonist, bound to an object, invisible, or sharing thoughts. The fix is not code: write a companions range in knowledge_rules.json, boundary chapters taken from the text. Only if the rules cannot express it does a plugin get written.

The 120-chapter book ended at 1,533 facts, 1,164 events and 1,057 scenes with 4.4% witnesses absent. That is not a beautiful number, but it is honest: what remains is scattered, not one person missing from the record.

④ Character cards: the state at the end of a stage

Stages are cut at plot turns, not equal chapter counts — a change of place, a death or departure, a change of status. Each main character gets one card per stage: identity, appearance, personality (each trait anchored to behaviour in that stage), speech, relationships, goals, state at the end of the stage, secrets.

Generation only sees material from that character and that stage: their numbered lines, events they took part in, verified facts about them, the people they shared the most scenes with. Not the whole book, and the model is told not to fill gaps from its own memory. The previous stage's card is supplied for continuity, but the current material wins.

Then a specific leak check: anything written on the card is treated by the role-player as known. So secrets about the character, or plans others are keeping from them, are removed from the material when the ledger does not make them a knower and the sentence is not about them; they move to “what they do not know yet”, and the model is told not to write them into the card. Any sentence on the card that closely matches those withheld items is sent back.

Runtime avoids one more trap: the current stage's card describes the end of that stage, so handing it to the role-player would leak the future. Only the last completed stage's card is used.

⑥–⑧ Downstream is a consumer

By the time the game layer starts, there is very little generation left. Scenes become beats in order, important events (importance ≥ 3) become anchors on the map, and each character's last sighting becomes their trail. All of it is a projection of the ledger and the character registry.

Design (⑥b) does ask the model again: two to four stats, a stage goal, free-time actions after each chapter, one choice per anchor, a handful of intel items. Its acceptance is not visual: a simulator plays canon (must survive to the end), a planner (must be able to win) and random runs (must be able to lose). The simulator shares the engine with the web page, so “winnable” is not a claim in the copy.

Looks (⑦) fills descriptions into fixed enumerated parameters; the validator replaces unknown values with defaults and logs them. Acceptance (⑧) is two kinds of probe: ask about something that has not happened yet and see whether the character volunteers it, and ask about something they should know and check that the key detail appears. Then a human still clicks through it.

Gates, goldens, staleness

gate does not record “I checked”. It records the metrics plus a fingerprint of that stage's inputs. Change a rule, a vocabulary, a plugin or the code, and status marks the affected stages stale — the earlier pass no longer counts and has to be rerun.

Goldens (golden.jsonl) are judgments confirmed by a person against the text: who said this line, whether two names are one person, whether someone was present in a chapter, whether they knew something by then. Every rebuild rechecks them, so regressions cannot happen quietly.

A guard test closes the other direction: it takes S/A names, aliases and frequent places from every built book and scans the framework, the tests and the docs. Writing one book's vocabulary into n2g/ fails the suite on the spot. That is what keeps “framework / per book / handbook” from slowly blending into one layer.

Fixes have a fixed ladder, top to bottom: book profile → vocabulary → rule files → extraction guide → plugin → framework. The framework only changes when two or more books hit the same problem and a general rule can fix it; after that, every book is regressed.

Cost, and what is still imperfect

Only ②③④⑥b⑦⑧ can spend money. Every paid command takes --budget, stops starting new requests at the cap, and keeps finished work; calls are cached on a hash of the request body, so unchanged prompts are not paid for twice; cards can be estimated with --dry-run first. The four built books logged $0.04 to $0.78 of calls — but early runs predate the spend log, so that is not a total.

Some real failures: one book's quotes decay in a particular chapter, shifting speakers for a whole stretch, fixed with a repair_line plugin; one protagonist shares memory with a companion, concentrating the witness metric on one character, fixed with a companions range; crowd words polluting knowers, fixed in crowd_words; an NPC teasing instead of telling, counted as intel, fixed by requiring wording overlap for told.

Still imperfect: books whose dialogue has no quote marks need a plugin before extraction works; the ledger counts presence as knowledge, so a scene where someone is deliberately kept in the dark is still recorded as known, and only a golden with known_gap plus the card leak check contains it; cards describe the end of a stage, so stage boundaries should fall on departures; long books are expensive, which is why a pilot slice is a constraint, not a trick.

Conclusion

If you keep one sentence: this skill swaps “generated convincingly” for “sourced clearly”. Its product is not a game, but a checkable layer of data; the game is just the first consumer of that layer.

Repository: NorwinYu/chinese-novel-to-game · landing page: chinese-novel-to-game. The repository contains no novel text or adapted material; use it only with text you have the right to process.

Method / Numbers come from four built books: 21, 120, 544 (30-chapter pilot) and 1,646 chapters. Gate metrics are recorded by n2g gate; goldens and spend come from each book's golden.jsonl and spend.jsonl. The books themselves are not in the repository; only aggregate numbers are quoted here.