Unofficial BTS 3.13 patch

Perhaps make it so that, instead of:

Each turn, check a tile for importance of each improvement, and build the most important one.

change that to:

Each turn, check a tile for importance of each improvement, and if the most important one exceeds the current one by x, build that improvement.

Or if it's already like that, then increase x. Especially for ham/vil/town as current, and more for the time it would take to build the new one.
 
Yeah the mine/windmill and farm/workshop changes make sense. Maybe if you can just focus on upping the value of the cottage line, that'd at least help the problem...
 
(...)

-OR-

Is this vassal simply choosing to still be my vassal even though they could break off every 10 turns now? I thought once the conditions were satisfied, they automatically break off. The civlopedia is worded in a way that makes me think they are only given the option to break off, it's not automatic.

Thats correct. Breaking off ist not automatic, it is a decision they base on the mood towards you and perhaps the threat level from you and other AIs.
 
Each turn, check a tile for importance of each improvement, and if the most important one exceeds the current one by x, build that improvement.

I would think this would be a feasible solution. Essentially, make the AI tilt towards "do nothing to the tile" unless it has a damn good reason.

Make sure to have a resource check too, just in case oil pops up under a town.
 
I like ggganz' idea. Seems like that would work.

Zath: No, the mine/windmill and farm/workshop changes do NOT make sense. Not when it continuously changes them back and forth.

I do agree that it's a lesser evil than the getting-rid-of-cottages issue.

Duuk: Yeah, that's about the one time it makes sense to rip up a town, when oil or uranium shows up underneath. Personally, I leave the town as often as not, but it makes sense to have the AI always rip up the town and build the resource improvement.

Wodan
 
Well, as I mentioned, it already adjusts the score downwards if the tile happens to be a cottage (or better). And the more the tile has been used (ie, the farther towards being a town it is), the lower the score is adjusted. The valuation system apparently just really likes workshops over cottages.

That's not a huge surprise, since the (very rough) weighting for the three resources are 10:6:4 for :food:::hammers:::commerce:. Even a hamlet with 2 commerce is going to look poor compared to a workshop with 3 hammers.

As for the idea of "exceeding the current improvement by X", that can work, although trying to come up with a particular value for X will be tricky. I should point out that there is already a mechanism to do that, if the tile is being worked (the score is adjusted downwards by 70, and further multiplied by 2/3). So it's mainly just unworked tiles that are subject to constant changes.

Bh
 
Can the AI be taught to specialize cities like (many) human players do and value improvements differently from one city to the next accordingly? So that it for example consider a city a production city, wants just enough food to maximize hammer output there according to the city's size, but doesn't even think about cottages there? And on the other hand value commerce tiles and improvements higher than hammers (or at least in a ratio different from the default) in a designated commerce city?
 
It does do that, yes. Or, at least, it sort of does so via the "emphasis" settings. If a city has emphasis food, it'll consider food sources 30% better than default. And it's 40% better for hammer emphasis/commerce emphasis. It'll also slightly emphasize food and de-emphasize commerce if the city is one of the better GP producers.

How well it manages to use the various "emphasis" settings is another matter. It's not something I've really looked in to.

Bh
 
Hi, I don't run Bhruic's patch, I play with the HOF mode for BtS 3.13 on. I had a weird bug to do with taking a city with no troops, as per this thread:

http://forums.civfanatics.com/showthread.php?t=254283

Which says the bug is fixed by this patch, something to do with teleporting workers.

Since the HOF mod includes many of Bhruic's patch bug fixes, I was wondering if you could point out where the bug fix is located in the code so that the HOF guys (Denniz I think maintains the HOF mod) can incorporate the fix into the mod?

Thanks in advance.
 
Perhaps make it so that, instead of:

Each turn, check a tile for importance of each improvement, and build the most important one.

change that to:

Each turn, check a tile for importance of each improvement, and if the most important one exceeds the current one by x, build that improvement.

Or if it's already like that, then increase x. Especially for ham/vil/town as current, and more for the time it would take to build the new one.

