Unofficial BTS 3.13 patch

I mean yeah it would bug me to see two workers side by side one changing workshop grassland tile to farm and other changing grassland farm to workshop" but what exactly is game breaking about it? Game breaking as in crippling the AI to make it so non competitive that it loses games and you can beat it easy no matter what you do?

That's a completely unrealistic requirement for making changes to the AI. If there's a change that can be made that makes the AI 1% more effective, then I consider that a worthy and valid change to make.

But the AI seems to me to be very good at connecting cities and making sure that worked tiles get improvemnts maybe not imporvements we would pick or it doesnt always stick with them but still seems to do good enough that it is competive for players at warlord and noble and gets harder and harder to beat as you go up in difficulty.

Competitive for which players? And yes, it gets harder, but only because it is given more and more artificial bonuses as the difficulty level goes up. The more the bonuses can be minimized, the better the overall game.

And maybe all that changing is because AI is trying to be flexible constantly evaluating the game and making changes to fit and result is LOTS of changes. And it seems to be working well for AI. And if it misses optimum tile impovement ocasionaly it still has chance to get once in while and has bonuses to compensate for when it not.

I really don't understand where you are getting the idea that the current situation is "working" for the AI? And I'm not sure why you continually put forth the idea that the AI getting bonuses is a good thing?

And I think making it more likely to stay in a certain set of improvements runs risk of getting AI "stuck" in bad placemnt such as someone mentioned losing food sources so now city with workshops doesnt have enough food but doesnt changes because it decided that city is a production city so it gets workshops and thats that. Especially if there is going to be an attempt at city specialization.

You are presenting hypothetical situations that aren't realistic. No one is suggesting changing it so that the AI would be unable to get enough food.

I dont think even people who like specializing cities specialize EVERY city or NEVER changes a cities specialization as game changes. Which could end up with either AI's cities being stuck in a specialization or worse instead of city changing tile every turn it changes cities entire specialization every turn. Or it doesnt use its specialization and ends up building wonders in cottage spammed city while heavy mined city is building wall street or oxford and the big city with nothing but grassland farms is trying to build a tank.

Again, you seem to be theorizing wildly without any evidence to support your hypothesis. What exactly leads you to believe that the AI could end up changing specialization every turn? Or building wonders in commerce cities? Certainly I've seen no one suggesting making such changes.

It just seems that letting AI stay flexible and fluid seems to be working as far as making games a challenge and not a cakewalk and reworking AI in that kind of detail is something more for Civ5 or something than a patch since I dont really think its "broke" now.

What makes you think that the AI is currently "flexible and fluid"?

To me it is like the city placment issue. Yeah it is annoying wihen city is one tile from coast or built too close to another city than I would like but there seems to be logic in AI's thinking to it and AI is competitive with it and working like intended so I would rather have AI competive but annoying rather than building cities where I like and improving them how I like and either need TONS of bonuses to stay competitive or end up where you can just walk all over them with no problem.

This makes almost no sense to me. Basically you seem to be saying "Yes, the AI is bad, but we can give it all sorts of bonuses so that it doesn't seem so bad, so let's just stick with that". If the option exists to make the AI better, so that it doesn't need as many bonuses, why wouldn't we take it? Indeed, that's exactly what Blake was doing with BetterAI, and that became the "official" AI of BTS. Deciding not to try to improve things simply because there's a chance that it might not work strikes me as being pretty defeatist. Let's try looking at it from a "glass is half-full" perspective, shall we?

Bh
 
Yes.

The AI is already at a huge advantage in the modern era because the AI simply can't build city infrastructure and to specialize cities like a human can. That means that the relative increase in research speed dramatically favors the human.

Crank in the AI having has less commerce because he's losing Towns here and there, and this means the AI is losing even more ground in regard to research speed.

Wodan

Agreed completely (except I think you meant DISadvantage in the first sentence).;)

Here's how I see it needs to be done...hamlets, villages and towns need a much higher "keep this improvement" weighting than they already have. However, in order to stop the ais then spamming absolutely nothing but cottage imps, they need a different procedure when deciding what to build in the first place.

So 2 very basic steps....

1) Is "grown" cottage imp already here? If yes, then find another tile to improve.

2) Use something similar to current procedure, weigh up what the city needs and improve as necessary.


[Here's actually where imo, the ai encounters another large problem, introduced somewhere (I think) along with the "better ai". If the ai that the "computer ai" uses is anything vaguely like the ai the player has to use if a normal city governor is switched on, then it always seems to think that growing a city as large as possible, while producing basically no production and no commerce is a good idea. Well it generally isn't. A balance of growth, commerce and production is by far normally the best. Unless every city is going to whip utterly everything, and whipping has it limitations (and where the heck to you get any commerce from if it uses this policy), you or the ai just end up with overgrown, expensive cities with no builidings in.........anyways that bit is of course just my opinion.........]


If its possible to do something like this, it would alleviate current observed negative worker behaviour. Changing a workshop to a farm, and a windmill to a mine, might often be silly, but no other imp apart from cottages is dependant upon time to make it flourish to full value. A mine doesn't give you 1:hammers: for 10 turns, 2:hammers: 10 turns later, and 3:hammers: 10 turns after that.....

So sort out the ai bulldozing villages and towns to make farms and workshops, without going back to a "nothing but cottages spam", and we're most of the way there.....
 
So 2 very basic steps....

1) Is "grown" cottage imp already here? If yes, then find another tile to improve.

2) Use something similar to current procedure, weigh up what the city needs and improve as necessary.

Actually, something occurred to me: Have the AI treat all cottages/hamlets/villages as towns so that it will "see" the tile as fully productive-potential.
 
