Skip to main content

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.

Python 3.11+ License

Full Documentation on the Wiki

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

Chronicle

Dwarves

Dwarves

Relationship Web

Relationship Web

Pantheon

Pantheon

Events

Events

Lore

Lore

Quests

Quests

Gazette

Gazette

Quick Start

# Install
git clone https://github.com/Been012/df-storyteller.git
cd df-storyteller
pip install -e .

# Configure (one time)
python -m df_storyteller init

# In DFHack console (first time per fortress)
storyteller-begin

# Launch web UI
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.relations don't exist in the Steam version. We use histfig_links on 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:

Note

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. API keys are stored in your local config file at ~/.df-storyteller/config.toml.

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

df_storyteller-0.2.0.tar.gz (5.1 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

df_storyteller-0.2.0-py3-none-any.whl (163.2 kB view details)

Uploaded Python 3

File details

Details for the file df_storyteller-0.2.0.tar.gz.

File metadata

  • Download URL: df_storyteller-0.2.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

Hashes for df_storyteller-0.2.0.tar.gz
Algorithm Hash digest
SHA256 e3373c42bcf7565c7cff13ef41e0e1a86f09d67ba3b9e7ff2d223e42b1559356
MD5 6dd342140c0bf513ffe6abc1d7666199
BLAKE2b-256 2233192505833e5ed05eecbd4d2107db6f2dd73b6250e3ea660fa79b7a27d9a3

See more details on using hashes here.

File details

Details for the file df_storyteller-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: df_storyteller-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 163.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for df_storyteller-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a129a8362e5e09cd053fa8ea61c958f175830ca7597e2ad8c9c272cf796229e0
MD5 8e8d7cad16f93cf7fca8e1992efdfd90
BLAKE2b-256 ce864e05c3c866aefe8a1607d1a21843e1c3e5a32c2cb95b35fd2681987c7d0f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page