Well, as I mentioned, it already adjusts the score downwards if the tile happens to be a cottage (or better). And the more the tile has been used (ie, the farther towards being a town it is), the lower the score is adjusted. The valuation system apparently just really likes workshops over cottages.

That's not a huge surprise, since the (very rough) weighting for the three resources are 10:6:4 for :food:::hammers:::commerce:. Even a hamlet with 2 commerce is going to look poor compared to a workshop with 3 hammers.

As for the idea of "exceeding the current improvement by X", that can work, although trying to come up with a particular value for X will be tricky. I should point out that there is already a mechanism to do that, if the tile is being worked (the score is adjusted downwards by 70, and further multiplied by 2/3). So it's mainly just unworked tiles that are subject to constant changes.

Bh

We should really think a bit about radical changes before we make them. I really dislike the AI stupidity with continually changes of terrain improvement and was one of the first to suggest some conservatism with regard to the terrain improvements. Introducing a required value improvement of X would do that. But if that would result in a city surrounded by currently unworked workshops which cannot be worked because of a resulting food shortage and no way to change it because a farm wouldn't reach the required value improvement of x, then we will have worsened the situation.

We must remember that a change we suggest that sounds very reasonable might result in adverse effects. A general increase in value of the cottage line of improvements might result in a cottage spamming AI which won't value other improvements anymore.

The fact that cottages grow in value is of course something that makes them very hard to value correctly. If I were to code a valuation system for the cottage, then I would value them as if they were a certain number of turns further in development to symbolise their potential strength. So a cottage and a hamlet might be valued as a village and a village might be valued as a town (and a town as a town).

It does do that, yes. Or, at least, it sort of does so via the "emphasis" settings. If a city has emphasis food, it'll consider food sources 30% better than default. And it's 40% better for hammer emphasis/commerce emphasis. It'll also slightly emphasize food and de-emphasize commerce if the city is one of the better GP producers.

How well it manages to use the various "emphasis" settings is another matter. It's not something I've really looked in to.

Bh

I remember that during the development of the BetterAI mod, this linking of the emphasis setting and the terrain improvements was discussed. Then and now, I'm not such a supporter of this behaviour. The idea behind this link is that it might result in specialised AI cities, but this clearly doesn't work as the AI never builds specialised cities in BTS. At least, I've never seen them. My guess is that during the development of the Civ4-BTS AI, this behaviour was introduced.

The problem is that the supporters of this idea think that the AI selects an emphasis setting and then changes the terrain around the city to reflect that emphasis setting and in effect specialises the city. However, I don't think the AI sticks with a single emphasis setting for the whole game, so the basic premise of this theory is incorrect. This means that during the early game, the AI might select a growth-emphasis in a city resulting in the building of farms on the surrounding riverland. Then it picks a production-emphasis because it wants to construct some buildings and some of the farms are changed into workshops and some mines are build on the hills. Later, it wants to develop its economy and picks the commerce emphasis and thus the terrain around the city is changed and the riverland and grassland hills are filled with cottages. Then someone declares war on this AI and it again thinks it needs production to build units and the semi-developed cottages in the riverland are replaced with workshops again and the grassland hills are mined again.

I must admit that I don't know if the AI is really behaving this stupidly, but the idea that the human behaviour of city specialisation should be introduced to the AI and that this would improve the AI is definately not a proven theory. It could very easily result in extreme AI stupidity. You will have to know everything about how the AI 'thinks' internally before you can somewhat predict what the result of a single change might be.

Really introducing city specialisation to the AI will probably require a whole new part of coding where cities can be marked as a certain type of city (production/commerce/food) for the entire game. The emphasis buttons were probably not designed in that way. They were probably designed as a temporary emphasis to focus on the use of certain tiles which are available around the city.
 
The fact that cottages grow in value is of course something that makes them very hard to value correctly. If I were to code a valuation system for the cottage, then I would value them as if they were a certain number of turns further in development to symbolise their potential strength. So a cottage and a hamlet might be valued as a village and a village might be valued as a town (and a town as a town).

Cottages are valued, effectively, as (cottage + town) / 2.

