AI suggestions

I noticed there is a (stack information) with options in the BUG menu I hadn't noticed b4, you can choose how descriptive the information about a stack of units is with this it seems :)
 
Press enter to end turn. During the end turn things Ostaneco of Carthage does his patented bad! civic switch.
Alright, not his originally but in this case it is.

Cheers

I've spent a few hours looking at this, and my conclusion is that it's not really as bad a switch as it appears. The main point (correct me if I am missing the point entirely!) is that he switches from Monarchy to Despotism, which looks at first sight like a very bad idea. However, on closer inspection, he's doing this for a reason (debateable how good a one, but the pros and cons are not being badly miscalculated as far as I can see). The reason is that Despotism has better military mods (especially great general emergence) than does monarchy. The big downside is a lot of unhappiness because he is several cities over the happyness limit for despotism, but if you look at his cities they are all in large happyness surplass (20+ - enough to soak up the civic-induced unhappyness).

So anyway, my conclusion at this point, pending further discussion, is that this isn't really a bad switch at all (at least not a grossly bad one). It may be over-weighting the great general emergence, and under-weighting its future growth requirements (which would make the unhappyness worse over time), but apart from that I don't see a major issue in this behaviour.

I suspect that as soon as the war ends he'll switch back, taking an anrachy penalty. For that reason I think the great general emergence should probably be down-played a little (or at least its added weight when in a war compared with when not - right now it considers it valueless outside of wartime, which migth be better as just reduced value). I think a few tweaks are in odrer, but I'm not seeing a major bug...

...discuss ;)
 
I've spent a few hours looking at this, and my conclusion is that it's not really as bad a switch as it appears. The main point (correct me if I am missing the point entirely!) is that he switches from Monarchy to Despotism, which looks at first sight like a very bad idea. However, on closer inspection, he's doing this for a reason (debateable how good a one, but the pros and cons are not being badly miscalculated as far as I can see). The reason is that Despotism has better military mods (especially great general emergence) than does monarchy. The big downside is a lot of unhappiness because he is several cities over the happyness limit for despotism, but if you look at his cities they are all in large happyness surplass (20+ - enough to soak up the civic-induced unhappyness).

So anyway, my conclusion at this point, pending further discussion, is that this isn't really a bad switch at all (at least not a grossly bad one). It may be over-weighting the great general emergence, and under-weighting its future growth requirements (which would make the unhappyness worse over time), but apart from that I don't see a major issue in this behaviour.

I suspect that as soon as the war ends he'll switch back, taking an anrachy penalty. For that reason I think the great general emergence should probably be down-played a little (or at least its added weight when in a war compared with when not - right now it considers it valueless outside of wartime, which migth be better as just reduced value). I think a few tweaks are in odrer, but I'm not seeing a major bug...

...discuss ;)


If I understand you the AI weighs +X% general vs Yturns of anarchy?
Now, considering you have a medium empire around the time of monarchy, you may have about 1000 {food/hammers/commerce/spy points} which would be missing during anarchy. Switching to despotism takes like what - 6 turns? (at least with eternity) + your stability drops during anarchy --
I really doubt that getting a general a little earlier is worth that at all.

Also, the AI doesn't weigh in on the diplomatic bonus of "royalty should stick together". That could end war easier, getting economy going (more trade, more tech) than switching back to Despotism.

Switching back to older civics should really be penaltilzed a bit, I think. Even if a new civic doesn't pay off immediately, sometimes staying with for some time and avoid anarchy turns is worth it. Think of the lost 6000 during anarchy! If I switch I consider that as the investment I have to make and if & when I would get a payoff that justifies it.
 
It's not only that but also that the AI switches numerous times, spending a fair percentage of it's time in anarchy switching between various civics. If you look in F9/GNP and show a couple hundred years back you'll see how the AI constantly drops to zero GNP, an indication of being in Anarchy.
In the Event Log you can also see when they switch, and to what, if scrolling down.
This makes me, as not doing Anarchy all that much, able to catch up and blaze past all the AI in tech almost exclusively because of their switching civics constantly.

I'm sending up another save, same game but a little further ahead, where this is even more pronounced and where I have taken over the tech lead, and that by a fair amount, at a time where I should still be trying to catch up.

My point is not only that they switch back and forth but also that they switch too often.

Cheers
 
@Koshling: Maybe it would be useful if you log the AI civic values and when they decide to switch so people can send you logs about the long term behavior.
 
