Dwarf Fortress storytelling assistant — turns game events into narrative stories
Project description
df-storyteller
A fortress journal and storytelling companion for Dwarf Fortress. Captures game events, dwarf personalities, and world history through DFHack. Use AI to generate narratives, or write your own — the choice is yours.
Features
Two Modes: AI or Manual
- No-LLM Mode — Use as a structured fortress journal. Write your own chronicles, biographies, gazette editions, sagas, and quests. No AI required.
- LLM Mode — AI generates narratives grounded in your gameplay. Manual writing is still available alongside AI output.
- Setup asks upfront — choose your preference during
init, change anytime in Settings.
Narrative Generation (AI or Player-Written)
- Fortress Chronicles — Seasonal narratives tracking what's changing in your fortress. Edit entries inline.
- Dwarf Diaries — First-person journal entries shaped by personality, beliefs, and stress
- Character Biographies — Dated entries that evolve as dwarves change over time
- Death Eulogies — Memorial narratives for fallen dwarves
- Battle Reports — Dramatic combat accounts written by survivors or the fortress chronicler
- Epic Sagas — World history narratives from legends data
- Fortress Gazette — A dwarven newspaper with five sections. Write your own or generate with AI. Edit published editions.
Player Agency
- Dwarf Highlights — Mark dwarves as Protagonist, Antagonist, or Watchlist. Highlighted dwarves get more focus in AI narratives and show role badges across the UI.
- Player Notes — 8 tag types (Suspicion, Fact, Theory, Rumor, Secret, Foreshadow, Mood, What If) that influence how AI writes.
- Manual Writing Everywhere — Write your own entries on every page, even with AI enabled.
- Inline Editing — Edit chronicles, quests, and gazette editions after creation.
Quest System
- AI-Generated or Player-Created — Generate quests from fortress state, or create your own with category and difficulty
- Resolve with Comments — Complete quests with a player-written resolution (no AI needed)
- Edit on the Go — Update quest titles and descriptions inline
- Difficulty Tiers — Easy, Medium, Hard, Legendary
- Completion Narratives — AI writes how the quest was fulfilled (LLM mode), or resolve manually
Visualization & Data
- Relationship Web — Interactive force-directed graph of fortress connections
- Pantheon — Deity worship chart with sphere descriptions from legends
- Combat Log — Blow-by-blow fight details with siege grouping
- Chat Log — Dwarf conversations with AI social summaries
- Lore Browser — Searchable world history with hover tooltips (kill counts, battle forces, relationships)
- Live Event Feed — Real-time game events via WebSocket
Screenshots
Chronicle
AI-generated seasonal narratives that track migrations, conflicts, role changes, and the evolving story of your fortress. Includes fortress-wide player notes with 8 tag types that influence how the AI writes.
Dwarves
Character sheets with tabbed Notes, Biography, and Diary sections. Personality traits, skills, relationships, combat record, and equipment. First-person diary entries written in the dwarf's voice based on their personality.
Relationship Web
Interactive force-directed graph showing family, friend, rival, and deity connections across the entire fortress. Drag, zoom, hover for details, double-click to focus on a dwarf's connections.
Pantheon
Bar chart of deity worship across the fortress, sorted by worshipper count. Click any deity to see who worships them. Sphere descriptions (death, minerals, sacrifice, etc.) pulled from legends data.
Events
Live event feed via WebSocket, collapsible combat log with blow-by-blow fight details and siege grouping, battle reports written by survivors, and a chat log of dwarf conversations with AI social summaries.
Lore
Searchable world history browser covering civilizations, wars, battles, historical figures, artifacts, and more. Hover tooltips show rich detail — kill counts, battle forces, relationships, deity spheres, artifact descriptions.
Quests
AI-generated quests based on your actual fortress state — citizens, buildings, events, religion, military. Filtered by category and difficulty. Grounded in real DF mechanics. Completion narratives feed into future chronicles.
Gazette
A dwarven newspaper with five sections: The Fortress Herald, Military Dispatches, Quarry Gossip, Quest Board, and Obituaries. Written by the fortress's best writer in their personality voice. Newspaper-style two-column layout.
Quick Start
Prerequisites: Python 3.11+ — during install, check "Add Python to PATH".
Install and run:
pip install df-storyteller
python -m df_storyteller init
python -m df_storyteller serve
In DFHack console (first time per fortress):
storyteller-begin
Or install from source:
git clone https://github.com/Been012/df-storyteller.git
cd df-storyteller
pip install -e .
python -m df_storyteller init
python -m df_storyteller serve
Requirements
- Dwarf Fortress v50.x (Steam / DF Premium) — tested with v50.14
- DFHack v50.14-r1+ (Steam Workshop or dfhack.org)
- Python 3.11+
- An LLM provider (optional — not needed for No-LLM mode):
- Ollama — free, runs locally, no API key needed (supports thinking models)
- Anthropic Claude — API key required
- OpenAI — API key required
Note: This tool uses DF Premium (Steam) APIs. Classic DF (pre-Steam) is not supported — some DFHack fields like
unit.relationsdon't exist in the Steam version. We usehistfig_linkson historical figures instead.
Tech Stack
- Backend: Python 3.11+, FastAPI, Pydantic v2
- Frontend: Jinja2 templates, vanilla CSS/JS (no build step)
- Game integration: DFHack Lua scripts
- LLM: Anthropic SDK, OpenAI SDK, Ollama REST API (with thinking model support)
- All narratives grounded in DF mechanics — the AI knows squad sizes, siege thresholds, temple values, what players can and cannot control
Documentation
See the Wiki for:
- Installation & Setup
- Architecture
- Configuration
- LLM Integration
- Feature guides for every tab
Notes
- This tool is designed to run locally on your machine (localhost). It is not intended to be exposed to the internet or run on a public server.
- Developed and tested on Windows with DF Premium (Steam). Should work on Mac and Linux — all code uses cross-platform libraries (
pathlib, FastAPI) and DFHack APIs are platform-independent — but these platforms are untested. If you run into issues, please open a bug report. - Config and stories are stored at
~/.df-storyteller/. API keys are inconfig.toml.
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file df_storyteller-0.3.0.tar.gz.
File metadata
- Download URL: df_storyteller-0.3.0.tar.gz
- Upload date:
- Size: 5.1 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2363689c33f92b635d3b327f5b4ff8343f3a7016996c73d6bc3ded4e336c3202
|
|
| MD5 |
3a8d0992216c1cf44ccd956945add8e1
|
|
| BLAKE2b-256 |
d066edb253f370e098aadd74c5d09f6107768a6abc9a3e6410f76ebd6adb44a2
|
File details
Details for the file df_storyteller-0.3.0-py3-none-any.whl.
File metadata
- Download URL: df_storyteller-0.3.0-py3-none-any.whl
- Upload date:
- Size: 173.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0cd9bfab4cada021013c4036335131582a42d4e75c27862a4f34c4d08591744a
|
|
| MD5 |
c2f567a46b7bfd0aacb7a2e9bb2b140c
|
|
| BLAKE2b-256 |
2fa0d6ac4f036b5b6268683589e9396fd0e4f50d553ba8de0b21bd80ebc0ab2c
|