The Modders Who Decided to Overhaul the AI in 'Civilization V'

It's one thing to modify part of a game, but a core component? That's something else.
April 13, 2017, 3:40pm

One of the most popular mods for Civilization V, dubbed the Community Patch, goes far beyond anything I've profiled before. It doesn't just add a weapon, faction, or tweak the colors on a t-shirt to fit someone's preferences. Instead, the creators raised their ambitions higher, hoping to radically improve the AI driving the game.

Community Patch was actually built upon another mod. Since development began in 2014, it's become its own thing, prompting a rebranding: Vox Populi. Besides improving upon the game's AI, Vox Populi tweaks the game's balance, and fixes bugs that were left behind after Firaxis moved on.


By making the AI smarter, it's also made Civilization V more difficult. When looking up comments about Vox Populi, inevitably you find people throwing up their hands at how different it feels. The goal was to make the AI more like a real-life player, someone who goes out of their way to try and screw you over. Their goal is to win.

"If you're going to make a mod, make it at least possible to beat without cheating," reads one comment on the game's subreddit.

You can imagine what the response to that comment was like.

To understand what it was like to build Vox Populi, and if there was any tension over a patch that implicitly criticizes Firaxis' design, I spoke with designers Cristoph and Jeff Grooms (Cristoph asked for his last name to be kept private.)

(This interview has been lightly edited for length and clarity.)

Waypoint: Why'd you originally fall in love with Civilization?

Cristoph: Well, I can't really remember, I played the first part back on my Amiga 500—and stuck with it. It's just one of the best games ever, regarding its scope and the connections to the real world. The turn based aspect is very important to me, I like to have time to think.

Jeff Grooms: I'm a historian by trade (Ph.D. in Comparative Imperialism), so the series was a natural fit. In all honesty Civilization—and games like Civilization—played a major role in my childhood interest in history, and that has carried on ever since.


Civilization has come a long way since 1991. Image courtesy of YouTube creator Maik's Hobbyzimmer

Can you talk to me about the origins of the community patch? What prompted you to attempt something this ambitious?

Cristoph: The problem with single-player games is that the AI is mostly atrocious. Which is understandable, in a way. Because professional developers target a large market of casual gamers who maybe don't even notice the difference between a good and a bad opponent. Because of the long duration of the game, Civilization isn't really suitable for multiplayer, so this started to annoy me. And then Firaxis released the Civ5 SDK, which made it possible to see what the AI is doing and improve it. Which was surprisingly easy because there was a lot of low-hanging fruit to pick. So I started to get to know the code better, and step by step we rewrote the important parts. Ambition came in only later when I realized that we can actually create a significant improvement and wanted the project to shine.

Grooms: William Howard, he's really the project's grandfather. I took his DLL as a base and expanded upon it, adding in the code for my first project, City-State Diplomacy (CSD). From here, I started chipping away at nagging bugs in the game, until—finally—I decided to branch these bugfixes off into an entirely new project, the Community Patch. At this point, I appealed to the community for help, after which Christoph joined. From here, we really started looking at AI bugs and poor performance, specifically improving the combat AI, diplomacy AI, and the city development AI. I don't want to pat us on the back too hard, but the Vox Populi AI is widely considered by users to be one of the (if not the) best turn-based strategy AIs currently available for a modern game.


The fact that you're messing with core elements of the game—the AI—goes beyond a lot of what people usually mods into games. Where do you even begin?

Cristoph: Well, Firaxis really gave the community a lot to work with. There are different components to a mod: SQL, XML, Lua and C++. Personally I focus on the C++ part because that's what I know best, but you don't need to be a programmer to contribute: Artist skills are also important. Forum moderation is important.

Grooms: It does require a programmer, but—more than anything else—it requires a human player to sit down and play against the AI. There's no way Christoph or I could have worked on the AI and debugged it efficiently. This is, of course, as good a time as ever to praise our community of users, beta testers, and content creators. If it isn't already coined, I'd like to coin the maxim that a game developer is only as good as its beta testers.

