Code Monkey home page Code Monkey logo

ai-dungeon-master's Introduction

AI Dungeon Master

This project implements an AI-powered game master that you and your party can interact with through discord.

The Problem

In order to play most tabletop role-playing games ("TTRPGs"), someone has to take on the role of Game Master. This means that one of your friends doesn't get to experience the world as a player character ("PC"). Some groups have a member who wants to act as game master, but there are a lot of groups where everyone prefers to take on the role of a PC. In those cases, someone has to compromise for everyone else to enjoy the game.

A Solution

With the advent of widely available generative AI systems and specifically large language models ("LLMs"), it's now possible to use high quality text generation models that can take on the role of Game Master in TTRPGs. AI-DM uses state-of-the-art LLMs to create immersive storylines, manage game mechanics, and interact with players.

Key Features

  • Dynamic Storytelling: Generates and adapts storylines on-the-fly based on PC actions, so every session is as unique as your party.
  • NPC Interaction: Characters in the game world are brought to life with realistic and varied dialogues, making each interaction feel genuine.
  • Rules Management: Understands and applies the rules for many TTRPG systems.
  • Discord Integration: Integrates with Discord, allowing players to interact with the AI-DM through a familiar interface.

How It Works

The AI-DM is built on top of OpenAI's chat interface to GPT-4 and the suite of LLM tools provided by LangChain. Players can then interact with the LLM chatbot through text in a channel on their discord server. When players input their actions, AI-DM interprets these actions and responds appropriately within the scope of the rules and the current adventure. Whether it's describing a new scene, managing combat, or engaging in dialogue with NPCs, the AI-DM handles it all.

Limitations

This project is at an early state of it's development. It works as intended (and is a ton of fun!), but it currently has some limitations:

  • You must have your own OpenAI API token. You can create an API account and get an API key by following the directions in OpenAI's API documentation.
  • You must have your own discord API token and invite a bot to your discord server. You can do that by following the directions on discord's developer documentation. The relevant channel in you discord server should be titled aidm.

Getting Started

  1. You need to add two environment variables to your system: AI_DM_BOT_KEY is the discord API key. OPENAI_API_KEY is the OpenAI API key.
  2. Install the Bot: Add AI-DM bot to your Discord server.
  3. Set Up Your Game: Choose your TTRPG system and establish basic game settings. Currently there is a file in the prompts directory titled aidm-system-prompt.txt. You can modify this file to fit the rules you want. The default rule system is the fifth edition of D&D.
  4. Initialize AI-DM through the CLI with aidm run. The CLI assumes you are working from the root directory of this repository.
  5. Invite Your Friends: Bring your party together in your Discord server.
  6. Start Playing: Begin your adventure with the AI-DM guiding your journey. Just describe your characters in the discord channel and the type of adventure you want to have.

If you are having trouble getting things to work please don't hesitate to reach out. I'll do everything I can to get your party adventuring!

Contribution

This is a labor of love. I'm currently working on this project in my spare time because I think it is a lot of fun. If you would like to contribute to this project I would greatly appreciate it! Just submit a PR, and we will work together to make AI-DM everything it can be.

ai-dungeon-master's People

Contributors

samvoisin avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.