If I understand you the AI weighs +X% general vs Yturns of anarchy?
Now, considering you have a medium empire around the time of monarchy, you may have about 1000 {food/hammers/commerce/spy points} which would be missing during anarchy. Switching to despotism takes like what - 6 turns? (at least with eternity) + your stability drops during anarchy --
I really doubt that getting a general a little earlier is worth that at all.
It calculates the civic values so that one unit of the value is roughly equivalent to 1 gold per turn. It calculates the anarchy cost as its GNP X number of turns. Hence these things are comparable. HOWEVER, now that I think about it it should be (GNP + production*<production-to-gold-evaluation-factor>)*<num anarchy turns>, so it probably is under-evaluating anarchy costs a bit.

It does not take account of stability loss during anarchy (probably not a bad idea to add this (when REV is enabled) as you suggest, at least when the switch is not a stability-increasing switch in itself)

The actual way it values Great general appearance rate modifiers is basically as a multiplier to how many units it has. I'm not entirely sure why this was chosen (I guess the logic is that more units imply more fights, which gives the GG modifier more to act on), but I suspect that very large armies are skewing the calculation. If anyone has suggestions for a better way to evaluate the GG modifier I'm all ears (right now all I can think of is using a non-linear scaling on unit numbers so that its more like a log curve)

Also, the AI doesn't weigh in on the diplomatic bonus of "royalty should stick together". That could end war easier, getting economy going (more trade, more tech) than switching back to Despotism.

Interesting point. It doesn't consider that at all. Maybe it should consider it for any civ it is in contact with which its relationship with is either close to neutral (where swings matter most) or at war with (in the hope of ending the war - though in that case it really ought to only count it for wars it wants to get out of, which is trickier to identify)

Switching back to older civics should really be penaltilzed a bit, I think. Even if a new civic doesn't pay off immediately, sometimes staying with for some time and avoid anarchy turns is worth it. Think of the lost 6000 during anarchy! If I switch I consider that as the investment I have to make and if & when I would get a payoff that justifies it.

There is no concept of 'older', nor is it well-defined in tech tree terms (depends on the path you take in some cases). One thing we could consider is retaining knowledge of the last civic you were in (in each category) and penalising a reversal of the last chnage made (i.e. - require a bigger preceived benefit to enact it than would normally be required)

I'm sending up another save, same game but a little further ahead, where this is even more pronounced and where I have taken over the tech lead, and that by a fair amount, at a time where I should still be trying to catch up.

Just for clarification - does end-turn on this save have another suspect switch in it? If so which civ (Carthaginians again?). I ask in advance because one turn running under the debugger is about an hour...

@Koshling: Maybe it would be useful if you log the AI civic values and when they decide to switch so people can send you logs about the long term behavior.

Yeh, good idea. I'll add that (though it won't tell you WHY it values the civic that way)
 
Ok, here's the smoking gun for 'start as minors' I think:

Code:
int CvTeamAI::AI_getEnemyPowerPercent( bool bConsiderOthers ) const
{
	int iEnemyPower = 0;

	for( int iI = 0; iI < MAX_CIV_TEAMS; iI++ )
	{
		if( iI != getID() )
		{
			if( GET_TEAM((TeamTypes)iI).isAlive() && isHasMet((TeamTypes)iI) )
			{
				if( isAtWar((TeamTypes)iI) )
				{
					int iTempPower = 220 * GET_TEAM((TeamTypes)iI).getPower(false);
					iTempPower /= (AI_hasCitiesInPrimaryArea((TeamTypes)iI) ? 2 : 3);
					iTempPower /= (GET_TEAM((TeamTypes)iI).isMinorCiv() ? 3 : 1);
					iTempPower /= std::max(1, (bConsiderOthers ? GET_TEAM((TeamTypes)iI).getAtWarCount(true,true) : 1));
					iEnemyPower += iTempPower;
				}
				else if( AI_isChosenWar((TeamTypes)iI) )
				{
					// Haven't declared war yet
					int iTempPower = 240 * GET_TEAM((TeamTypes)iI).getDefensivePower();
					iTempPower /= (AI_hasCitiesInPrimaryArea((TeamTypes)iI) ? 2 : 3);
					iTempPower /= 1 + (bConsiderOthers ? GET_TEAM((TeamTypes)iI).getAtWarCount(true,true) : 0);
					iEnemyPower += iTempPower;
				}
			}
		}
	}

	return (iEnemyPower/std::max(1, (isAVassal() ? getCurrentMasterPower(true) : getPower(true))));
}

