Using culture to influence AI improvement build

Predator145

Prince
Joined
May 22, 2020
Messages
448
I've been testing attaching cultural values to influence the sequence with which the AI builds city improvements.

By attaching 12 culture to a granary, you make it a higher priority than a settler at the start of the game. The AI doesn't grow fast enough to make a settler and spends a lot of time waiting for pop. A slightly lower culture value also works, but will not ensure.

By attacking the highest value to walls, the AI will be likely to build it first. Walls are cheap and tremendously benefit the AI. 20 shields is nothing for the demi and above AI whose smaller food box doesn't compensate for the huge settler discount. This punishes forgoing bombard. Attacking with just horsemen will be costly.

Barracks are another improvement the AI will only build the middle ages in stock game. Militaristic civs are a joke in AI hands. A value around 8 ensures the AI builds it early before it has produced most of its spearmen. Expect facing vet spears behind walls.

Other buildings like harbors, courthouses, aqueducts, coastal forts, civil defense can have culture added to make the AI build them in a timely fashion, something it doesn't do in stock game.

Test show that the AI expands a little slower in the early phase in city count due to being busy building these buildings. But benefits from larger cities that will spit out settlers faster. Research is also better because the larger cities work the roaded tiles the AI improves (AI workers work around old cities instead of connecting new ones). This should be even more pronounced once Flintlock gets it to stop irrigating green in despot. The stock game deity AI gets out 4-5 size 1-2 cities without improvements by 2600BC. The modded AI gets out around 3-4 size 3-5 cities with granaries, walls and barracks by 2600BC. With more granaries, it's in a better position to continue REXing, esp if there is lots of space.

BUT, the AI whips. All that culture makes it think it needs to get them out ASAP. Whipping has to be disabled in despot in order to obtain the results above. Otherwise it will end up with size 1 cities on entertainer. Also, the AI values to Pyramids sooooo much more and would build it as soon as it has Masonry. I solve that by putting a number of improvements required.

But all this added culture distorts the builder aspect of the game. How do I balance it out and limit the change?
Negative culture is the solution.

For example we have granaries being +12, walls being+13 and barracks being +8 we've added 33 culture to the game that will double down the road. Culture even for the warmonger is needed to expand the city border. And the cheapest you can do that without discount is 60 shields. I'd like to maintain that aspect of the game. I don't want granaries to expand borders.

So I have 33x2 extra culture to negate. So an improvement with -66 culture is needed. I couldn't get the AI to build it in a timely manner before it gets a border expansion from the buildings above. Nor could I get the AI to build a SW to generate them in time. No matter how much culture the SW has, the AI doesn't like the negative culture improvement it generates and ignores it. It may build it down the road, but it's too late.

I tried having the Palace generate these negative culture improvements. It didn't work because the palace is an improvement. Maybe Flintlock could change that? So I changed the palace to a SW. It worked. The negative culture improvements are there. The drawback is that now you can't change the capital as easily and lose a pre build. Setting up a new successor city via pop and culture and deleting the old capital is the only way. I tried adding a "Palace2" improvement with the same "center of empire" flag but that doesn't work. If you lose your Palace SW and new one will spawn regardless. It can even spawn in your Forbidden Palace city.

So how does one expand the border starting out -66 in the hole? The palace has +67 to ensure that the capital gets the usual expansion. Cultural victory points shall have to be adjusted accordingly. Once the palace's culture doubles the capital will be churning out 68 culture a turn. With other cities you need a +67 culture improvement. But that would defeat the purpose of prioritizing the buildings above. I solve it like this:

Monument gives +67 culture and 1 happy face at 40 shields, requires Poly and a Shrine (+2culture, 1 happy face, 40 shields, requires Ceremonial B.). That way the AI prioritizes the buildings above and builds a shrine like it would do with stock game temple. A border expansion costs 80 shields. Religious civs do it faster than anyone else as they get cheap shrines and monuments. Gotta give something back to science civs though.

So far there is a mystery I've encountered:

In my mod I have walls obsolete to be replaced with stronger similar improvements. 8 bombard def is useless past ancient age. So at Engineering they get replaced by "Citadel". Citadels have a culture of +3 and the AI builds it. But when I built a new city and rushed the citadel, my border expanded shortly and the city grew at +3 culture despite having the SW generated negative culture improvement present. Shrines at +2 get negated just fine. I've no explanation for that. More testing is needed.

Play around with the culture values on debug too find out what numbers helps the AI the most. If anyone is interested in testing I'd be very glad. It's time consuming after all.
 
Last edited:
Interesting read for sure.

You've given me some ideas, I might have to try out.

Further testing show that all the original stock game BLDG entries comply with negative culture. Some new BLDG entries do as well but for the most part, they simply ignore negative culture. The reason why I'm not sure. It could be hardcoded.