Actually, something occurred to me: Have the AI treat all cottages/hamlets/villages as towns so that it will "see" the tile as fully productive-potential.
Somewhere in the in this thread it says that they are valued at their current state + a towns value divided by two. So it's valuing it half way to the end.
 
I've noticed that toward the late-mid game the AI has very few unimproved tiles. So from that we can say that the AI wasting it's workers time is not an issue, and farms, windmills, workshops, mines are all easily built or rebuild so we can safely ignore the AI when it wants to swap those around.
Food is solely important to the city that it goes to and although production does affect the empire as a whole when building units and wonders it functions at the individual city level. Commerce on the other hand usually has little to do with the actual city that generates it, with the exception of culture. So does the AI take into account how much commerce the empire as a whole is generating when it decides to build/remove cottages/towns? I'd think it would have to otherwise it would never build them. So how exactly does it decide how much commerce it needs and where it should generate it?

Here's another question. Does the AI take into account the buildings in a city when it decides the value of improvements? If not shouldn't it? One problem is that commerce gets more modifiers earlier so it might over value commerce and neglect production. Or a city that starts with a lot of production then builds all the commerce buildings quickly and then switches every thing to cottages. If it did that enough it might ruin the whole empires production.
 
That's a completely unrealistic requirement for making changes to the AI. If there's a change that can be made that makes the AI 1% more effective, then I consider that a worthy and valid change to make.

What is unrealistic about suggesting that maybe considerations other than JUST will it make the AI "better" should be looked into before making changes like that?

I mean if ONLY whether or not a change would make the AI "better" is all that should ever be considered then why not code the AI to be like those super chess computers have it go through every possible combination of decisions 1000's of turns in advance and then have it pick the one most likely to end in success? I mean sure it MIGHT make turns take a couple of days for some computers but hey as long as the AI is "better" thats ALL that matters right?

And to use your phrasing I am not saying anyone is suggesting an extreme like that what I am saying is just that change for the sake of making the AI "better" COULD have unforseen or unintended consequences and COULD end up changing the game beyond the scope of a patch.

Competitive for which players?

Uh I dont know the average player maybe? I mean maybe I am misreading the boards but it seems to me there are plenty of people who ask questions about or who have have problems on every level from warlord to diety. People who play it and get beat or if they win find it a challenge to do so and people who when they have mastered a difficulty level find going up a level to be a challenge.

And no I didnt take a scientific poll or anything but I did kinda get the impression there were more posts like that than posts about how Deity is so easy because the AI had workers build a farm over a cottage.

Or then again maybe I didnt misread but it's only the few people who play on the higher levels whose opinions count and the rest of us are just unrealistic.

And yes, it gets harder, but only because it is given more and more artificial bonuses as the difficulty level goes up. The more the bonuses can be minimized, the better the overall game.

Yeah people evaluate a game NOT about how challenging a game is or how fun it is but how many bonuses the AI is getting. All those games reviews that go "yeah the game isnt fun to play and I beat it in 5 minutes and never want to play it again but oh yeah baby no bonuses for the AI --5 stars!!" :P

But sarcasm aside even many of those who DO complain about "bonuses" usually complain in ways about how something they plan didnt work out and it was unfair or unbalanced or basically just too hard. And thats assuming it was even due to ACTUAL bonuses the AI gets instead of "mythical" bonuses like the AI "combat" bonus issue that tends to come up when someones lvl 9 maceman with 89% chance to win loses to an archer or something. So many of those complaints were more a call to eliminate bonuses WITHOUT at the same time making the game so it is just as hard. Meaning it was the difficulty that was bothering them NOT the bonuses themselves.

Also speaking of how my ideas and thoughts are just "unrealistic", How exactly is it "realisitic" to expect to have difficulty levels WITHOUT artificial bonuses in SOME form? I mean is it your plan to just have one and only one difficulty level? I mean even if you get the AI to play JUST right the way you personally think the AI should play then what? How do you make difficulty levels without artifical bonuses?

And even THAT point aside. My MAIN point was that changing something like AI behavior can have far reaching considerations beyond just that change. For example say this change is made and now the AI perfectly improves the tiles exactly the way you think tiles should be improved. What adjustments then will be made to AI bonuses to compensate for it? That is a consideration that so far I havent notice anyone bothering with which is kinda funny since now we are being told that part of the changes purpose is to eliminate those bonuses.

I really don't understand where you are getting the idea that the current situation is "working" for the AI? And I'm not sure why you continually put forth the idea that the AI getting bonuses is a good thing?

To me "working" is the game being fun and competitive and I have already explained before many people find the game challenging and I assume fun otherwise they wouldnt be playing.

I dont put forth the idea the AI igetting bonuses is good or bad in and of itself. I put forth whether it is good or bad depends on the results of doing so. Is the game fun--yes I think so and I think maybe others might say it is fun too. Is the game challenging yes I think so and again I think many other people would say it is too. So if this comes as a result of AI bonuses then I see nothing worng there. So all that is left especially when considering if it is something that needs to be in a patch is things like is the AI getting bonuses causing performance issues wiith like graphics or game speed? is it making buildings or units not work as intended? Is it causing combat odds or calculations for number of turns needed to get a buildiing completed or tech researched to be miscalculated, Does it leave open an exploit that can be abused to the point where it fails to be challenging? Things of that nature. If the answer to any qiestion like that is no then honestly I am not sure why you continually put forth the idea the JUST the fact the AI is getting bonuses is a bad thing.

I just feel if you mean it is a bad thing on some moral principle or whatever that a game isnt good if it requires the AI to get bonuses to be comptetive or adjust for difficulty so you want to try and make it "better" by eliminating need for those bonuses and NOT for some performance or game play issue then that is moving beyond "patch" and into mod.


