Typo Affecting AI Yields

isau

Deity
Joined
Jan 15, 2007
Messages
3,071
FYI someone just alerted me to the existence of this thread on Reddit:

https://www.reddit.com/r/civ/comments/84d5cz/firaxis_please_fix_ai_crippled_by_dumb_typo/


It turns out part of the reason the AI is struggling is due a typo in the AI code. :D Firaxis is seemingly aware. I guess we'll see an update soon. People in the thread are speculating that it will make AI opponents much tougher.

Meanwhile, if you want to fix the game, you can borrow this code below. Just put it into any mod that loads SQL. Or, someone will probably make a mod of this soon.

Spoiler :
Code:
UPDATE AIFavoredItems SET Item='YIELD_PRODUCTION' WHERE Item='YEILD_PRODUCTION';
UPDATE AIFavoredItems SET Item='YIELD_FAITH' WHERE Item='YEILD_FAITH';
UPDATE AIFavoredItems SET Item='YIELD_CULTURE' WHERE Item='YEILD_CULTURE';
UPDATE AIFavoredItems SET Item='YIELD_GOLD' WHERE Item='YEILD_GOLD';
UPDATE AIFavoredItems SET Item='YIELD_SCIENCE' WHERE Item='YEILD_SCIENCE';



Now I just hope someone finds a typo that fixes the use of Nukes and Air units. :D


(Thanks to @ease for posting about it.)
 
Last edited:
did anybody make a search for other possible misspelling of "yield" as to "YEILD" in the firaxis code?
 
So I made the edits and tried it out. I could be projecting and it could just be because the main two aggressive AIs I ended up fighting were Genghis and Shaka, but they both seemed noticeably more competent than before. The units they were producing were competitive with mine, sometimes a little ahead. Genghis even did his "send a trade route and then declare war" trick on me and the combat buffs he got forced me into taking the Defenders of the Faith belief to hold him back.

I don't want to be too optimistic without playing more but I'm glad we can look forward to improved AI in the near future.
 
