New GameOption Request: Cuthroat AI

phungus420

Deity
Joined
Mar 1, 2003
Messages
6,296
From here:

http://forums.civfanatics.com/showthread.php?t=311889

Consider the possibility of a gameoption that when toggled loads the XML personality atributes of the runnaway AI (found in the link above). The most optimal way to implement such a gameoption would be to have a tag in LeaderheadInfos called <CuthroatAIType> with a couple types, like Warmonger, TechWhore, WonderWhore, SpyMonger, or some such types. Then if the CuthroatAI gameoption is selected the AI's personality is loaded from a cuthroatAI file which changes all the personality atributes like UnitWeight and such to the values assinged to it's cutthroat type (this way the leadertraits could be maximized so the AI plays to it's strengths). Of course that's very complex for a first run. Just to get things started it would proably be simplest to implement a CuthroatAI starting gameoption when if selected it overrides the personality atributes set in LeaderHeadInfos with the values assigned by TheMeInTeam's runaway AI mod, found in the link. Such a game option would be enjoyed by many players, I'm sure there would be much demand for it. While I agree the standard AI should be limited to roleplay style behavior, I think having the option to play with AIs that try to win at all costs and play in an extremely cuthroat manner would be interesting.
 
The issue about TMIT AI XML changes is that they don't necessarily do a AI that performs better on the field if all the AI behave like that. TMIT runaway AI runs away because it plays like more a gamer ( don't care about religion, tech trades like a mad man, prepares wars with more time and against better chosen adversaries, backstabs far more frequently .... ). The issue is that a gamer only runs away when no one else is a gamer of when it has a lot of luck with the starting spot and today AI lacks the brain power to concieve and maintain aliances based solely in mutual gain ( a thing that is so usual in MP games )... in the end it might get to the BtS Agg AI path in lower levels: classical slugfest between AI with the human watching from behind or manouvering in the shadows ( TMIT AI IIRC has no qualms about being bribed to war IIRC .... )

