File size: 3,391 Bytes
6a9c45b
71b378e
 
 
 
6a9c45b
a907323
6a9c45b
 
71b378e
6a9c45b
 
71b378e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
a907323
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
---
title: D'n'D Campaign Manager
emoji: 🎲
colorFrom: purple
colorTo: red
sdk: gradio
sdk_version: 6.0.1
app_file: app.py
pinned: false
license: mit
---

# 🎲 D'n'D Campaign Manager

A complete AI-powered D&D 5e character creator and campaign management system built with Gradio.

## Features

### Character Creation
- **AI-Powered Generation**: Create fully-detailed D&D 5e characters with backstories, personality traits, and equipment
- **Race & Class Support**: All standard D&D 5e races and classes
- **Background System**: Rich backgrounds with personality traits, ideals, bonds, and flaws
- **Portrait Generation**: AI-generated character portraits using DALL-E 3 or HuggingFace
- **Character Export**: Export to Markdown, JSON, or HTML character sheets

### Campaign Management
- **Campaign Synthesis**: AI creates complete campaigns tailored to your party composition
- **Session Tracking**: Track campaign sessions and important events
- **Character Integration**: Automatically weaves character backstories into campaign narrative
- **Campaign Notes**: Detailed NPCs, locations, adventure hooks, and session outlines

### What Makes This Special

The **Campaign Synthesis** feature analyzes your entire party (backstories, alignments, classes, personalities) and generates:
- Custom adventure hooks that tie into each character's background
- NPCs connected to party members
- Locations relevant to the party's story
- Session-by-session progression outlines
- Character connections explaining how the party knows each other
- Villains with personal stakes for each PC

## Configuration

This app requires API keys for AI features. Set them as Hugging Face Space secrets:

### Required (choose one):
- `OPENAI_API_KEY` - For OpenAI GPT-4 (recommended for best results)
- `ANTHROPIC_API_KEY` - For Claude models

### Optional:
- `HUGGINGFACE_TOKEN` - For HuggingFace image generation (fallback)
- `GEMINI_API_KEY` - For Google Gemini models (optional alternative)

## How to Use

1. **Create Characters**: Go to "Create Character" tab and fill in the basic details
2. **Select Party**: In "Campaign Management" β†’ "Synthesize from Characters", select multiple characters
3. **Generate Campaign**: Click "Synthesize Campaign" to create a custom campaign
4. **Track Progress**: Use "Session Tracking" to record events and progress

## Local Development

```bash
# Clone the repository
git clone <your-repo-url>
cd dungeon-smasher-pro

# Install dependencies
pip install -r requirements.txt

# Set up environment variables
cp .env.example .env
# Edit .env with your API keys

# Run the app
python3 app_v2.py
```

## Tech Stack

- **Gradio 5.38.2** - Web UI framework
- **OpenAI GPT-4** - Character and campaign generation
- **DALL-E 3** - Portrait generation
- **SQLite** - Character and campaign storage
- **Pydantic** - Data validation

## Architecture

```
src/
β”œβ”€β”€ agents/           # Business logic
β”‚   β”œβ”€β”€ character_agent.py
β”‚   └── campaign_agent.py
β”œβ”€β”€ models/           # Pydantic data models
β”‚   β”œβ”€β”€ character.py
β”‚   └── campaign.py
β”œβ”€β”€ ui/              # Gradio interface
β”‚   └── character_creator_ui.py
└── utils/           # AI client utilities
    └── ai_client.py
```

## Credits

Built with ❀️ for D&D players and Dungeon Masters everywhere.

## License

# Trigger rebuild to load secrets