You are presenting hypothetical situations that aren't realistic. No one is suggesting changing it so that the AI would be unable to get enough food.

Again what exactly is unrealistic of suggesting that changes in AI behavior COULD have unforseen/unintended side effects and that they COULD be negative?


Again, you seem to be theorizing wildly without any evidence to support your hypothesis. What exactly leads you to believe that the AI could end up changing specialization every turn? Or building wonders in commerce cities? Certainly I've seen no one suggesting making such changes.

I didnt know I needed evidence to support the suggestion that changes like that in a program could have unforseen results. But ok lets try hmm--- I dont know an exapmle of say there was a complaint on how the AI valued cottages SOO highly that they cottaged TOO much thus crippling themsleves and so change was made so that they DIDNT value cottages as much and would do other improvements more.. Only NOW as a result the complaint is they value cottages TOO little and are crippling themselves by not making enough of them or making them and then changing them into other improvements. You mean an example like that? or is that unrealistic too?

And actually yeah encouraging the AI to specialize cities WAS mentioned in a post by suggesting that making the AI more reluctant to change existing improvements would encourage city specialization by the AI.

My response was that city specialization involved a LOT more than just not changing tile improvements. So it would require a lot more changes than that and that ALSO running an civ empire is A LOT more than JUST saying ok this city will be gp farm so priorty value high for farms here and this city will be production so priority value hi here for mines and other hammer imporvements and then making AI reluctant to change those prorities.

And if those other things ARENT considered then it COULD run into mistakes and unintended behaviors. Dismissing them with strawman argument of trying to act like I am saying people have been SUGGESTING those unintended behaviotrs doesnt change the fact that those behaviors, or something similar, or even something noone can predict exactly COULD happen. And very fact that this issue is addressing an unitended behavior resulting from making the AI "better" before is an example of how they could.

And again my other point is even IF all that was done and pulled off without a hitch the amount of change in AI behavior may go well beyond "patch" and into "mod"




What makes you think that the AI is currently "flexible and fluid"?

It is just my definition of what AI is doing by evaluating things and making changes based on those evaluations as the game goes on. And what makes me think the AI is doing that? well isnt whole point of this is because people feel the AI is doing that TOO much and doing it to its detriment? And therefor they feel the AI needs behavior changes so it will be more "static" as in more reluctant to change improvements once its decided on one?

This makes almost no sense to me. Basically you seem to be saying "Yes, the AI is bad, but we can give it all sorts of bonuses so that it doesn't seem so bad, so let's just stick with that". If the option exists to make the AI better, so that it doesn't need as many bonuses, why wouldn't we take it? Indeed, that's exactly what Blake was doing with BetterAI, and that became the "official" AI of BTS. Deciding not to try to improve things simply because there's a chance that it might not work strikes me as being pretty defeatist. Let's try looking at it from a "glass is half-full" perspective, shall we?

Bh

What I said was there are considerations beyond JUST hey is the AI better or not. And to me better is not whether or not the AI gets some kind of bonus but whether the AI is challenging and if the game is actually fun.

And like I said unless you somehow plan on either have the game with JUST one dififculty level. Or you try and and nitpick with something like "hey well with these changes now on deity the AI DOESNT get bonuses the player gets PENALTIES" or something to that effect. SOME sort of artifical adjustments WILL be necessary.

As for BlakesAI -- maybe I am wrong but as far as I know BlakesAI never presented itself as a "patch" unoffical or otherwise. And part of my point is that possibly one of results of making a change of this type is the amount of adjustment needed could end up being so much that the game changes and then it would no longer be a patch but a mod. And I did say this is something possibly more suited to CIV5 than a patch. So lets split the difference since BlakesAI while never a patch DID get incorporated in an expansion, And say this something more suited for the next expansion or CIV5 whichever comes first. Either way it is going beyond the scope of "patch".

As for labeling me "defeatist". Well if when someone says "hey lets change this" and I say well lets be careful and think through how that change could effect the game. And given that any change could have unforseen outcomes then at least lets ask is that change really necessary. Especially if that change is upposed to be for a "patch". And the change isnt really fixing a bug or performance issue but is instead an attempt to alter the game. And even if the alterations will be for the "better" then we should at least think through it carefully, then ok I guess thats me Ms Defeatist.

Kaytie
 
And to use your phrasing I am not saying anyone is suggesting an extreme like that what I am saying is just that change for the sake of making the AI "better" COULD have unforseen or unintended consequences and COULD end up changing the game beyond the scope of a patch.

Every time something is changed, it "could" have unforseen/unintended consequences. But that's no excuse to do nothing. If I walk outside, I could get hit by a car. Is that a good reason to never go outside? Or is it a good reason to be careful when I go outside?

Uh I dont know the average player maybe? I mean maybe I am misreading the boards but it seems to me there are plenty of people who ask questions about or who have have problems on every level from warlord to diety. People who play it and get beat or if they win find it a challenge to do so and people who when they have mastered a difficulty level find going up a level to be a challenge.

I think you are misreading the board. Finding threads that highlight AI weakness is extremely easy. And if people aren't complaining about it per se, that's likely because at this point they've simply accepted it the way it is. Again, that's no excuse not to try and improve it.

And no I didnt take a scientific poll or anything but I did kinda get the impression there were more posts like that than posts about how Deity is so easy because the AI had workers build a farm over a cottage.

Again with the unrealistic expectations! "No one is saying the AI is easy on Deity, so improving the AI would be bad!" What kind of messed up logic is that?

