Build a city builder mod for Valheim that tests itself in game

A Redditor had Claude write most of a free Valheim mod that turns the game into a city builder, driving the game itself to check its work; the mod hit #1 on r/valheim.

Done withClaude· Oct 26, 2026

What they did

The poster, u/Any-Explanation3814, wanted Valheim to switch into a city builder at the press of a key: settlers who move in, pay taxes, need food and mead and leave when they go without, plus boss camps you raid with your own army. Claude wrote most of the C# for it as a BepInEx plugin with Harmony patches into the game's own systems, covering settler behaviour, the economy and houses that assemble themselves from real Valheim building parts. The poster set up a small command file the agent could write to, so it could steer the running game: build a town, take screenshots, judge whether things looked right and fix them. The poster says they did the design and the testing and kept pushing.

How it went

The mod shipped free on Nexus and Thunderstore and the poster says it reached #1 on r/valheim. When a tester reported bosses chasing players into town and scouts getting stuck, Claude found and fixed both causes in one pass. It also wrote an in-game benchmark, measured frame rates with 10 to 150 houses, and found that merging finished houses for rendering helped most, taking the game from 36 to 56 fps.

Worth knowing

The harness was not named; the poster only says Claude. The work was one long chat with plenty of unrelated context, so there is no single prompt to share. The giveaway is the feedback loop: letting the agent act in the game and look at screenshots is what let it debug itself. Expect pushback in gaming communities; the r/valheim thread was mostly arguments about AI.

Try it

With Claude· 4 parts to fill in

Help me build a mod for [game] using [mod framework, e.g. BepInEx and Harmony] that adds [feature, e.g. a city builder mode with settlers and an economy]. First, set up a way for you to drive the running game, such as a command file you write to that the mod reads, plus a way to take screenshots. Then build one feature at a time: implement it, trigger it in game, look at the screenshot and logs, and fix what is wrong before moving on. Add an in-game benchmark that reports fps at [load levels] and use it before any performance change. Stop after each feature and show me what you built so I can play test it.

Square brackets are the parts to fill in. The prompt is ours; the story is theirs.

Where they said it

Related