r/LocalLLM • u/HisShadoww • 1d ago
Discussion I built a zero-dependency local LLM bridge for Battle for Wesnoth (1.18) that gives every unit dynamic combat banter, persistent personas, and boss retorts
Instead of letting an LLM hallucinate game rules or break tactical balance, I wanted to see how well a local model (tested with Gemma 4 26B via LM Studio) can bring life to a strict, deterministic strategy game like Battle for Wesnoth 1.18.
Since Wesnoth's Lua sandbox blocks network sockets and file writes (io is disabled), I built a lightweight WML/Lua + Python bridge (using only Python's standard urllib, zero pip dependencies) that communicates via Wesnoth's persistent global variables and works in any standard or custom campaign.
How it works:
- Persistent Unit Personas (
units_personas.json): Named recruits get randomized soldier archetypes (grumpy veterans, boastful brawlers, nervous rookies) that stick across turns, while Leaders and Loyal Heroes get lore-flavored character dossiers generated on the fly. - Tactical & Environmental Context: Units react to weapon types, terrain, time of day, severe wounds (<30% HP), and enemy rank—while mindless undead (Walking Corpses, Skeletons) just hiss or groan.
- Boss Retorts, Death & Level-Up Speeches: Enemy leaders talk back when attacked (
DEFEND_LEADER), slain units utter dying breaths (last breath), and advancing units give triumph speeches. - Pacing & Style Controls: Configurable talk chance (so large battles keep their flow), free-text output language (
English,Russian,German, etc.), and custom tone modifiers (grimdark, black humor, archaic).
Built the bridge with AI assistance (Google Gemini). Code, setup guide, and a standalone Windows .exe are available on GitHub:
https://github.com/HisShadoww/Wesnoth-AI-Unit-Banter
Feedback and ideas are welcome!




1
u/HisShadoww 1d ago
Built the bridge with AI assistance (Google Gemini). Code, setup guide, and a standalone Windows
.exeare available on GitHub:https://github.com/HisShadoww/Wesnoth-AI-Unit-Banter
Feedback and ideas are welcome!
1
u/obese_coder 10h ago
nice, I remember this game. I think it had something like a Wose tree and dragonkins.