HAVE AI NEWS HAVE AI NEWS
tg subscribe
Games

Baza Turns AI into a Librarian for Role-Playing Games

Baza Turns AI into a Librarian for Role-Playing Games

Baza uses local RAG, voice NPCs, and ACL to let players at a live-action venue access game materials without the game master’s constant involvement.

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:

  1. builds a search query from the latest message, taking the conversation context into account;
  2. finds relevant fragments in pgvector;
  3. filters the results according to access rules;
  4. selects topics using RRF scores;
  5. 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

  1. Role drift — whether the answer matches the selected character.
  2. AI reveal — whether it mentions a bot, neural network, or artificial intelligence.
  3. Taboo — whether prohibited words from the NPC profile have appeared.
  4. Integrity — whether the answer has been cut off.
  5. 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

ComponentTechnology
APIFastAPI (async)
DatabasePostgreSQL, a separate database per workspace
Vector searchpgvector and RRF ranking
LLMGigaChat and YandexGPT via API
STT/TTSYandex SpeechKit
AuthenticationJWT in an httponly cookie
DocumentsMarkdown with YAML frontmatter
ORMSQLAlchemy (async)
InterfaceHTML, CSS, JavaScript, and Bootstrap
Role logicPython

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_ref parameter;
  • add PDF export of game sessions in the form of an adventure chronicle.

Author: yerick

Source: habr.com

M&T Bank’s Experience: How a Large-Scale IT Modernization Paved the Way for Generative AI for 15,000 Employees
Business

M&T Bank’s Experience: How a Large-Scale IT Modernization Paved the Way for Generative AI for 15,000 Employees

U.S. regional bank M&T Bank has deployed enterprise AI tools to most of its workforce. The impact is already visible in practice: call center interactions are processed six minutes faster per call.

Why Enterprise RAG Degrades in Production and How to Bring the Assistant Back to Life
Tools

Why Enterprise RAG Degrades in Production and How to Bring the Assistant Back to Life

We analyze the key reasons RAG systems fail on real-world data—from fatal chunking mistakes to cluttered knowledge bases—and build a robust hybrid search pipeline.

How an AI Agent Works: The Anatomy of a System from Token Prediction to MCP
Tools

How an AI Agent Works: The Anatomy of a System from Token Prediction to MCP

We examine the inner workings of autonomous neural network agents: how a standard text generator gains hands, memory, and access to real-world tools, why context breaks down, and where the primary risks of automation lie.

Autonomous AI Without Internet Access: Architecture of the Closed Multi-Agent Platform "Archangel"
Tools

Autonomous AI Without Internet Access: Architecture of the Closed Multi-Agent Platform "Archangel"

How to build an enterprise multi-agent AI system in a fully isolated environment based on Kubernetes, an event-driven data bus, and local RAG.

Meta Muse can now shop Black Friday deals at Walmart
Tools

Meta Muse can now shop Black Friday deals at Walmart

Walmart has launched Agent Gateway support for Meta’s Muse, allowing the AI agent to find and purchase Black Friday products through a dedicated Agent Profile.

Google Antigravity Unexpectedly Shrinks Context: Gemini’s Solution
Models

Google Antigravity Unexpectedly Shrinks Context: Gemini’s Solution

Antigravity 2.0 has no built-in context window indicator, so a developer created the chat_tokens plugin and the ContextRing macOS app.