Waidrin is a purpose-built role-playing game engine powered by an LLM. It is designed around an asynchronous, fully typed, fully validating state machine that uses constrained generation based on JSON schemas to dynamically create locations and characters as the story progresses, and keep track of them. Waidrin produces structured narrative events, not just chat messages. It can handle potentially thousands of characters and locations, without ever losing sight of what is happening.
While the engine itself is headless and can power any frontend, Waidrin comes with its own beautiful React-based frontend that is co-evolving with the engine to drive development forward. The frontend features AI-generated artwork that adds flavor and atmosphere to text-first storytelling.
At each turn, the player is presented with a choice of multiple AI-suggested actions, but they can also provide a different action as freeform text. This blends a classic CYOA experience with the limitless freedom of generative AI. It's an RPG unlike any other.
All modifications are done using Gemini CLI Gemini-2.5-flash model in VS code, so coding standards and method will very likely be suboptimal. This is just a proof of concept to adopt AI tools for my BA workflow in a development project to quickly prototype with just very basic knowledge of the stack.
[WIP] build test-ui-plugin (or remove it from code) and game-rule-dnd5e in the plugin directory, then follow the main guide's instructions to build and run the app with npm run dev
- Internal game mechanics are handled in a plugin; the core app only receives prompt guidance to narrate the next scene.
- rpgDiceRoller is installed as a dependency for the core app.
- The ability to create tabs in the Character Select screen has been added.
- The ability to select/deselect an installed plugin (enabled plugins) has been added.
- The ability to inject guidance for prompts based on selected game rules has been added, including:
- Character backstory based on ability score interpretation.
- Biography based on backstory.
- Narration based on Action and Skill Check results.
- D&D 5e Rules plugin (WIP)
- Detects combat situations and starts Initiative.
- Determines Ally vs. Enemy when combat starts.
- Auto-generates enemies based on narration.
- Prompts to determine game rules and game data like ability, skill, and class are contained in the plugin.
- Other things like spells, equipment, and game time (combat round vs. role-play vs. travel, etc.) will be added.
Many other ideas come to mind, including rules plugins for Pokémon, Gundam, and even using it to narrate a turn or generate a custom scenario for your board game would be fun.
Note that only the fantasy genre is currently implemented.
The system generates a suitable character name and biography from the player's base choices. The player has the option to override those generated attributes.
Make sure you have Git and Node.js installed, then run the following commands:
git clone https://github.com/p-e-w/waidrin.git
cd waidrin
npm install
npm run build
To use Waidrin, you need a running llama.cpp server with the model of your choice (Mistral Small 2506 is recommended). Once you have that set up, run
npm run start
from Waidrin's installation directory, open the displayed URL in the browser, and follow the instructions.
You can also use
npm run dev
to run in development mode, which gives you features like hot reload and React Strict Mode, and is probably what you want if you plan to work on Waidrin's code (which you are very welcome to do!).
Copyright © 2025 Philipp Emanuel Weidmann (pew@worldwidemann.com)
This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License along with this program. If not, see https://www.gnu.org/licenses/.
By contributing to this project, you agree to release your contributions under the same license.