The problem is that the supporters of this idea think that the AI selects an emphasis setting and then changes the terrain around the city to reflect that emphasis setting and in effect specialises the city. However, I don't think the AI sticks with a single emphasis setting for the whole game, so the basic premise of this theory is incorrect. This means that during the early game, the AI might select a growth-emphasis in a city resulting in the building of farms on the surrounding riverland. Then it picks a production-emphasis because it wants to construct some buildings and some of the farms are changed into workshops and some mines are build on the hills. Later, it wants to develop its economy and picks the commerce emphasis and thus the terrain around the city is changed and the riverland and grassland hills are filled with cottages. Then someone declares war on this AI and it again thinks it needs production to build units and the semi-developed cottages in the riverland are replaced with workshops again and the grassland hills are mined again.

I agree, this is part of what causes the AI to change tiles so often, I believe. For example, a city hits unhappiness which makes the AI change the city to de-emphasize food. It proceeds to build workshops on all of the tiles around it (this is, incidentally, what happens with one of the cities in Wodan's sample save. Then it either gets some happiness resources, or the factor causing unhappiness is removed, so now it wants to grow again, so it changes them to farms. Etc.

Really introducing city specialisation to the AI will probably require a whole new part of coding where cities can be marked as a certain type of city (production/commerce/food) for the entire game. The emphasis buttons were probably not designed in that way. They were probably designed as a temporary emphasis to focus on the use of certain tiles which are available around the city.

I don't think I could do that, but I could do close. I could check the surrounding tiles, sans features, and do a food/production/commerce comparison (this would have to be done every turn, since to do it once and mark it would require storing that in the save, effectively breaking save game compatibility). But other than global warming, I don't think there's any mechanism to change the base tile in the default game, is there?

edit: Although there are multiple cases I can think of where a city would lose access to a tile (culture, another city working it, etc) which might cause the city to change focus. A city focused on GPPs, for instance, that loses its Fish tile to another Civ might not be able to support enough GPs to continue focusing on GPPs.

Bh
 
Seems like that might be a good first step, then. If 2 tiles are not being used, and one is improved while another is not improved, then the AI should improve the non-improved one first. That's basic common sense, but it sounds like we're saying the AI doesn't do that.

Step 2 would perhaps be to make a check: if, though execution of the current algorithm, switching a tile from one improvement to another will result in the tile STILL not being used, then don't switch it. Send the worker to another city, perhaps.

Wodan
 
Cottages are valued, effectively, as (cottage + town) / 2.

That's a decent valuation. At least when all the bonuses villages and towns get from civics are taken into account.

I agree, this is part of what causes the AI to change tiles so often, I believe. For example, a city hits unhappiness which makes the AI change the city to de-emphasize food. It proceeds to build workshops on all of the tiles around it (this is, incidentally, what happens with one of the cities in Wodan's sample save. Then it either gets some happiness resources, or the factor causing unhappiness is removed, so now it wants to grow again, so it changes them to farms. Etc.



I don't think I could do that, but I could do close. I could check the surrounding tiles, sans features, and do a food/production/commerce comparison (this would have to be done every turn, since to do it once and mark it would require storing that in the save, effectively breaking save game compatibility). But other than global warming, I don't think there's any mechanism to change the base tile in the default game, is there?

edit: Although there are multiple cases I can think of where a city would lose access to a tile (culture, another city working it, etc) which might cause the city to change focus. A city focused on GPPs, for instance, that loses its Fish tile to another Civ might not be able to support enough GPs to continue focusing on GPPs.

Bh

If you would be able to do that, then I would suggest to also remove the different valuation for terrain improvements depending on the emphasis setting. I really don't see it working for the AI if it regularly changes its emphasis settings for a city.

The instance of global warming is rare enough and late game enough to ignore it. And if a city would really be harmed significantly by global warming, then maybe it's not a bad thing that the AI might qualify it differently.

If I may suggest something. I would mark most cities as regular cities with a normal requirement of hammers, commerce and food and only a few of the exceptional cities should get a special marking. Markings could include GP-city (lots of potential food), Production-city (food surplus from food resources + hills, bonus for special production resources like iron, coal, copper, etc.), Commerce-city (lots of grassland/floodplain flatland, river, a bonus for being coastal without lots of coastal tiles). It's a bit tricky to get it exactly right I guess. The computer should be able to calculate the exact optimal hammer output or optimal commerce output of a city when improved with the right improvements, but the calculation isn't that easy.

One potential issue: I've read that the AI doesn't switch tiles between cities and thus tiles could get lost when the AI founds another city and this new city automatically claims some of the tiles belonging to the older city. This could mess up the classification of this older city.


By the way, is the AI aware that other workers are working on changing the improvements around a certain city. If the AI wants to improve the food output of a city a little, will it start changing 8 cottaged grassland tiles into farms or will it change 1 cottaged grassland tile into a farm?

Hmm, maybe reimproving the land of 1 city should be limited to 1 worker per city while the original improvement doesn't have this limitation. This limitation might just avoid some of the worse cases of stupidity where two workers next to oneanother are making the opposite improvements (farm->workshop and workshop->farm). It can't be that bad if reimprovement is a bit slow. It's not that crucial anyway. A special resource that can get its special resource harvesting improvement would of course be an exception to this limitation.
 
If I may suggest something. I would mark most cities as regular cities with a normal requirement of hammers, commerce and food and only a few of the exceptional cities should get a special marking. Markings could include GP-city (lots of potential food), Production-city (food surplus from food resources + hills, bonus for special production resources like iron, coal, copper, etc.), Commerce-city (lots of grassland/floodplain flatland, river, a bonus for being coastal without lots of coastal tiles). It's a bit tricky to get it exactly right I guess. The computer should be able to calculate the exact optimal hammer output or optimal commerce output of a city when improved with the right improvements, but the calculation isn't that easy.

But isn't that more or less impossible without breaking the savegame compatibility as Bhruic just mentioned?

That is unless there is some clever way you could code this sort of information into something which does happen to be stored in save games. I've never looked into it and I wouldn't have the foggiest of ideas what things are stored in save games, but if there is something stored say for each AI and you can add to it then it might be possible to store and retrieve some information relating to things like city specialisation designation.

It would have been nice, for example, if the developers had included in the savegames an object something like a comment field, where modders could add comments that would be saved and not break save game compatibility. eg. "Paris = Science, Orleans = Regular..." etc. I would assume there is no such feature already?
 
You can add script data to cities, players, and many other objects which is stored as a string ... so yes. PieceOfMind, you can do exactly what you describe. I've only done this through Python, don't know if doing it inside the SDK could maintain compatibility with mods which also use this functionality.

Anyway, I think what they're talking about would analyze the terrain in the fat cross without improvements and make the production/GP/etc distinction every turn. Since the underlying terrain wouldn't change without global warming, then the label for the city wouldn't change much.

My question is wouldn't you want the label to vary based on forests and maybe jungles as well? Maybe not, but a city in empty grassland and a city surrounded by forested grassland have potentially very different uses and forests aren't so permanent.
 
Hello, I want to thank you for making this patch. I just got BTS yesterday and am greatly looking forward to installing the patch.
Two questions, if I may -- sorry, I am a computer idiot and cannot grasp most of your conversation about coding.

1. I seem unable to DL the file. The link here http://forums.civfanatics.com/downloads.php?do=file&id=7288 indicates "file not found" when I try clicking on any of the "download" icons.
2. Bhuric said to "backup the .dll files" before installing the patch. How exactly do I do that? I mean, where are they exactly so that I may copy them?

Thank you!
 
1/ same problem for me

2/ either take the original CvGameCoreDLL.dll file and rename it, leaving it at the same place (harmless) or move it to another safe location on your computer (still harmless, as long as you know where it is obviously ;) )
The file location is something like ....\Civilization 4\Beyond the Sword\Assets , which is also where the new file should be placed.
 
Bhruic, can u plz upload the file again, just read announcement and looks like the site data base got hack :(
 
Back
Top Bottom