Also speaking of how my ideas and thoughts are just "unrealistic", How exactly is it "realisitic" to expect to have difficulty levels WITHOUT artificial bonuses in SOME form? I mean is it your plan to just have one and only one difficulty level? I mean even if you get the AI to play JUST right the way you personally think the AI should play then what? How do you make difficulty levels without artifical bonuses?

No one has said anything about removing the bonuses. The only thing that's been mentioned is decreasing them. Again, exactly what happened with Blake's BetterAI was included in BTS.

And even THAT point aside. My MAIN point was that changing something like AI behavior can have far reaching considerations beyond just that change. For example say this change is made and now the AI perfectly improves the tiles exactly the way you think tiles should be improved. What adjustments then will be made to AI bonuses to compensate for it? That is a consideration that so far I havent notice anyone bothering with which is kinda funny since now we are being told that part of the changes purpose is to eliminate those bonuses.

Yes, and my main point is that that's no reason not to try to improve it. Your argument sums up as "Something might go wrong, so don't try". My argument is "Something might go right, so let's try".

I am not sure why you continually put forth the idea the JUST the fact the AI is getting bonuses is a bad thing.

The AI getting bonuses is a bad thing because it's an indication that the AI is not competitive. In effect, the human player is getting an advantage when playing with the exact same rules/settings as the AI. Changing the rules for the AI so that it can give the human player a challenge is never a good thing. To use your comparison, it'd be like those chess programs giving the AI an extra Queen so that it has a chance to compete against humans.

I just feel if you mean it is a bad thing on some moral principle or whatever that a game isnt good if it requires the AI to get bonuses to be comptetive or adjust for difficulty so you want to try and make it "better" by eliminating need for those bonuses and NOT for some performance or game play issue then that is moving beyond "patch" and into mod.

I disagree completely. So does Firaxas. From the 3.13 patch notes:
AI uses spies more smartly (camps them in cities to get the discount)
AI more likely to promote siege units with Accuracy
AI has a better understanding of when to build early Wonders for non-Normal game speeds
AI does better job of bribing other AI's
AI better aware of Free Market / Environmentalism corporation impact

I could go on, and you can go read it yourself. There are many AI changes that are designed to improve the AI's performance. So it's pretty clear that improving the AI is a valid goal for a patch.

I dont know an exapmle of say there was a complaint on how the AI valued cottages SOO highly that they cottaged TOO much thus crippling themsleves and so change was made so that they DIDNT value cottages as much and would do other improvements more.. Only NOW as a result the complaint is they value cottages TOO little and are crippling themselves by not making enough of them or making them and then changing them into other improvements. You mean an example like that? or is that unrealistic too?

That's not an example. That's you theorizing again. Of course it's possible to come up with hypothetical situations. Try actually analyzing the code changes I've made and come up with an example. That's right, you can't, because I haven't made any yet. So if I haven't made any, why are you jumping immediately to the "oh no, it might not work!!" stage? Once I've actually changed something, and given it to people to test, then you can move beyond the hypothetical, and see if it actually causes any problems. But jumping to the assumption that it will is pointless.

My response was that city specialization involved a LOT more than just not changing tile improvements.

We're not simply talking about "not changing tile improvements". We're talking about making intelligent decisions about tile improvements. There's nothing wrong with changing a tile, if that's the correct decision to make.

And again my other point is even IF all that was done and pulled off without a hitch the amount of change in AI behavior may go well beyond "patch" and into "mod"

Again, Firaxis clearly disagrees with you.

It is just my definition of what AI is doing by evaluating things and making changes based on those evaluations as the game goes on. And what makes me think the AI is doing that? well isnt whole point of this is because people feel the AI is doing that TOO much and doing it to its detriment? And therefor they feel the AI needs behavior changes so it will be more "static" as in more reluctant to change improvements once its decided on one?

The current AI isn't being "flexible and fluid", it's being indecisive. And the fix for that is not to make it "static", it is to make it make better decisions.

As for BlakesAI -- maybe I am wrong but as far as I know BlakesAI never presented itself as a "patch" unoffical or otherwise.

No, but it also ended up being the AI for the official expansion. Even without the above 3.13 patch changes, that seems like a clear indication that Firaxis is interested in an improved AI.

As for labeling me "defeatist". Well if when someone says "hey lets change this" and I say well lets be careful and think through how that change could effect the game.

If you were merely saying "let's be careful and think this through", I'd have no argument with you. The fact is, we are being careful and thinking it through. That's the whole point of this discussion in the first place. But you aren't merely saying that. You've decided that instead of thinking things through, we should just not do anything at all because the possibility exists that something could go wrong. That is a defeatist attitude. As I said above, I'm not going to look at this from a "something might go wrong" attitude (although obviously I'll do my best to ensure nothing does).

Bh
 
I've noticed that toward the late-mid game the AI has very few unimproved tiles. So from that we can say that the AI wasting it's workers time is not an issue, and farms, windmills, workshops, mines are all easily built or rebuild so we can safely ignore the AI when it wants to swap those around.

Yes and no. In the sample game that Wodan posted, there's multiple points where there are unimproved tiles in another city, but the AI is busy replacing improvements in a developed city. That's because Workers can get assigned to a city, at which point they'll continue to work for that city until there is nothing left to do. If there's always something left to do, then it'll never leave.

This problem is mitigated to some degree by the fact that the AI usually has lots of Workers, so even if a few get "stuck" at a city, there are others that can work the other cities.

Another issue is also raised by Wodan's game, that the AI is actually making poor choices for tiles beyond just replacing cottage+. For example, a city that has insufficient food sources probably shouldn't be replacing all of its tiles with workshops just because it's currently got unhappiness.

Commerce on the other hand usually has little to do with the actual city that generates it, with the exception of culture. So does the AI take into account how much commerce the empire as a whole is generating when it decides to build/remove cottages/towns? I'd think it would have to otherwise it would never build them. So how exactly does it decide how much commerce it needs and where it should generate it?

