Does the AI cheat?

EdwardtheElder

Chieftain
Joined
Mar 22, 2007
Messages
17
How does the AI work?

I'm playing Ottomans on Warlords - Emperor, Epic, Skinny Archipelago. It's 150BC and I have 5 cities, 5 warriors and a few archers (I'm a builder). My only direct neighbour is Saladin. He has a stack of 5 chariots and 1 archer (with 3 promotions) crossing my land plus 7 archers (most with 3 promotions), 2 chariots and 1 settler back in Mecca - not to mention what he's got in his other towns! Now I know he gets an automatic promotion for being Protective, but..... There's been no other wars and the barbarians got squeezed out early, so where have the promotions come from? And why isn't his economy getting crushed?
 
The AI doesn't cheat, but the programming has some bonuses and allownaces built in for the AI to compensate for the AI lack of intelligent thoughts.

The AI can have larger armies before it starts hitting their economy. The upkeep costs for more cities is lower. They start with more units. Their production times for units is lower and so on.
 
Protective gives two free promotions, not one.
 
Protective Archers with Barracks start with 3 promotions: Drill, City Defense I, and one freebie.

AIs cheat in roughly the following ways: (if I remember right)
1> Much reduced unit upgrade and upkeep costs.
2> Much reduced unit production costs.
3> Slightly faster city growth, tech costs, and wonder/building production.
4> A handful of free technolgies and units at the start of the game.

If you go over to the BetterAI subform (in Creation and Customization), you can download an AI upgrade and some changed handicap files. These files reduce the advantage the AI has over the player (especially in unit upgrade and supply costs), but also make the AI somewhat better at using units.
 
Ah you're right - 2 free promotions plus 1 for barracks.

But even so, I've just checked my other opponent, Carthage and all he has is a couple of units per town plus a couple of triremes.

Maybe I'm just annoyed that my normal early axeman rush / romp through my nearest neighbours towns has been kicked into touch? Looks like I will have to wait till trebuchets or go by boat somewhere else.
 
But I have another question? Are battle odds accurate? We have all experienced losing a 98% bet, but does it really come up only 2 times in 100?

I have also noticed some units become indestructible for one turn. For example you have a stack of macemen and one sword and come across a speaman. You want to move on with all your maces, so attack him with your sword. It's a 60% chance say. You lose, then nail him with a mace. But I have noticed if you reload and go at the spearman with a mace first, even with a 95% chance, you will lose again. It's as if the AI has decided you will lose the first round no matter what. I realise reloading isn't the done thing, but nevertheless what is happening here?
 
The chances are accurate.

Note that the sequence of random numbers used to determine the fight don't change when you reload (there is an option that reseeds the RNG on reload).

If you save, attack with a maceman, then reload, and attack with the maceman again, you are going to lose the second time. And the 500th time you reload and retry.

If you attack with a different unit, the results could be different. The details require an understanding of how combat works in Civ4.

In civ4, when two units fight, they swing at each other.

On each swing, your chance of winning is symetrical, and purportional to your strength. Your chance of winning is thus A/(A+B), and thier chance is B/(A+B).

The winner hits the other. A different formula is used to determine how much damage is done.

If the swing is a first-strike round, only the side with first strike gets to "win" -- if the non-first strike side wins, no damage is delt on that swing.

In effect, the combat is described by a sequence of percentages. If the percent is under a threshold, A hits -- if it is over, B hits.

If you reload and pick a different fight, the sequence of percentages won't change. This could result in a different fight result, or it could result in the same: it depends on the details of who is fighting.

Btw, if you want to cheat, you can just turn on worldbuilder and give every city in the world to your empire. It is much quicker and easier.
 
Thanks Yakk for the detail, which I roughly knew including the re-seeding. But I remain a bit of a sceptic. If I have 5 different units each with a 20% chance of winning a fight, then I should be able to win (on average) by reloading 4 times and attacking with a different unit each time. But it doesn't happen - that longbowman or whoever just will not go down. So I suspect there is some wiring in there to deter reloaders.

In answer to your btw, when I discovered the worldbuilder it was tempting for a game or two, but I soon gave it up.
 
No, they don't need writing to deter reloaders.

Let's give an example.

You have an attacker with 8 strength vs a defender with 5 strength.

Damage per attack:
25 attack, 15 defense.

Defender has to win 7 times before attacker wins 4 times, with a 38.5% chance of winning each swing.

If you boost the attacker's strength to 9, the numbers barely change:
26 attack damage, 15 defense damage.
35.7% chance of winning a round.

In fact, for any one round, there is only a 2.7% chance that it will turn out different on a reload!

If the combat lasted 7 rounds, there is an 82% chance that the 9 attack unit and 8 attack unit's combat will be identical down to the very last hit 82% = (100%-2.7%)^7.

Ie, if your next roll is going to be a 99, it doesn't matter if your 9 attack unit or your 8 attack unit attacks: they are both going to get hit on the first round of combat.

In fact, rolls of 1% to 35.7% and 38.5% to 100% result in exactly the same combat round: the same person gets hit.

In this case, the damage is the same -- but quite often, even if the damage is slightly different, the number of "hits until death" remain the same.

If you are going for 1-fight-kills, the most important part is the number of hits until death on each side. If the units all have a 80%ish chance of winning, that implies that the hits-until-death-count in all of the fights is probably nearly identical.

The chance-to-hit in each swing is the only thing that changes, and small changes in that, given the same string of rolls coming up, quite often result in the same sequence of hits -- occassionally a swing or two will switch sides.

If you want to reload-cheat, turn on "new random seed on reload" -- they added it for the reload cheaters who don't like dialing the game down to a difficulty level they can actually win at. :) (well, and it also lets you test game in different ways...)
 
Back
Top Bottom