Random AI Personalities

DrewBledsoe

Veteran QB
Joined
Nov 6, 2005
Messages
2,634
Location
Cheering For Mr Sanchez
If you haven't used this option (it's in custom game options), and are becoming slightly jaded with the standard opponents, then try it.

For example whatever game constraits you play (e.g. Warlords Vanilla 2.08, Blakes Mod, your own (I use my own "different AI mod") ), it doesn't matter which you play. In every single game, when you've played quite a few games, you know exactly how every AI will react to you, right from the very beginning. Musa will trade (whore) his shirt away with anyone, and will be a science monster, given a decent sized nation. Cyrus will be a decent trading partner. Napoleon will attack unpredictably, as will Alexander. Monty will be a beligerent idiot. Isabella will be, well Isabella.

You get the picture. The point is that you know all this and it's rock solid for every single game. Turning "Random AI Personalities on", and especially combining this with "Aggressive AIs", leads to a much more unpredictable and may I say enjoyable game. You now have no idea how each leader will behave, until the game develops, and you start to see their personalities develop.

It makes diplomacy dare I say (almost) fun again. My last game, Asoka would trade absolutely anything with anyone, yet was still prepared to go to war with anyone over almost anyhing , and didn't care too much for religion. Cyrus, (my immediate neighbour) turned into a slavering raging beast, constantly attacking me (and losing) without any obvious consideration. Genghis, despite the the fact that I attacked and took several of his cities early on, turned out to be a religious nutter, and even though I had -5 penalties with him, when my state religion spread to his cities (through closed borders), he gave me a +8 for same religion, and not longer after, voluntarily asked to vassalize to me ! (Go figure that one).

So sorry for the ramble, but I was just showing how this one little option change, has breathed a whole new lease of life into the game for me. If you want a different flavour to the game, then try it. Every new game feels like the first time you played CIV IV, in that you have no idea how the other leaders will act, except you know the game mechanics inside out. It's fun and new again :)
 
I love this option. It doesn't help at all when you're playing above your comfort level (which I usually try to), but it makes things way more interesting, like you said, when you're at a level you're good at. I mentioned in another thread that this option is the only way to make Tokugawa tolerable - when he comes asking for open borders, you know you're in for an unusual game. I like it when Isabella has Kublai's attitude towards religion, too. The trouble comes when you're trying harder than you can handle - it really, really helps to be somewhat able to predict the AI's attitude towards things. It's very strange, though, to see Monty redline a DoW because "We're afraid of their military might". One could, and perhaps you just did, devote an entire thread to the weird personalities that come up.

I see your ramble and raise you some incoherence. ;)
 
how exactly does this work? ive been curious to play it, but does it just affect the way they interact, their aggressiveness, their propensity to trade, etc?
 
yes. it keeps their traits (financial, etc) the same but randomizes the coding on how they wait all the various things (likeliness to declare war or trade, weight they put on shared religion, etc). i think.
 
how exactly does this work? ive been curious to play it, but does it just affect the way they interact, their aggressiveness, their propensity to trade, etc?
it randomly assigns one set of personalities (e.g. war probability, preferred civic, attitude values etc.) as defined in the AILeaderheadInfo.xml - i.e. it switches e.g. Monty's values with Gandhi's

Edit: KMadCandy beat me to it
 
oh but i didn't know it did a straight swap of one for another, rather than just randomly picking a number of each individual trait.

do you know if it could give two people gandhi's traits for example, or if it picks one and then that one can't be picked again?
 
I didn't know this, either. It's kind of surprising, actually, that quashes a bit of the fun factor for me. :undecide: If it's Monty masquerading as Gandhi rather than Gandhi with schizophrenia, well, it's predictable! No good, that should be changed. At least there should be a pool of unused personalities for it to pick from randomly.
 
I also am not sure if it's a straight swap, but in the game I mentioned, Asoka had Mansa's will "trade monopoly techs" attitude (Mansa is the only one in standard who will do this), yet he was also very aggressive which Mansa isn't...

