AI behavior with the "replaces others with this flag" flag

Predator145

Warlord
Joined
May 22, 2020
Messages
255
Powerplants in stock game have the "replaces others with this flag" flag in the editor. Every time you build a new powerplant, the old one automatically gets sold off. Does the AI make the mistake of loop building powerplants in stock game? Imagine the AI building a Coal Plant first, then replacing it with a Hydro Plant, then a Solar Plant and then a Coal Plant again, crippling its Industrial and Modern performance.

This is very hard to test. But knowing how half baked stock game is, this major late game performance sabotage error may be present.

I've just tested how the AI behaves with heavy perfuming via Flintlock's patch. Coal Plants and Solar Plants have no requirements and cost 0 shields. Both are perfumed at 10000. The AI in the WW2 Pacific scenario instantly build them in their cities with Factories. It seems to value both the Coal Plant and Solar Plant equally, not factoring in pollution. Some cities chose Coal, some chose Solar first.

But here's the kick in the teeth. Both got built right after another, triggering a loop. Of course things are accelerated with the heavy perfuming and 0 shield cost. But this makes me think this error exists in stock game as well. It's just that the AI is too busy building other stuff to often be harmed by it.

I've decided to not use this flag in any of the scenarios I play. Now I see why many hate it. In stock game, a city could have up to 8 production bonus (x4) with fresh water and 6 bonus (3x) without. You could achieve the same numbers by scaling down each production boosting improvement and let them accumulate. Here's what I do:
Factory: +2, maintenance 3, 240 shields, pollution 2 , does not require Iron to not gimp AI's unfortunate with RNG.
Coal Plant: +1, maintenance 1, 120 shields, pollution 2, requires Factory and Coal.
Hydro Plant: +1, maintenance 2, 120 shields, no pollution, requires Near River and Factory.
Solar Plant: +1, maintenance 2, 160 shields, requires Factory
Nuclear Plant:+1, maintenance 2, 160 shields, no pollution, can meltdown, requires Factory, Fresh Water and Uranium
Manufacturing Plant: +2, maintenance 3, 320 shields, pollution 2, requires Factory

All of them are heavily perfumed, esp the Factory and Coal Plant, making sure that the AI industrializes ASAP. Shield investments, pollution and maintenance are not a heavy departure from stock game.
 

Civinator

Blue Lion
Supporter
Joined
May 5, 2005
Messages
7,882
This is very hard to test. But knowing how half baked stock game is, this major late game performance sabotage error may be present.
With the Flintlock mod such a test in Debug mod could be done with the original C3C game as a base. Give all civs all techs that are needed to produce all powerplants in the game. You can even preplace one of the better plants in a city and have a look into that AI city, if there is still a chance (point value) that the AI replaces the better plant with a not so good plant. If the AI gets into a loop, the chance of production the not so good plant should be greater than zero. Unfortunately at present I don´t have the time to do such a test.
 

Flintlock

King
Joined
Sep 25, 2004
Messages
904
Both got built right after another, triggering a loop. Of course things are accelerated with the heavy perfuming and 0 shield cost.
The perfume is definitely distorting the AI's behavior here. Perfume is a pretty blunt tool, the points are simply added into the AI's judgement of the building/unit's value. Also they're added at the very end so the AI can't weigh or override them in any way. (I did that so that they'd work in a consistent way. Initially I inserted perfume in the middle of the AI's evaluation but then I discovered the AI was applying a weight to that intermediate value which was making the value of perfume vary unpredictably.) That means if you add a huge amount of perfume to something, the AI will always choose to build it if possible.
 

Predator145

Warlord
Joined
May 22, 2020
Messages
255
Testing stock game will be extremely time consuming as the AI doesn't put any priority to timing sensitive improvements like anti-corruption, production, pop growth enablers and fortification esp during war time. It's very easy to prevent the AI from ever industrializing and growing past size 12 by playing them against each other from industrial age onwards. They will go to war with each other for peanuts.

It takes a massive perfume value to override the desire for the war time AI to make units instead.

Even if stock game conditions aren't broken, they're far from ideal.
 

tjs282

Stone \ Cold / Fish
Joined
May 19, 2009
Messages
4,417
Location
Inside my skull
I don't think you can draw conclusions about behaviour in the stock game, from a modded game where there's no difference between the Coal and Solar Plants (other than their pollution-value). Reducing pollution in itself is certainly not an AI priority (how often have you seen a Pop20+ AI-metro surrounded by multiple polluted tiles, because that AI did not prioritise researching Ecology/ building Mass Transits?).

I suspect that the AI might be smart enough to recognise that a more expensive (/less polluting) powerplant is 'better' than a cheaper (/more polluting) one, simply because of the higher shield-cost, and in the stock game, there is a substantial difference in shield-cost between the 4 powerplants. But the Coal Plant (160 shields) is available a lot earlier than both the Hydro (240 shields) and Solar Plants (320 shields), so will likely be built first — if any plant is built at all.

However, I do not know whether it will ever go on to build one of the more expensive plants afterwards (apart from 'accidentally' via the Hoover GW). Certainly in my games (mostly at Emperor–DG, mostly on Standard Continents/Pangaea Maps, mostly aiming for Domination/ Space/ Diplo), I cannot recall ever capturing any powerplant more advanced than a Coal Plant.

I suspect that this is, as you say, due to the AI-Civs' tendency to spend the late Industrial and Modern eras pretty much permanently at war (frequently due to the MPPS that it will sign at the drop of a hat, with anyone), either as a runaway AI, or an increasingly desperate defender against that runaway — which means that it will be pouring all its shields and gold into Tanks/ModernArmor and Infs/TOWs/MechInfs (and/or whipping/drafting its population to death under Fascism), rather than investing in the late-game techs and infrastructure.
 
Top Bottom