How Difficulty Bonuses work for AI

@Gazebo , while the new version is being prepared, I'd like to play Deity on the current one without AI starting with pottery. If I delete the "AIFreeTechs" part of the code in one of the files, will that change anything else or just remove pottery from AI start?

Look in the DifficultyMod.sql at the bottom. Delete that.
 
After computing back the number. We made a mistake, resulting in the AI being far too weak compared to what EliotS wanted.

Current formula is :
iYieldHandicap = (iHandicap * iEra * iEra)
With iYieldHandiCap going from 0 to 5
And iEra being 1/1/2/3/...

EliotS formula was
iYieldHandicap = (iHandicap * iEra * iEra *1.5)
With iYieldHandiCap going from 0 to 7
And iEra being 1/2/3/4... (Main error is here, we have a shift of one era)

So AI handicap is currently VERY low compared to before.
 
Last edited:
So I've made some computation, and I have some suggestions.

(I take 0/0/1/1/2/3/4/5 for iHandicap and 1/1/2/3/4/5/6/7 for iEra)

Suggestion A: Just multiplaying by 2:
iYieldHandicap = iHandicap*iEra*iEra*2
Main problem: Probably not enough.

Suggestion B: Just multiplaying by 3:
iYieldHandicap = iHandicap*iEra*iEra*3
Probably my favorite.

Suggestion C: Multiplying by 2 and adding a linear component:
iYieldHandicap = iHandicap*(iEra+1)*iEra*2
If quadratic scaling is not linear enough for you.

Suggestion D: Taking a cubic evolution
iYieldHandicap = iHandicap*iEra*iEra*iEra
If quadratic scaling is still too linear for you.

VPdiff.png