As someone who writes its share of code everyday, I sometime purposely uses Typo for a duplicated concept between two objects like price/priec just so I can read my code (I'm used to it) yet won't confuse them in my algorithm as they have different types /comes from different sources.

My point is, it might not be a typo.

(before someone tells me it's not good practice to have the same concept represented twice, I'll tell them come work with the data from a decade old legacy platform and see if you won't have to adapt;))
 
As someone who writes its share of code everyday, I sometime purposely uses Typo for a duplicated concept between two objects like price/priec just so I can read my code (I'm used to it) yet won't confuse them in my algorithm as they have different types /comes from different sources.

My point is, it might not be a typo.

(before someone tells me it's not good practice to have the same concept represented twice, I'll tell them come work with the data from a decade old legacy platform and see if you won't have to adapt;))

I'd call things "price" and "price_old" or something :)

For the above, definitely seems like it could be an issue. Given that they load a lot of data from XML files, it's probably set up to ignore anything that doesn't match their expected (so if you mod stuff in, it will just ignore whatever they want), and they maybe never thought to double check that their files were free of typos. Seems like they've been made aware of it, and hopefully will be fixed soon :)
 
As someone who writes its share of code everyday, I sometime purposely uses Typo for a duplicated concept between two objects like price/priec just so I can read my code (I'm used to it) yet won't confuse them in my algorithm as they have different types /comes from different sources.

My point is, it might not be a typo.

(before someone tells me it's not good practice to have the same concept represented twice, I'll tell them come work with the data from a decade old legacy platform and see if you won't have to adapt;))

That sounds like a sensible idea, though if it were me I'd probably make the typo more obvious - something like "Yeold" rather than just flipping the I and E since that's a common mistake that people make normally even when they aren't trying to use it on purpose :lol:

Anyway, could this be the dawn of the era of the terrifyingly competent AI? What a time to be alive! :cool:
 
Anyway, could this be the dawn of the era of the terrifyingly competent AI? What a time to be alive! :cool:

AI improvements are being made elsewhere as well. Civ Flavour Deity got updated for R&F yesterday (a mod that does an insane amount to help out AI prioritization) and Siesta Guru is working on writing a new AI, which is kind of possible now, which will likely be a big step forward for AI+.

I'm not sure if I'll still be playing Deity in two months...
 
Yeah it's a funny little mistake. It's not exactly the difference between okay and good AI though. I've compensated for this typo ages ago in AI+ (I think I've boosted science as far back as v1) and the difference isn't that great.

It's just one of those changes that makes them prioritize things differently, without really making them smarter. Yes, they'll build more campuses with a fixed typo, but that means they won't be building a commercial or holy district. They probably did under-value science in the base game, but fixing that may mean the religious game suddenly gets way easier. What makes humans competent is that they can adapt. In some games/times you'll prioritize science, in others production.


This typo was actually found back in November already, but I guess no one reported it. See https://forums.civfanatics.com/threads/ai.603494/page-49#post-14918686
 
Yeah it's a funny little mistake. It's not exactly the difference between okay and good AI though. I've compensated for this typo ages ago in AI+ (I think I've boosted science as far back as v1) and the difference isn't that great.

It's just one of those changes that makes them prioritize things differently, without really making them smarter. Yes, they'll build more campuses with a fixed typo, but that means they won't be building a commercial or holy district. They probably did under-value science in the base game, but fixing that may mean the religious game suddenly gets way easier. What makes humans competent is that they can adapt. In some games/times you'll prioritize science, in others production.


This typo was actually found back in November already, but I guess no one reported it. See https://forums.civfanatics.com/threads/ai.603494/page-49#post-14918686

Still, science is way more valuable than faith, so I'd rather they prioritize science. Sure it won't fix all the AI's problems, but it's a small start.
 
Yeah it's a funny little mistake. It's not exactly the difference between okay and good AI though. I've compensated for this typo ages ago in AI+ (I think I've boosted science as far back as v1) and the difference isn't that great.

It's just one of those changes that makes them prioritize things differently, without really making them smarter. Yes, they'll build more campuses with a fixed typo, but that means they won't be building a commercial or holy district. They probably did under-value science in the base game, but fixing that may mean the religious game suddenly gets way easier. What makes humans competent is that they can adapt. In some games/times you'll prioritize science, in others production.


This typo was actually found back in November already, but I guess no one reported it. See https://forums.civfanatics.com/threads/ai.603494/page-49#post-14918686

I suppose no one should be surprised that you were already on this :)

Well, I had a brief glimmer of hope that maybe this would make a material impact to the AI. On the margin, I would think that de-emphasizing an early holy site in favour of an early campus would help the AI, but then the player will on average get better religious bonuses, which may more than offset that. And I guess this would weaken the already rare instance when an AI gets rolling with it's religion and can almost achieve a religious victory.

Out of curiousity, do you think there's any way under the current AI design to force specific AIs to prioritize a particular victory condition and gear all decisions towards it? That's not as good as a human's ability to assess what to go for under the current circumstances, but would might be better than the AI taking primarily a "generalist" approach to it's decisions.
 
Out of curiousity, do you think there's any way under the current AI design to force specific AIs to prioritize a particular victory condition and gear all decisions towards it? That's not as good as a human's ability to assess what to go for under the current circumstances, but would might be better than the AI taking primarily a "generalist" approach to it's decisions.

There's a system in place that kind of does that. So yes.
The current implementation has somewhat wonky conditions to activate these strategies though, and the impacts are relatively minor.
Mod-wise there's not that much that can be directly done with it since the conditions can't be changed, though I did use the underlying system for some important changes (like changing build desires at war).
In the upcoming lua mod I'll circumvent the system entirely and will make my own implementation for long term strategies, which should be more impactful.
 
There's a system in place that kind of does that. So yes.
The current implementation has somewhat wonky conditions to activate these strategies though, and the impacts are relatively minor.
Mod-wise there's not that much that can be directly done with it since the conditions can't be changed, though I did use the underlying system for some important changes (like changing build desires at war).
In the upcoming lua mod I'll circumvent the system entirely and will make my own implementation for long term strategies, which should be more impactful.

I appreciate your hard work and look forward to what you come up with.
 
It only applies when pronounce as a long "e" sound. In fact, the full quote was "i before e except after c, and when pronounced like 'a' as in neigh and weigh." Our language, with its combination of words and sounds from so many other languages, both germanic and latin based [with some greek, etc. thrown in for good measure] results in lots of oddities that most languages don't have.
 
Well I can't blame them too much. I can't tell you how many times in my modding I've created tags for the "Medeival" and "Rennaissance" eras.... :O

No I don't think fixing this bug massively improves the AI's strategies but it seems to unchoke them. Basically, the programmers were assuming the whole time AI was following these weights, and it wasn't. What impact that has on the overall system is difficult to determine.
 
Back
Top Bottom