Said that, I would obviously give my support to the changes you propose ( I'm sure it would make far diferent SP games from the normal "let's be budhist like everyone else to be safe" , and that alone is a selling point :D ). I would also definitely support some global strategies partly or completely overriding the XML personalitly files every now and then ....
 
Looking at the XML for the Runaway AI:

iNoTechTradeThreshold = 50
iTechTradeKnownPercent = 0
TechRefuseAttitudeThreshold = ATTITUDE_FURIOUS​

Be very willing to trade and broker techs. Plainly all AIs should trade techs more. We should also improve the sophistication of the tech trade code.

FLAVOR_GROWTH​

This is to try to leverage the IMPERIALIST trait as much as possible. All AIs with IMPERIALIST should produce settlers more often.

iRefuseToTalkWarThreshold = 150​
If this is a boost, then that means that all the diplomacy that the AI does while it is at war is a net disadvantage, which is unfortunate. We need to make the AI want more in exchange for peace, and have a better idea of what peace is worth to it.

iMaxWarNearbyPowerRatio = 70
iMaxWarDistantPowerRatio = 30
iMaxWarMinAdjacentLandPercent = 0
NoWarAttitudeProbs = 10 for all attitudes​
These and other changes set the Runaway AI's war strategy: it finds a civ that it has a significant power advantage over and it attacks them, regardless of attitude. This is a great war strategy, and all AIs should do it to a greater or lesser extent. If Ghandi sees another civ sitting on 25% of Indian power, and it's not in a vassalage/defensive pact, then that civ is a sitting duck for the warmongers out there. Ghandi should offer a vassage agreement. If the victim civ refuses, Ghandi should attack and capitulate the civ for its own protection.

iSameReligionAttitude* = 0
iDifferentReligionAttitude* = 0
iFavoriteCivicAttitude* = 0​
The existing AI's current religion diplomacy hurts it, so disabling it improves the AI's performance. The same applies for civics. Here's my suggestion for improving religious diplomacy:
http://forums.civfanatics.com/showthread.php?t=337714

UnitAIWeightModifiers - UNITAI_COLLATERAL = +10​
AIs should build slightly more collateral units.

ImprovementWeightModifier - IMPROVEMENT_TOWN = +20​
AIs should slightly increase their valuation of towns.
Edit: on reflection, this probably only helps because of the bug jdog fixed where AI workers keep bulldozing towns.

iBuildUnitProb = 80
iWonderConstructRand = 0​
AIs should build slightly more units and slightly fewer wonders.
 
Looking at the XML for the Runaway AI:

iNoTechTradeThreshold = 50
iTechTradeKnownPercent = 0
TechRefuseAttitudeThreshold = ATTITUDE_FURIOUS​

Be very willing to trade and broker techs. Plainly all AIs should trade techs more. We should also improve the sophistication of the tech trade code.
This does not improve the AI in a iota if all the AI behave like this. It only helps in a enviroment where some won't trade. Agreed in refining the tech trade code, especially the dreaded "too advanced" code, that is extremely stupid.
FLAVOR_GROWTH​

This is to try to leverage the IMPERIALIST trait as much as possible. All AIs with IMPERIALIST should produce settlers more often.
Not always. There is no gain in doing settlers where there is no decent land to settle and there is a net loss if the AI builds settlers with the objective of colonizing land that was open by razing of cities during war ( a VERY sad a common show even today ... this would exarcebate it ).
iRefuseToTalkWarThreshold = 150​
If this is a boost, then that means that all the diplomacy that the AI does while it is at war is a net disadvantage, which is unfortunate. We need to make the AI want more in exchange for peace, and have a better idea of what peace is worth to it.
TMIT probably wanted to make it's AI to wage it's wars for more time instead of acepting too quicky to talk. It makes some sense combined with the way ti choses targets and the war prep times.... as this AI is coded to smash smaller civs and to agregate them to it's growing power, it makes sense to make war longer than the normal AI would. But yes, this one can backfire heavily...
iMaxWarNearbyPowerRatio = 70
iMaxWarDistantPowerRatio = 30
iMaxWarMinAdjacentLandPercent = 0
NoWarAttitudeProbs = 10 for all attitudes​
These and other changes set the Runaway AI's war strategy: it finds a civ that it has a significant power advantage over and it attacks them, regardless of attitude. This is a great war strategy, and all AIs should do it to a greater or lesser extent. If Ghandi sees another civ sitting on 25% of Indian power, and it's not in a vassalage/defensive pact, then that civ is a sitting duck for the warmongers out there. Ghandi should offer a vassage agreement. If the victim civ refuses, Ghandi should attack and capitulate the civ for its own protection.
WARNING: this looks good on 1:1 , but it can put the AI in serious troubles if it has a oportunist and backstabber AI close ( that is, other runaway AI :D ) . Say, for a example, that we have Civ A with 1.1 power, civ B with 0.7 and Civ C with 1.0, all bordering eachother. Civ A decides to attack civ B because it is weaker.... but in that moment Civ B decides that them + civ C are stronger than civ A by a bigger margin than they are stronger than Civ B and attacks A. A has it's army locked in B territory, and because it will refuse to talk ;) can't call peace vs B ... neither B will acept talking with them :D . So A is screwed because it was greedy ;)
iSameReligionAttitude* = 0
iDifferentReligionAttitude* = 0
iFavoriteCivicAttitude* = 0​
The existing AI's current religion diplomacy hurts it, so disabling it improves the AI's performance. The same applies for civics. Here's my suggestion for improving religious diplomacy:
http://forums.civfanatics.com/showthread.php?t=337714
To say the truth, I've been increasingly losing my faith that the roleplay issues ( religion included ) actually hurt the AI, atleast compared with the alternatives. The AI has absolutely no sense of mutual self-interest cooperation, so if we cut the things that actually make the AI cooperate with eachother, we will probably get a AI that shoots in every direction with little gain .... True, religion might make the AI to lose some golden chances, but i wonder if , in average , this AI would not perform worse if they all played in "don't care about your faith" mode
UnitAIWeightModifiers - UNITAI_COLLATERAL = +10​
AIs should build slightly more collateral units.
This oe is probably the one hardest to talk againt ;)
ImprovementWeightModifier - IMPROVEMENT_TOWN = +20​
AIs should slightly increase their valuation of towns.
Edit: on reflection, this probably only helps because of the bug jdog fixed where AI workers keep bulldozing towns.
Exactly. With that BUG out, this might even be detrimental in some circumstances
iBuildUnitProb = 80
iWonderConstructRand = 0​
AIs should build slightly more units and slightly fewer wonders.
Well, this point is HIGHLY discussible. Sure , a roleplay AI eater like this AI probably wins more with troops that with Chichen Itza :p , but what happens if ALL the AI shuns wonders? Hum, who will build them and reap their benefits? :p Also, there is already some empirical evidence that AI plays very badly when has no wonders...