No, each city is improved in (relative) isolation. Now, it's possible that a city will get designated as "Commerce Emphasis", which will influence it's improvement choices. But beyond that, it won't consider anything beyond the immediate needs of the city.

Here's another question. Does the AI take into account the buildings in a city when it decides the value of improvements? If not shouldn't it? One problem is that commerce gets more modifiers earlier so it might over value commerce and neglect production. Or a city that starts with a lot of production then builds all the commerce buildings quickly and then switches every thing to cottages. If it did that enough it might ruin the whole empires production.

It doesn't take buildings into consideration, no. I'm not sure having it do so would be a good idea. If a city happens to build a Forge before a Library, would we really want it to run around tearing up Cottages to build Workshops?

Bh
 
If I walk outside, I could get hit by a car. Is that a good reason to never go outside? Or is it a good reason to be careful when I go outside?
You could get hit by a car inside! Is that a good reason to go hide in a concrete bunker? :lol: Sorry, I just enjoyed the way you made that point :)

There is some truth that in attempting AI improvements, as opposed to AI fixes, you are somewhat changing the scope of the patch/mod/whatever. But I don't think there's much point in us getting hung up about what makes a patch a patch and a mod a mod. As far as I'm concerned if the only rule changes you are making are ones that were obviously done wrong in the first place then I'm still playing the original game and not a mod.

Anyway, is it possible Bhruic for us to get some idea what sort of valuation scheme (or whatever you'd call it - figuring out a city's specialisation) you're contemplating? I can appreciate the complexity of the task but I have my own concerns about its potential if it will depend on the terrain alone. I was more in favour of a one-off designation for each city as opposed to having it calculate its specialisation each turn. I was assuming this would be difficult since it is difficult to store information like that in a gamesave but I think for the most part it would save a large number of unnecessary calculations that would take place every turn. --> ie. going back to efficiency.

You've identified the particular parts of the AI worker code that are in need of improvement, but I'm unsure what parts of the code are holding you back from implementing the solution you have in mind. I apologise if I'm making you repeat anything - I've only come back to reading this thread in the last few days.

edit... missing word lol
 
Some minor suggestions and some questions:

Does the AI change terrain improvements into farms and windmills when the city doesn't provide enough food to work all the terrain tiles and there are no happiness or health issues? I assume it does.

What makes the AI create fairly balanced cities in terms of production and commerce? Does the value of hammers go up if the city has a very low hammer output? If not, I think it should (instead of the emphasizing effects). That way every city would get a decent enough hammer output to get some work done and get the crucial buildings in the city.

Suggestion 1: We want the AI to be a bit more conservative about cottages because that is an area where constant re-improvement and indecision about terrain improvements hurts the AI most. I've read (from Bhruic) that the AI uses the average value of a cottage and a town as a valuation for cottages. I think that's a quite decent valuation when building them. But I think that when you're considering replacing them, the valuation should be more towards the end goal of a cottage, namely the town. When you're replacing terrain improvements, then you're actually fiddling a bit with the end result of your city, so you should actually consider the end result of the cottage improvement.
So when the AI is considering replacing a 'growing' improvement like the cottage/hamlet/village/town, then it should value it as the end result namely the town (with all civic and technology bonuses).

As long as the AI will still replace towns when it really needs to, this will not have adverse effects. So if a city needs to grow and not enough food is available, then the AI should still consider removing a town. Note that if this idea is implemented, the AI should still rather replace a cottage with a farm than a town with a farm.

Suggestion 2: The AI often replaces multiple terrain improvements at the same time around a city. Often these changes even have the opposite result, changing a farm into a cottage and a cottage into a farm. And in other cases, multiple tiles are changed to the same tile improvement at the same time resulting in a radical shift of focus for the city. I assume this has to do with (subsequent) changes in city emphasizing causing repeatedly different valuations of tile improvements. As a result more improvement changes are being performed than necessary and more cottages are replaced and rebuild. It is also hard for the city to find a stable equilibrium situation. If the AI were to concentrate its workers into groups when replacing improvements, then the adverse effects could be lessened. But when the initial improvements are being build, then it is not so efficient to group together the workers as moving to a tile often already costs one of the worker turns. Moving in groups before roads are present is rather inefficient as you lose multiple worker turns at once. So only when workers are re-improving terrain should they be joined together. It will typically not cost worker turns spent on movement as roads are already in place.

(And as I already argued earlier, I don't think the effects of the emphasize buttons on the tile improvement is very positive. It makes it impossible for the AI to find an end goal for the city, it causes it to repeatedly change improvements back and forth. If the AI can create the right tile improvements without these buttons, then I'm in favour of that. But I already argued for this earlier.)
 
Anyway, is it possible Bhruic for us to get some idea what sort of valuation scheme (or whatever you'd call it - figuring out a city's specialisation) you're contemplating? I can appreciate the complexity of the task but I have my own concerns about its potential if it will depend on the terrain alone. I was more in favour of a one-off designation for each city as opposed to having it calculate its specialisation each turn. I was assuming this would be difficult since it is difficult to store information like that in a gamesave but I think for the most part it would save a large number of unnecessary calculations that would take place every turn. --> ie. going back to efficiency.

Right now I've got nothing planned. Roland mentioned the fact (which I agree with) that the emphasis city option can result in the AI changing it's improvements whenever it's priorities change - even if it's only temporary. I'd mentioned the idea of removing that, and we talked a bit about trying to come up with a way for the AI to do a more reasonable city specialization. But that's as far as we've got - just talk. I'm not going to start making changes until we've got a better idea of what changes would be best to make.