Can anyone confirm for sure, whether the leaderheads are randomised with this option, or just swapped around (too much code delving to find out..I'm lazy;) )?
 
The code is from CvPlayer.cpp:

Code:
	if ((GC.getInitCore().getSlotStatus(getID()) == SS_TAKEN) || (GC.getInitCore().getSlotStatus(getID()) == SS_COMPUTER))
	{
		setAlive(true);

		if (GC.getGameINLINE().isOption(GAMEOPTION_RANDOM_PERSONALITIES))
		{
			if (!isBarbarian() && !isMinorCiv())
			{
				iBestValue = 0;
				eBestPersonality = NO_LEADER;

				for (iI = 0; iI < GC.getNumLeaderHeadInfos(); iI++)
				{
					if (iI != GC.getDefineINT("BARBARIAN_LEADER")) // XXX minor civ???
					{
						iValue = (1 + GC.getGameINLINE().getSorenRandNum(10000, "Choosing Personality"));

						for (iJ = 0; iJ < MAX_CIV_PLAYERS; iJ++)
						{
							if (GET_PLAYER((PlayerTypes)iJ).isAlive())
							{
								if (GET_PLAYER((PlayerTypes)iJ).getPersonalityType() == ((LeaderHeadTypes)iI))
								{
									iValue /= 2;
								}
							}
						}

						if (iValue > iBestValue)
						{
							iBestValue = iValue;
							eBestPersonality = ((LeaderHeadTypes)iI);
						}
					}
				}

				if (eBestPersonality != NO_LEADER)
				{
					setPersonalityType(eBestPersonality);
				}
			}
		}

Basically it gives each LeaderHeadType an integer value and calls a random number to find the one it chooses for the player it currently starts. In CIV4LeaderHeadInfos.xml Types are denoted as e.g.
Code:
<LeaderHeadInfo>
			<Type>LEADER_ALEXANDER</Type>
i.e. it really swaps the whole "type". The give away really is the preferred civic - you can read alot from this one as there are only a few LeaderHeadTypes with the same civic ;) - and yes it can allocate one type multiple times
 
Thanks for that Ori :)

Seems a shame..maybe I'll have a go at making the personalities truly random one day (and yes I know this may cause certain paradoxes)..if anyone's already modded this please let me know, I wouldn't be the only one who'd appreciate it.

But as I said, I've gone into rl lazy mode recently ;)
 
One more thing :p

part of the Type is also the DiplomacyMusic so since each leader has his own DiploMusic which can be found in ...\Firaxis Games\Sid Meier's Civilization 4\Assets\Sounds\Diplomacy you can actually tell which Type is being used on first contact - provided you know all those .mp3 files by heart that is :rolleyes:
 
you can actually tell which Type is being used on first contact - provided you know all those .mp3 files by heart that is :rolleyes:

Agh! Random personalities just got a lot less fun... :(
 
Agh! Random personalities just got a lot less fun... :(

actually on second thought: I know for sure that the preferred civic is swapped with all the other stuff - so if you get positive attitude modifier for using mercantilism you know you have Toku (in Vanilla) or for Free Market you know it is a disguised Mansa - for the Music stuff I never paid attention to this and would have to test it ingame (I'll probably do this tomorrow out of curiosity ;) ) but from the code I don't see how this would be treated different from all the other stuff in the LederHeadInfos. There is one Caveat though: The traits (i.e. spiritual etc.) are also defined in that file and there is nothing i can find that would not swap those as well (e.g. having a spiritual and financial Mansa disguised as Monty :p) but I thought that the traits were not changed by the randompersonalities flag - I do not know of an easy way to check that though...
 
There is one Caveat though: The traits (i.e. spiritual etc.) are also defined in that file and there is nothing i can find that would not swap those as well (e.g. having a spiritual and financial Mansa disguised as Monty :p) but I thought that the traits were not changed by the randompersonalities flag - I do not know of an easy way to check that though...

i started a fake game, hand-selected opponents with and without the creative trait in their usual form, unchecked LMA and checked random personalities.

after two turns i went into WB and checked their culture using edit city. in every case, the civs that usually are creative were getting 4 culture per turn, the civs that usually are not creative were getting 2 culture per turn.

not conclusive by any means, but seems to confirm what we all think we heard, that the traits don't change. was the quickest thing i could think of.
 
The traits definetly don't change, (thanks for the effort Candy, but you can just hit F8 then see settings, and it tells you e.g. agg/ philo etc.)....

The music stays with the nation too Ori, just the personalities are shuffled.
 
The traits definetly don't change, (thanks for the effort Candy, but you can just hit F8 then see settings, and it tells you e.g. agg/ philo etc.)....

The music stays with the nation too Ori, just the personalities are shuffled.

i wasn't sure it wouldn't just go with what the civilopedia said on F8. altho i guess the civilopedia isn't pre-written it's calling from the code. well, i'm a combination of untrusting and forgetful about coding i guess hahaha. i wanted to check it *giggle*. good news about the music.
 
The music stays with the nation too Ori, just the personalities are shuffled.

Fine, so it is not that easy ;) - I wrote the thing about the music not thinking about the fact that traits are there as well - so there has to be some discrimination between certain items in that file - I just cannot find it in the code, yet. But the Leader specific things (Name, Music, Traits) might actually be called before the game randomizes the personality stuff...
 
Fine, so it is not that easy ;) - I wrote the thing about the music not thinking about the fact that traits are there as well - so there has to be some discrimination between certain items in that file - I just cannot find it in the code, yet. But the Leader specific things (Name, Music, Traits) might actually be called before the game randomizes the personality stuff...

That makes sense to me..hmmm..it might need quite a lot of writing then for as I said a truly random ai personality (whether said personality would make any sense is another possible problem)..oh well, it seems possible anyway :)
 
Well, it's good to know the music won't give it away! It wouldn't make any sense at all for the traits to stick to the personality, that wouldn't help anything... so it's just the favorite civic I should watch out for?

DrewBledsoe, if you come across or make any "truly random" mods, I'd love to hear about it!
 
Back
Top Bottom