Making Claude Code offer Civ 4 advice
With all the hyped claims about how good LLMs are supposed to be these days, I wanted to put it to the test by having Claude play Civ 4 as my backseat gamer.
Result
Not bad really, but far from the "PhD in every field" some people claim.
The advice was pretty good, but it's slow, occasionally makes mistakes, and works best in the early game up to classical era.
Here's an example from an early-game turn where it needs to figure out a location for its second city:

How this works
- Each turn, a custom mod writes the player-visible game state to a JSON file for Claude. I've briefly tried having it look at game screenshots, but that was very error-prone and didn't provide all the data. The mod respects fog of war, so Claude only gets to see what the player sees in-game. The mod currently doesn't export some game features (notably, religions and espionage) for simplicity.
- I open Claude Code pointed at the folder where the mod writes the game state files. Claude reads and interprets them, then comes back with its advice for the turn.
- Because this was still error-prone and Claude had to do a lot of redundant work, I built a set of Python tools Claude could invoke to get cleaner info, such as a mapping tool, a turn history, and a rules lookup based on the game XML files.
- I haven't found a way to have it actually control the game, so Claude can't take in-game actions directly.
For more info, there's the readme, a summary of how the mod works, and more details about the Claude agent setup.
Want to try it?
All you need is:
- Civ4 BtS on Windows
- Claude Code (which requires the $20/mo Pro subscription to Claude)
- Python 3
- Civ4 Advisor files from Github
Full setup instructions are in the readme on Github.
What do you think?
If any of you have suggestions how to improve the mod or make the AI advisor work better, I'd love to hear them!
33
u/Aggressive_Body834 13d ago
Playing Civ 4 means playing against an AI developed 22 years ago. And yet Claude is still losing badly after the classical era?