A new approach for difficulty levels

Eddie Verdde

Chieftain
Joined
Jan 10, 2020
Messages
81
From Civ1 to Civ6, the difficulty levels have been determined essentially through bonuses, meaning that in higher difficulty levels the AI receives more units at the beggining of the game, as well as more gold, science and culture outputs during the game.

This can be frustrating because not only it feels that the AI is "cheating" but also fails to provide an actual smart and challenging opponent.

I propose a different approach to the difficulty levels, based on the likelihood that the AI will make "smart" decisions. Under this system, at the highest difficulty level there's a 100% probabilty that the AI will make an optimal choice while at the lower difficulty level there's only a 10% probabilty that the AI will make an optimal choice, with intermediate values for intermediate difficulty levels.

Example A:
A Barbarian outpost spawns near a city of the AI and the AI doesn't haver enough gold to bribe the barbarians. The "optimal" decision would be to train a military unit and defend the city from attacks. On "deity" the AI would train a military unit 100% of the times. On "settler" he would only do that 10% of the times. On "Prince", the AI would train an unit 50% of the times.

Example B:
The AI needs to reduce unhappiness in its capital, there's a source of diamonds within the city radius and there's a worker available. On deity, the AI will use the worker to improve the resource imediately. On settler, the AI will most likely spend a large amount of gold to purchase a luxury resource from another player or build an entertainment complex wich takes a lot of time.

Example C:
The AI has several marshes and floodplains within some of its cities. On deity, the AI will rush for Etemenanki. On Settler it will most likely build another wonder.
 
I agree that this form of difficulty levels is optimal, but would suggest in addition to percentage-based randomizers (which I feel should be a little more middle-ground than the examples here), maybe on different difficulty levels, the AI could prioritize better?

Using a mix of leader-specific traits and random assignment, AI leaders would have a couple of set priorities for their empire they will stick to if nothing else is of greater concern. Maybe on lower difficulties, Alex will only sometimes use his free time to build his military and bolster his aggression, but on Deity, he will do so almost always.

I don't think it should be extreme enough to where it feels like Civ VI's manic agenda fixations brought to life, but I think it might work well and has the added benefit of rewarding players who are familiar with each AI leader's playstyle.
 
But the AI more or less always making suboptimal choices right now. How do you teach an AI to intentionally play suboptimally if you can't teach it to play optimally? Moreover, Civ isn't solved like chess or go. You can't say that improving several marshes and floodplains tiles is better than building another wonder; that depends on the broader game state and the goals that the AI is pursuing. Civ is all about balancing short term needs against long term objectives, and sometimes the "obvious" choice is the wrong one depending on the context.
 
How do you teach an AI to intentionally play suboptimally if you can't teach it to play optimally?

Take note that you'd not be "teaching" the AI to play suboptimally, but just assigning different probabilities to different decisions. As to "teaching" the AI to play "optimally", I believe that's possible - in Civ 6 that's just a problem because the game has gotten more complex and the devs didn't put a lot of effort into it because that doesn't sell more copies of the game.

I agree that Civ is not like chess and I understand when you say that "sometimes the obvious choice is the wrong one depending on the context". But when I say "optimal" choice, it's precisely about balancing short term needs and long term objectives. There will be points in the game where it won't be possible to define an "optimal" decision, but there will be other points where an optimal decision can be defined and those would be the points where decisions would be randomized depending on the difficulty level.

Yesterday someone posted an interview with former lead designers of Civ and they were asked about the future of the game. Well, this was not entirely brought up, but I think that the greatest challenge for the next iteration would be to "teach" the AI how to play smart, considering how complex the game became.
 
You would need a line of code for every "example" possible. Considering the devs (and the players) are still making discoveries...

Well, according to Soren Johnson in this presentation,
back in Civ4 only 3% of the code was dedicated to AI, and the AI was better than in Civ6. So maybe the number of lines of code wouldn't be a limiting factor.
 
Last edited:
So maybe the number of lines of code wouldn't be a limiting factor.

The limitation is not the size of the codebase, but the human time it takes to write it.

Take note that you'd not be "teaching" the AI to play suboptimally, but just assigning different probabilities to different decisions

Teaching the AI to play suboptimally is exactly what you're proposing doing, since that is what "assigning different probabilities to different decisions" means. What decisions? How many? How different from the "optimal" decision should they be? How does the AI know the optimal decision is the optimal decision and not one the suboptimal ones? These are all things that need to be considered. Just because there are multiple suboptimal paths doesn't automatically make teaching the AI to play that way easier.
 
How does the AI know the optimal decision is the optimal decision and not one the suboptimal ones?

I'm not sure what's your point with this. It's obvious that the AI doesn't know - nor it needs to "know" - how to differentiate an optimal decision from a sub-optimal one. The AI makes decisions based on how the developer programs it to behave - I'm not a computer scientist but I believe that's called an algorithm, and when the developers are designing that algorithm, it's obvious that some decisions will make more sense than others. Just, each decision would have a probability attached, based on the smartness of the decision and on the difficulty level.

These are all things that need to be considered.

And considered they should, coming from highly qualified professionals that are developing a million dolar franchise with 30 years of history.
 
I'm not sure what's your point with this. It's obvious that the AI doesn't know - nor it needs to "know" - how to differentiate an optimal decision from a sub-optimal one. The AI makes decisions based on how the developer programs it to behave - I'm not a computer scientist but I believe that's called an algorithm, and when the developers are designing that algorithm, it's obvious that some decisions will make more sense than others. Just, each decision would have a probability attached, based on the smartness of the decision and on the difficulty level.

Yes, an AI "makes decisions based on how the developer programs it to behave," but your idea for the AI to periodically make suboptimal choices is meaningless if the AI isn't making optimal choices anyway. What you're effectively asking is for Firaxis to make an excellent AI for Civ, and then have lower difficulty levels by intentionally have it make wrong choices. The problem is that Firaxis can't make a great AI for Civ, and they won't even make a good one. Firaxis has really struggled with that, not just because they haven't invested much into the problem, but because it's a fundamentally very, very difficult task. Most games, including Civ, use a lot of smoke and mirrors to disguise the fact that the AI is not actually playing the same game that the human is.

I'm not sure where the disconnect is, except I think you don't have a full appreciation of the complexity of the problem you've presented. To use your example again, the choice between improving tiles and building a wonder isn't just the choice between those two, it's the choice between improving tiles, building a wonder, and anything else the game state allows at that moment. The human mind has an amazing ability to filter out irrelevant options, it's part of our natural abilities at pattern recognition. Computers really, really struggle with that, because, as you say, they can only do what programmers tell them to do (learning systems like neural networks blur the line, but such a system is well beyond what Firaxis can add to Civ in the foreseeable future). Consequently, each individual choice needs to be evaluated and there are few to no shortcuts that we take for granted in our ability to visualize the game state and understand what is relevant. So, a seemingly simple game state can actually represent dozens or even hundreds of potential decisions and as complexity rises--more cities, more units, more tiles, etc.--the difficulty of choosing the correct decision rises at an exponential rate (meaning you need more and more processing power). Plus, the AI still needs to have knowledge of what is "optimal" if you're going to assign a 50% or whatever probability to it choosing that option versus something else.

TL;DR your idea is conceptually but deceptively easy. It's much harder to get a computer to do what you're imagining.
 
The could have gathered data on how the players play the game and then set AI priorities based on that Unfortunatly they lost trust when 2K started gathering data for other reasons and I don't know if that will be possible in the future.
 
Top Bottom