This is returning a measure of the ratio of enemy power to our power, which is used in a variety of ways, but critically it pushes cities into military productiion as a high priority when you fall significantly behind on this measure (all stops are pulled out when it hits 150).

The problem here lies in this part:

Code:
	int iTempPower = 220 * GET_TEAM((TeamTypes)iI).getPower(false);
	iTempPower /= (AI_hasCitiesInPrimaryArea((TeamTypes)iI) ? 2 : 3);
	iTempPower /= (GET_TEAM((TeamTypes)iI).isMinorCiv() ? 3 : 1);
	iTempPower /= std::max(1, (bConsiderOthers ? GET_TEAM((TeamTypes)iI).getAtWarCount(true,true) : 1));
	iEnemyPower += iTempPower;

  • Minors have their value divided by 3 (so they are less important than civs you are 'seriously' at war with, which is good)
  • Things are normalized by dividing by the total number of civs you are at war with, BUT this count does NOT include minors
The result is that in a game with lots of civilizations that are easily contactable (think GEM Europe) every Civ contributes with the only normalization being the minor-divide-by-3, so in a symmetrical situation where everyone is a minor, if any more than 3 are in mutual contact they will all think they are behind at what are actually equal force levels.

This is ok to a limitted extent (you really DO have multiple enemies, even if they are only enemies in a weak sense), but it doesn't scale well. In my GEM game I was in contact with 18 other civs before I even got canoes, so you can see how that looks (everyone sees power ratios around 1/6th and madly tries to build their way our of it - classic arms race, but amped up!).

I'm going to fiddle with this later today to try to improve it (I'm thinking counting minors as one third in the divisor as well as at 1/3 of their power in the numerator as now).
 
Another wonderful progress! :clap:
Spoiler :
Continue at this speed and the estimation of 1 year of isolation for a new engine would shrink to 1 month ;-)


Aside the reason of the build-up of the minor armies, have you also found the bug(?) that some Ai stacks are not triggered to leave city and attack?

At least the doomsday stack of barbs in the save I posted in the 'tips and tricks' thread does not attack - and in my game of Japan before that I saw non-attack attitude with Korea as well (not that they didn't build canoes but also they didn't attack a barb city that was nearby and had like 4 Atl-Atls in vs korean stack of 20 axes + general that refused to storm the barbarian site).

I think a few days ago I speculated that AI would not calculate the battle 4-5 outcomes deep so it's not estimating the (average) possible situation after having sacrificed like 4-5 units (or even half the stack) -- so it seems high losses are avoided but no city is taken or even attacked//but even high losses would mean more money for science while rebuild etc..

The save I provided might actually show you when you could get the right value because at that time the barb stack would start to wander to my city, I suppose^^
 
Another wonderful progress! :clap:
Spoiler :
Continue at this speed and the estimation of 1 year of isolation for a new engine would shrink to 1 month ;-)


Aside the reason of the build-up of the minor armies, have you also found the bug(?) that some Ai stacks are not triggered to leave city and attack?

At least the doomsday stack of barbs in the save I posted in the 'tips and tricks' thread does not attack - and in my game of Japan before that I saw non-attack attitude with Korea as well (not that they didn't build canoes but also they didn't attack a barb city that was nearby and had like 4 Atl-Atls in vs korean stack of 20 axes + general that refused to storm the barbarian site).

I think a few days ago I speculated that AI would not calculate the battle 4-5 outcomes deep so it's not estimating the (average) possible situation after having sacrificed like 4-5 units (or even half the stack) -- so it seems high losses are avoided but no city is taken or even attacked//but even high losses would mean more money for science while rebuild etc..

The save I provided might actually show you when you could get the right value because at that time the barb stack would start to wander to my city, I suppose^^

I haven't got around to looking at that save yet, but I should do so in the next couple of days I hope.
 
Has anyone noticed the AI tendency to suicide units into Warlords? I have seen that parking a Warlord unit on a square adjacent to AI territory inspires lots of attacks even when the units are clearly outmatched (like Guard Dogs vs. a Warlord Colonel). This is really good for the Warlord for generating XP and Great General points, but not so good for the AI.
 