All summed: yes, this AI will eat alive the current roleplay AI... that is expected, it was designed to do that. But I'm thinking that it can actually perform far worse than the current AI if all the AI in game behave like this. In a game like that, it would only give 2 outcomes: some states would eat the others like silkworm eats mulbery leafs ( a nice methafor from the times of the Chinese Warrior states ) or we would get a Ancient Greece scenario: everyone killing everyone and then someone that was in the shadows ( Macedon or Rome ) comes and kill them all ( this would be the human , I guess :D ), with very little in between. My opinion is that this makes the AI, in average ( note that I'm talking in average, so this is not only seeing the victors side :D ), weaker and not stronge.

But if it was simply a setting I would play in from time to time, just for the fun :D
 
Interesting feedback. I agree that merely increasing the iRefuseToTalkWarThreshold doesn't help us much - but it is an indication that the AI's war diplomacy could be dramatically improved. Being able to talk during wartime should be a good thing!

This does not improve the AI in a iota if all the AI behave like this.

I think it does help, because it means that a human player can gain a much smaller advantage from tech brokering. Silly example:

Incan AI has the Burgers tech, worth 800 beakers
German AI has the Fries tech, worth 400 beakers.
French human is one turn from finishing the Cola tech, worth 400 beakers.

Currently I believe the Incans and Germans will not trade, because the Incans believe it would be an unfair trade. This means that the French human can trade Cola for Fries, and then Cola+Fries for Burger, and leapfrog the other civs to get a tech lead. Plus, the human can then gift Burger to the Germans to bribe them to attack the Incans, or save that trade for when the Germans discover their next tech.

If the AI is willing to accept 50% losses on tech trades, then the Incans will trade Burgers for German Fries. Next turn, the human will trade Cola for German Fries and Incan Burgers, or vica versa, and the three civs end up at tech parity. This is a better end result for the AIs, in relative and absolute terms.

Now, we can do much better than that. For example, an AI could avoid trading a tech until another civ is about to finish researching it, and then it could trade it around like candy, including using it to start wars and trade embargoes. That allows a tech leader AI to better guard its tech lead.

Civ A decides to attack civ B because it is weaker.... but in that moment Civ B decides that them + civ C are stronger than civ A by a bigger margin than they are stronger than Civ B and attacks A.

I think you mean that Civ C decides to attack Civ A?
I think that would be a bad decision by Civ C, unless there are other factors. It can't rely on Civ B, because at any moment Civ B might sue for peace or capitulate. A better option would be for Civ C to vassalise Civ B, so that it can count on B's support for several turns. Alternatively, it could attack Civ B, knowing that if the A vs B war stops, it will still be in a good position.

If we cut the things that actually make the AI cooperate with eachother, we will probably get a AI that shoots in every direction with little gain.

I don't think this is an impossible task. Suppose Apostolic members liked each other and disliked non-Apostolic members. That's good game play, and it's good role play, and it encourages blocks of AIs to co-operate with each other.

what happens if ALL the AI shuns wonders? Hum, who will build them and reap their benefits?

I agree. I'm thinking of a small reduction, rather than a total change. When I see winning Immortal/Deity game reports, it seems like the human never founds any religions and maybe will build a couple of (key) wonders. I think that implies that the AIs are slightly over-emphasising both things.
 
WARNING: this looks good on 1:1 , but it can put the AI in serious troubles if it has a oportunist and backstabber AI close ( that is, other runaway AI ) . Say, for a example, that we have Civ A with 1.1 power, civ B with 0.7 and Civ C with 1.0, all bordering eachother. Civ A decides to attack civ B because it is weaker.... but in that moment Civ B decides that them + civ C are stronger than civ A by a bigger margin than they are stronger than Civ B and attacks A. A has it's army locked in B territory, and because it will refuse to talk can't call peace vs B ... neither B will acept talking with them . So A is screwed because it was greedy

I'd like to clarify something. The RTT time taking so long was meant for the guy who DECLARES to avoid talking, such that it won't take capitulation but instead consolidates the land. This is not what happens in practice, it seems the turns are its RTT threshold when being the target. Now, in this scenario since they're all like that it doesn't matter, but still...

Also, are you trying to make a case that there IS or IS NOT a runaway AI resulting from the case you describe? Think about it. If C mauls A off pure opportunistic "luck", C is STILL going to get A's land while A and B fight it out initially. They all spam units like crazy, but only C's units are coming to cities unscathed by an initial stack battle. What do you think happens? The likely outcome is that C captures a large # (possibly all, since we're dealing in massive stacks) of A's cities. That's trouble for B, because C will continue spamming units, and eventually come after B.