You've identified the particular parts of the AI worker code that are in need of improvement, but I'm unsure what parts of the code are holding you back from implementing the solution you have in mind. I apologise if I'm making you repeat anything - I've only come back to reading this thread in the last few days.

It depends which solution is decided upon. Identifying a weakness isn't the same as knowing how to solve it. I mean, it might be something as simple as boosting the valuation decrease for existing cottage+ tiles. Or it might be as complex as doing city specialization. I've still got an open mind about it at this point. Although not quite so open where I think doing nothing is the best plan. ;)

Bh
 
No, each city is improved in (relative) isolation. Now, it's possible that a city will get designated as "Commerce Emphasis", which will influence it's improvement choices. But beyond that, it won't consider anything beyond the immediate needs of the city.

Well one solution would be to give it a better "wide angle lens" so it knows how what effect removing a town has to it's overall competitiveness, but even without knowing how the AI works, that sounds like it would be difficult.

I think the grouping of workers would be the best first step. If it can only evaluate the tiles improvements that exist, changing one at a time as quickly as possible keeps it from erratic changes. It should start grouping them as soon as it has more than one working the same city. Road take two turns so it could probably be set to have groups of two without losing anything. I think everything is in multiples of two, but some things take four and six turns so any more than two workers could make for wasted worked turns. That could still be better that the 70~35 turns lost from removing a town.
It might not have a huge impact but it could and it's unlikely it would have any unforeseen side effects.
 
