# Civilization 2

## byMelth

### Part 30: Mechanics: Civ 2 AI Personalities

#### berryjon posted:

Would you be willing to go over civilization tendencies, such as what leads to Democratic Ghandi going nuclear, and how that affects your choice of civilization (or doesn't), as well as how the AI tends to act?

There's a lot of documentation about the details of this in Civ 1 and Civ 5 but considerably less for the games in between. I'll cover Gandhi first.

In Civilization 1, every AI civ leader had a hidden stat from 1 to 10 that rated their aggressiveness. This determined their likelihood to declare war or accept peace treaties under various circumstances. 1 was the minimum amount of aggressiveness, and Gandhi had it. This meant Gandhi would basically never choose to go to war and would readily accept peace treaties.

However, a few things modified the normally static aggressiveness stat. One of them was that civ discovering Democracy. When they got Democracy, the discovering Civ's aggressiveness would drop by 2, making them more peaceable for the rest of the game. But the poorly debugged programs of mice and men go awry. Time for a bit of math and computer science! Skip the spoilered section if you'd rather have a metaphor.

See, Civ 1 was setting aggressiveness stats using a signed 8-bit integer, but interpreting the aggressiveness stat as an unsigned 8-bit integer. What does that mean?

I'll give a better explanation in a moment, but for now just know that an unsigned integer is one that can only be positive or 0, while a signed integer can be positive, 0, or negative.

An 8-bit integer basically means one that has up to 8 digits in the binary numeral system. As most of you likely know, binary means a base-2 counting system. Normally we use base-10. In base-10 any digit in a number can be one of 10 things (0, 1, 2, 3, 4, 5, 6, 7, 8, or 9). In base-2, any digit in a number can be one of 2 things (0 or 1). And in base-10 our numbers have a "1s place", a "10s place", a "100s place", and so on. For example, 234 has a 2 in the 100s place, a 3 in the 10s place, and a 4 in the 1s place. Those places correspond to the powers of 10: 10 ^ 0 is 1, 10 ^ 1 is 10, 10 ^ 2 is 100, and so on. Well in base-2 numbers have a "1s place", a "2s place", a "4s place", an "8s place", etc. Those are just the powers of 2: 2 ^ 0 is 1, 2 ^ 1 is 2, 2 ^ 2 is 4, etc.

To return to the example, here's how 234 would be represented in binary: 11101010. From right to left it has a 0 in the 1s place, a 1 in the 2s place, a 0 in the 4s place, a 1 in the 8s place, a 0 in the 16s place, a 1 in the 32s place, a 1 in the 64s place, and a 1 in the 128s place. Add up 0 x 1, 1 x 2, 0 x 4, 1 x 8, 0 x 16, 1 x 32, 1 x 64, and 1 x 128 and you'll get 234. This is exactly what you do when you look at 234 in base-10 and understand its value to be (2 x 100 = 200) + (3 x 10 = 30 ) + (4 x 1 = 4), but you probably don't need to actually think about that.

A computer using 8-bit integers would represent 1 as 00000001. It will use all 8 digits and just leave a 0 in everything but the 1s place.

Now to return to signed vs unsigned integers. You're no doubt used to just putting a "-" sign in front of a number to mark it as negative. But with a computer's binary you can't actually do that, even with signed integers. All you have available are 0s and 1s. So there's a workaround.

With 8-bit unsigned integers, everything works as I said above. 00000001 is 1, 11111111 is 255. 11111110 is 254. So the 256 integers between 0 and 255 can be represented.

With 8-bit signed integers, it's different. The 256 integers between -128 and +127 are represented instead. Everything between 0 and 127 works the same as with 8-bit unsigned integers. 0 is represented as 00000000, 1 is represented as 00000001, and 127 is 01111111. BUT anything with a 1 in the leftmost spot is different. That leftmost spot with unsigned integers is the "128s place" and a 1 there meant 128, just as you'd expect. With signed integers, a 1 there instead is defined to mean NEGATIVE 128. So 10000000 actually means -128 + 0 x 64 + 0 x 32 + 0 x 16 + 0 x 8 + 0 x 4 + 0 x 2 + 0 x 1. And thus -128. 11111111 ends up being -1 because it's -128 + a total of 127. 11111110 is -2.

So now we can get back to Civ 1 at last. Civ 1 essentially wrote down aggressiveness stats using signed integers. Thus it represented Gandhi's initial 1 aggressiveness as 00000001. When learning Democracy dropped his aggressiveness to -1, it represented that as 11111111. But Civ 1 then read aggressiveness stats as unsigned integers. So it read 00000001 as 1 aggressiveness as intended. But it read 11111111 not as -1 aggressiveness but as 255 aggressiveness.

The upshot of going from 1 on a 10 point scale to -1 on a 10 point scale was kind of like turning an analog clock back an hour from 1 o'clock. 1 is the smallest number on the clock, but if you tick back an hour, then you end up at 12, the HIGHEST number instead! In this case Gandhi was supposed to tick back from 1, the smallest number, and the result was that he jumped up to 255, the highest number. So he instantly went from minimally aggressive to maximally aggressive due to learning a tech that was supposed to make him LESS aggressive. A pretty serious screwup.

Overnight Gandhi goes from never attacking anyone and almost always accepting peace to declaring war on everyone and basically never accepting peace.

However, as far as I'm aware, he was not actually more likely to use nuclear weapons than anyone else who was at war in Civ 1. He was just suddenly more likely to be at war with people.

Anyway, this bug became famous and something of a joke on Civ forums. But (again, incorrectly as far as I'm aware) what people joked about was Gandhi's alleged love of nuclear weapons rather than his sudden murderousness in general. The game developers learned about this joke based on a misunderstanding of a bug and began deliberately building it into the games. Everyone says it's been a deliberately included thing since Civ 2, but actually I'm only certain about it in CIv 5. In Civ 5, once again most people are definitely wrong about how Gandhi works. He is NOT particularly aggressive. No, he's very peaceable. BUT, he has an obsessive love of nuclear weapons and is more likely than any other Civ to use those once he has them. This is actually the reverse of the true situation in Civ 1 as far as I understand it.

So the question of Civ 2, 3, and 4 remains. If you look up this bug and jokes about it online, you'll find loads of pages claiming that "nuclear Gandhi" has been included deliberately in every game after Civ 1. However, the only actual specifics anyone provides are about Civ 1 and Civ 5. Perhaps I'm wrong about Civ 3 and 4, but I DON'T think Gandhi was actually either a warmonger or a nuke fiend in either of those games.

In Civ 2 he's definitely not. In Civ 2 every single AI Civ is completely merciless with nuclear arms while at war and, as mentioned previously, they all cheat in numerous obvious ways to nuke you again and again the instant they have the technology.

Furthermore, I did a bunch of research on the details of Civ 2 AI today and I found absolutely nothing that would indicate Gandhi is unusually bloodthirsty at all under any circumstances.

This stuff is not very well documented, but here's what I was able to find out through a bunch of experimentation with the cheat menu plus playing experience plus what I read:

In Civ 2 the old aggressiveness stat is gone. Every Civ now has 3 personality traits.

1) Aggressive or Neutral or Rationalist. This is kind of like the old aggressiveness stat, but with just these 3 options rather than a 10 point scale. Aggressive guys are more likely to start offensive wars and demand tribute or refuse peace treaties.

2) Militaristic or Neutral or Civilized. As far as I know, this is all about technology priorities rather than actual number of military units produced; all AI Civs make tons of units. Militaristic ones try to learn military techs earlier. Not that that means much since their Science rate is bad, they often trade techs among themselves, and you need plenty of non-military techs as prereqs for military ones anyway.

