Improving the AI: a modest proposal

Txurce

Deity
Joined
Jan 4, 2002
Messages
8,285
Location
Venice, California
Everyone knows the combat AI could be a lot better, and most know how hard it is to achieve that. There are also countless small adjustments that would improve AI behavior. What I'm proposing here for the fall patch are two simple core changes that have game-long impact and are guaranteed to make the game more challenging at the higher levels.

Era-based AI science bonuses

Even on Deity, where the AI normally blows the human away on science in the early going, the human starts to pull away around the Renaissance, and eventually leaves the AI in the dust. How much in the dust? As many as 100 turns, when you compare the fastest human and AI win times.

I propose making the AI's difficulty-based bonuses era-based, especially the science bonus, so that they may even start lower (say, on Immortal and Deity) but keep scaling upward with each era.

This means that by the Industrial era, when the human's bpt is really picking up steam, the AI will still be hanging in there - without having to play any smarter. Properly scaled for era and difficulty level, the AI will pose much more of a challenge throughout the game - and without requiring the current front-loaded boosts.

I focused on a science bonus because science leads to improvements everywhere else, but obviously the same approach could apply to other areas. I suggested this change to the Communitas mod a while back, and it's worked well there. That mod also applied the same principle to units, reducing the human's gradual promotions edge by making late-era AI units start with more promotions.

Increased AI focus on Victory Conditions

How many times have we seen the AI ignore a sure DV, or proceed at a snail's pace to building the SS parts for a SV? When it happens, it always cheapens my victories. I propose that the AI focus as single-mindedly as the human on a VC once one is in sight - say, with the first UN vote, or once Apollo has been researched. Doing so is sure to spike the number of hold-your-breath photo finishes. Who wouldn't want that some of the time?

Both of these proposals are very easy to do - it's just a matter of changing numbers in existing code. Again, these changes would be scaled to difficulty as well as to era, so mid-level players wouldn't face a tougher opponent - just a more consistently challenging one, at the level they most enjoy playing. I'd love to be challenged more often on Immortal. Wouldn't it be great if the best players were challenged a little more often on Deity?
 
That's all well and good, but this is not "a modest proposal." Using that phrase has a particular connotation. Jonathan Swift wrote a famous satirical essay by that title. So when people claim they are making "a modest proposal," you're not supposed to take them seriously.

Anyway, I'm skeptical that the second part is as simple as you claim. I think there's a Victory Competitiveness flavor, but I'm doubtful that it would alter AI behavior that much. It shouldn't be too hard to see what it feels like with a quick mod that alters the AI flavors.
 
That's all well and good, but this is not "a modest proposal." Using that phrase has a particular connotation. Jonathan Swift wrote a famous satirical essay by that title. So when people claim they are making "a modest proposal," you're not supposed to take them seriously.
So? Did he copyright the phrase?

This is a class A idea. I say give this man a cookie, promote him and make Jon Shafer his personal servant. :goodjob:

If they make AI pursue diplomatic victory, though, they should tweak AI gold supply so that they don't have 90k gold in the end-game and/or make it so you need to complete quests as well to get CSs to vote for you. If the AI used all its gold, currently you'd have no chance to stave off DV on Deity and might have a hard time on Immortal.
 
Everyone knows the combat AI could be a lot better, and most know how hard it is to achieve that. There are also countless small adjustments that would improve AI behavior. What I'm proposing here are two simple core changes that have game-long impact and are guaranteed to make the game more challenging at the higher levels.

Era-based AI science bonuses

Even on Deity, where the AI normally blows the human away on science in the early going, the human starts to pull away around the Renaissance, and eventually leaves the AI in the dust. How much in the dust? As many as 100 turns, when you compare the fastest human and AI win times.

Right now the AI has static difficulty-based bonuses - that is, those numbers don't change throughout the game. I propose making these bonuses era-based, especially the science bonus, so that they may even start lower (say, on Immortal and Deity) but keep scaling upward with each era.

This means that by the Industrial era, when the human's bpt is really picking up steam, the AI will still be hanging in there - without having to play any smarter. Properly scaled for era and difficulty level, the AI will pose much more of a challenge throughout the game - and without requiring the current front-loaded boosts.

I focused on a science bonus because science leads to improvements everywhere else, but obviously the same approach could apply to other areas. I suggested this change to the Communitas mod a while back, and it's worked well there. That mod also applied the same principle to units, reducing the human's gradual promotions edge by making late-era AI units start with more promotions.

The problem is the AIS have an Era based bonus that works the opposite of this.

They start with free techs (massive Ancient bonus).. and then have fixed bonuses the remainder of the time.

If they started with 0 free techs, and just a fixed X% reduction in tech costs.. you might get the result you are looking for. (and human players might have a chance of getting ancient/classical wonders they beeline.)
 
Anyway, I'm skeptical that the second part is as simple as you claim. I think there's a Victory Competitiveness flavor, but I'm doubtful that it would alter AI behavior that much. It shouldn't be too hard to see what it feels like with a quick mod that alters the AI flavors.

Victory Competitiveness flavors are relative ratings. Cranking these up across the board would dilute variety. I am talking about the underlying code that tells the AI to, for example, build a SS part or bribe a CS under certain circumstances.

If they make AI pursue diplomatic victory, though, they should tweak AI gold supply so that they don't have 90k gold in the end-game and/or make it so you need to complete quests as well to get CSs to vote for you. If the AI used all its gold, currently you'd have no chance to stave off DV on Deity and might have a hard time on Immortal.

