Dwarf Fortress storytelling assistant — turns game events into narrative stories
Project description
df-storyteller
A storytelling companion for Dwarf Fortress. Captures game events, dwarf personalities, and world history through DFHack, then generates AI-written narratives grounded in your actual gameplay.
Features
Narrative Generation
- Fortress Chronicles — Seasonal narratives tracking what's changing in your fortress
- 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, written by the fortress's best writer
Quest System
- AI-Generated Quests — Based on your actual fortress state, grounded in real DF mechanics
- Narrative-Driven — Quests that drive the story (character arcs, threats, faith, ambition)
- Difficulty Tiers — Easy, Medium, Hard, Legendary
- Completion Narratives — AI writes how the quest was fulfilled, feeds into future chronicles
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
Dwarves
Relationship Web
Pantheon
Events
Lore
Quests
Gazette
Quick Start
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 (one of):
- 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.2.1.tar.gz.
File metadata
- Download URL: df_storyteller-0.2.1.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 |
f6cc4ae533d6e515d24d14de7d0eaa60962f5f1d6fda3155dac44ef098e459ae
|
|
| MD5 |
451e0782bf6d7260dfafdd501af05c25
|
|
| BLAKE2b-256 |
07a0625bc8b6ca39db062d52e05c2621d3fce8fc485d0a47cf61cd5d10a30809
|
File details
Details for the file df_storyteller-0.2.1-py3-none-any.whl.
File metadata
- Download URL: df_storyteller-0.2.1-py3-none-any.whl
- Upload date:
- Size: 163.4 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 |
596c5d7be937d81ff8578c6a7cc6155d0d98104bc75eb2732f3603df502ca7bf
|
|
| MD5 |
80efced18d98abc7a1565db5e43f8df9
|
|
| BLAKE2b-256 |
c9b02dbf3dbe24f1c0b2305503799e1e59e3c4077d320d8bdeb8364a673caac0
|