I’m a big fan of Turn Based Strategy games, and perhaps none more so than Sid Meier’s Civilization series. I managed to make it into my twenties without ever picking up one of the Civilization series, and so the one I started with was Civilization V. And let me tell you - from day one, I was hooked. Having now sunk several hundred hours into the game, it’s one of the first things I think about when I consider how our product can help improve already-amazing games to be even better.
Civilization V is a relatively complex game. For those who’ve never had the pleasure of picking up the game before, the premise is simple - you are the ruler of a civilization, and the goal is to get from the agricultural revolution to space travel through technological, cultural, religious and diplomatic/military means. However, all of this is done while competing and co-operating with fellow civilizations. For an AI, there is quite simply a lot to take care of. The branching factor of possible decisions and outcomes is enormous once you consider how many elements are required to do well in the game. Even for most human players there is a steep learning curve.
Here’s the thing: for Civilization V, the AI is essential. Any individual game can easily take a dozen hours (or much, much more - people report games longer than 100 hours!). To play on multiplayer is a challenge simply because of the time commitment. Finding other people to play a single game over multiple long sessions can be very difficult, especially when you consider that a standard size map is eight players. To get eight people together for that long is next to impossible (especially as the more humans you have, the longer a game tends to take, since humans need to think). You will almost certainly end up playing with at least a couple of AIs, if not mostly AIs.
When I play, it’s usually with one other person. Even though we are the minority, and even though we play on higher difficulties, when we play, we know that the winner will be one of the two humans. The AIs in the game serve as foils, as help or harm, but they will not win. In fact, no AI has ever won a game of Civilization in which I’ve played.
To make the AIs tougher on higher difficulties, a complex series of balances are used. You may recall from my post on Dota 2 that at Decisive, this sort of thing is regarded as cheating, but unfortunately this is usually a necessary evil in video game NPCs.
The difficulty tables clearly illustrate the complexity of the game. There are many variations between the difficulties, some to do with the player’s starting stats, and others to do with their opponents. Prince is the standard difficulty level, and going up from there sees little difference in player abilities (primarily it is a change in bonus combat ability against barbarians). However, the AI sees huge changed. They receive free technologies to start, extra defense units, worker units, exploration units. They have an increased work rate, and decreased unhappiness, unit costs and era modifiers. All this is to say that the AI does not become a better player as the difficulty goes up, it simply gains resources. As a result, there comes a point for most players where the game is no longer fun.
For many aspects of the game, there’s a certain degree of looking forward. Long term plans are important, but so are sabotaging other people’s. Playing in a short-sighted manner will lead to you losing. Usually when playing, one of the two humans will begin to take a commanding lead in the later stages of the mid-game, which leaves the other human trying to rally the AIs in trade embargoes, wars or other diplomatic punishments against the leader and almost certainly failing as the AIs see greater short term value in continuing to trade with that rich civilization. This is frustrating. Why can’t the AIs see that if they don’t do this, don’t work together, that that other player will win?
On the other hand, sometimes you will have been friends with another civilization for what amounts to thousands of years of in-game time, only for them to suddenly turn on you with little warning or provocation.
To quote Civilization V’s lead designer and principal gameplay programmer, Jon Shafer:
“The AI in the base version of Civ 5 was... not as strong as it could be, shall we say.
Working on this system was another experience that taught me a great deal about design and development. I wrote the AI code that handled the computer opponents' high-level strategic goals, economy and diplomacy.
Like most engineers, I really enjoy architecting elegant and flexible structures. Civ 5's AI was a beautiful mesh of interwoven systems, and even included the ability to record virtually everything to a massive log file. Unfortunately, my enjoyment of building caused me to fall in love with the design rather than its actual impact. I was very proud of my code. But it really wasn't very good.
What many people don't know about AI programming is that one of the greatest challenges is getting your artificial players to actually do what you think you're making them do! The AI code in a big strategy game is typically so complex that you end up with a variety of pieces that either don't function as expected, or worse, don't do anything.Another problem with my AI was the randomness, which is something I've already talked about at length. The computer opponents were weighted towards a variety of possibilities, with a healthy serving of RNG (random number generator) on the side. This meant they floated from one "strategy" to another without any real cohesion behind those decisions. This approach is nice in theory, but if you want a strong AI there are times when you need to force it to behave in very specific manner.”
The reviews for Civilization 5 are overwhelmingly positive, but the criticisms are almost always the same.
“...the AI in Civ V is still curiously terrible. At its absolute smartest (what the game calls its 'normal' difficulty setting, before the AI starts receiving stat bonuses) the AI still makes inexplicable demands from you...These aren't opponents that make for fond memories. Civ V is occasionally capable of clashes between equally-matched nations, but they're unforgivably rare. If you want respectable competition, you need to head online.” - Eurogamer
“Time may have been kind to many of Civ V’s best aspects, but while expansions and updates have bolstered the game in some areas, others are in need of a helping hand. Combat AI, especially at lower difficulties, can still be maddeningly simple and ineffective, while on harder ones it still feels like you’re being cheated.
Likewise, the diplomatic AI still hasn’t managed to match the personality of its visuals. Opponents will still make repeated and unnecessary demands of you, and a lot of the time erratic declarations of war come across as, well, more erratic than unpredictable.” - Kotaku
So the question remains: is there a way to make the AI in Civilization V play - not just hard, with a lot of resources - but well? Is there a way to make it so that the NPCs have a chance of winning, and are seen as a threat rather than just an obstacle in the fight against the other human players?
At Decisive AI, we believe the answer to that is yes.