A terminal app for running 5th-edition-compatible tabletop combat. Pick a party level and a risk level and RPGen builds a balanced encounter: a random environment, monsters that live there, and (optionally) a party of generated characters. Initiative is rolled and sorted, and you can track hit points and turns right in the terminal.
- Encounter generation that uses XP budgets and group-size multipliers to pick monsters for the chosen environment.
- Character generation for the party: species, class, 4d6-drop-lowest ability scores, level-appropriate weapons and armor, AC, HP, spell slots (including Pact Magic) and known spells.
- Manual mode for real players: type the initiative each player rolled, or leave it blank to roll a d20.
- Combat tracker with the turn order, the current turn, the round counter, damage and healing, and downed combatants skipped automatically.
- Full stat blocks, including traits, actions, reactions, legendary actions, equipment and spells.
- Responsive layout. Three columns on wide terminals; on small ones you switch between Setup, Combat and Details tabs.
- Works offline. Data comes from the Open5e API and is cached on disk. Without a connection, RPGen falls back to a bundled SRD 5.1 snapshot.
Requires Python 3.10 or newer.
git clone https://github.com/phmuni/rpgen.git cd rpgen python3 -m venv .venv source .venv/bin/activate # Windows: .venv\Scripts\activate pip install -r requirements.txt python main.py
The first run downloads data from Open5e, which takes about 30 seconds. Later runs load it from the cache.
| Key | Action |
|---|---|
r |
Generate a new encounter |
n |
Next turn |
d |
Damage/heal the selected row (7 or -7 = damage, +7 = heal) |
↑ ↓ |
Select a combatant |
Enter |
Show details (switches tab on small terminals) |
1 2 3 |
Setup / Combat / Details tabs (small terminals) |
Esc |
Back to the combat view |
q |
Quit |
Risk goes from 1 to 20 and scales the XP budget from about 0.6× to 2× the party's baseline. The setup panel previews the difficulty (Easy, Medium, Hard or Deadly) as you type.
main.py Textual UI (CombatManager)
src/api_loader.py Open5e fetching, normalization and disk cache
src/utils.py Data loading, XP/CR tables, spell picking
src/monster_picker.py Encounter building
src/player_generator.py Character generation
src/environment_picker.py Random environment selection
resources/ Hand-written environments and class progression tables
resources/srd/ Offline SRD 5.1 snapshot (see scripts/build_srd_data.py)
The cache lives in your OS user cache directory (for example ~/Library/Caches/rpgen
on macOS or ~/.cache/rpgen on Linux). Set RPGEN_CACHE_DIR to put it somewhere else.
To regenerate the offline snapshot:
python scripts/build_srd_data.py
Issues and pull requests are welcome. Please keep any bundled game content limited to the SRD or other openly licensed sources.
The source code is released under the MIT License.
This work includes material taken from the System Reference Document 5.1 ("SRD 5.1") by Wizards of the Coast LLC and available at https://dnd.wizards.com/resources/systems-reference-document. The SRD 5.1 is licensed under the Creative Commons Attribution 4.0 International License, available at https://creativecommons.org/licenses/by/4.0/legalcode.
At runtime, RPGen also downloads content from the Open5e API, which includes third-party material published under the Open Game License 1.0a. That content is not distributed with this repository; see https://open5e.com/legal for its licenses.
RPGen is an unofficial fan project. It is not affiliated with, endorsed, sponsored or approved by Wizards of the Coast.