Easy to implement but strong A.I. buff

Slowpoke

The Mad Modder
Joined
Sep 30, 2010
Messages
1,321
One major problem with the A.I.'s ability to attack is it does not attack with enough units, and if said attack fails it sends enemies to attack in a trickling fashion. This is especially true with the new patch.

So there's a few simple things that need to happen:

A) The A.I.'s "prepared for war" check should require more attacking units and it should depend on era.

E.g.

-Ancient:8 combat units (i.e. never)
-Classical: 6 units (the "catch with their pants down" level)
-Medeival: 12 units (level meant to take down walls)
-Industrial: 15 units (level meant to take down castles)
-Modern: 12 units (has artillery)
-Future: no req (nukes)

B) The A.I. needs to check if it has taken a city within (15 turns + (the hex distance between their capitals*ArbitraryMapSizeFactor/10 turns)). If it has not it needs to immediately sue for peace with a stalemate proposition. If it has, it needs to make this check every 20 turns.

C) If a stalemate proposition is refused by the other player, or if the other player declares war and the A.I. does not have enough units, or (optionally) if the other other player takes 2 more cities than the A.I. takes of the player, it needs to go into defense mode.

Defense mode is simple: Units go to the nearest friendly city (or if it does not take too much processing time, the city with the least defenseive units nearby), and do not move more than 1 tile away from it unless it can make an immediate attack. Alternatively, rather than 1 tile from a city, it does not leave cultural borders, although same with the other it is fine if it allows them an immediate attack. The upshot of the latter is allowing them more mobility in defending cities in need.

As well, while in defense mode, it should focus more on units, in attempt to have enough units to leave defensive mode.

D) Every 20-25 turns, an A.I. in defense mode will check whether it can leave defense mode or not. To leave defense mode, it simply needs the unit requirement in part A.

Edit: One more thing- Peace treaties

E)Peace treaties are way too high. Way Way Way Way Way too high. Peace offerings should never ever exceed 250 gold worth * eramod, where era mod is simply 1,2,3.... for ancient,classical,medeival...
 
Yeah, this was most certainly the case in Civ4 also. The AI was too easily drawn out in small numbers.

A) sounds completely reasonable. In fact, this would seem to have the additional benefit of reducing the extent to which warfare dominates the game.

B) doesn't sound quite as intuitive. What if they are in an advantageous position, just haven't gone for cities yet?

C) sounds like it makes complete sense, although it would be a shame to have a completely defensive AI, especially in situations where it might make sense for it to counterattack. Making the AI congregate around a city may not be to the AI's advantage, especially if better defensive territory is a couple of tiles further out.

D) 20-25 turns? That seems a long time. Why not cut this check down to 5-10 turns?
 
Yeah 5-10 might be better, but units do take a while to make.

And 15 turns sounds like a small amount of time, but usually if they're attacking and are close they can take a city in less than 10 turns. At the very most it should be 20 + distance/7. Any longer than that and the player can already mount a succesful counterattack against their decimated army.
 
It just seems that a system that is designed to force the AI to immediately sue for peace without directly taking into account the situation (not taking cities doesn't necessarily mean you aren't in a strong position) is not a terribly effective system for buff AI. I would think that the AI should have to perform some sort of check at that stage, but going straight to suing for peace without consideration of specific circumstances beforehand seems a recipe for AI disaster.
 
Well, the A.I. is very aggressive. If it can't take a city within 25 turns (the average given the distance), then it's because you've killed it's army. I'd be hesitant to make it based on casualties suffered because sometimes it could be in a position where it has a few units left, but the city they're fighting is at 10% health. It's very hard to program it to detect a situation like that.
 
If you are combining the idea with the defensive mode one though, the AI may not be nearly as aggressive, and could've (through defence) worked itself into quite a strong position ready for a counterattack (when the check in D is performed), when the requirement to sue for peace kicks in.
 
That situation would only occur if it were attacked by a player. If it attacks itself, then it's because it already had the unit requirement to break out of defense mode. D mode only occurs after the 25 turns, and only on a failed attack.

I suppose there is this fuzzy situation where it gets attacked by a player, the player fails, and it's still in defense mode. I suppose the requirement for breaking out of defense mode could be lower than the requirement to declare war.
 
Would it actually be all that much more difficult to require the AI to actually look at the situation before automatically suing for peace? Because even if it is not a particularly likely scenario in which they sue for peace from an advantageous position, having a more precise qualification for this part of AI behaviour can hardly be a bad idea if it's just as possible to implement.
 
It pretty much is very difficult to my knowledge. Unless you can qualify what exactly a situation is where it shouldn't sue for straight peace, you can't code it. There are several rare cases where the A.I. might be winning even if it has failed to capture a city, but extremely rare situations aren't worth coding and lag.

So what are common situations that can be easily checked for where the A.I. is winning but hasn't taken a city in a long time? I can't think of any honestly. It can't be based on unit ratios, as most human players can fend off an attack with less than half the A.I.'s units, sometimes a quarter or less even.
 
@Slowpoke- tie it into the check in suggestion D. That would seem to be such a situation, and one that you're already qualifying.
 
Maybe multiply the AI's judgement of the human player's army by X when making war and peace decisions? If I have 4 horseman and 2 archers and an AI player has 6 horseman and 3 archers, I have substantially more military force then that AI and could beat them in a war under most circumstances. That would mean the human player is technically treated differently, but in practice it would lead to better decision making and less hostile AI. As someone once said, the invisible "controlled by a person" promotion is the strongest in the game and much of the current AI strangeness/stupidity is due to it not taking that into account.
 
One major problem with the A.I.'s ability to attack is it does not attack with enough units, and if said attack fails it sends enemies to attack in a trickling fashion. This is especially true with the new patch.

So there's a few simple things that need to happen:

A) The A.I.'s "prepared for war" check should require more attacking units and it should depend on era.

E.g.

-Ancient:8 combat units (i.e. never)
-Classical: 6 units (the "catch with their pants down" level)
-Medeival: 12 units (level meant to take down walls)
-Industrial: 15 units (level meant to take down castles)
-Modern: 12 units (has artillery)
-Future: no req (nukes)

One thing you need to keep in mind, is that the CiV AI also needs to be able to deal with various mods. Hard coding thresholds like that is a good way of breaking the AI for mods with different tech trees.

The proposal you make also assumes tech parity between the AI and the player.

More sensible "prepared for war" checks would be stuff like:
total attacking unit power >= X*(average city power of opponent)

More sophesticated checks would weight the total attacking power for elements like: seige units, ranged units, nukes, etc.
 
Well there's really no reason it would have to be hardcoded, it could be an xml value for each era, which mods can easily deal with. Most of the A.I. is in the xmls even.

The pitfall of X*(avg city power) is several civs and most players ignore city walls, favoring an active defense. This would result in the player getting nearly every DOW in the game. So perhaps maybe X*(city power + military strength) instead. But here also needs to be a base minimum, so perhaps (Min(9,complicated formula) + 6) units would be best. In any case, the minimum now in medeival and industrial should be about double what it is now is the point.
 
Top Bottom