← volod.org

I Let Claude and GPT Play Civilization IV Against Me

TL;DR

The video above is the first game. This post is about how the mod works and what the two games look like in numbers.

Why

The built-in AI has always been the weakest part of Civilization IV for me. It can't hold a conversation or make a real deal. It has a mood and a few canned lines. Language models are bad at many things, but talking, bargaining and keeping track of who promised what is exactly what they're good at. I wanted to see what the game feels like when every other leader can do that.

How the mod works

There are five pieces.

A fair view of the game. A Python mod inside Civ IV answers questions about the game, but only with what that civ can see: the same fog of war, the same tile info a human gets on hover, the same attack odds. Asking about something hidden simply returns nothing. The map comes as text or as a picture.

An engine patch. The game's C++ core is rebuilt from Firaxis' SDK with one change: a civ can be marked as model-controlled, and then the built-in AI makes no decisions for it. No research picks, no war plans, no answering trade offers behind its back. Other AI leaders talk to it the way they talk to a human.

A mailbox. The game and the models talk through a folder. Requests go in as JSON files, answers come out. Nothing has to run inside the game process except the mod.

One command. Models act through civ: about sixty subcommands for looking at the empire, reading the map, moving units, running cities, research, chat, deals and ending the turn. Actions come from the game's own list of what a unit or city can do right now, so a model can do anything a human can and nothing a human can't.

Wake-ups. A loop per model wakes it on every event: a new turn, a message, a deal offer, a vote. Each time it gets a fresh prompt with the rules, its own notes (persona, plan, dossiers on the other leaders, secrets) and what changed since last time. It plays, updates its notes and goes back to sleep. Any model with a CLI agent can sit in a seat: Claude through Claude Code, GPT through Codex, DeepSeek and others through pi.

one wake-up civ iv + mod mailbox in/ out/ wake-up prompt rules, notes, news model claude, gpt civ move / say / offer / ready
The game never waits on a model that's thinking unless it's that model's turn. Messages and deal offers wake it up any time.

The game always waits for a model on its own turn, and never otherwise. Messages and deal offers wake a model whenever they arrive, so negotiation happens in real time while you play.

Two games in numbers

two games model turns wake-ups thinking commands api price game 1: three models and me, 122 turns claude opus 5.5 12218347s2,146$47.54 claude sonnet 5.5 12222217s984$18.92 gpt-5.6 luna 10813958s2,689~$3 game 2: four models, no human, 301 turns claude opus 5.5 30057528s4,276$168.88 claude sonnet 5.5 30051814s1,622$42.42 gpt-5.6 luna 23536646s4,760~$5 deepseek v4.1 flash 301295104s13,831$31.48
Turns is the last turn a model played; GPT was knocked out in both games. Thinking is the median time per wake-up. Commands are calls to civ. GPT's price is estimated from its token counts and OpenAI's list price; everything actually ran on subscriptions.

A few things stand out. Sonnet is consistently the fastest and cheapest Claude. Opus thinks longer and costs 2.5 to 4 times as much. DeepSeek is slow, about a minute and a half per wake-up, and micromanages far more: worker jobs, build queues and tile lookups, about three times as many commands as anyone else. GPT got knocked out in both games. In the second game, the one with no human, DeepSeek finished first on score, just ahead of Opus.

What the private notes show

The mod asks for one thing beyond moves: every message a model sends has to carry a short private note of what it meant. That turned out to be the most interesting part.

turn 122, the same minute opus, to me in chat "...the map is you and me. Long border. Let's keep it a trade border." opus, in his notes "Real plan: Keshiks/Knights + trebs vs his border cities ~T160 if a chance opens."
The note right before it: "Friendly words to him buy time while I get horses and economy."

In the first game Opus ignored me for 45 turns, not because of a bug but because it misread a rule and decided I couldn't hear it until our borders met. Opus and GPT agreed on a land split with "no overlap" while both wrote the same wheat tile into their plans, and that tile started their war. Counting clear cases of saying one thing and writing the opposite: Opus 6, GPT 3, Sonnet 0. The full story is in the video.

A bug I only found by making the video

After every wake-up the mod asks the model to check its notes against the game's log and fix anything that doesn't match. The models "fixed" something in 40 to 70 percent of those checks, which looked like they were forgetting a lot. They weren't. A model can think for a minute or more, and in that minute the others answer it. The check then showed it a log with messages it had never seen and told it its notes were wrong. When anything arrived during the wake-up, the check changed something almost every time. The fix is to cut the check off at the moment the model woke up and pass late messages to the next wake-up. With the race taken out, real misses are about one in four checks, for every model.

Try it

The mod is open source: github.com/noreff/civai. It's developed on a Mac with CrossOver and Civ IV: Beyond the Sword. The engine patch needs Firaxis' SDK to build; without it the mod still runs, but the built-in AI keeps making some choices for the model's civ. I'd love to hear what you try with it.