RPG System
Channel-agnostic RPG engine with a validated action/result pipeline, SQLite-backed campaign persistence, and a CLI channel adapter, covered by a pytest regression suite.
Channel adapter CLI
Translates player input and output only. No game rules, state, or persistence here.
RinGM interpret_action()
Interprets natural-language intent into a structured Action for the engine.
RPGEngine execute()
Authoritative core: validates actions, owns the game rules, mutates CampaignState, and returns a GameResult carrying ordered events in details["events"].
RinGM narrate_result()
Turns the GameResult and its events into narration for the player.
SQLite CampaignState store
Authoritative persistent store. Saving state is the caller’s job — the engine never touches it directly.
Purpose
A turn-based RPG engine where a game-master layer interprets natural-language player intent into structured actions, the engine validates and executes the rules, and narration is produced from structured results. The design keeps game rules independent of any chat channel, CLI, or language model.
My contribution
- Designed and built the Python RPG engine: action validation, rules execution, combat, encounters, and character progression.
- Built SQLite-backed campaign persistence with additive, backward-compatible migrations.
- Built the CLI channel adapter and the pytest regression suite covering engine, combat, persistence, and presentation.
Architecture
- Strict layering: channel adapters translate input/output only; the GM interface produces structured actions; the engine owns all rules and state changes; SQLite is authoritative.
- Campaign identity is always explicit — no assumed IDs, no silent reseeding of existing campaigns.
- Database initialization is non-destructive and safe to run repeatedly; encounters persist through the campaign state path with a single source of truth.
Challenges & solutions
Game logic kept leaking into interface code as new channels and commands were added.
Enforced the layering contract — no rules, combat, duplicate state, or persistence in adapters or the GM layer — and backed it with focused tests per behavior area.
Campaign data had to survive schema evolution without resets.
Made migrations additive and tested against existing data, with fixtures that guard the real campaign database during testing.
Notes
- Personal code-focused project with no graphical UI — not publicly available. No public demo or repository link; architecture is shown as a conceptual diagram, not an application screenshot.