3) Expansionist or Neutral or Perfectionist. This is supposed to be smallpox vs bigpox but is actually more of a competentish bigpox vs amazingly stupid bigpox. Perfectionists built tiny numbers of cities with enormous amounts of pointless Irrigation on bad terrain and every single worthless city improveent available. Expansionists build a medium number of cities with some Irrigation and quite a few decent city improvements

None of this stuff is secret; you can find it all in the intelligence menu once you have an embassy with someone or Marco Polo's Embassy (and in fact I talked about it before a bit). Further, none of this stuff ever changes or is randomized like in Civ 5. And finally it's the civilization rather than the ruler who has the personality. Some pictures may help.

It doesn't matter if the Japanese are led by Amaterasu or by Tokugawa, they will ALWAYS be Aggressive, Militaristic, and Perfectionists.

Rather than having neutral listed, a Civ that's neutral for a personality trait just has nothing listed. So Gandhi is Rational (opposite of Aggressive, meaning he's peaceable and not likely to attack you) and Perfectionistic (plays like an idiot with a tiny number of cities full of worthless junk and surrounded by Irrigation and Mines he'll never use) and is also neutral between Militaristic and Civilized in terms of what techs he researches.

Note that Indira Gandhi has the exact same personality. Male and female leaders are 100% identical, any given Civ will have the same personality no matter what.

In theory the easiest enemy Civs to deal with should be those which are Perfectionists (because they'll control no territory and be pitifully weak in every way), Rational (because they'll be less likely to attack you before you're ready), and Civilized (because they'll research more techs you might want to trade for and will tend to have a lower-tech military).

The Mongols are the most problematic possible Civ because they're Aggressive, Expansionists, and Militarists. The Babylonians are the least dangerous possible Civ because they're Perfectionists, Rational, and Civilized. What a bunch of pansies. The Indians are pretty soft too since they're Perfectionists and Rational, which are probably what matter most.

Not that ANY of that matters much at all. First of all, AI civs are prey, not threats. Their entire existence should be a unbroken string of humiliations, blunders, and defeats. They are there to be bullied or tricked into giving you gold, technology, free scouting, and eventually cities and Roads and Irrigation to speed up your victory.

Second and most importantly, their personality basically doesn't matter. The number of cities they have is determined largely by their starting position and how much early opposition they face. For example, the Sioux are not Expansionists (they're neutral) but last game they covered half a giant continent just because they were largely unopposed. The Greeks were Expansionists but had much less territory.