(EDIT: I've forget to take in account the fact that there is now more trigger than before for those yields. So my favorite is now the suggestion A and not the suggestion B)
 
Last edited:
So I've made some computation, and I have some suggestions.

(I take 0/0/1/1/2/3/4/5 for iHandicap and 1/1/2/3/4/5/6/7 for iEra)

Suggestion A: Just multiplaying by 2:
iYieldHandicap = iHandicap*iEra*iEra*2
Main problem: Probably not enough.

Suggestion B: Just multiplaying by 3:
iYieldHandicap = iHandicap*iEra*iEra*3
Probably my favorite.

Suggestion C: Multiplying by 2 and adding a linear component:
iYieldHandicap = iHandicap*(iEra+1)*iEra*2
If quadratic scaling is not linear enough for you.

Suggestion D: Taking a cubic evolution
iYieldHandicap = iHandicap*iEra*iEra*iEra
If quadratic scaling is still too linear for you.

View attachment 482023

(EDIT: I've forget to take in account the fact that there is now more trigger than before for those yields. So my favorite is now the suggestion A and not the suggestion B)
Hi Moi Magnus, can this be changed editing files or it's in the DLL. If it's the former can you please tell me where so I can test, thanks.

EDIT: Ok, after looking the first post I see that the code must belong to the DLL, so time to wait until G can hotfix this.
 
Last edited:
So I've made some computation, and I have some suggestions.

(I take 0/0/1/1/2/3/4/5 for iHandicap and 1/1/2/3/4/5/6/7 for iEra)

Suggestion A: Just multiplaying by 2:
iYieldHandicap = iHandicap*iEra*iEra*2
Main problem: Probably not enough.

Suggestion B: Just multiplaying by 3:
iYieldHandicap = iHandicap*iEra*iEra*3
Probably my favorite.

Suggestion C: Multiplying by 2 and adding a linear component:
iYieldHandicap = iHandicap*(iEra+1)*iEra*2
If quadratic scaling is not linear enough for you.

Suggestion D: Taking a cubic evolution
iYieldHandicap = iHandicap*iEra*iEra*iEra
If quadratic scaling is still too linear for you.

View attachment 482023

(EDIT: I've forget to take in account the fact that there is now more trigger than before for those yields. So my favorite is now the suggestion A and not the suggestion B)
Actually, I think a quadratic curve may be too steep in the later eras.

Taking your option c, I think you can increase the linear component while lowering the quadratic one.
iHandicap * (iEra + N) * iEra / M
N and M flat numbers.

This way, people won't complain about early game being too easy.
 
Actually, I think a quadratic curve may be too steep in the later eras.

Taking your option c, I think you can increase the linear component while lowering the quadratic one.
iHandicap * (iEra + N) * iEra / M
N and M flat numbers.

This way, people won't complain about early game being too easy.
It's supposed to be steeper in late game. Currently it's really easy to surpass AI even from way behind.
 
Hotfixing for option A (handicap * era * era * 2). will be savegame compatible.

G
Good. If it is too much, we can go back to EliotS initial suggestion (handicap * era * era * 1.5), or use a downgraded version of my other suggestion.
 
Good. If it is too much, we can go back to EliotS initial suggestion (handicap * era * era * 1.5), or use a downgraded version of my other suggestion.

Floats are irrelevant in the DLL if all other values are not floats (i.e. decimals). They just get rounded down to the nearest integer immediately.

G
 
Floats are irrelevant in the DLL if all other values are not floats (i.e. decimals). They just get rounded down to the nearest integer immediately.

G
Then "(handicap*era*era*3)/2" should be ok. The rounding is done at the end, so we only lose few half yields, which is not a great loss.
 
You prefaced your argument with vanilla having a bunch and VP removing them. You made the comparison, not me.

G

what i said is a simple relevant fact - VP removed a broken feature almost entirely (% bonuses, for vanilla that was actually only Science I believe) and then inexplicably re-introduced it en masse over time.

the quantity and impact of % yields in VP is drastically lower than those of vanilla

the quantity of % yields is drastically lower than in vanilla? im sorry, thats just not true anymore- take a look around the mod, they are quite literally everywhere. and i can see where you tried to limit their impact by makingsome of them only applicable in WLTKD, but then youve failed to take into account how easy it is to keep WLTKD going in perpetuity- so theyre having plenty of impact.
 
what i said is a simple relevant fact - VP removed a broken feature almost entirely (% bonuses, for vanilla that was actually only Science I believe) and then inexplicably re-introduced it en masse over time.



the quantity of % yields is drastically lower than in vanilla? im sorry, thats just not true anymore- take a look around the mod, they are quite literally everywhere. and i can see where you tried to limit their impact by makingsome of them only applicable in WLTKD, but then youve failed to take into account how easy it is to keep WLTKD going in perpetuity- so theyre having plenty of impact.

I prefer reals over feels. Show me the numbers and we’ll talk. ‘Everywhere’ is hardly accurate.

G
 
I prefer reals over feels. Show me the numbers and we’ll talk. ‘Everywhere’ is hardly accurate.

G

Replying to myself, I was curious, so I headed to the database. Here's my numbers. Note that many of the bonuses below are tied to exclusive entities (UBs, Beliefs, Policies, Wonders), so it is rare that a player would ever achieve the total values indicated below. Additionally, many bonuses are capital-only. I personally do not see a problem with the nature of yield modifiers in the current game, but I'm itching to be corrected:

Code:
WLTKD

"BELIEF_WORLD_CHURCH"    "YIELD_FAITH"    "15"
"BELIEF_WORLD_CHURCH"    "YIELD_GOLD"    "15"
"BELIEF_WORLD_CHURCH"    "YIELD_CULTURE"    "15"

"BUILDING_SYNAGOGUE"    "YIELD_SCIENCE"    "15"
"BUILDING_CIRCUS_MAXIMUS"    "YIELD_CULTURE"    "10"
"BUILDING_CIRCUS_MAXIMUS"    "YIELD_GOLD"    "10"
"BUILDING_PAPER_MAKER"    "YIELD_GOLD"    "10"
"BUILDING_CANDI"    "YIELD_FAITH"    "20"
"BUILDING_CANDI"    "YIELD_CULTURE"    "20"
"BUILDING_MAUSOLEUM_HALICARNASSUS"    "YIELD_PRODUCTION"    "10"
"BUILDING_MAUSOLEUM_HALICARNASSUS"    "YIELD_SCIENCE"    "10"
"BUILDING_MAUSOLEUM_HALICARNASSUS"    "YIELD_GOLD"    "10"

"POLICY_REFORMATION"    "YIELD_PRODUCTION"    "15"

Faith: 35%
Gold: 45%
Culture: 45%
Science: 25%
Production: 25%


GA

"BELIEF_PEACE_LOVING"    "YIELD_FOOD"    "15"
"BELIEF_PEACE_LOVING"    "YIELD_PRODUCTION"    "15"
"BELIEF_PEACE_LOVING"    "YIELD_GOLD"    "15"
"BELIEF_PEACE_LOVING"    "YIELD_CULTURE"    "15"
"BELIEF_PEACE_LOVING"    "YIELD_FAITH"    "15"
"BELIEF_PEACE_LOVING"    "YIELD_SCIENCE"    "15"

All in Capital only

"BUILDING_MOSQUE"    "YIELD_CULTURE"    "20"
"BUILDING_BATH"    "YIELD_CULTURE"    "10"
"BUILDING_NATIONAL_COLLEGE"    "YIELD_SCIENCE"    "20"
"BUILDING_SEOWON"    "YIELD_SCIENCE"    "15"
"BUILDING_ROYAL_LIBRARY"    "YIELD_SCIENCE"    "20"
"BUILDING_STELE"    "YIELD_FAITH"    "25"

"POLICY_HUMANISM"    "YIELD_SCIENCE"    "10"
"POLICY_HUMANISM"    "YIELD_FOOD"    "10"
"POLICY_FINE_ARTS"    "YIELD_CULTURE"    "10"

Food: 25%
Production: 15%
Gold: 15%
Culture: 55%
Faith: 40%
Science 70%


Generic

"POLICY_SCHOLASTICISM"    "YIELD_CULTURE"    "3" (per x spies - caps 30%, capital only)
"POLICY_SCIENTIFIC_REVOLUTION"    "YIELD_SCIENCE"    "4" (per GW - caps 20%)

"BUILDING_TEMPLE_ARTEMIS"    "YIELD_FOOD"    "10"
"BUILDING_TWOKAY_FOODS"    "YIELD_FOOD"    "10"
"BUILDING_MANDIR"    "YIELD_FOOD"    "10"
"BUILDING_THRONE_ROOM"    "YIELD_FOOD"    "10"
"BUILDING_THRONE_ROOM"    "YIELD_SCIENCE"    "10"
"BUILDING_THRONE_ROOM"    "YIELD_FAITH"    "10"
"BUILDING_THRONE_ROOM"    "YIELD_PRODUCTION"    "10"
"BUILDING_THRONE_ROOM"    "YIELD_GOLD"    "10"
"BUILDING_STOCKYARD"    "YIELD_FOOD"    "15"
"BUILDING_COAL_PLANT"    "YIELD_PRODUCTION"    "15"
"BUILDING_SOLAR_PLANT"    "YIELD_PRODUCTION"    "50"
"BUILDING_NUCLEAR_PLANT"    "YIELD_PRODUCTION"    "50"
"BUILDING_TRAINSTATION"    "YIELD_PRODUCTION"    "25"
"BUILDING_TRAINSTATION"    "YIELD_GOLD"    "10"
"BUILDING_SEAPORT"    "YIELD_PRODUCTION"    "25"
"BUILDING_SPACESHIP_FACTORY"    "YIELD_SCIENCE"    "25"
"BUILDING_VENETIAN_ARSENALE"    "YIELD_PRODUCTION"    "15"
"BUILDING_PALACE_SCIENCE_CULTURE"    "YIELD_SCIENCE"    "15"
"BUILDING_FINANCE_CENTER"    "YIELD_GOLD"    "15"
"BUILDING_FINANCE_CENTER"    "YIELD_FOOD"    "15"
"BUILDING_EHRENHALLE"    "YIELD_PRODUCTION"    "25"

"POLICY_WORKERS_FACULTIES"    "BUILDINGCLASS_FACTORY"    "YIELD_SCIENCE"    "10"
"POLICY_MANDATE_OF_HEAVEN"    "BUILDINGCLASS_CASTLE"    "YIELD_FOOD"    "10"
"POLICY_TRADE_UNIONS"    "BUILDINGCLASS_WINDMILL"    "YIELD_PRODUCTION"    "5"
"POLICY_TRADE_UNIONS"    "BUILDINGCLASS_WORKSHOP"    "YIELD_PRODUCTION"    "5"
"POLICY_TRADE_UNIONS"    "BUILDINGCLASS_FACTORY"    "YIELD_PRODUCTION"    "5"
"POLICY_TRADE_UNIONS"    "BUILDINGCLASS_WINDMILL"    "YIELD_GOLD"    "5"
"POLICY_TRADE_UNIONS"    "BUILDINGCLASS_WORKSHOP"    "YIELD_GOLD"    "5"
"POLICY_TRADE_UNIONS"    "BUILDINGCLASS_FACTORY"    "YIELD_GOLD"    "5"
"POLICY_MERCANTILISM"    "BUILDINGCLASS_MARKET"    "YIELD_CULTURE"    "2"
"POLICY_MERCANTILISM"    "BUILDINGCLASS_CARAVANSARY"    "YIELD_CULTURE"    "2"
"POLICY_MERCANTILISM"    "BUILDINGCLASS_STOCK_EXCHANGE"    "YIELD_CULTURE"    "2"
"POLICY_MERCANTILISM"    "BUILDINGCLASS_BANK"    "YIELD_CULTURE"    "2"
"POLICY_MERCANTILISM"    "BUILDINGCLASS_MINT"    "YIELD_CULTURE"    "2"
"POLICY_MERCANTILISM"    "BUILDINGCLASS_MARKET"    "YIELD_SCIENCE"    "2"
"POLICY_MERCANTILISM"    "BUILDINGCLASS_CARAVANSARY"    "YIELD_SCIENCE"    "2"
"POLICY_MERCANTILISM"    "BUILDINGCLASS_STOCK_EXCHANGE"    "YIELD_SCIENCE"    "2"
"POLICY_MERCANTILISM"    "BUILDINGCLASS_BANK"    "YIELD_SCIENCE"    "2"
"POLICY_MERCANTILISM"    "BUILDINGCLASS_MINT"    "YIELD_SCIENCE"    "2"
"POLICY_NATIONALISM"    "BUILDINGCLASS_SEAPORT"    "YIELD_PRODUCTION"    "10"
"POLICY_MEDIA_CULTURE"    "BUILDINGCLASS_STADIUM"    "YIELD_CULTURE"    "20"
"POLICY_SPACE_PROCUREMENTS"    "BUILDINGCLASS_LABORATORY"    "YIELD_SCIENCE"    "10"

Culture: 60%
Science: 100%
Food: 80%
Faith: 10%
Production: 240%
Gold: 50%
Tourism: 25% (below)

Tourism
"POLICY_MEDIA_CULTURE"    "BUILDINGCLASS_BROADCAST_TOWER"    "25"

G
 
off the top of my head i know baths, steles and mosques aren't capital only buildings and i dont see monopoly modifiers in there. also dont think the %bonuses to production for buildings made it in (progress) or the %cost reduction bonuses from forbidden palace/industry for example which serve the almost identical function. or the happiness modifiers, granted its probably a sufficiently fleshed out and intricate system that they make sense to have in place (although it is a bit easy to exploit through buying AI's luxuries, not just the spares but they often sell their only copy for a paltry price; 10-15gpt is nothing for them losing % bonus across the board and me gaining them). I dont see the rationalism opener, the science penalty reducer (effectively the same function again, but scaling up with # cities also), did opera houses make the list? I think there is more honestly we're missing but thats enough for now no? golden ages already had a sturdy inherent % bonus that came with them, not sure why so many more should be added in to that but at least theyre pretty brief until later in the game.

for the sake of argument you could even ignore modifiers from modern (maybe even industrial) era and onwards, I dont see a problem there because thats closing time but to my mind theres just no reason to have so many % bonuses before then, particularly in an instance like policies where you can have 2 players picking the same policy at the exact same time and getting different bonuses out of it, advantaging the person who was already in a better spot for no reason. its not like per city yields, having extra cities is another whole risk / reward / penalty system unto itself.

The incomplete list already shows there is definitely more than vanilla tho, and I think you know intuitively theyre kind of a bad thing as your first instinct was to say "hey, we have less than vanilla". I have no idea how im supposed to prove anything to you here though, even if i played out a common scenario that racks me up X amount of % bonuses by medieval, who's gonna say that X was "too much" or not. its a problematic function at its core, and while it has a place in the game for the sake of variety or where some system of scaling makes sense, I "feel" theyve definitely become too widespread / early and numerous because i recognize theyre a detriment to good balance.


BTW I think AI is keen on the fact of belief_world_church being pretty nuts, it goes quick. and mosques come out really poorly against synagogues.
 
you would know this better than me im sure but % modifiers not applying to instant yields is also a formula for large discrepancy between strategies ( I say large because of your handy tooltip I know how much in instant yields i get per turn) and creates balancing problems in itself I imagine, no?
 
off the top of my head i know baths, steles and mosques aren't capital only buildings and i dont see monopoly modifiers in there. also dont think the %bonuses to production for buildings made it in (progress) or the %cost reduction bonuses from forbidden palace/industry for example which serve the almost identical function. or the happiness modifiers, granted its probably a sufficiently fleshed out and intricate system that they make sense to have in place (although it is a bit easy to exploit through buying AI's luxuries, not just the spares but they often sell their only copy for a paltry price; 10-15gpt is nothing for them losing % bonus across the board and me gaining them). I dont see the rationalism opener, the science penalty reducer (effectively the same function again, but scaling up with # cities also), did opera houses make the list? I think there is more honestly we're missing but thats enough for now no? golden ages already had a sturdy inherent % bonus that came with them, not sure why so many more should be added in to that but at least theyre pretty brief until later in the game.

for the sake of argument you could even ignore modifiers from modern (maybe even industrial) era and onwards, I dont see a problem there because thats closing time but to my mind theres just no reason to have so many % bonuses before then, particularly in an instance like policies where you can have 2 players picking the same policy at the exact same time and getting different bonuses out of it, advantaging the person who was already in a better spot for no reason. its not like per city yields, having extra cities is another whole risk / reward / penalty system unto itself.

The incomplete list already shows there is definitely more than vanilla tho, and I think you know intuitively theyre kind of a bad thing as your first instinct was to say "hey, we have less than vanilla". I have no idea how im supposed to prove anything to you here though, even if i played out a common scenario that racks me up X amount of % bonuses by medieval, who's gonna say that X was "too much" or not. its a problematic function at its core, and while it has a place in the game for the sake of variety or where some system of scaling makes sense, I "feel" theyve definitely become too widespread / early and numerous because i recognize theyre a detriment to good balance.


BTW I think AI is keen on the fact of belief_world_church being pretty nuts, it goes quick. and mosques come out really poorly against synagogues.

Honestly, I wasn’t the one to bring up vanilla. We have fewer generic modifiers to yields, but most definitely we have a greater variety and quantity of modifiers overall. The difference is that they’re spread out across dozens of buildings, policies, wonders, and beliefs, instead of being stuck on a few ‘key buildings’ like libraries. With a few exceptions modifiers show up on niche, unique, specialized, or restricted buildings, or on policies at opposite ends of the spectrum. I don’t see a balance issue here. Hating modifiers solely because of what they are isn’t useful.
 
Back
Top Bottom