Has anyone noticed the AI tendency to suicide units into Warlords? I have seen that parking a Warlord unit on a square adjacent to AI territory inspires lots of attacks even when the units are clearly outmatched (like Guard Dogs vs. a Warlord Colonel). This is really good for the Warlord for generating XP and Great General points, but not so good for the AI.

It doesn't like hidden nationality units, but it really shouldn't attack with very poor odds. Do you have an illustrative save?
 
It doesn't like hidden nationality units, but it really shouldn't attack with very poor odds. Do you have an illustrative save?

Try this one. I have a huge stack of units including two Warlord Corporals near Cahokia. If you end the turn (Shift-Enter), Deganawida is going to suicide 5 Trebuchets into them. The Warlords take no damage.
 
Just for clarification - does end-turn on this save have another suspect switch in it? If so which civ (Carthaginians again?). I ask in advance because one turn running under the debugger is about an hour...

No, just for demonstrative purposes showing that during the past 200 turns on Eternity every AI nation has had at least 2 Anarchy from switching civics periods, some up to 7 times, some spending almost 25% of their turns in Anarchy.

Cheers
 
I haven't got around to looking at that save yet, but I should do so in the next couple of days I hope.

Ah cool, thx!

Btw. In the same game I only got the cities that are not attacked by barb stack because of a Ai flaw I think. half of Tupi army suicided on a scout with very many promotions and a general nearby who also had 10 promotions I think.

So the scout had many first strikes and was on wooded hill, I also had a tracker and a thief nearby to kill the units AI didn't suicide right after as the scout was not able to attack himself.. but if the Tupi just had waited and had estimated the first strikes correctly they should have just ignored the situation and let the one tile occupied by me - after all they had several other tiles to work...(thx to deer*6 spawn bug) basicly they should have researched... axes and stuff, well they had no chance to kill those units I had there (thx to amazon cobra) anyway... which leads me to another suggestion: animals should not give xp to generals, it's just too exploitable. -->What about hunting generals, like real master hunter, that get xp from killing animals and give boni vs animals?

I beelined to tracking, when I got to it my wanderers had already farmed the first general and he was promoted quite a bit. //I made the risky move to send my 3 elite wanderers with him in the wild Haast eagle and Moa killed 2 of them and my last wanderer had to rescue general from battlefield until reinforcements arrived. The food and hammers from hunting helped the city to grow to 2 and from there on tracking became visible at the horizon.
To make a long tupi story short, I somehow managed to get the early 2. and 3. city.
After that, while building their economy buildings (I was on 0% science for quite some time) and I had to bribe the previous Tupi capital to stay on my side (steady minor revolts :rolleyes:) at times -yet when they finally wanted to break off, it payed off I beelined to petroglyphs and my superior inca elite was able to seek shelter in lascaux caves which impressed the natives so much that they loved to work for me again^^:king:

In screenie 2 you see my I conquered the first place in GPT, which - yes, I know - is thx to many exploits and minor start bug but it's 2 city AI deity start and I think I can be a little bit proud of me after all. 4070 BC is to be beat now hehe :crazyeye: (what about a monthly C2C GEM HoF lol)

Atm my Moa and Haast Eagle brigades have established at least some defense (est. 1:5) against the stack of doom which got even larger in the meantime (screenie1) and I hope I won't trigger it anytime soon... //at least as long as you don't provide the fix, that is^^

Hope you had a happy birthday! Keep on mastering the art of codeology :goodjob:



EDIT just found a little thing that might add flavour to the game:
When building Lascaux Caves, the a bit sucking underperforming graphics [speaking of glasshouses, I can't do it any better as I suck at 3d-modeling or never really tried it so... :rolleyes:]
should not be displayed in the city if it is not on a hill (+ extension rule: you are only allowed to build if hills are in bfc), but somewhere in the surrounding hills (imagine how it could look like in screenie 4) ---or it might even stick out of a _peak_ now that would look interesting^^

Screenie 3, the general next to the cave brought me to yet another idea: could there maybe be a BUG option that allows you to change the size of your units?

It always bugged me to have so 'large' units and that climaxed when my wife saw me playing civ4 for the first time she asked "why are the units so large compared to the city buildings?... so now, a few years later I am ready to ask for a solution or at least ask for how I can produce that solution...

the idea is like this: You could have the units smaller (and have larger numbers of them at a certain zoom level)
so much like zooming in and zooming out your angle
(which I often do for screenshots) there would be another bar below that which allows you to have the displayed unit larger or smaller (maybe not 100 like the angle bar but 4 positions) and if smaller, at certains steps have their graphics mirrored so larger unit-stacks are displayed^^)? see screenie 5