This game the Romans have loads of cities and the Mongols just have a few even though the Mongols have more turf because the Romans have much better land and were 100% unopposed in settling it.

And military tech differences can be hard to observe because AI civs love trading techs with each other and research things slowly and tend to field an unorganized mishmash of all unit types available to them. Furthermore, guys with more cities will tend to be ahead in ALL techs.

And Aggressive vs Rational means absolutely nothing in practical terms because 95% of AI behavior is dictated by your reputation and your relative power. Even people who have not met you will sign alliances with people they have not met to team up and attack you if you're doing too well. Doesn't matter if it's Gandhi or Genghis Khan, every AI CIv will drop everything to attack you as your economy eclipses theirs. Your closest allies will come to hate you within a few turns if you do something like a sudden Celebration to rocket into a runaway first place.

AI personality is bunk, all that really matters is the AI's friendliness to you. If you're moderately stronger than people, they'll tend to like you and not start fights with you. If you're much stronger than a civ, they'll suicidally attack you. If you conquer someone's city, he'll sue for peace. If you break a treaty, the victim will hate you (and so will most other civs to a lesser extent). If you give a civ free stuff, they will like you for 1 turn and then rapidly revert to whatever your relative power says their friendliess should be. Basically no one ever sneak attacks you before their attitude drops to neutral or below. And so on.

Like I said at the very beginning, "I’ve decided to play as the Romans, which is also an almost purely cosmetic choice. The only difference it makes is that no enemy can play as the Romans (or the Russians or Celts) and the enemy AI supposedly changes slightly depending on what civilization they’re playing as. Honestly, I’ve never noticed a real difference in AI behavior."

Even if AI personality WAS significantly different, there's no one color that would really be the best one to play as (and thus prevent the others from using) since every color has 3 civs with different personalities.