Regarding AI design, we really had to step back and reevaluate Firaxis's design. I'll spare the details, however the core of the Firaxis AI was a system of flavors. Everything was flavored—AI personalities, buildings, units, wonders— and these flavors were weighed and changed dynamically during the game. The AI would select tasks, policies, and so on based on these flavors, a system which—on paper—makes a lot of sense. In reality, though, it largely left AI decision-making up to chance, as the flavors were generally not good at creating long-term planning or predictive behavior models.


So, we went back to the drawing board, scrapped most flavors, and wrote AI systems that focused more on weighting based on things the AI had already done. So, if the AI had been focusing on war-related policies or beliefs, for example, it would be more keen to continue this trend in the future. It isn't perfect, but it is an efficient way of simulating long-term strategy.

"The problem with single-player games is that the AI is mostly atrocious. Which is understandable. In a way. Because professional developers target a large market of casual gamers who maybe don't even notice the difference between a good and a bad opponent."

What's the relationship like between Fixaxis and the mod? Is there any tension?

Cristoph: I haven't been in contact with anybody from Firaxis, so I can't really tell. They seemed to be ignoring us, until recently. A while after Grooms put the Community Patch on Steam, there were reports about a user getting banned for mentioning it in a Civilization VI forum, and suddenly CP vanished from the 'most popular mods' list on the steam workshop (which it had been topping). So somebody out there doesn't seem to love it. For me it's an ambiguous situation. On the one hand we have to respect them for giving us the source code, and that must have taken some courage because some parts of it are nothing to be proud of. On the other hand, fixing their bugs, improving their game and being denied any recognition isn't very nice. But doing it was fun, so it's OK!


Grooms: No tension, as there's no interaction at all. And I don't blame Firaxis for that—hard to support, or even be happy about, an amateur project improving/fixing your AAA game for you (for free!). It is clear, based on some of the choices they made for Civilization VI, that they were clearly aware of our project, as some of our ideas were lifted and put into the new game. I do hope Firaxis does not hate us for this—if anything, our project should be seen as a testament to the durability of the Civilization series, not a condemnation of their development choices.

One of the tensions that Vox Populi faces is whether folks want to stick around with Civilization V, or move onto the more novel Civilization VI.

One of the things this patch does is address bugs that were left behind. How do you go about trying to root out a bug, and what ones were really bothering you?

Grooms: As noted above, our beta testers and debuggers are amazing. Most of the time, they'll open an issue on Github for us (an open issue and code-tracking website) that we can track, assign, and respond to as we get a chance. In the best situation, we step in, replicate the scenario on our end, attach Visual Studio to Civ (so we can step through the DLL line-by-line to watch the event), and see the bug immediately. In other situations, the bug is so obscure, or so difficult to track down, that it may take us months of steady sleuthing to find.

The worst bug I can recall was related to trade deals. This happened last year. For some reason, trade deals were corrupting after completing a cycle, breaking the entire diplomacy system. I had barely touched this system, yet the bug was clearly my fault. I poured over the code probably a 100 times, checking and checking for inconsistencies. I'd make a tweak, release a fix, and then it would come back. Finally, after almost six months, I found the bug—a merge error with my Github client was reintroducing a singular boolean value into the DLL incorrectly. Every time I would upload a new version, the bool would come back. Needless to say, I was both relieved and exasperated once I found this.


I imagine a project like this takes up a ton of time. How do you balance it with real-life?

Cristoph: It hasn't really been a problem, I did this in the evenings and sometimes on a rainy weekend. We didn't have any deadlines, so the only pressure was self-imposed. I don't watch TV much, but I still have a social life. Also there's the autoplay mode, without which this wouldn't have been possible. When you need to test something, set up autoplay, go out and come back some hours later to check the results.

Grooms: Lots of late nights, but I enjoy them. It is honestly a hobby at this point. some people collect rocks or watch paint dry for fun—me, I like to watch little digital men kick about and scrutinize just why exactly Askia of Songhai decided embarking that spearman next to Alexander the Great's frigate was a good idea.

During most of this project, I was working on a massive manuscript project (Comparative Imperialism Ph.D. Dissertation, to be precise). DLL work was a nice counterpoint to academic writing.

Follow Patrick on Twitter. If you have a tip or a story idea, drop him an email here.