A Python RPG framework built on Arcade with seamless Tiled map editor integration
Project description
Pedre
A Python RPG framework built on Arcade with seamless Tiled map editor integration. Build Zelda-like games with dialog systems, NPC interactions, inventory management, and event-driven scripting.
Features
- Tiled Map Integration - Load .tmx maps with automatic layer detection and object parsing
- NPC System - Animated NPCs with dialog trees, pathfinding, and state management
- Dialog System - Multi-page conversations with character names and pagination
- Event-Driven Scripting - JSON-based cutscenes and interactive sequences
- Inventory Management - Item collection and categorization system
- Portal System - Map transitions with conditional triggers
- Save/Load System - Automatic game state persistence
- Audio Management - Background music and sound effects with caching
- Camera System - Smooth camera following with optional bounds
- Particle Effects - Visual feedback system for interactions
Installation
Install from PyPI:
pip install pedre
Or with uv:
uv add pedre
Quick Start
from pedre import run_game
if __name__ == "__main__":
run_game()
This will start your game with the default configuration. Configure your game using GameSettings:
from pedre import run_game, GameSettings
# Create settings directly
settings = GameSettings(
screen_width=1280,
screen_height=720,
window_title="My RPG",
initial_map="my_map.tmx"
)
if __name__ == "__main__":
run_game(settings)
Adding NPCs with Dialogs
Create a dialog file assets/dialogs/village_dialogs.json:
{
"merchant": {
"0": {
"name": "Merchant",
"text": [
"Welcome to my shop!",
"Take a look around."
]
}
}
}
Place the NPC in your Tiled map's "NPCs" layer with custom properties:
name: "merchant"- NPC sprite will be automatically loaded and animated
Creating Interactive Scripts
Create a script file assets/scripts/village_scripts.json:
{
"meet_merchant": {
"scene": "village",
"trigger": {
"event": "npc_interacted",
"npc": "merchant"
},
"actions": [
{
"type": "dialog",
"speaker": "Merchant",
"text": ["Welcome to my shop!", "Take a look around."]
},
{
"type": "play_sfx",
"file": "coin.wav"
}
]
}
}
Adding Portals Between Maps
In Tiled, create a "Portals" object layer and add a rectangle with properties:
name: "to_forest"target_map: "forest.tmx"spawn_waypoint: "from_village"
Create a matching waypoint in the target map's "Waypoints" layer (Point object named "from_village") where the player should spawn.
The framework automatically handles transitions when the player enters the portal zone.
Architecture
The framework uses a manager-based architecture with event-driven communication:
- Views - Menu, Game, Inventory, Load screens
- Sprites - AnimatedPlayer, AnimatedNPC with sprite sheet support
- Systems - Modular managers for different game aspects:
- DialogManager - Conversation display
- NPCManager - NPC state and interactions
- PortalManager - Map transitions
- ScriptManager - Event-driven actions
- InventoryManager - Item management
- AudioManager - Sound and music
- SaveManager - Game persistence
- And more...
Development
Want to contribute or run from source?
# Clone the repository
git clone https://github.com/msaizar/pedre.git
cd pedre
# Install with dev dependencies
uv sync
# Run quality checks
just qa
# Run tests
just test
This project uses modern Python tooling:
- uv - Fast Python package manager
- ruff - Linter and formatter
- ty - Type checker
- pytest - Testing framework
- just - Command runner
See CONTRIBUTING.md for detailed guidelines.
Documentation
Full documentation is available at msaizar.github.io/pedre
License
BSD 3-Clause License - See LICENSE for details.
Contributing
Contributions are welcome! Please read CONTRIBUTING.md before submitting pull requests.
Credits
Built with:
- Python Arcade - 2D game framework
- Tiled Map Editor - Level design tool
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pedre-0.0.1.tar.gz.
File metadata
- Download URL: pedre-0.0.1.tar.gz
- Upload date:
- Size: 202.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
56fb69bb5b0d35041b6aee0b2b7768e13ec1b7b7d31ec81f019e4180017fb702
|
|
| MD5 |
c171e6a5c89a643fb29dcd77e0216b80
|
|
| BLAKE2b-256 |
3abc7f2ede33e59f22791b133f420429214667589fb658bf48a2a675dc426095
|
Provenance
The following attestation bundles were made for pedre-0.0.1.tar.gz:
Publisher:
publish.yml on msaizar/pedre
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pedre-0.0.1.tar.gz -
Subject digest:
56fb69bb5b0d35041b6aee0b2b7768e13ec1b7b7d31ec81f019e4180017fb702 - Sigstore transparency entry: 822921254
- Sigstore integration time:
-
Permalink:
msaizar/pedre@b98c1000a576929f3137ff468fc45b48b5d3b617 -
Branch / Tag:
refs/tags/v0.0.1 - Owner: https://github.com/msaizar
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@b98c1000a576929f3137ff468fc45b48b5d3b617 -
Trigger Event:
release
-
Statement type:
File details
Details for the file pedre-0.0.1-py3-none-any.whl.
File metadata
- Download URL: pedre-0.0.1-py3-none-any.whl
- Upload date:
- Size: 154.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e6f91a721d67001f5fba960e5051c522696039fa1feb0c28296a986d4f83136b
|
|
| MD5 |
1e0c0dd0c484d0d8563d93834a8ccb1d
|
|
| BLAKE2b-256 |
0ed87470d435078b7f31690427b73f618b56f3a56e40cadcaf8197645a4988a5
|
Provenance
The following attestation bundles were made for pedre-0.0.1-py3-none-any.whl:
Publisher:
publish.yml on msaizar/pedre
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pedre-0.0.1-py3-none-any.whl -
Subject digest:
e6f91a721d67001f5fba960e5051c522696039fa1feb0c28296a986d4f83136b - Sigstore transparency entry: 822921350
- Sigstore integration time:
-
Permalink:
msaizar/pedre@b98c1000a576929f3137ff468fc45b48b5d3b617 -
Branch / Tag:
refs/tags/v0.0.1 - Owner: https://github.com/msaizar
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@b98c1000a576929f3137ff468fc45b48b5d3b617 -
Trigger Event:
release
-
Statement type: