Game Options Discussion

So I'm more secure playing a single player in knowledge I'm being fair to AI. I like Noble for that reason. At least until I finally become an insane strategist :lol:.

The most impressive aspect of civ is the needed unbalancing to "balance" things up.

While in Noble all the bonuses are paired between Human and AI, their behavior is lighthearted. They may attack you or not, they may take the best positions or not. Most of the time they won't have enough units to start a war campaign. They like to use units as cannon fodder even if it doesn't make any sense.

While when you play on Deity all these flaws are fixed, the AI behavior is the fiercest there is. But to that the human gets several penalties, while the AI gets a load of new bonuses (like starting with 2 settlers and 5 techs).

So this is actually never truly balanced, it's a war of balance and unbalance taking place for eternity. I would like a game as fierce as deity, with the AI a lot better at everything, while it doesn't make our gap on bonuses so huge, so I may expect an AI with a sizeable army, not every medium AI with at least 2x my army, and the overlords with 10x my army. Everytime you start to think on numbers based on your condition, you know the AI need to be enjoying several bonuses to host a huge empire with hundreds of units and still be at 90%:science: and getting +35:gold:/turn (because :espionage: lets you check this on any of their cities), while you don't have 10% of their army, 50% of their cities and to keep at 80% to not anger the people if you're using those 'taxes anger civics' is costing you some caravan :gold: missions.
 
The most impressive aspect of civ is the needed unbalancing to "balance" things up.

While in Noble all the bonuses are paired between Human and AI, their behavior is lighthearted. They may attack you or not, they may take the bets positions or not. Most of the time they won't have enough units to start a war campaign. They like to use units as cannon fodder even if it doesn't make any sense.

While when you play on Deity all these flaws are fixed, the AI behavior is the fiercest there is. But to that the human gets several penalties, while the AI gets a load of new bonuses (like starting with 2 settlers and 5 techs).

So this is actually never truly balanced, it's a war of balance and unbalance taking place for eternity. I would like a game as fierce as deity, with the AI a lot better at everything, while it doesn't make our gap on bonuses so huge, so I may expect an AI with a sizeable army, not every medium AI with at least 2x my army, and the overlords with 10x my army. Everytime you start to think on numbers based on your condition, you know the AI need to be enjoying several bonuses to host a huge empire with hundreds of units and still be at 90%:science: and getting +35:gold:/turn (because :espionage lets you check this on any of their cities), while you don't have 10% of their army, 50% of their cities and to keep at 80% to not anger the people if you're using those 'taxes anger civics' is costing you some caravan :gold: missions.

That is what offends me: Noble AI being feeble while Deity it is strong because of its XML values favoring it. I much prefer that Noble AI be as brilliant as possible, then going up difficulty levels only as "starting from behind" instead of "starting at same starting line".

What I mean is that I want AI at Noble to be as smart as it can be in warfare, diplomatic skills, and other strategizing using everything it has with right proportions. That will feel like I'm challenging AI approaching human skills (never will, obviously, that is why I said approaching) on level field. Then after I learn how to beat AI at Noble level fairly easily, I will be more willing to start at position behind the other AIs.

I hope I make my points clear.
 
That is what offends me: Noble AI being feeble while Deity it is strong because of its XML values favoring it. I much prefer that Noble AI be as brilliant as possible, then going up difficulty levels only as "starting from behind" instead of "starting at same starting line".

What I mean is that I want AI at Noble to be as smart as it can be in warfare, diplomatic skills, and other strategizing using everything it has with right proportions. That will feel like I'm challenging AI approaching human skills (never will, obviously, that is why I said approaching) on level field. Then after I learn how to beat AI at Noble level fairly easily, I will be more willing to start at position behind the other AIs.

I hope I make my points clear.

To be honest I think instead of having bonuses and penalties, the game should be straitforward: all starting modifiers equal in every difficulty and for every player, AI or not, with the exception, maybe, for the easiest difficulty (just to greet starters). And what made the difference was the complexity of actions of the AI.

Of course that would mean enhancing the AI, which is a hard thing to do, but it should be the primary purpose on balancing. It's sad that a game has to rely in bonuses to make the difference of levels. Instead of feeling harder, it feels being cheated.

For example the willingness of the AI in trading techs with one another and never treating you fairly. The best deal an AI can do on deity, is giving you a tech some 10 columns behind the one it is now for free. If it's doing this, it probably already gave several other techs for free for other AIs.
Normally, it doesn't even deal with you. When it does, it asks for unimaginable unfair deals, even if you are as weak as the AI itself, or even weaker. The AI has a terrible time considering you by the modifiers of diplomacy (it always seem that they like to be cautious, annoyed and furious towards you, good bonuses are always forgotten, but bad ones stay forever, even that you declared war against their friend some 5000 years ago and that player doesn't even exist anymore for ages, and the AI in consideration has already changed several civics and shifted alliances, like even declaring war against this same friend and conquering him, being the reason that player doesn't exist anymore)

AIs should be more like the player, helping you if both are weak and far behind, and ganging up against stronger ones as it could normally do against any threat, AI or not. Alliances could matter more, and past drawbacks could be forgotten for brighter decisions and less honourable games. There are plenty of reasons to get several diplomatic penalties, but diplo bonuses are rare and weak. Past Events and declared war on our friend have no limit, and I guess declared war on our friend doesn't decay, at least not in my Iroquois Story. I think only "you gave us help" or "you payed us tribute" in the good side are unlimited, and this is totally random as the AI has to ask you for it to be gained, not you.

But I understand this, coding the AI must be pretty hard. This is more yelling at a bad thing instead of complaining about it still being used.
 
The AI is the same across all difficulty levels. The settler AI uses the same exact logic as the Deity AI. Only the handicaps change.
 
The AI is the same across all difficulty levels. The settler AI uses the same exact logic as the Deity AI. Only the handicaps change.

This can't be possible. Deity AI always chase you, while other easier settings sometimes they walk forward then walk backward, then walk forward again. I've never seen Deity AI taking wrong steps towards attacking you. They are so predictable that the Shield Glitch works better with Deity, while it gets less usable the easier you go.

When I got your save Afforess, I tried to enact the Shield Glitch, but for that I had to be sure without it they would march on me. They didn't. I spawned 20 Axemen for the enemy, and he turned around. I spawned more 20 axemen in his capital and more 20 on our borders, he turned back again. Deity AI wouldn't turn back in any circumstance with such sizeable army.

Once in a really hard game on LoR me and my friend used the shield glitch with the best result: The SoD of 100+ troops walked 1SE on one turn, then we changed the positioning of our combined shield and in the next turn the AI walked 1NW, and again we changed the positioning so it would walk 1SE again, and it repeated this forever while we enhanced our forces. This Prince AI of your game conquered your capital and decided it would leave your only other city alone. Deity would never do that.

There must be something hidden that changes the AI behavior.
 
This can't be possible. Deity AI always chase you, while other easier settings sometimes they walk forward then walk backward, then walk forward again. I've never seen Deity AI taking wrong steps towards attacking you. They are so predictable that the Shield Glitch works better with Deity, while it gets less usable the easier you go.

When I got your save Afforess, I tried to enact the Shield Glitch, but for that I had to be sure without it they would march on me. They didn't. I spawned 20 Axemen for the enemy, and he turned around. I spawned more 20 axemen in his capital and more 20 on our borders, he turned back again. Deity AI wouldn't turn back in any circumstance with such sizeable army.

Once in a really hard game on LoR me and my friend used the shield glitch with the best result: The SoD of 100+ troops walked 1SE on one turn, then we changed the positioning of our combined shield and in the next turn the AI walked 1NW, and again we changed the positioning so it would walk 1SE again, and it repeated this forever while we enhanced our forces. This Prince AI of your game conquered your capital and decided it would leave your only other city alone. Deity would never do that.

