VEGA and the AI Backend: A Language Model with a Safety Net
- Marcel Dütscher
- Jul 4
- 1 min read
Updated: 4 days ago
VEGA, the game's onboard AI, and our NPCs can hold lively conversations thanks to a real language model. How that's built — and why the game works without it too — is what this article is about.
The setup. The AI integration lives in its own backend service, built with LangChain/LangGraph and an OpenAI-compatible interface. Behind it right now is a Mistral model, hosted in Europe (OVH). The interface is deliberately swappable: if a better or cheaper model shows up tomorrow, we swap the provider, not the architecture.
Only open on the inside. The AI service is reachable exclusively internally on the server — no public endpoint. The game servers talk to it, nobody else. An open LLM gateway on the internet would become a free chatbot for strangers within days (on our bill).
The most important design decision: the template fallback. The game must never depend on the AI. Every dialogue the language model can hold also exists as a classic text template. If the backend is unreachable, the quota is used up, or the response is simply too slow, NPCs and VEGA seamlessly carry on talking with templates. At most, the player notices the sentences becoming a bit more predictable. A game that goes silent when the AI fails would be broken — a game that just talks a little more woodenly is not.
This fallback philosophy is perhaps our most important advice for anyone building LLMs into games: treat the model like nice weather. Plan for rain.
Comments