Skip to main content

A flexible, code-first RPG framework for building turn-based games with support for procedural generation and AI-driven content

Project description

Barebones RPG Framework

PyPI version Python 3.11+ License: MIT Documentation

A flexible, code-first RPG framework for building turn-based games with support for procedural generation and AI-driven content.

Documentation

What is this?

Barebones RPG is a Python framework designed to be a foundation for creating RPG games. It provides all the essential systems needed for an RPG (combat, entities, items, quests, dialog, world management, etc.), but with no content - making it a perfect starting point for your own games.

The framework is code-first (Python classes and functions), fully extensible (hooks and events throughout), and supports both hand-crafted and procedurally generated content.

Installation

Requirements

  • Python 3.11+

For Users

# Install from PyPI
pip install barebones-rpg

For Development

# Clone the repository
git clone https://github.com/PierceGov/barebones_rpg.git
cd barebones_rpg

# Install with uv (recommended)
uv sync --dev

# Or with pip
pip install -e ".[dev]"

Running the Examples

# Run the main example
uv run python main.py

# Or run specific examples
uv run python -m barebones_rpg.examples.simple_combat_example
uv run python -m barebones_rpg.examples.mini_rpg
uv run python -m barebones_rpg.examples.tile_based_example

Running Tests

# Run all tests
uv run pytest

# Run with coverage
uv run pytest --cov=barebones_rpg

Documentation

View the full documentation online

The documentation is also available locally in the sphinx_docs/ directory. To build and view:

./build_docs.sh
# Then open sphinx_docs/_build/html/index.html

The documentation includes:

  • Getting Started Guide
  • Core Concepts and Architecture
  • Complete API Reference
  • Step-by-Step Tutorials
  • In-Depth Guides
  • Example Breakdowns

Quick Example

from barebones_rpg import Game, GameConfig, Character, Enemy, Stats, Combat

# Create game
game = Game(GameConfig(title="My RPG"))

# Create characters
hero = Character(
    name="Hero",
    stats=Stats(strength=15, constitution=12, dexterity=10,
                intelligence=8, charisma=10, base_max_hp=50, hp=100)
)
goblin = Enemy(
    name="Goblin",
    stats=Stats(strength=8, constitution=6, dexterity=12,
                intelligence=5, charisma=5, base_max_hp=20, hp=30)
)

# Start combat
combat = Combat(
    player_group=[hero],
    enemy_group=[goblin],
    events=game.events
)
combat.start()

# Example with custom AI
from barebones_rpg import AIInterface, AIContext

class SimpleAI(AIInterface):
    def decide_action(self, context: AIContext) -> dict:
        if context.nearby_entities:
            return {"action": "attack", "target": context.nearby_entities[0]}
        return {"action": "wait"}

# Assign AI directly to entity
goblin.ai = SimpleAI()

See barebones_rpg/examples/ for complete working examples.

Project Structure

barebones_rpg/
├── core/           # Game engine, events, save/load
├── entities/       # Characters, NPCs, enemies, stats, AI
├── combat/         # Turn-based combat system
├── items/          # Items, inventory, equipment, loot
├── quests/         # Quest and objective tracking
├── dialog/         # Conversation trees
├── world/          # Maps, locations, tiles
├── rendering/      # Pygame renderer
├── loaders/        # Data loaders (JSON/YAML)
└── examples/       # Example games

Contributing

Contributions are welcome!

License

MIT License - See LICENSE.md for details

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

barebones_rpg-0.2.0.tar.gz (211.6 kB view details)

Uploaded Source

Built Distribution

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

barebones_rpg-0.2.0-py3-none-any.whl (110.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: barebones_rpg-0.2.0.tar.gz
  • Upload date:
  • Size: 211.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for barebones_rpg-0.2.0.tar.gz
Algorithm Hash digest
SHA256 189ec46d686f6bcd38b12a5665130dbcd4a60746faff03208e9017380f1c4adf
MD5 dbdd000ae3d83afefa36aebc5a4dfe6b
BLAKE2b-256 9db9d6e258c6a80125c0a7cac2293d0412f72eaa2f791f732f3cf5441e0e0292

See more details on using hashes here.

Provenance

The following attestation bundles were made for barebones_rpg-0.2.0.tar.gz:

Publisher: publish-pypi.yml on piercegov/barebones_rpg

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

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

File metadata

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

File hashes

Hashes for barebones_rpg-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 52320fb7bbce022c26f7e496bc74e4d0782cd7f745c7b3ebb53300334cde280d
MD5 76095b1738a401009f3a2ee5efb66a16
BLAKE2b-256 201a08b148e541c722ec969f319ed1d062411750093b03204af41c835e478cdb

See more details on using hashes here.

Provenance

The following attestation bundles were made for barebones_rpg-0.2.0-py3-none-any.whl:

Publisher: publish-pypi.yml on piercegov/barebones_rpg

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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