There must be something hidden that changes the AI behavior.

There isn't. There is no code that checks the difficulty level in the AI logic. The only variables that affect difficulty are here. If you read them, you will notice that there are no mention of combat or anything of the sort.

Don't take my word for it. Setup such a scenario, save, and play on Diety vs Noble. You can change the difficulty in-game with the AND bug options.
 
There isn't. There is no code that checks the difficulty level in the AI logic. The only variables that affect difficulty are here. If you read them, you will notice that there are no mention of combat or anything of the sort.

Don't take my word for it. Setup such a scenario, save, and play on Diety vs Noble. You can change the difficulty in-game with the AND bug options.

Yeah, I posted on the S&T forums about the differences found on the XML for handicaps. So after your last post I got curious and started looking the Source files to find where the AI decisions are taken. Then I found the CvPlayerAI.cpp.

And indeed it seems you're right, there isn't any place that the Handicap Level directly affects any of the AI decisions.

What does happen, and is probably the reason of the differences, is that it affects some modifiers that lead the AI into hating more players on higher difficulties.

The ocurrences of 'Handicap' on the file are:

2 in Attitude Change;

1 in Tech Choosing;

1 in helping to put the AI on the AI_STRATEGY_DAGGER mode (only if Agressive AI is Off);

1 in the number of city defenders;

I couldn't discover what exactly AI_STRATEGY_DAGGER changes in the AI, besides increasing several values related to the military that I couldn't discover what they mean yet.

About the defenders, it seems the AI will leave less Defenders on their cities if the Difficulty is Higher. This is funny to think at first, because this would mean it would be easier to get their cities, instead of fighting them on the field, or surviving their assault. But actually this means their number of city defenders won't increase as much as the number of total troops, because on the Handicaps.xml you may see that the production of troops for the AI is faster and they have so many bonuses to their economy (including troops costing less) that they will have much more units on higher difficulties then on lower ones, which mean they will have as much or even more troops defending cities, but overall in % they will have less Defender/NotDefenders then on easier difficulties.

Maybe with so many Non Defending troops the AI will use more agressive Strategies against the humans, and that explains why it's so fierce on Deity.

------------------------------------------------------------------------------

BTW, this raises a question, if you Afforess, or anyone can answer this I would be grateful:
Does Ruthless AI consider all things considered by Agressive AI (being a more detailed version of Agressive AI), or the effects of Agressive AI are exclusive to Agressive AI, and those of Ruthless AI are exclusive to Ruthless AI?

E.G.: So if something has this line:
Code:
(GC.getGameINLINE().isOption(GAMEOPTION_AGGRESSIVE_AI))
Will it affect only Agressive AI mode games, or both Agressive AI and Ruthless AI?
 
Yeah, I posted on the S&T forums about the differences found on the XML for handicaps. So after your last post I got curious and started looking the Source files to find where the AI decisions are taken. Then I found the CvPlayerAI.cpp.

The 3 most important AI files are: CvPlayerAI, CvTeamAI and CvUnitAI. Don't limit your search just to players. Teams are what makes all the war plan decisions. Units do the actual work of carrying out a war.

What does happen, and is probably the reason of the differences, is that it affects some modifiers that lead the AI into hating more players on higher difficulties.

The ocurrences of 'Handicap' on the file are:

2 in Attitude Change;

1 in Tech Choosing;

1 in helping to put the AI on the AI_STRATEGY_DAGGER mode (only if Agressive AI is Off);

1 in the number of city defenders;

I couldn't discover what exactly AI_STRATEGY_DAGGER changes in the AI, besides increasing several values related to the military that I couldn't discover what they mean yet.

Attitude change really only has a big effect without Aggressive AI. Aggressive AI doesn't care about attitude as much as just picks easy targets. Without Aggressive AI, the AI pretends to be human and slightly cares about other players.

Strategy Dagger is the very early game warrior rush strategy (think Inca UU rush). It is not used outside of the first era. Notice there is a iCurrentEra <= 2 check before the main dagger logic.