If you wait long enough, the entire continent belongs to C. If the human does not interfere in this process post-haste (while fending off his own annoying runaway AIs), C could easily turn into an unstoppable monster in spite of other AI just like it.

The only situation I can think of that would be trouble is a continent with ONLY A and B. In this case, it is unlikely one side will overtake the other with equal unitprobs sufficiently to actually declare. They will probably spam units in a cold war and tech somewhat slowly, although they WILL at least trade everything freely, so it might still be better than an isolated unitprob 80 civ :lol:. Also, if someone (say the human) were to declare on them or they on someone else, their neighbor backstabbing would be very likely! Haha!

To say the truth, I've been increasingly losing my faith that the roleplay issues ( religion included ) actually hurt the AI, atleast compared with the alternatives. The AI has absolutely no sense of mutual self-interest cooperation, so if we cut the things that actually make the AI cooperate with eachother, we will probably get a AI that shoots in every direction with little gain .... True, religion might make the AI to lose some golden chances, but i wonder if , in average , this AI would not perform worse if they all played in "don't care about your faith" mode

Infinite tech collusion might overcome the religious advantages. Besides, TRUE (rather than temporary) collusion is questionable from a "play to win" standpoint. There's only 1 winner per game.

Not always. There is no gain in doing settlers where there is no decent land to settle and there is a net loss if the AI builds settlers with the objective of colonizing land that was open by razing of cities during war ( a VERY sad a common show even today ... this would exarcebate it ).

This flavor was chosen because it is consistent with some of the strongest AIs. Also, having every AI do it would be incredibly annoying to the human. You would literally be surrounded by cathy on all sides every game X_X.

Exactly. With that BUG out, this might even be detrimental in some circumstances

I disagree, unless we change how the AI treats its final civics. Let's consider:

1. AI SUCKS HARD at GPP management
2. AI seems to eventually adopt environmentalism indiscriminately. Same for US, FS, and emancipation
3. The AI, if spamming units, will be needing to pay for them and pay for them early.
4. This tile improvement is the one that gives the AI the best tech rate, at the cost of some production.

If betterAI corrects the civic choice priority materially, this tile improvement preference is subject to change. However, I would strongly content that for your typical 3.19 BTS US/FS/Eman/Env whore the town is the best tile improvement it can build.

Well, this point is HIGHLY discussible. Sure , a roleplay AI eater like this AI probably wins more with troops that with Chichen Itza , but what happens if ALL the AI shuns wonders? Hum, who will build them and reap their benefits? Also, there is already some empirical evidence that AI plays very badly when has no wonders...

It is important to point out that a wonder prob of 0 does NOT mean the AI won't build wonders. For example, montezuma has a 0 there and I've seen him collect 5+ wonders in his capitol when he has the resources for them. In a sense, this will feel like MP in terms of wonders...their time going will be pretty erratic and unpredictable, and if anyone tries getting cute by spamming them they are just about guaranteed to be the first target :lol:.

In all seriousness: should I touch up my settings based on my improved play, and find/replace them across all AIs as a custom XML? If people want a nasty AI it will certainly be nasty...a forced adjustment if nothing else. I think it would be impossible outright on deity, too :p.
 
I think you are missing my point on the backstab example, TMIT. My point was to show that a simple "weaker should be smashed" aproach combined with high backstab tendencies of all the AI can generate dynamics that are highly detrimental for the AI that starts the process with some ease ( and obviously if there is a Civ D bordering C and so on it can also spread like bush fire to a state of all kill all ) . I obviously recognize that your AI settings will a lot of times lead to some Ai growing like mushrooms ( read my last paragraph of the post above ) and I'm not questioning that. My question was slightly diferent: a certain AI player will become better or worse by doing what TMIT AI does instead of doing what it does now if all the AI behave the same ? And that is what I'm not so sure that will be true. Ok, in most games ( not all, because it can stall in a all kill all scenario with no one rising above ) some AI will be big and powerful and pose a credible threat to a human win, but what about the others that were smashed in the way, but that could had won via other ways if they hadn't betted everything in the military? Those would had been ill served :p That is why i said that I wasn't sure that in average the AI would become a better player by using this settings .....