So in order to have a "Citadel" with a culture of +12 that conforms to negative culture, I use the BLDG_Library for it. As for the Library, BLDG_Library2 is used instead.
The new Library with the entry BLDG_Library2 ignores the SW generated negative culture building and thus has its original +3 culture and will expand your border upon building despite having that -66 culture SW generated improvement.

By having new BLDG entries for all improvements that you wish to ignore negative culture you could have old culture values and play with the standard cultural victory limits.
 
I love the various tricks and tips people have figured out over the years in enticing the AI to do things. I'm having a blast figuring out how to "poke" the AI in the right ways to get the results I want.
 
I love the various tricks and tips people have figured out over the years in enticing the AI to do things. I'm having a blast figuring out how to "poke" the AI in the right ways to get the results I want.

First off, @Predator145 - I'm sorry I'm "late to the game," and :goodjob: nice catch.

If you'd like to check out the same sort of thing for AI Unit builds, see:
The Big Question - How Does The AI Choose Which Units To Build? | CivFanatics Forums
The BIG Q Continued - AI Flag Choices For Building Units | CivFanatics Forums (Note that this second one is incomplete; I'll dg around for more info.)

If you'd like other such inffo:
What Will the AI Research Next? | CivFanatics -AND-
The actual thread by the discoverer himself: What will the AI research next? | CivFanatics Forums

- :)z
 
- Further thoughts;
  1. Aren't all Improvements with a Culture value destroyed if a City is captured; and -
  2. Doesn't this also screw up Cultural Victories?

1. I'm not sure. I've never paid any attention to captured improvements as captured cities that aren't razed are going to be abandoned and replaced for risk of flips anyway.

2. I've come up with a method around that. After a certain number of building slots in the editor the game no longer supports the negative culture. That's why the "Citadel" I added wasn't culturally suppressed. By swapping the buildings that you want to emit culture with the slots that are outside of the game's support you can have them ignore negative culture and thus can play the same game with the same points for cultural victory. I'll make an elaborate post on that after I've solved my Civ3 crisis right now.
 
- Further thoughts;
  1. Aren't all Improvements with a Culture value destroyed if a City is captured; and -
  2. Doesn't this also screw up Cultural Victories?
Hi, Oz.
1. Yes, with a few exceptions: Great wonders are not destroyed. Also buildings that are required to continue city growth beyond size limits ( like aqueducts) are kept - even if they have cultural value.

2. Don't think so. Even though wonders (and those buildings mentioned) with cultural value are kept when the city is captured, their cultural value is not transferred to the new owner. They also stop generating more cultural points for the city. I think they will start generate cultural points again if the city is re-captured by the civ that originally built the buildings.
 
Ahh yes, that one. I've never used this option myself, but i believe the culture-generating buildings still will be destroyed (with the exceptions mentioned earlier). As far as I understand, the cultural borders of a newly captured city will not shrink to size 1 with this option checked.
If the accumulated cultural value of the captured city is added to the conquering civ's total culture points, then it could indeed screw up the cultural victory. I'm afraid I don't know if it is added or not.
 
The effects of negative culture will not be supported by the game after a certain number of building slots in the editor has been used. I believe it's around 16 slots ( I could be a little off) after the last slot of stock game.

If you relocate your culture generating buildings down there (you'd need filler to reach that if you don't intend on adding anything else to fill these 16 or so slots), they would still emit culture as usual. I have relocated all the wonders, SWs and culture improvements. That way I can still play normally without having to alter the cultural victory point limit.

This means your negative culture Palace SW generated improvement can have a huge negative culture value. This allows you to have the AI construct things ASAP if you give them very high culture values that would just be negated. Things like civ specific "flag" improvements to allow civ specific buildings or SWs providing bonuses will be provided instantly. That's a good way to customize civ traits.

With this setting I've managed to get expansionist civs to produce their own scouts (not just auto produce). It's a bit complicated:

-First you need an "Expansionist" non era, untradeable tech. Give it to expansionist civs

-Then, you need a SW requiring said tech. Have it be in a building slot on the editor that has it's culture negated by the negative culture improvement. Have it be very high culture (like 100) to have the AI build it in their FIRST turn. Have it cost 0 as well. This means the AI will spend like 2 shields on it. This is meant to be an AI perk only, so refrain from building it yourself. Have this SW go obsolete at a tech were you want the AI to stop making scouts. For me it's Bronze Working (the Russians get a whole separate civ specific set with the tech "Russian" obsoleting at Iron Working instead).

