DEV Community

davidvk89
davidvk89

Posted on

I Just Wanted Bannerlord NPCs to Remember Things

I did not want to write.

I did not want to think.

I did not want to code.

I just wanted Bannerlord NPCs to remember things.

That was the whole crime.

Bannerlord is a strange game for me because it has so much of what I like. Big map. Clans. Armies. Marriages. Trade. Sieges. Prisoners. Fiefs. Lords and ladies with family names, banners, grudges, and theoretically important political ambitions.

It has rich systems.

It also has a world that can feel weirdly dead.

Not bad. Not empty. Just… dead in the specific way sandbox games can be dead. Things happen, but the world does not always seem to understand that they happened. A lord is captured. A battle is won. A marriage is arranged. A village burns. A clan rises. A family member dies.

And then the game politely continues being a spreadsheet wearing armor.

So I started playing with an LLM alongside the campaign.

At first, it was just prose.

And honestly? The prose was the hook.

Suddenly a council scene had weight. A companion could have an opinion. A marriage negotiation could feel like more than a transaction screen. A village notable could become a person with fears, leverage, and memory. A warband returning from a battle could carry more than loot and wounded troops. It could carry consequences.

For a week or two, that was enough.

I was not thinking about architecture. I was thinking, “This is fun.”

Then the magic started fading.

Not immediately. That is the dangerous part. At first, it works well enough to make you believe. Then, a few sessions later, small cracks start showing.

A character remembers something slightly wrong.

Someone knows something they should not know.

A private thought leaks into public dialogue.

A rumor hardens into fact.

A future plan from a planning note starts acting like current canon.

By around session four, the medieval sandbox is no longer a roleplay companion. It is a gossip-powered hallucination engine with horses.

That was the point where I realized the problem was not prose quality.

The LLM could write. That was not the issue.

The issue was memory.

If I wanted the world to feel alive for longer than a few sessions, the characters needed some kind of stable memory. Not just “the whole chat so far.” That would not be enough. Long chats get heavy, messy, and full of things that are not supposed to become true.

The characters needed structured memory.

Who are they? What do they know? What do they believe? What did they witness directly? What were they told second-hand? What is rumor? What is private? What is public? What has happened in the world? What is the current scene? What is the current political situation? What is old enough to matter but not so immediate that it should dominate every conversation?

This was the moment the companion app idea appeared.

The first idea was simple: flat JSON files.

Nothing glamorous. No grand platform. No elaborate database. Just structured files that could hold character memory, world state, campaign events, and useful context.

The important thing was not the storage format. The important thing was that the memory had to be sliceable.

A character should not receive the entire world.

A scout does not need the same context as a spouse. A village elder does not need the same context as a clan council. A captured enemy lord should not know the player’s private plans. A merchant should not suddenly become omniscient because the LLM was given too much campaign history.

The right actor needed the right context packet at the right time.

That sentence sounds boring until you start thinking about multiplayer.

In single-player, a hallucination can sometimes be treated as flavor until it breaks continuity. In multiplayer, it becomes fairness. Hidden information. Player trust. Canon. Authority. Maybe even moderation.

If an LLM says something happened, did it happen?

If an NPC reveals secret information, was that information actually available to them?

If two generated scenes contradict each other, which one is true?

If a player tricks the system into saying something useful, does that become world state?

I needed one exact point where LLM output stopped being suggestion and became truth.

That was the beginning of the trust gate, though I did not have that language yet.

At the time, it was much less dignified. It was more like:

Wait. No. The AI cannot just say that and make it canon.

Very academic.

So the companion app started becoming a memory and context-routing problem. The LLM was not just a writer anymore. It was an actor receiving a bounded context packet and producing output that still needed to be accepted before it changed the world.

Then I asked a coding agent to help build the app.

And within a few prompts, the development process started showing the same disease as the story layer.

The coding agent could move quickly. Sometimes very quickly. It could generate a mockup, create files, wire routes, adjust behavior, and make the thing look like progress.

But it could also grab the wrong idea, preserve a temporary assumption, broaden the scope, or act on something that was only ever meant as background thinking.

That was when the recursion became hard to ignore.

The app needed controlled context so fictional characters would not accidentally act from the wrong memory.

The coding agent needed controlled context so it would not accidentally build from the wrong project understanding.

Same shape. Different layer.

So I started applying the same instinct to the development workflow.

The project documentation became the development equivalent of actor memory. It preserved what the project currently was, what the architecture meant, which data shapes existed, which API contracts mattered, and which ugly things were intentionally deferred.

The Codex Contract became the context packet. Not the whole planning conversation. Not every idea. Not the future dream. Just the bounded implementation slice: what to change, what to preserve, what not to touch, what to verify, what documentation to update, and what to report back.

Final Review became the trust gate. The coding agent’s output was not automatically accepted project state just because it existed. It had to be checked against the contract, tested, reviewed, and folded back into the documentation before it became part of the next cycle’s memory.

In hindsight, this is funny.

I started by wanting Bannerlord characters to remember things.

Then I built memory files for fictional actors.

Then the coding agent building those files needed its own version of memory.

Then the documentation started behaving like project memory.

Then the review step became the point where output became accepted truth.

Then I found myself writing about operational memory, controlled context flow, and trust gates like a person who definitely meant to end up here.

I did not.

This started as play.

Then the toy developed architecture.

This is probably the most honest version of the story:

"I was hooked by the prose first. The serious part came later, because the fun thing had a real problem underneath it. Making an LLM-powered sandbox feel alive is not only a writing problem. It is a memory problem. A context problem. An authority problem."

And, apparently, building the tool to solve that problem creates the same problem one layer up.

That does not mean I solved it. The companion app is still very much a prototype. The workflow is still something I am testing, tightening, and trying not to overclaim.

But the path makes sense to me now.

I wanted NPCs to remember things.

To make that work, I needed structured memory.

To use that memory safely, I needed scoped context.

To make scoped context reliable, I needed review boundaries.

To build the app without losing control of it, I needed the same pattern in my development process.

So yes, I spent a week trying to make AI-assisted development less chaotic.

But the real origin is much less grand than that.

I just wanted Bannerlord NPCs to remember things.

Top comments (0)