Skip to main content

CampAIgn — map-based LLM RPG simulation engine (Session API, multi-area worlds, compound turns)

Project description

CampAIgn RPG Engine

Grid-based LLM agent simulation engine: multi-area worlds, compound turns (move → look → speak → interact/emote), pluggable memory modules, and a stable campaign_rpg_engine library API. Build your own UI and scenarios on the engine; use CampAIgn-RPG-Studio as a full GM reference app.

License: MIT — open source.

Current version: 1.2.0 — plugin primitives (extensions, events, turn verbs, prompt slots). See Plugin primitives and the changelog index.

Quick start

cd path\to\CampAIgn-RPG-Engine
uv sync
uv run pytest
from campaign_rpg_engine import Session, load_profile, AgentCompoundTurn

session = Session.from_profile(load_profile("default_compound"))
session.create_agent(name="Scout", position=(0, 0), personality="Curious.")
session.create_object(name="Chest", position=(2, 1), passive_description="An old chest.")
prompt = session.build_prompt()
result = session.run_compound_turn(
    AgentCompoundTurn(reasoning="look around", action="none"),
)

GM web UI: clone CampAIgn-RPG-Studio (separate GitHub repo):

cd path\to\CampAIgn-RPG-Studio
uv sync
copy .env.example .env   # optional; or use Settings gear in the UI
uv run campaign-rpg-studio

On Windows, if Smart App Control blocks uv run campaign-rpg-studio, use uv run python -m backend.main. Open http://127.0.0.1:8765.

Environment

Copy .env.example to .env and set OPENROUTER_API_KEY for LLM turns. Optional OPENROUTER_MODEL (default deepseek/deepseek-v4-flash). Engine tests mock the LLM — no key required for uv run pytest.

CampAIgn-RPG-Studio Settings (gear icon) can set API key and model in memory for the current server process only — nothing is written to disk.

Custom memory modules

Register .py modules at process startup before creating agents or loading saves:

from campaign_rpg_engine import register_memory_module_from_path

register_memory_module_from_path("path/to/my_module.py")
session.create_agent(..., memory_module="my_module_id")

Saves store module_id + state only (no bundled source). Import fails if a save references a module that is not loaded. Sample module and upload UI: CampAIgn-RPG-Studio fixtures/custom_memory/.

Lorebooks

Load SillyTavern-style .json lorebooks via session.load_lorebook_from_path(...) or CampAIgn-RPG-Studio Lorebooks tab. Add a lorebook prompt block in Prompt layout to inject matched world info. Not included in the default prompt layout.

Tests

uv run pytest

CampAIgn-RPG-Studio API tests live in the CampAIgn-RPG-Studio repo.

Documentation

Start at docs/README.md — guides, API overview, and changelog index.

Doc Topic
Building on CampAIgn-RPG-Engine App integration (typed API, hosting)
Plugin primitives Extensions, events, turn verbs, prompt slots (1.2.0)
API reference campaign_rpg_engine exports and Session methods
Migration realm-fabric → campaign-rpg-engine Rename from Realm-Fabric / realm_fabric
CampAIgn-RPG-Studio Full GM reference UI (GitHub)
Roadmap Version plans
Long-term goals Aspirational features

Older version notes: changelog index.

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

campaign_rpg_engine-1.2.0.tar.gz (94.7 kB view details)

Uploaded Source

Built Distribution

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

campaign_rpg_engine-1.2.0-py3-none-any.whl (131.9 kB view details)

Uploaded Python 3

File details

Details for the file campaign_rpg_engine-1.2.0.tar.gz.

File metadata

  • Download URL: campaign_rpg_engine-1.2.0.tar.gz
  • Upload date:
  • Size: 94.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.23 {"installer":{"name":"uv","version":"0.11.23","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for campaign_rpg_engine-1.2.0.tar.gz
Algorithm Hash digest
SHA256 c5d7abe649fee5b632ea9ffc04d85609a85d117e78fe3c875fea8fc0878e1f9d
MD5 4acf47575953fc49a8c4bb2b454c2b65
BLAKE2b-256 ab26e1d701190be8b9bf5284535fa0f2d8b7155dc99daa2f124c5b16b428c680

See more details on using hashes here.

File details

Details for the file campaign_rpg_engine-1.2.0-py3-none-any.whl.

File metadata

  • Download URL: campaign_rpg_engine-1.2.0-py3-none-any.whl
  • Upload date:
  • Size: 131.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.23 {"installer":{"name":"uv","version":"0.11.23","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for campaign_rpg_engine-1.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4a7ae1f32982caf45fe0ea6b32343397fce59a84ac043889c5afe038cdb99032
MD5 7f44c940a931d30a6fe37f8fde492e23
BLAKE2b-256 f348bf4d68b6ec73e8dd1cf912e9d250396f5655c403f9e4fa492a44af307487

See more details on using hashes here.

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