-This SW provides a "Scout Camp" improvement in every city. Give this Improvement a high culture too because that helps entice the AI to build the SW (remember to put it in the right building slot). This "Scout Camp" improvement has the same effect of a barracks. Have it require a "hidden reserve" tech so that it doesn't clutter your menu and the AI can't build it but only get it from the SW. Then have it obsolete at another tech (in my case it's "The Wheel"). This means these free barracks will be obsoleted by 2 techs.

-But free barracks means the AI could train veteran combat troops for free? No. Because now you need to create a buncha scout units. I have a "Scout2" unit with the same cost as the Scout (10shields). This unit is flagged as "Offense" and "Defense" AI strat. It is ATR and Immobile in unit ability. The AI values ATR over everything and would only build units flagged with it regardless of other stats as well as the fact that it's Immobile. It will thus not train any other combat unit other than this "Scout2" as long as it's around.

-Have "Scout2" upgrade into "Scout (King)". This unit is identical to the regular scout except it's a King ability unit. It's flagged as "Explore " AI strat.

-"Scout2" units trained would then automatically upgraded into "Scout (King) and then proceed to explore.

- I recommend modding all scouts to be with "Capture" special order, a token defense stat of 1 and -4 bonus HP. This way they can serve as MP (something the AI appreciates a lot. This also prevents scouts from being able to freely walk into other civs land. I've always found that to be exploitative combined with the "Pillage" special order (something I also removed).

-But we need the AI to stop making Scout2s at some point and start training real combat troops. This is where we create a buncha more scout units. Have "Scout (King)" upgrade into these units. I have up to Scout8 all in an upgrade chain. These scout units are identical to the starting "Scout" (have that one join the upgrade path as well to eliminate menu clutter) and are of "Explore" AI strat, obsoleting "Scout2". "Scout3" is obviously at Bronze Working, "Scout4" at The Wheel and "Scout5" at Iron Working for Russia. "Scout6, 7 and 8" for Mysticism, Mathematics and Writing. They're optional but the AI could trade, pop or research their way towards them while ignoring Bronze Working and The Wheel, resulting in too many scouts built. The drawback is of course if they get to these 3 they would still retain their free barracks and get to train veteran combat troops. But this is rare.

-Play around with "Scout2" stats to determine how many scouts the AI makes. You can always increase movement and attack stats consequent free as it's Immobile. Ideally, the AI should end up with 2-6 scouts on Demi difficulty and above. Too infrequent building means they could run into a Scientific civ trading them Bronze Working without having built a single extra scout.

This makes the Expansionist Trait a bit less pathetic in the hands of the AI on Pangaea and Continental maps. It will contact others quickly and leave you out of the trading loop.
 
Last edited:
Have you ever lamented the AI's inability to use the luxury slider? Wouldn't it be so much better of if the slider is permanently fixed to 10%? Using this thread's set up, we can try to somewhat imitate the effects of having the slider set to 10%-20% for the AI.

If I'm not mistaken, 1 gold spent into luxury produces 1 happy face. An early city during expansion phase may make 5 gpt. By having the lux slider at 20% we get 1 happy face at the cost of 1 gold. The human player constantly employs that to let settler factories reach larger size.

The AI however, has no concept of factories where settler production is constant. It would train a settler, then follow up with a military unit/improvement. This is OKish if the AI doesn't use granaries. Even then it spends quite a few turns waiting for pop to catch up to release the settler. With granaries in place tks to my settings, the AI can now grow tall and benefit from terrain improvements in their core. But even with 2 MPs, the AI is stuck at size 5 and would waste growth there running a clown. Being able to get to size 6 would often coincide with their next settler coming out, allowing it to waste no time growing in population.

What if the AI can have 1 happy face at the cost of gold? This can be done via a 0 cost improvement with very high ignored culture (make sure it's in the right slot). The AI will build this right after founding, representing the instant effect of the slider on every city. But how much maintenance does it need to mimic the effects? A size 3 core city makes around 4 gpt working roaded tiles in despotism. So that means 1 happy face for 1 g maintenance at 20% slider imitation?

But later on a size 12 city working roaded/coastal tiles could make around 13-20 gpt without multipliers. I guess we can call this "the AI adjusting it's slider to 10% from 20%"?

In Rep and Dem gold income is increased. This can be imitated by having another identical 2 gov only improvements. This would imitate one raising the lux slider to compensate for the loss of MP or the same rate yielding more cash and thus more happy faces.

This could allow the AI to grow tall with granaries during the expansion phase. Do you think the AI will end up stronger this way than having more size 1-2 cities with even fewer terrain improvements? After all, growing broad means there are more cities growing at the same time.
 
Ran into a problem.

If the original capital city has been captured/razed the new "Palace" auto generated will not count as a SW and thus won't give all cities the negative culture flag. The "SW Palace" can then be built in other cities.

So now I need to find a way to coax the AI to build a SW providing all cities with a negative culture improvement. The AI would only be likely to build something if it yields some kind of gain. The negative culture on all these provided improvements would yield a massive loss. I doubt even Flintlock's perfume could overcome that.

Edit: Flinlock's perfume did overcome that. With a perfume value of 2 billion everything can be built by the AI.
 
Last edited:
Top Bottom