About the tech trades: I guess that i wasn't clear enough in my argument there and both Martin and TMIT misunderstood what I was saying. Sure , you are right, the AI will tech faster in average, but you are forgetting a smallish detail: the AI also trades techs with humans :D The human would also be caught in the wave of tech trading love if he wanted to, so in average the result would not much more than acelerating the tech advance to insane levels ( assuming everyone knows everyone , that is ;) ). In fact this could even , in some situations, benefit the human compared with games with the stock AI personalities. Not mentioning that there is atleast two ways of getting techs from a AI without trading for them :p
 
Sure, the human can trade tech, but the human doesn't wave a magic wand to upgrade units ;). The AI has this advantage, it should make use of it :/.

I could always throw in a couple unitprob 5 personalities that WHORE wonders like crazy and do a bend-over vassal job to the AI (or a stupid enough human) almost on DoW. Nothing like going off to stop a culture or space win on super shaka's vassal.

But I'm interested to see how a world of just runaway AIs performs, because in honesty we are only theorizing on it.
 
I took my "better iPower" personal mod, and made all the AI's "Runaway" in style. They all traded voraciously:

iNoTechTradeThreshold = 50
iTechTradeKnownPercent = 0
TechRefuseAttitudeThreshold = ATTITUDE_FURIOUS​

They all liked backstabbing:
iMaxWarNearbyPowerRatio = 70
iMaxWarDistantPowerRatio = 30
iMaxWarMinAdjacentLandPercent = 0
NoWarAttitudeProbs = NoWarAttitudeProbs / 10​

They all built more units and fewer wonders:
iBuildUnitProb = iBuildUnitProb x 2
iWonderConstructRand = iWonderConstructRand / 10​

I was expecting the AIs to all jump on me before I managed to hook up Iron to get hold of axemen, but they did not. The only DoW was the tech leader against a nearby victim - a good choice.
The tech trading seemed more effective than normal, though I caught up significantly because none of the AIs researched Compass. However, I normally play without tech brokering, so maybe that is the difference.

Here is the leaderheadinfos.xml file I used:
View attachment CIV4LeaderHeadInfos.zip
 
I took my "better iPower" personal mod, and made all the AI's "Runaway" in style. They all traded voraciously:

iNoTechTradeThreshold = 50
iTechTradeKnownPercent = 0
TechRefuseAttitudeThreshold = ATTITUDE_FURIOUS​

They all liked backstabbing:
iMaxWarNearbyPowerRatio = 70
iMaxWarDistantPowerRatio = 30
iMaxWarMinAdjacentLandPercent = 0
NoWarAttitudeProbs = NoWarAttitudeProbs / 10​

They all built more units and fewer wonders:
iBuildUnitProb = iBuildUnitProb x 2
iWonderConstructRand = iWonderConstructRand / 10​

I was expecting the AIs to all jump on me before I managed to hook up Iron to get hold of axemen, but they did not. The only DoW was the tech leader against a nearby victim - a good choice.
The tech trading seemed more effective than normal, though I caught up significantly because none of the AIs researched Compass. However, I normally play without tech brokering, so maybe that is the difference.

Here is the leaderheadinfos.xml file I used:
View attachment 232424

Thanks. I might try that out.
 
I know this thread is pretty derelict, but I added a "Ruthless AI" option to my mod, and it works incredibly well. It doesn't change much, it's just MartinHarper's suggestions put into the SDK, plus a few of my own changes.

My own changes include tweaking the contacts so that the AI can trade 3x as often (with a isHuman() check to make sure this doesn't affect human-AI trading). (If humans can initiate trades every turn, why not the AI?) Also, I removed all the WHEOOHRN denials, with a random number that gave either a DENIAL_MYSTERY, DENIAL_JOKING, or DENIAL_NO_GAIN, so players can't try to figure it out anymore.

Playing with this new AI is like moving up two difficulty levels. If I play on Prince, I win 99% of the time, but with Ruthless AI, I was dead 200 turns in.

I have all this code on a SVN, so you guys can check it out if you are interested.
 
Check out the current SVN 2.8 todo list. IT's intended to include Ruthless AI, but not this instant.
 
@Afforess: If you still remember which files are affected, that would be helpful as I currently don't have the discspace for your whole trunk.
 
@Afforess: If you still remember which files are affected, that would be helpful as I currently don't have the discspace for your whole trunk.

Just the source code. You should be able to search for GAMEOPTION_RUTHLESS_AI to find all the changes.
 
Top Bottom