Sorry if this is old ground well-trodden. Anyone who digs into the AI scripts would probably already know this, but since I can't decipher that stuff yet, I decided to do this the old-fashioned way: experimentation.
Motivation: In our mod, we have 2 improvement types that generate food, hothouses (+1 food, +2 w/ civic) and terraforming, which actually changes the tile and then allows other improvements, but is coded to look like +2 food, -1 hammer to the AI. We found that the AI workers would sit around, waiting for the better improvement to come along, current unimproved status of the land nonwithstanding.
(It turns out the AI doesn't give a hoot about civics when weighing an improvement. I assume but don't know that it DOES account for tech changes, but I haven't run tests on that yet.)
Experiment: I created a "Super Farm" improvement and moved its tech location around.
With Super Farm at Writing, Calendar, and Music, automated workers refused to build regular farms and sat in the city instead. (Note that at Writing and Calendar, the UI displayed Super Farms as on the way, but not at Music, yet the results were the same for the AI).
At Future Tech, workers did go build farms. I didn't feel like trying every tech in between as a 4 tech gap in between is already too much for purposes of our mod.
Changing the Super Farm to -2 hammer didn't cause the workers to build regular Farms. Nor did making Farm+2 and Super Farm+3, nor did giving Roosevelt a +100 preference for Farm.
I would conclude that the AI is only able to handle ONE improvement per terrain type per yield value. When you go through all the vanilla terrain types and think about improvements that go with them, there is at max one per terrain type per yield. If there is more than one, the second is always (a) better, and (b) applies only in a special case (e.g. watermill better than workshop, but is only next to river. Perhaps watermill was coded to be allowed only on one side of the river to prevent the AI from not building cottages?).
If any modders out there have had a different experience, or know how to "fix" this in the AI scripting, we welcome your suggestions.
Otherwise, what I've now learned is KISS: Keep It Simple, Sucka.
Motivation: In our mod, we have 2 improvement types that generate food, hothouses (+1 food, +2 w/ civic) and terraforming, which actually changes the tile and then allows other improvements, but is coded to look like +2 food, -1 hammer to the AI. We found that the AI workers would sit around, waiting for the better improvement to come along, current unimproved status of the land nonwithstanding.
(It turns out the AI doesn't give a hoot about civics when weighing an improvement. I assume but don't know that it DOES account for tech changes, but I haven't run tests on that yet.)
Experiment: I created a "Super Farm" improvement and moved its tech location around.
With Super Farm at Writing, Calendar, and Music, automated workers refused to build regular farms and sat in the city instead. (Note that at Writing and Calendar, the UI displayed Super Farms as on the way, but not at Music, yet the results were the same for the AI).
At Future Tech, workers did go build farms. I didn't feel like trying every tech in between as a 4 tech gap in between is already too much for purposes of our mod.
Changing the Super Farm to -2 hammer didn't cause the workers to build regular Farms. Nor did making Farm+2 and Super Farm+3, nor did giving Roosevelt a +100 preference for Farm.
I would conclude that the AI is only able to handle ONE improvement per terrain type per yield value. When you go through all the vanilla terrain types and think about improvements that go with them, there is at max one per terrain type per yield. If there is more than one, the second is always (a) better, and (b) applies only in a special case (e.g. watermill better than workshop, but is only next to river. Perhaps watermill was coded to be allowed only on one side of the river to prevent the AI from not building cottages?).
If any modders out there have had a different experience, or know how to "fix" this in the AI scripting, we welcome your suggestions.
Otherwise, what I've now learned is KISS: Keep It Simple, Sucka.