Although it should be really hard for anyone to win on Deity, I agree with your overall thrust. The AI should spend its gold regardless - hoarding it is poor design.

The problem is the AIS have an Era based bonus that works the opposite of this.

They start with free techs (massive Ancient bonus).. and then have fixed bonuses the remainder of the time.

If they started with 0 free techs, and just a fixed X% reduction in tech costs.. you might get the result you are looking for. (and human players might have a chance of getting ancient/classical wonders they beeline.)

Yes, that's what I'm trying to say. The early game would vary more, and be more competitive in its specific aspects (like competing for Wonders). And the late game would also be more competitive, as the scale tips the other way.
 
Victory Competitiveness flavors are relative ratings. Cranking these up across the board would dilute variety. I am talking about the underlying code that tells the AI to, for example, build a SS part or bribe a CS under certain circumstances.
Hm, they could probably make it so they spend gold more aggressively and prioritize spaceship parts more. I'm not sure if giving them "laser focus" would be ideal all the time, though. Oftentimes the main competition in a game is one runaway major civ that could possibly win Diplo, Culture, or Science, and you need to prepare for each of them. I'm not sure if that's always to the AI's detriment.
 
A modest proposal was a book about eating Irish babies... Great gift for a baby shower.
 
I think the community project would be a better location for this thread, but I think better to try to come up with a mod that slightly improves AI behavior than just give them a handicap.

In the case of Science, it would be teaching all AIs that spawn a Great Scientist early on to form an academy instead of bulbing it. (While in late game, bulb them.)

In addition, it would be teaching all AIs to choose Rationalism, given that it's the best policy tree by a wide margin.
 
Hm, they could probably make it so they spend gold more aggressively and prioritize spaceship parts more. I'm not sure if giving them "laser focus" would be ideal all the time, though. Oftentimes the main competition in a game is one runaway major civ that could possibly win Diplo, Culture, or Science, and you need to prepare for each of them. I'm not sure if that's always to the AI's detriment.

I agree that some divs - Poland, for example, or Persia - probably should develop an all-around game. I'm talking about giving them more focus once they reach an end-game milestone (like building the Apollo Project or an upcoming UN vote).

I think the community project would be a better location for this thread, but I think better to try to come up with a mod that slightly improves AI behavior than just give them a handicap.

In the case of Science, it would be teaching all AIs that spawn a Great Scientist early on to form an academy instead of bulbing it. (While in late game, bulb them.)

In addition, it would be teaching all AIs to choose Rationalism, given that it's the best policy tree by a wide margin.

I'm suggesting these changes not for a mod, but for the fall patch. (Now duly noted in the OP). Both your suggestions are good ones, but the difficulty levels are primarily built around handicaps, and that's not going to change. I'm proposing a scaling of the handicaps (or bonuses), so that the game is more competitive at the start, and at the end.
 
Search SDK of getAIPerEraModifier from handicaps file:

1. Units bonus per era
iProductionNeeded *= std::max(0, ((GC.getGame().getHandicapInfo().getAIPerEraModifier() * GetCurrentEra()) + 100));

2. Building bonus per era
iProductionNeeded *= std::max(0, ((GC.getGame().getHandicapInfo().getAIPerEraModifier() * GetCurrentEra()) + 100));

3. Projects bonus per era
iProductionNeeded *= std::max(0, ((GC.getGame().getHandicapInfo().getAIPerEraModifier() * GetCurrentEra()) + 100));

4. Reduction in growth thresholds per era
iThreshold *= std::max(0, ((GC.getGame().getHandicapInfo().getAIPerEraModifier() * GetCurrentEra()) + 100));

5. Reduction in unit supply per era
iSupply *= std::max(0, ((GC.getGame().getHandicapInfo().getAIPerEraModifier() * m_pPlayer->GetCurrentEra()) + 100));

6. Reduction in inflation rate per era
iAIModifier *= std::max(0, ((gameHandicap.getAIPerEraModifier() * m_pPlayer->GetCurrentEra()) + 100));

7. Reduction in unit upgrade cost
iPrice *= std::max(0, ((GC.getGame().getHandicapInfo().getAIPerEraModifier() * GET_TEAM(getTeam()).GetCurrentEra()) + 100));
 
Right now the AI has static difficulty-based bonuses - that is, those numbers don't change throughout the game. I propose making these bonuses era-based, especially the science bonus, so that they may even start lower (say, on Immortal and Deity) but keep scaling upward with each era.

I looked up on doing this over a year ago. The bonuses already do change with era, not just the science ones but also the production and gold ones. So much so that by the atomic era on diety and immortal, the AI gets close to 80% discounts on most things. I tried increasing these numbers but then it becomes plain silly when the AI can build anything in 1 turn.
 
I looked up on doing this over a year ago. The bonuses already do change with era, not just the science ones but also the production and gold ones. So much so that by the atomic era on diety and immortal, the AI gets close to 80% discounts on most things. I tried increasing these numbers but then it becomes plain silly when the AI can build anything in 1 turn.

That's not my understanding, but more to the point, it certainly doesn't seem that way, when it comes to science. This is one key area where the AI loses the game, regardless of what else it's doing. In other words, regardless of where the setting is now, the AI could use a hefty science bonus in the later eras.
 
Top Bottom