Skip to content

ramidecodes/rpgen

Repository files navigation

RPGen

A web-app game that allows the player to start a new text-based RPG campaign. Inspired by old-school text adventures, TTRPGs (D&D), and point-and-click classics.

The core differentiator is the Living World Engine. A Game Master Agent (GMA) manages a sophisticated Narrative Graph—tracking relationships, plot fronts, and world states—to create a universe that reacts dynamically to every player decision. No two campaigns are alike, and the story never hits a generic "Game Over."

Setup

Prerequisites

  • Node.js 18+
  • pnpm 8+

Installation

  1. Clone the repository:
    git clone <repository-url>
    cd generative-deep-neural-dungeon
  2. Install dependencies:
    pnpm install
  3. Set up environment:
    cp .env.local.example .env.local
    # Add DATABASE_URL and AI Provider Keys (OpenRouter/OpenAI)
  4. Database:
    pnpm db:generate
    pnpm db:migrate
  5. Run:
    pnpm dev

Project Structure

See docs/ARCHITECTURE.md for detailed architecture.

Architecture Documentation

Features

Feature requirements are located in docs/features/ (new FRED: docs/features/chat-agent-v6-refactor.md for the AI SDK v6 chat refactor).

1. Universe Generation (Ontology)

Instead of simple genres, players define the Ontology of their world:

  • Timeframe: Ancient, Medieval, Cyberpunk, Far Future.
  • Magic & Physics: Hard Science vs. Dream Logic.
  • Metaphysics: Do gods exist? Is the universe indifferent? The system generates a deep history, factions, and locations based on these axioms.

2. Character Creation

Characters are created within a specific Universe.

  • Professions and Origins are context-aware (e.g., "Starship Pilot" only appears in Sci-Fi worlds).
  • Classic D&D stats (Strength, Int, etc.) are rolled 1-20.
  • Backstories are AI-assisted to weave the character into the world's history.

3. Campaign & Living World State

Campaigns are the "Play Session" of a Character in a Universe.

  • Multi-Genre: Combine "Sci-Fi" + "Horror" for an "Alien" style game.
  • Narrative Graph State:
    • Knowledge Graph: Tracks NPCs, Relationships (HATES, LOVES), and secrets.
    • Active Fronts: Plot threats that advance if ignored (e.g., "The Void expands").
    • Narrative Vectors: Tracks abstract values like Hope vs. Despair, Order vs. Chaos.

4. Game Loop

  • Narrative: AI streams descriptive text via the Game Master Agent (GMA).
  • Action: Player types flexible actions.
  • Visuals: Generative images for scenes automatically generated by the Visual Engine Agent (VEA).
  • Agentic Chat (AI SDK v6): Three-agent architecture:
    • Game Master Agent (GMA): Interactive narration and HITL skill checks only (no state mutations)
    • Campaign Manager Agent (CMA): Background state reconciliation (quests, fronts, narrative vectors)
    • Visual Engine Agent (VEA): Background scene image generation

See docs/AGENTIC-ARCHITECTURE.md for detailed agent patterns and architecture.

License

Apache v2.0

About

A continuously generated D&D experience.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published