Agreed completely (except I think you meant DISadvantage in the first sentence).;)
oops yeah. :(

BTW I heartily agree with the trend of discussion by everyone. RJ in particular I think has some great points.

Katie -- if I may make a suggestion, if you could focus on specifics rather than generalities then that would be both productive as well as welcomed. By this I mean, for example, exactly what specific "unintended consequence" do you fear? Rather than "the sky could fall". You don't even have to have the answers, i.e., "This will affect X by doing Y." By simply asking a question, "Will this affect X?", you will open up that specific concern to the group, in particular Bh. It can then be evaluated or researched as needed.

Wodan
 
Does the AI change terrain improvements into farms and windmills when the city doesn't provide enough food to work all the terrain tiles and there are no happiness or health issues? I assume it does.

Yes, it'll try to build food improvements if it currently has a food deficit.

What makes the AI create fairly balanced cities in terms of production and commerce?

I mis-reported some of what it's doing. It does a two-step process, and I've mainly been focused on the first (well, technically second, but really first) step, instead of the second. For example, it does take global commerce into account - sort of.

Income = Gold Percent + Research Percent + (Gold Per Turn if > 0)
Expenses = Inflation Costs + (Gold Per Turn if < 0)
Ratio = Expenses / Income (expressed as percent)

Basically, if the Ratio is > 40, then it increases the emphasis on commerce. There are other things it does, like normalize the values based on averages over all the cities. There's too much to really list here, and, frankly, there's too much to keep all in my head at once.

(BTW, if you look at the above "Income" formula, you'll note that it only looks at the slider for gold and research - not espionage. I'm pretty sure that's a bug)

Does the value of hammers go up if the city has a very low hammer output?

Yes, it does. It does this in two ways - if the total production (where the "total production" is the current number of :hammers: from any square being worked, or where 10x:food: + 6x:hammers: + 4x:commerce: > 21) is less than 10, it'll increase the desire for hammers. Also, if the total production is less than a target value which is generated roughly based on the size of the city, it'll increase the desire for hammers.

edit: More for my own memory, but another bug - where it does the "total production" and "total food", it assumes the city gets the minimum values of 2:food:/1:hammers: - if a city is settled on a bonus, it may end up with more.

Suggestion 1: We want the AI to be a bit more conservative about cottages because that is an area where constant re-improvement and indecision about terrain improvements hurts the AI most. I've read (from Bhruic) that the AI uses the average value of a cottage and a town as a valuation for cottages. I think that's a quite decent valuation when building them. But I think that when you're considering replacing them, the valuation should be more towards the end goal of a cottage, namely the town.

That won't have the effect we're looking for. That would make the AI more likely to build Cottages, but it wouldn't change its valuation when it comes time to replace them. Valuation is only done for things that Workers can build - they can't build Hamlets/Villages/Towns, only Cottages. The area where it compares possible improvements to the current improvement doesn't use that averaging system, it removes valuation based on the current development level of the tile, and the amount of time put into the developing to the next level.

If the AI were to concentrate its workers into groups when replacing improvements, then the adverse effects could be lessened. But when the initial improvements are being build, then it is not so efficient to group together the workers as moving to a tile often already costs one of the worker turns. Moving in groups before roads are present is rather inefficient as you lose multiple worker turns at once. So only when workers are re-improving terrain should they be joined together. It will typically not cost worker turns spent on movement as roads are already in place.

The AI is already set up to group workers together. I'm not sure if you've watched the AI working, but using Wodan's test game, I added a bunch of extra Workers for the AI. Almost every tile improvement was thereafter worked by multiple Workers.

Bh
 
The problem is
1. If you want to switch from Commerce to something else you should replace Cottages instead of Towns (the AI probably does that from the fact that Towns give more)

2. The problem is that is not enough... a town is more than just the Valuation, they also need to consider the work "put into" it... so that

If a city is valuing Commerce v. hammers and under civics such that a Mine and a Town are equally valued (on a Grassland Hill) but the City Needs Food it should build the Windmill on the Mine and not on the Town, becase it can easily replace the Mine, but not Easily replace the Town (once Sid's Sushi is established and it has enough food.)

The same thing can happen with Forests/Jungle Preserves


The main thing is the Cost in switching back... I'm pretty sure it considers the time to put an improvement on a tile, but it doesn't consider the time to change it back... which is significant for Towns.

So I'd say the easiest thing would be to put somewhere in the code where it considers how Long it will take the Worker to build the NEW improvement it also looks at the "cost" of replacing the old Improvement (in citizen Time rather than Worker time).

so If Building a Windmill over a Town/Mine is equally beneficial, but building it over the Town will "take" longer, then it will go with the Mine.
 
Thanks again for your explanations of how the AI works, although it remains a bit mysterious here and there.

Yes, it'll try to build food improvements if it currently has a food deficit.

And I guess it will also build food improvements if some tiles are unused and the food surplus is 0... (in a healthy, happy city).


I mis-reported some of what it's doing. It does a two-step process, and I've mainly been focused on the first (well, technically second, but really first) step, instead of the second. For example, it does take global commerce into account - sort of.

Income = Gold Percent + Research Percent + (Gold Per Turn if > 0)
Expenses = Inflation Costs + (Gold Per Turn if < 0)
Ratio = Expenses / Income (expressed as percent)

Basically, if the Ratio is > 40, then it increases the emphasis on commerce. There are other things it does, like normalize the values based on averages over all the cities. There's too much to really list here, and, frankly, there's too much to keep all in my head at once.

(BTW, if you look at the above "Income" formula, you'll note that it only looks at the slider for gold and research - not espionage. I'm pretty sure that's a bug)

Ok, that sounds fairly reasonable, although it's hard to get a picture of the details of what is going on. I should learn to read the code myself. ;)

As of 3.13, the espionage slider is usually fairly low for the AI, something like 0% or 10%, so I guess it doesn't matter that much. It just means that the civilisations which invest in espionage still try to get a good science rate.

I wonder if the income calculation also takes into account the accumulation of gold, science (and espionage) points caused by fixed income sources like settled great persons or specialists (which don't depend on the slider). Note that in the modern age, the espionage point generation can get pretty high without investment in the slider thanks to fixed income from buildings. However, you can't invest those espionage points in other things so it doesn't tell you how healthy your economy is.

Yes, it does. It does this in two ways - if the total production (where the "total production" is the current number of :hammers: from any square being worked, or where 10x:food: + 6x:hammers: + 4x:commerce: > 21) is less than 10, it'll increase the desire for hammers. Also, if the total production is less than a target value which is generated roughly based on the size of the city, it'll increase the desire for hammers.

edit: More for my own memory, but another bug - where it does the "total production" and "total food", it assumes the city gets the minimum values of 2:food:/1:hammers: - if a city is settled on a bonus, it may end up with more.

Ok, I didn't get the part of 10x:food: + 6x:hammers: + 4x:commerce: > 21. I don't know what you're trying to tell me with that formula.

It seems that 10 hammers is a lot in a small city, so I guess the AI naturally emphasizes hammers in small cities? It seems to me that food should also be important in a small city, but I don't have the full picture. I only see one of the modifying formulas.

That won't have the effect we're looking for. That would make the AI more likely to build Cottages, but it wouldn't change its valuation when it comes time to replace them. Valuation is only done for things that Workers can build - they can't build Hamlets/Villages/Towns, only Cottages. The area where it compares possible improvements to the current improvement doesn't use that averaging system, it removes valuation based on the current development level of the tile, and the amount of time put into the developing to the next level.

Hmm? :confused:

There seems to be a misunderstanding as you mention that it would make it more likely for the AI to build cottages. For building cottages, it should still take the value that you mentioned: the average value of the cottage and the town. So it shouldn't make the AI more likely to build cottages. However, when replacing the cottage, hamlet, village or town, it should value it as a town, so the valuation it removes from the new improvement should be the value of the town.

The logic behind that is what I described in my previous post. When you're building a cottage on an empty square or an already occupied square, then you're building a slowly developing improvement which has a value somewhere in-between the cottage and the town. When you're replacing a cottage/hamlet/village/town with something else, then you're fiddling with the end result of your city. You're trying to optimize the food/hammer/commerce output of that city. In that case, the value of the cottage/hamlet/village/town should be as the value of the town as that is the end result of that improvement. So when you're replacing it with another improvement, then you should deduct the value of a town from the value of the new improvement.

The AI is already set up to group workers together. I'm not sure if you've watched the AI working, but using Wodan's test game, I added a bunch of extra Workers for the AI. Almost every tile improvement was thereafter worked by multiple Workers.

No, I didn't look at the examples posted by Wodan as I had some experience with the issue myself in the various games that I've played. I have seen the AI replace multiple improvements in the same city at the same time. I've seen instances where 5-6 workers were re-improving a city, typically 2 workers per tile. So often 2 or 3 tiles were being replaced at the same time. This resulted in massive changes in the city which would be undone again a few turns later by that same group of workers. There would never be an equilibrium situation. If those 5-6 workers had been working on the same tile, then maybe an equilibrium would have been reached. At least it might have caused less damage to developing cottages.

Even without the effect the emphasize buttons may have on re-improvement, the massive changes made by multiple worker groups re-improving the terrain must also result in different valuation of the various tile improvements just by the effect of the formulas you have posted. For instance, after replacing 3 farms by workshops (by 3 worker groups at the same time), the value of hammers in that city will go down and the value of food will go up. That might thus result in the opposite change of 3 workshops into 3 farms. At that point, the value of food will go down and the value of hammers will go up, restarting the perpetual cycle. There cannot be an equilibrium when multiple changes happen at the same time.



Seeing the formulas that you posted, I noted that next to the emphasize buttons, there are other modifiers which change the value of a certain improvement so that the AI tries to create cities with a decent food, hammer and commerce output. So I guess that without the emphasize buttons, the AI would still build cities with a decent hammer and commerce output and able to grow to the health and happy cap. Do you think the emphasize buttons are important for the creation of decent cities by the AI? Because they're likely the cause of a lot of the re-improvement issues.
 
Because it's extremely important? I'm don't want to have to end up dealing with a bunch of angry people when the next official patch comes out, and people find they can't load their old games with it, because of changed save game compatability.

Bh

OK. I can see where your coming from and agree with your worries.

But, may I put to you this suggestion. The people you are trying to protect, with your savegame compatibility issue are not the people who would try your unofficial patch anyway.

Most players do not even know about this site (or others, like it.). If they upgrade, it is by accident - they noticed the ingame upgrade option. Tried it and hey this time it worked.

The majority of players on this site that use your patches (and we are all truely thankfull for them) understand the compatibility issues you mention.

If something you do now (before the elusive patch) happens to break that long awaited Firaxis patch (damm - the national local versions and the time delays they introduce because of PC.)

We will accept that, knowing that it only effects our current game.

I guess most online players would finish their current game anyway before installing a new patch.

Just my 2 cents. :)

Edit:

Sorry for the rant - but I do not want you to stop your good work, just because you think you may upset players who may never see what you are doing. Hope this preamble makes sense.
 
I'm not sure if here or the technical support section is the more appropriate place for this question but I'm having technical issues with the unofficial BTS patch.

I have only recently installed BTS. Initially there were problems with the Options Menus not showing the text properly (I have seen posts from others having similar issues) and the game crashing if I started a custom game (but not if I used 'play now' though I didn't try to see how long it would go before crashing). I immediately downloaded and installed the official 3.13 patch and things worked fine. I then downloaded this unofficial patch, (fortunately) saved a copy of the .dll file before replacing it with this one. With the unofficial patch the game crashes (back to Windows) while it's still showing the loading screen (i.e. even before the promotional screens and intro movie).

I'd appreciate any assistance with getting this problem solved. Thanks.
 
Sounds to me like you need to upgrade your DirectX, GB.

Wodan
 
Thanks again for your explanations of how the AI works, although it remains a bit mysterious here and there.

It does to me too. But mostly because I keep forgetting parts. ;) There are a lot of little minor details that it's easy to overlook if you aren't focused on them.

And I guess it will also build food improvements if some tiles are unused and the food surplus is 0... (in a healthy, happy city).

Without getting into the mechanics of it, it basically checks how big the city could get (based on "useful" tiles), and how much food the city has based on the current tile improvements + base. If the current food isn't enough to get it to its target size, it'll prioritize food.

As of 3.13, the espionage slider is usually fairly low for the AI, something like 0% or 10%, so I guess it doesn't matter that much. It just means that the civilisations which invest in espionage still try to get a good science rate.

Usually, yes. But I've seen the AI put it in the 40-50% range, especially after using a GSpy on them. It doesn't make sense that the AI would be emphasizing commerce heavily when it's already producing a fair amount - it's just mainly going into Espionage. Especially when the mechanic to check for commerce production seems to have overlooked it.

I wonder if the income calculation also takes into account the accumulation of gold, science (and espionage) points caused by fixed income sources like settled great persons or specialists (which don't depend on the slider).

Note that in the modern age, the espionage point generation can get pretty high without investment in the slider thanks to fixed income from buildings. However, you can't invest those espionage points in other things so it doesn't tell you how healthy your economy is.

True. I can't tell from the way the function is set up whether it's getting the amount based on the slider, or the total amount.

Ok, I didn't get the part of 10x:food: + 6x:hammers: + 4x:commerce: > 21. I don't know what you're trying to tell me with that formula.

Take a standard tile - let's say a normal plains tile. It produces 1:food: and 1:hammers:. So the "value" based on the above would be 1x10 + 1x6 = 16, meaning that tile wouldn't be counted. On the other hand, take a river grassland tile. It produces 2:food: and 1:commerce:. 2x10 + 1x4 = 24, so that tile would be counted.

It seems that 10 hammers is a lot in a small city, so I guess the AI naturally emphasizes hammers in small cities? It seems to me that food should also be important in a small city, but I don't have the full picture. I only see one of the modifying formulas.

Not really, as mentioned above, it does take squares beyond what is being used into consideration. So, really, this is more of a way of making sure that some of the first improvements for a city are hammers (ie, a prioritization system).

However, when replacing the cottage, hamlet, village or town, it should value it as a town, so the valuation it removes from the new improvement should be the value of the town.

That's really not a good idea, imo. The AI should be much more likely to replace a cottage tile than a town tile. Doing it that way, if a city had both a town and a cottage tile, the AI would be just as likely to replace the town as the cottage.

If those 5-6 workers had been working on the same tile, then maybe an equilibrium would have been reached. At least it might have caused less damage to developing cottages.

Not really true, I'm afraid. The improvements are "queued", which means that it counts them even if they haven't actually be built (just planned). Moreover, I've seen the AI continually replacing the improvement of a single tile.

Seeing the formulas that you posted, I noted that next to the emphasize buttons, there are other modifiers which change the value of a certain improvement so that the AI tries to create cities with a decent food, hammer and commerce output. So I guess that without the emphasize buttons, the AI would still build cities with a decent hammer and commerce output and able to grow to the health and happy cap. Do you think the emphasize buttons are important for the creation of decent cities by the AI? Because they're likely the cause of a lot of the re-improvement issues.

It's one of those "I'm not sure" scenarios. I mean, effectively you could compare it to how well the AI improves a human player's city when they don't turn on any of the emphasis buttons. I haven't done that in a long time, so I couldn't really say how well that is.

Bh
 
Back
Top Bottom