Baza helps run live-action role-playing games: an AI acts as a librarian, gatekeeper, or another NPC and answers players based on permitted materials. The system works with Markdown documents, accounts for roles, locations, factions, and individual players, and refuses to answer when the information is unavailable.
Why a Game Needs a Digital Assistant
At a live-action venue, participants are constantly moving between locations, while the documents they need remain in the workshop, library, or with the game masters. A player may come looking for an answer when the game master is busy, somewhere else on the site, or has not yet prepared the required material.
Without a unified system, this leads to waiting, searching through files, and dealing with envelopes that are easy to mix up. Baza is designed to replace this routine with an interactive artifact that can talk to participants on its own.
What Baza Looks Like to a Player
A device with a screen, microphone, and speaker is placed at the game location. First, the system asks the player to name a secret word. After three authentication attempts, the player gains access, and the character determines how to address them—for example, by title or name.
A QR code or image can be used instead of a word. The project’s creator is also considering different equipment designs, ranging from an ordinary monitor to a glowing idol or a magical cube.
If several keepers of knowledge are taking part in the game, the gatekeeper asks which one the player wants to reach. The player can then talk to the selected character:
- write a message in the chat;
- ask a question by voice;
- use voice mode with subtitles.
Each NPC has their own speech pattern and voice. The gatekeeper speaks in a calm male voice, while the tavern owner uses a lively female voice.
While the system searches for information, the screen displays a message saying that the archives are being consulted. Sources can be stored on a local computer or online. In the networked version, the game master can add materials during the game, after which they are indexed automatically.
Answers Based Only on Available Materials
If the required information is not present in the records, the character does not fill the gap with invented details. Instead, it says that there is not enough information. Each NPC can have their own preconfigured refusal phrases—short responses that fit the character.
What the Game Master Prepares
Before the game, all materials are placed in a single folder. They include:
- roles, locations, and factions;
- a list of players with secret words;
- NPC profiles with speech patterns and prohibitions;
- text pages about the game world.
Each document can have its own access restrictions. A file can be made available to the entire game, specific roles, participants in a particular location or faction, or selected players. An empty access setting means that the document is public. If a file is marked as restricted and no recipients are specified, nobody can see it.
Baza is designed for use across multiple games. A separate game is created in the administration panel, after which materials are added to it. Searches are limited to the current game database.
How the RAG System Works
Baza is built around a local RAG system. Documents are stored in Markdown, split into fragments during indexing, converted into vector representations, and saved in PostgreSQL with the pgvector extension. A conventional keyword search is used at the same time.
When a player addresses an NPC, the system proceeds as follows:
- builds a search query from the latest message, taking the conversation context into account;
- finds relevant fragments in pgvector;
- filters the results according to access rules;
- selects topics using RRF scores;
- passes the context to the role-playing response engine.
The instruction “answer as the NPC” is not enough: the model may break character or start revealing its nature. That is why the project uses a separate validator.
What the Validator Checks
- Role drift — whether the answer matches the selected character.
- AI reveal — whether it mentions a bot, neural network, or artificial intelligence.
- Taboo — whether prohibited words from the NPC profile have appeared.
- Integrity — whether the answer has been cut off.
- Grounding — whether the facts are based on the supplied context.
Basic protection against prompt injection is also included. The project’s creator notes that such attempts by players can disrupt the role-playing atmosphere.
ACL: Access to Knowledge at the Search Level
Game documents are Markdown files with YAML frontmatter. The metadata can specify the game and access categories: roles, locations, factions, and player IDs.
Baza’s key principle is that the model never receives a document the character is not authorized to access. The restriction is applied before the prompt is created: a prohibited fragment is discarded during the search stage itself rather than hidden in an instruction to the AI.
Technology Stack
| Component | Technology |
|---|---|
| API | FastAPI (async) |
| Database | PostgreSQL, a separate database per workspace |
| Vector search | pgvector and RRF ranking |
| LLM | GigaChat and YandexGPT via API |
| STT/TTS | Yandex SpeechKit |
| Authentication | JWT in an httponly cookie |
| Documents | Markdown with YAML frontmatter |
| ORM | SQLAlchemy (async) |
| Interface | HTML, CSS, JavaScript, and Bootstrap |
| Role logic | Python |
What the System Delivers in Practice
Baza turns documents into part of the game world: the NPC tells players only what their character knows and what the specific player is allowed to access. The secret word and conversation with the gatekeeper add atmosphere, while access can be configured for roles, locations, factions, and individual participants.
According to the creator’s concept, the system takes on recurring questions about rumors, reports, places, and letters. The game master is still needed for live reactions, conflicts, and decisions that cannot be mapped out in files in advance.
As a result, the game location gains a tireless information post that does not mix up materials or hand out someone else’s document. Its capabilities are more limited than a human’s, but its access rules and predefined boundaries make it suitable for the routine parts of a game.
Development Plans
- add a narrator character to describe the world and its events;
- create an inventory and quest system linked to the player’s status;
- use NPC portraits through the
portrait_refparameter; - add PDF export of game sessions in the form of an adventure chronicle.