Code:
	if( !(AI_isDoVictoryStrategy(AI_VICTORY_CULTURE2)) 
	 && !(m_iStrategyHash & AI_STRATEGY_MISSIONARY)
	 && (iCurrentEra <= (2 + (AI_getStrategyRand(11) % 2))) && (iCloseTargets > 0))    {

About the defenders, it seems the AI will leave less Defenders on their cities if the Difficulty is Higher. This is funny to think at first, because this would mean it would be easier to get their cities, instead of fighting them on the field, or surviving their assault. But actually this means their number of city defenders won't increase as much as the number of total troops, because on the Handicaps.xml you may see that the production of troops for the AI is faster and they have so many bonuses to their economy (including troops costing less) that they will have much more units on higher difficulties then on lower ones, which mean they will have as much or even more troops defending cities, but overall in % they will have less Defender/NotDefenders then on easier difficulties.

Maybe with so many Non Defending troops the AI will use more agressive Strategies against the humans, and that explains why it's so fierce on Deity.

If you are looking at AIStartingDefenseUnits then you are mistaken, that only controls how many free AI defenders the game gets when the world begins. It has no effect on decision making.

If not, then clarify which modifier you are looking at, because I didn't see it on skimming.

BTW, this raises a question, if you Afforess, or anyone can answer this I would be grateful:
Does Ruthless AI consider all things considered by Agressive AI (being a more detailed version of Agressive AI), or the effects of Agressive AI are exclusive to Agressive AI, and those of Ruthless AI are exclusive to Ruthless AI?

E.G.: So if something has this line:
Code:
(GC.getGameINLINE().isOption(GAMEOPTION_AGGRESSIVE_AI))
Will it affect only Agressive AI mode games, or both Agressive AI and Ruthless AI?

Easy. From CvGame:

Code:
void CvGame::init(HandicapTypes eHandicap)
...
	//Ruthless AI means Aggressive AI is on too.
	if (isOption(GAMEOPTION_RUTHLESS_AI) && !isOption(GAMEOPTION_AGGRESSIVE_AI))
	{
		setOption(GAMEOPTION_AGGRESSIVE_AI, true);
	}
...
 
If you are looking at AIStartingDefenseUnits then you are mistaken, that only controls how many free AI defenders the game gets when the world begins. It has no effect on decision making.

If not, then clarify which modifier you are looking at, because I didn't see it on skimming.

Thanks for all the info Afforess, there were many things I always wanted to know.

About the defenders, I took the info from CvPlayerAI.cpp on the function:
Code:
int CvPlayerAI::AI_getTotalFloatingDefendersNeeded(CvArea* pArea) const

In this line:

Code:
iDefenders /= std::max(30, (GC.getHandicapInfo(GC.getGameINLINE().getHandicapType()).getAITrainPercent() - 20));

So it seems that the harder the game, the lesser iDefenders gets
 
I've taken a look at CvTeamAI but didn't find anything about handicaps that matter (there were some references but nothing serious).

But in CvUnitAI I found something interesting in this function:

Code:
void CvUnitAI::AI_attackCityMove()

Code:
int iStepDistToTarget = stepDistance(pTargetCity->getX_INLINE(), pTargetCity->getY_INLINE(), getX_INLINE(), getY_INLINE());
                int iAttackRatio = std::max(100, GC.getBBAI_ATTACK_CITY_STACK_RATIO());

                [B]//      Koshling - use the difficulty level of the opponent's settings to estimate how
                //      much more prepared we really need to be - this should cause players on higher difficulty
                //      settings to get attacked by larger stacks rather than prematurely by not-quite-adequate ones
                //      Only do this if we're still in preparation mode either in our own territory or some way away from
                //      the target (before we lose the benefit of surprise)[/B]
                if ( plot()->getOwnerINLINE() == getOwnerINLINE() || iStepDistToTarget > 3 )
                {
                        int iTargetUnitTrainModifier = GC.getHandicapInfo(GET_PLAYER(pTargetCity->getOwnerINLINE()).getHandicapType()).getAITrainPercent();

                        if ( iTargetUnitTrainModifier < 100 )
                        {
                                [B]//      Difficulty above Noble, so a player on a higher settings
                                //      Diety has 75% so squaring things means a diety player can expect to see
                                //      the AI prepare attack stacks approximately 16/9 times more powerful
                                //      then a noble player[/B]
                                iAttackRatio *= 10000;
                                iAttackRatio /= iTargetUnitTrainModifier*iTargetUnitTrainModifier;
                        }
                }

I didn't check the code exactly, but the commented area.

And BTW, I was wrong on my previous analysis about defense units. The AI Train Modifier is not applied to the AI production, but rather to the Total Value Cost, so it actually decreases the harder the handicap, not the other way as I was thinking. So actually on Deity the AI has iDefenders > then on easier settings.
 
I've taken a look at CvTeamAI but didn't find anything about handicaps that matter (there were some references but nothing serious).

But in CvUnitAI I found something interesting in this function:

Code:
void CvUnitAI::AI_attackCityMove()

Code:
int iStepDistToTarget = stepDistance(pTargetCity->getX_INLINE(), pTargetCity->getY_INLINE(), getX_INLINE(), getY_INLINE());
                int iAttackRatio = std::max(100, GC.getBBAI_ATTACK_CITY_STACK_RATIO());

                [B]//      Koshling - use the difficulty level of the opponent's settings to estimate how
                //      much more prepared we really need to be - this should cause players on higher difficulty
                //      settings to get attacked by larger stacks rather than prematurely by not-quite-adequate ones
                //      Only do this if we're still in preparation mode either in our own territory or some way away from
                //      the target (before we lose the benefit of surprise)[/B]
                if ( plot()->getOwnerINLINE() == getOwnerINLINE() || iStepDistToTarget > 3 )
                {
                        int iTargetUnitTrainModifier = GC.getHandicapInfo(GET_PLAYER(pTargetCity->getOwnerINLINE()).getHandicapType()).getAITrainPercent();

                        if ( iTargetUnitTrainModifier < 100 )
                        {
                                [B]//      Difficulty above Noble, so a player on a higher settings
                                //      Diety has 75% so squaring things means a diety player can expect to see
                                //      the AI prepare attack stacks approximately 16/9 times more powerful
                                //      then a noble player[/B]
                                iAttackRatio *= 10000;
                                iAttackRatio /= iTargetUnitTrainModifier*iTargetUnitTrainModifier;
                        }
                }

I didn't check the code exactly, but the commented area.

And BTW, I was wrong on my previous analysis about defense units. The AI Train Modifier is not applied to the AI production, but rather to the Total Value Cost, so it actually decreases the harder the handicap, not the other way as I was thinking. So actually on Deity the AI has iDefenders > then on easier settings.

That code was adding by Koshling, so you can see that the BTS code did not have the same effect. I believe the stack attack ratio forces to consider enemy cities as 16/9 more powerful than normal, so they spend more time creating a larger stack before attacking. Whether this is effective, or actually improves the AI is debatable. If it does improve stacks, why is easier AI under-estimating the enemy? If it doesn't, then deity AI's would take longer to prepare to attack, which is bad.
 
That code was adding by Koshling, so you can see that the BTS code did not have the same effect. I believe the stack attack ratio forces to consider enemy cities as 16/9 more powerful than normal, so they spend more time creating a larger stack before attacking. Whether this is effective, or actually improves the AI is debatable. If it does improve stacks, why is easier AI under-estimating the enemy? If it doesn't, then deity AI's would take longer to prepare to attack, which is bad.

I guess this was already present on LoR, so I'm probably used to it. I don't have LoR source files so I can't check it.

If it does improve the stacks, the game gets harder indeed, as it's easier to deal with less units then more units. But if it takes too long for them to build, then it might not be an advantage after all. But as Deity has only 60% of total cost to build units, 60% of maintenance cost of units, and specially on the beginning they have more starting techs, 2 settlers and several units, and you have several penalties forcing you to not build a big army early on, maybe it doesn't take much more time to amass a sizeable army to attack.

If this truly happened on LoR (and I think so), it was allied to the fact that there the starting spawn of a barb civ was incredibly larger then on AND (sometimes giving 20 units for free just because they formed the state event, with metal and horse needing troops, while you may still be researching Bronze Working).

Maybe this function AI_attackCityMove is the one that is affected by the Shield Glitch, but I would have to read the code entirely and get some knowledge on the Area functions, because it surely has to do with it, to discover if I'm right on my assumption.
 
The easiest way to debug the shield glitch would be to try and create a new game and use the worldbuilder to set up the simplest example of it possible. Then with a debug DLL, you or I could step through the unit AI code and try and determine where the AI checks are bad.
 
The easiest way to debug the shield glitch would be to try and create a new game and use the worldbuilder to set up the simplest example of it possible. Then with a debug DLL, you or I could step through the unit AI code and try and determine where the AI checks are bad.

I would probably have to dedicate some time to it because in your game even spawning 60 Axemen to the enemy who had conquered your capital, he decided to turn around even with my city empty and some 3 weak units outside of it. So it's not so straitforward like this.

The Shield Glitch happens when you put at least a single unit on every tile in a line around your cities. This way the AI turns around thinking it's impossible to reach your cities. It thinks you are overseas, so it gets some boats to attack you (never tested a non coastal city game with the shield glitch, nor a boat shield). But this only affects the main army, so those wandering units eventually decide to attack you. If the stack gets adjacent to your shield, then the glitch is broken because the AI will attack you.


The best case for the shield glitch, which most player may have already used without knowing is the Single Tile Entrance to the player's Penninsula, like your game. It's obvious you'll use the single tile entrance for defense, so with that you are cheating the AI into thinking you're overseas.

Of course all these impressions were on LoR, with its last update sometime around 2011-2012. Maybe this was fixed in AND, I'll have to test.


Some interesting discoveries about the Shield Glitch (all on a single game that the Aztec AI had all religions, and was a lot more developed then anyone, and was an archipaelago empire):


-When the Aztec put a SoD of 100+ troops on the main continent, me and my friend developed a shield to protect him against the Aztec. When we completed it, not only their SoD turned around, but suddenly MANY ships left their harbors and started sailing towards me or my friend. So we realized the AI thought it had only Overseas enemies (we were the last 2 free civs they were at war).

-Then we opened the shield, and thought of opening and then close each 2 turns (one open, one close). This didn't slowed their ships, and we were afraid of incursions. So we saw there were some peaks near their SoD, and we attempted an interesting idea: The fastest way of reaching a hole on our shield in the north, was going NW of the current SoD position, while the fastest way of reaching a hole on our shield in the south was to come back to the spot they were (SE). So each turn we closed on one place and opened on the other. This made their SoD uselessly walking forward and back forever (1NW then 1SE and 1NW again and so on), while he stopped using ships because technically he could reach one of us by land.

To the curious people, we finally took the SoD with 3 Tactical Nukes.

Here is the graph of his Military Power just after we obliterated his SoD with tactical nukes on my friend's landmass:

Spoiler :
 
Well the way you describe it sounds like an issue with the usage of generatePath in CvUnit/AI. It takes flags which indicate whether paths can contain enemies or not. So I suppose: Incorrect flags are being used in some AI attack logic (more likely) or the actual pathing logic itself is wrong (less likely)
 
45°38'N-13°47'E;13439233 said:
Talking about options to be removed, is it really necessary to have "advanced espionage" as a separate option? Shouldn't we include it as default (not an option)?

AFAIK, Advanced Espionage turns on the extra spy options. I almost always use those, but I would like to hear if anyone else doesn't.
 
I always use Advanced Espionage, myself.
 
Always, here.
 
Top Bottom