As I suppose that mirrored graphics would make the game slower, a normal machine could just have it like now and leave the secound slider at lets say (1) all the time and a faster machine could have it at (3) for smaller and more units in the first eras and later maybe switch to (1) when there are generally more units... so it would be a win-win to have that other slider, wouldn't it?
 

Attachments

  • Civ4ScreenShot0057.JPG
    Civ4ScreenShot0057.JPG
    237 KB · Views: 75
  • Civ4ScreenShot0058.JPG
    Civ4ScreenShot0058.JPG
    129 KB · Views: 40
  • Civ4ScreenShot0059.JPG
    Civ4ScreenShot0059.JPG
    207.9 KB · Views: 45
  • Civ4ScreenShot0060.JPG
    Civ4ScreenShot0060.JPG
    244.3 KB · Views: 90
  • Civ4ScreenShot0061.JPG
    Civ4ScreenShot0061.JPG
    444.8 KB · Views: 79
animals should not give xp to generals, it's just too exploitable. -->What about hunting generals, like real master hunter, that get xp from killing animals and give boni vs animals?

I like this idea (file it for the future - wouldn't be hard to do though in principle)

For now I think I'll add a BUG option for whether great commanders can get XP from animals (and default it to NO). What does everyone think about that?
 
It's not only that but also that the AI switches numerous times, spending a fair percentage of it's time in anarchy switching between various civics. If you look in F9/GNP and show a couple hundred years back you'll see how the AI constantly drops to zero GNP, an indication of being in Anarchy.
In the Event Log you can also see when they switch, and to what, if scrolling down.
This makes me, as not doing Anarchy all that much, able to catch up and blaze past all the AI in tech almost exclusively because of their switching civics constantly.

I'm sending up another save, same game but a little further ahead, where this is even more pronounced and where I have taken over the tech lead, and that by a fair amount, at a time where I should still be trying to catch up.

My point is not only that they switch back and forth but also that they switch too often.

Cheers

I've just pushed some tweaks to AI civic evaluation to SVN, which should help (and indeed makes the Carthaginians make a better choice in your save):
  • Added more exact calculation of anarchy costs. If the switch doesn't return a net benefit in 50 turns (standard speed), taking the entire economy into account, it won't happen, regardless of other factors (which might also make it wait, such as better civics just down the road)
  • Great general emergence modifiers now scale non-linearly with army size (added benefit drops off progressively and caps at army size of 100 units)
  • Unhappyness from city limits now calculates on the added assumption that any existing city wants to grow, so happyness is evaluated as if it had 3 more population than it currently does (it already evaluated on the assumption that you want to found <num settlers> + 1 more cities anyway in the not too distant future)
 
No, just for demonstrative purposes showing that during the past 200 turns on Eternity every AI nation has had at least 2 Anarchy from switching civics periods, some up to 7 times, some spending almost 25% of their turns in Anarchy.

Cheers

Have you ever thought that "Anarchy" itself needs changed? That the penalty for switching a Civic should only stop the Civics {set} "benefits" but Not the cities production/commerce/research/etc. ques/builds?

JosEPh
 
I like this idea (file it for the future - wouldn't be hard to do though in principle)

For now I think I'll add a BUG option for whether great commanders can get XP from animals (and default it to NO). What does everyone think about that?

Sounds good.

I think we also need to have diminishing returns on GG points from defeating animals eg half points (rounded down) if you already have had two generals, quarter points if you have had 4 and no points if you have had 6.
 
Have you ever thought that "Anarchy" itself needs changed? That the penalty for switching a Civic should only stop the Civics {set} "benefits" but Not the cities production/commerce/research/etc. ques/builds?

JosEPh

Why? Anarchy represents a period of just that - social chaos and unrest as you change the way you run your society. During that period society breaks down, so all economic activity ceases.
 
Why? Anarchy represents a period of just that - social chaos and unrest as you change the way you run your society. During that period society breaks down, so all economic activity ceases.

Not really, it's just a game mechanic. Society in any gov't change or societal change (which is what Most civic changes are) does not turtle up and stop. People still buy and sell, make and use things etc.

But if that's too hard a concept never mind.

JosEPh
 
Back
Top Bottom