Skip to content
Internals — research note: investigation or findings, not a description of shipped behaviour.
Unverified: This page has not yet been anchored to automated code tests.

FableForge Combat Knowledge Graph

Last modified: 2026-06-17T16:35:00-04:00

A directed knowledge graph (graphify-out/) spanning every layer of the Dystopia/FableForge combat engine, from the original GodWars C source through the TypeScript/Convex implementation. Used for semantic search to continuously audit the C→TS migration and plan the generic combat engine.

  • 4,838 nodes · 13,683 edges · 198 communities
  • Extraction: 78% EXTRACTED · 22% INFERRED · 0% AMBIGUOUS
  • Built from 728 files (~712k words), AST only (no LLM tokens consumed)
FilePurpose
graphify-out/graph.htmlInteractive vis.js browser graph
graphify-out/graph.jsonGraphRAG-ready JSON
graphify-out/GRAPH_REPORT.mdAudit report with all community labels
graphify-out/manifest.jsonFile manifest for --update incremental runs
graphify-out/.graphify_labels.jsonCommunity ID → name map
graphify-out/.graphify_pythonResolved interpreter path (Python 3.12)
graphify-out/.graphify_rootScan root for --update
  1. C:\Users\Owner\DystopiaGold-main\dystopia-legacy\src\ — 75 legacy C/H files
    • Note: excluded by .gitignore (dystopia-legacy/) so manually injected
  2. packages/dystopia-core/src/ — 445 TypeScript files (combat SSOT)
  3. convex/dystopia/ — 34 Convex server files
  4. convex/village_game/combat/ — 2 files (mutations, consequences)
  5. packages/fableforge-combat/src/ — 1 file
  6. packages/game-systems/src/ — 53 files
  7. packages/ffscript/src/ + packages/ffscript-core/src/ — 25 files
  8. packages/shared-config/src/ — 93 files
NodeDegreeLayerNotes
one_argument()304Legacy CString parsing utility — called everywhere in legacy C
number_range()233Legacy CRNG — central to all combat math
is_affected()167Legacy CStatus effect check — foundation of affect system
str_cmp()144Legacy CString compare — C command dispatch workhorse
get_char_room()142Legacy CRoom lookup — core of C combat targeting
CHAR_DATA132Legacy CCore character struct — everything touches it
damage()93Legacy CMain damage fn — bridges 7+ communities
deriveCombatMetrics()high-betweennessTypeScriptBridges TS Combat Math, Damage Formulas, Class Skills
IDLabelKey Files
0Legacy C Combat Coremagic.c, fight.c, damage(), dice()
3Legacy C Magic Systemmagic.c, CHAR_DATA, affect_to_char
15Legacy C Fight Resolutionfight.c, kav_fight.c, one_hit, darkheart
7Legacy C Arena & Movementarena.c, act_move.c, do_recall
35Legacy C Stealth Classesassassin.c, do_ambush, do_assassinate
14Legacy C Vampire & Lichvamp.c, lich.c, set_fighting, callgolems
39Legacy C Ninja & Samuraininja.c, samurai.c, tanarri.c, one_hit
41TS Arena Engine CorearenaEngine.ts, CombatResolver, tests
25TS Damage FormulasdamageFormulas.ts, resolveOneHit, kekkaishi
28TS Combat Math & TestscombatMath.test, resolveOneHit, specCastMage
10TS Combat Command PipelineextendedCombat, combatInputQueue, LimbSlot
23TS Combat Input QueuearenaWorkflow, queueCommands, run.ts
18TS Affect / Status Systemaffects.ts → AFFECT_DATA port
43TS Religion EnginereligionEngine.ts → religion.c port
26FFScript State BridgeffscriptAlignment.ts, MudStateSnapshot
50Generic Combat AdaptersADAPTER_REGISTRY, listRegisteredSystems

Critical cycles in TS combat layer:

  • arenaEngine.ts → CombatResolver.ts → miracles.ts → arenaEngine.ts (3-cycle)
  • championFlags.ts → skills.ts → world/types.ts → championFlags.ts (3-cycle)
  • commands/combat.ts → combatAction.ts → run.ts → index.ts → combat.ts (4-cycle)
  • Multiple *Skills.ts → skills.ts → *Skills.ts 2-cycles (skills registry pattern)
  • update_handler() → highlander_update() [INFERRED] — update tick calls Highlander-specific logic
  • interpret() → log_string2() [INFERRED] — command interpreter touches jobo logging
  • damage() bridges 7 legacy C communities — true god function, must be faithfully ported

The 1,383 isolated nodes (≤1 connection) mostly represent:

  • Legacy C struct fields (OBJ_DATA, EXIT_DATA, CHAR_DATA sub-fields)
  • These indicate areas where C mechanics have NO TS counterpart yet → migration backlog
Terminal window
# From fableforge repo root:
& "C:\Users\Owner\AppData\Local\Programs\Python\Python312\python.exe" -m graphify query "How does damage() work?"
# Or run the pipeline again with --update for incremental refresh:
# (re-run Step 3+ of the graphify pipeline using the existing detect/manifest)

To update after code changes:

Terminal window
# Re-run AST extraction + graph build (skips semantic for code-only corpus)
& "C:\Users\Owner\AppData\Local\Programs\Python\Python312\python.exe" graphify-out/label_communities.py