Welcome to the DND Character Creator! This project leverages the power of the OpenAI API to help you create detailed and imaginative characters for your Dungeons & Dragons campaigns. Whether you're a seasoned Dungeon Master or a first-time player, this tool will simplify the process of bringing your characters to life.
- Features
- Project Structure
- Prerequisites
- Installation
- Usage
- Example Output
- Contributing
- License
- Acknowledgments
- AI-Generated Character Details:
- Character names based on race and background
- Rich, detailed backstories
- Balanced ability scores and traits
- Personality traits, ideals, bonds, and flaws
- Customizable Parameters:
- Choose from all official D&D 5e races and classes
- Select background and alignment
- Set custom ability score generation methods
- Campaign Integration:
- Generate characters that fit your campaign setting
- Create NPCs with specific roles and motivations
- Include relevant faction affiliations
- Export Options:
- Save as JSON for programmatic use
- Export to PDF character sheets
- Plain text format for easy sharing
The project is structured as follows:
dnd-character-creator/
├── README.md
├── LICENSE
├── .env.example
├── requirements.txt
├── character_creator.py
├── data/
│ └── sample_characters.json
├── docs/
│ └── project_documentation.md
├── src/
│ ├── __init__.py
│ ├── character_generator.py
│ ├── utils.py
└── tests/
├── test_character_generator.py
└── test_utils.py
README.md: Main documentation file for the project.LICENSE: License information for the project..env.example: Example environment variables file.requirements.txt: List of dependencies for the project.character_creator.py: Main script to run the character creator.data/: Directory for storing sample character data and other resources.docs/: Directory for additional documentation.src/: Directory for source code.tests/: Directory for unit tests.
- Python 3.8 or higher
- OpenAI API key
- Basic understanding of D&D 5e mechanics
-
Clone the Repository:
git clone https://github.com/your-username/dnd-character-creator.git cd dnd-character-creator -
Create and Activate Virtual Environment (recommended):
python -m venv venv # On Windows .\venv\Scripts\activate # On Unix or MacOS source venv/bin/activate
-
Install Dependencies:
pip install -r requirements.txt
-
Configure Environment:
cp .env.example .env # Edit .env with your OpenAI API key
python character_creator.pypython character_creator.py --race elf --class wizard --level 5 --alignment "lawful good"| Option | Description | Default |
|---|---|---|
--level |
Character starting level | 1 |
--method |
Ability score generation method | "standard array" |
--detail |
Backstory detail level (1-5) | 3 |
Character Name: Kaelith Moonshadow
Race: Elf
Class: Rogue
Alignment: Chaotic Neutral
Backstory: Kaelith grew up in the shadowy streets of Neverwinter, mastering the art of stealth and deception. A chance encounter with a mysterious artifact set her on a path to uncover secrets that could reshape the Forgotten Realms.
We welcome contributions! Please follow these steps:
-
Fork and Clone:
git fork https://github.com/your-username/dnd-character-creator.git
-
Create Feature Branch:
git checkout -b feature/amazing-feature
-
Commit Changes:
git commit -m 'Add amazing feature' -
Push and Create PR:
git push origin feature/amazing-feature
- Follow PEP 8 style guide
- Add unit tests for new features
- Update documentation as needed
- Maintain compatibility with Python 3.8+
Common issues and solutions:
- API Key Issues: Ensure your
.envfile is properly configured - Dependencies: Try
pip install --upgrade -r requirements.txt - Generation Fails: Check your internet connection and API quota
This project is licensed under the MIT License. See the LICENSE file for details.
- OpenAI for their incredible API.
- The Dungeons & Dragons community for endless inspiration and creativity.