Terrain Optimization (Phase I)

DaviddesJ

Deity
Joined
May 5, 2003
Messages
4,390
Location
Burlingame CA
The subject of this posting is to work out a theoretical analysis of the possible output of a city of a given size, given the following assumptions:

1. The city has access to an unlimited number of tiles of every "basic" terrain type (i.e., plains or grassland, hill or flat). The tiles may or may not have rivers; this doesn't really affect the analysis, as the city just gets +1 commerce for each river, regardless of other choices.

2. We assume all special resource tiles will automatically be worked, so we are only analyzing the incremental production from additional tiles.

3. The civilization has researched the relevant early-game technologies of Agriculture, Mining, Pottery, and Machinery (for farms, mines, cottages, windmills, and watermills). We don't have access to advanced technologies such as Chemistry or Replaceable Parts, or any relevant civics or leader attributes.

4. We assume that each cottage/hamlet/village/town is a village, worth 3 commerce; there may be some towns at this point, but there will also be some cottages and hamlets that haven't grown to villages yet. This value could be varied, with some extra complexity in the analysis.

5. We will also simplify the analysis by pretending that a city can allocate fractional citizens, e.g., 1/2 citizen on a grassland/flat/farm and 1/2 on a grassland/hill/mine. Again, this could be made more precise, with some extra complexity. Note that you can usually achieve an equivalent result to a fractional citizen by moving one citizen back and forth between different tiles on successive turns.

Immediate conclusions:

1. We can define the value of each worked tile relative to the basic unimproved grassland, which produces just enough food to feed the citizen who works it. E.g., we think of a grassland farm as +1f, because it's worth 1f more than the unimproved grassland. A plains farm is +1p. A grassland mine (on a hill, of course) is worth -1f +3p.

2. The value of a tile can be split into an improvement value and a base terrain value. The base terrain is worth 0 (grassland) or -1f +1p (plains). The hills/flat and improvement values then modify this base value. The complete table:

grassland 0
plains -1f +1p

hill/mine -1f +3p
hill/windmill +1p +1c
flat/farm +1f
flat/watermill +1p
flat/town +3c

3. Workshops are never useful, under these theoretical conditions, because hill/mine (-1f +3p) is strictly better than flat/workshop (-1f +1p).

4. Watermills are never useful, either, because hill/windmill (+1p +1c) is strictly better than flat/watermill (+1p).

5. Windmills are never needed, either, because a hill/windmill (+1p +1c) is equivalent to 1/3 of flat/farm (+1f) plus 1/3 of hill/mine (-1f +3p) plus 1/3 of flat/town (+3c).

6. Plains/flat/farm is never useful, because 1/2 of grassland/flat/farm (+1f) plus 1/2 of grassland/hill/mine (-1f +3p) is strictly better than plains/flat/farm (+1p).

7. Plains/flat/town is only useful if we have no farms, because one grassland/flat/town (+3c) plus 1/2 of grassland/hill/mine (-1f +3p) plus 1/2 of grassland/flat/farm (+1f) is strictly better than one plains/flat/town (-1f +1p +3c) plus one grassland/flat/farm (+1f).

8. Plains/hill/mine is only useful if we have no farms, because one grassland/hill/mine (-1f +3p) is strictly better than 2/3 of plains/hill/mine (-2f +4p) plus 1/3 of grassland/flat/farm (+1f).

This leads to the following optimal allocations (depending on what we are trying to maximize):

1. All grasslands, in some mix of hill/mine (-1f +3p), flat/farm (+1f), and flat/town (+3c). If we allocate a fraction X of our population to mines, Y to towns, and 1-X-Y to farms, this gives (1-2X-Y) food, (3X) production, and (3Y) commerce.

2. Plains and/or grasslands, in some mix of hill/mine (-1f +3p) and flat/town (+3c). If we allocate a fraction A of our population to mines, 1-A to towns, and a fraction B to plains, 1-B to grasslands, this gives (-A-B) food, (3A+B) production, and (3-3A) commerce.

To phrase this differently, suppose our goal is to produce P production and C commerce, per citizen. If P+C is between 0 and 3, we can do this with scheme 1 (all grasslands): we will have P/3 mines, C/3 towns, and (3-P-C)/3 farms, for a net food production of (3-2P-C)/3, per citizen. If P+C is between 3 and 4 (and C is at most 3), then we will need to use scheme 2 (mix of grasslands and plains): we will have 1-C/3 mines, C/3 towns, C+P-3 plains, 4-C-P grasslands, for a net food production of (6-3P-2C)/3, per citizen.

An example:

Suppose I found a city on default terrain (so the core produces 2f 1p 1c), and the city has one grassland/corn space which I farm and irrigate for 6f. So the net production with 1 citizen (minus his food consumption) is 6f 1p 1c (plus any river commerce). Suppose the city grows to size 10 (with no health penalty). I want it to be stable at this size, meaning I need to produce a net of -6 food with the remaining 9 citizens, or -2/3 food per citizen.

In scheme 1, this happens when (3-2P-C)/3 = -2/3, or 2P+C = 5. So, in scheme 1, I can produce as much as P=2.5, with C=0, which would give the city net production of 9*2.5+1 = 23.5, and just 1 commerce (plus rivers). This is achieved with 7.5 grassland/hill/mines and 1.5 grassland/flat/farms. Or, I could produce P=2 and C=1 (remembering that P+C can't go over 3 in scheme 1), for net production of 19, and 10 commerce. This is achieved with 6 grassland/hill/mines and 3 grassland/flat/towns. Or, I can choose something in between these two.

Or, in scheme 2, the food balance occurs when (6-3P-2C)/3 = -2/3, or 3P+2C = 8. Then I could, again, have P=2 and C=1, for net 19 production and 10 commerce (as above). Or, I could maximize commerce with P=2/3 and C=3, for net 7 production and 28 commerce. This would mean 9 towns, of which 3 are grassland and 6 are plains. Or, again, I could choose something in between these two.

In other words, for this example, for P values between 2 and 2.5, each unit of production that I give up, buys me 2 additional commerce, while maintaining the same level of food production. For P values between 0.67 and 2, each unit of production that I give up, buys me only 1.5 additional commerce, while maintaining food production. And P values between 0.67 are never optimal (i.e., I could always put out the same amount of food and commerce, and more production).

Conclusion:

I'm not sure yet if or how this sort of analysis will be useful. Of course, you don't get to choose the terrain you're on. But I'm thinking that this might eventually lead to one of two conclusions: either it might be helpful in deciding how to develop a particular city with a particular terrain mix, or it might be useful in deciding how productive a city can be in a particular site (and thus to compare one location to another).

The analysis does generally support something that I already felt to be true (and this is not going to be a big surprise to Civ IV players): that grasslands are generally better than plains. But, there are some cases where it is better to have some plains, i.e., when you already have bonus food (so you don't need any farms), and you want to put out as much production as possible.
 
DaviddesJ said:
The tiles may or may not have rivers; this doesn't really affect the analysis, as the city just gets +1 commerce for each river, regardless of other choices.

You're wrong on this one. Rivers give +1 commerce to certain terrain types, but nothing to other types. For example, it gives nothing to forests.
 
Well the basic rule is that flatlands are best for commerce and food, and hills best for production.

Windmills, Watermills, and Workshops are ways to use a terrain type sub optimally (although Watermills and Workshops become net usefull under state property)

Plains reduce a flatland's strength and shore up its weaknesses
Forests do the same thing (becoming as good as a mine when lumbermills are available)


BTW towns are +4c
 
Zombie69 said:
You're wrong on this one. Rivers give +1 commerce to certain terrain types, but nothing to other types. For example, it gives nothing to forests.

Under the stated conditions, you would never choose to work a forest tile, so this isn't relevant to the analysis.

Krikkitone said:
BTW towns are +4c

Yes, as I said above, I'm counting them all as 3c because they don't spring up fully formed, and you won't generally, at this stage of the game, have the opportunity to work all towns and no cottages, hamlets, or villages.
 
You also made the unstated assumption that the leader is not financial. I suspect that half of all games played are with a financial leader, since this is understood by almost everyone to be the best trait in the game.

This changes your analysis a lot, adding 1 extra commerce to hamlets/villages/towns, while adding nothing to the other types of improvements.
 
Zombie69 said:
You also made the unstated assumption that the leader is not financial. I suspect that half of all games played are with a financial leader, since this is understood by almost everyone to be the best trait in the game.

This changes your analysis a lot, adding 1 extra commerce to hamlets/villages/towns, while adding nothing to the other types of improvements.

I did say "no relevant civics or leader attributes". So it's not unstated.

I think (or maybe hope) that most people mostly play with random leaders. What would be the point of just always choosing the best ones? Isn't that sort of like just always playing on the easiest difficulty level?

Anyway, if you change the value of towns from 3c to 4c (for example), it basically just increases all of the commerce figures above by 33%, leaving everything else unchanged. So it doesn't really affect the analysis much (it makes windmills even less attractive).
 
DaviddesJ said:
1. The city has access to an unlimited number of tiles of every "basic" terrain type (i.e., plains or grassland, hill or flat). The tiles may or may not have rivers; this doesn't really affect the analysis, as the city just gets +1 commerce for each river, regardless of other choices.
I'd like to hear your plan for removing this assumption.

After all, the analysis cannot be readily applied to any in-game situation until this is relaxed. Work including this assumption is principally meaningful insofar as it lays the groundwork to eventually move past it.
 
You really need to define a production/commerce conversion rate. This seems to be pretty much constant for each game, though it will obviously vary between games with different goals.

Assume your city has no national wonders that would skew the local value of food/production/commerce. (Optimizing specialized cities is easy.)
 
I would just like to go on the record as saying I support what DaviddesJ is trying to do.

<troll>
I think Krikkitone and Zombie69 are being unhelpful, because they are supporting what is "accepted" to be true, when DaviddesJ is trying to get a rational basis for why such things might be accepted. If you are not willing to accept the possibility that your findings will overturn conventional wisdom, you are not approaching this project with the right frame of mind. (Similarly, if you are not willing to accept that your findings may support conventional wisdom, you're suffering the same problem.)
</troll>

Firaxis has pulled a real number on us by all the techs/options that improve improvements. Time-delayed towns, State Property, Universal Sufferage, Free Speech, Emancipation, Biology, Replaceable Parts, Electricity, Guilds, Chemistry... every one of these changes the numbers drastically. I get my back up whenever anyone says something is "useless," but in the context of assumption 3, I can't deny it. Even if I want to.

At first I was uncomfortable with assumption 5, since I thought it was an invitation to MM, but then I realized I could translate conclusion 5 into meaning "I'd rather have a farm, a village, and a mine than 3 windmills." So I guess I can accept it now. (Yes, I'm being careful with the difference between the assumptions and the conclusions.)

I'll reiterate my opinion that workshop and windmill are "Terraforming" features: They turn a flat into a hill and a hill into a flat, respectively. With guilds+chemistry, you can even mine your "terraformed hill", and with electricity/replaceable parts, you get some cottage bonuses out of your "terraformed flat." If you buy this theory, then the "infinite tiles" assumption becomes more reasonable. A side effect of this is that no city should have both workshops and windmills, which is unfortunate, because I'm tempted to classify the watermill as a "workshop+", but have also been pushing the watermill/windmill combo as improved over farm+mine in the late game. I still think, post replaceable parts, mill/mill is better than farm/mine, but I don't know where that leaves watermill conceptually.

One interesting discovery is that, within certain limitations, your commerce/production balance is arbitrary. IE, you choose what you want more of first, then develop the land to suit, not look at the land and decide which it's suited for. This makes DaveMcW's call very poignant to me. A combination of a rational basis for production/commerce ratios, the use of DaviddesJ's optimized allocation schemes with the belief that the workshop/windmill are terraforming devices, and the natural march of technology to make that belief supportable for us less-than-deity players, could lead to a good-enough "set it and forget it" worker strategy.

Deity players appear to be stuck with a focus on workers and continually updating their tiles as new technology is discovered.
 
I feel the correct approach to this topic needs to be more specific. First you need to have a list of resources available. Then, you can come up with a happiness and health bonus to shoot for. This will give you an idea of the maximum city size for all cities regardless of terrain. You need 2x city size + extra unhealthiness for food, but the ultimate goal is maximizing commerce and production. If you are not getting much commerce or production (too much farms), drop the city size and replace farm with cottage or mine.
A city with half hills and half grassland probably is best with whole grassland farmed, all hills mined. You can replace farms with cottage if you have too much flatland (in planning of course), and windmill on hills if you have too many hills. Try to pick out a group of flatlands as "support tiles" with farms, then drop cottage and mines on the rest.
Work as much of your river/floodland as possible. Otherwise, ignore the extra commerce in your planning.
In my opinion, watermills and workshops are never useful. Specialize you grassland city for commerce. Use universal suffrage (I think) for hammer if necessary. Your hill towns can do all the producing.
It's probably necessary to separate the planning into pre and post biology cities. Biology usually gives 2-3 extra size to my cities.
Great merchant gives +1 food. Farm everything and use specialists for production and research is a viable strategy if you can come up with lots of happiness and health.
 
BruceLeeee said:
First you need to have a list of resources available. Then, you can come up with a happiness and health bonus to shoot for.

DaviddesJ's allocation formulas are population independent. You plug in your population. So, yes, this is an important step for using the formulas, but not developing them.

BruceLeeee said:
You need 2x city size + extra unhealthiness for food, but the ultimate goal is maximizing commerce and production. If you are not getting much commerce or production (too much farms), drop the city size and replace farm with cottage or mine.

The lack of consideration for unhealth is a concern, but maximizing commerce and production (in a predetermined ratio) is exactly what the allocation formulas are for.

In my opinion, watermills and workshops are never useful. Specialize you grassland city for commerce. Use universal suffrage (I think) for hammer if necessary. Your hill towns can do all the producing.

A more balanced city will produce more utility than a totally specialized grasslands commerceberg in the long term, simply because it can produce the market, grocer, bank, library, university, observatory, and laboratory in something resembling a reasonable time frame, since Universal Suffrage is so very late game. Unless you have pyramids, but I've tried a pyramids strategy, and I'm finding the wait for towns to develop leaves you vulnerable. PS: If you have a farm and a mine, you will seriously want to consider a watermill and a windmill post replaceable parts, as that gives you the same production and *more* commerce. Electricty makes this even more embarassing for the farm/mine. Workshops are more debateable.
 
DaviddesJ said:
I think (or maybe hope) that most people mostly play with random leaders.

Let's say that half the people play random leaders, and the other half pick financial leaders 90% of the time. Of the 26 different leaders, 7 are financial (that's 27%). So on average, that would be (27+90)/2 = 58.5% of games being played with financial. Even if everybody played random civs (which is clearly not the case from the messages posted in the forums, where it seems like 90% of people choose their leaders), that would still be 27% of games played with financial. It's very much worth taking into account.
 
Zombie69 said:
It's very much worth taking into account.

So are US, State Property, and all the techs I listed in my first post. But we have to start somewhere, and if the basic analysis is predicated on financial, it leads to everyone leaning on financial as a crutch to their gameplay. What about 8+ player MP games? Someone's not going to be financial.

I definitely think it's better to have a basic strategy that you can adjust for being financial, rather than a strategy that you have to adjust for not being financial.
 
I'd suggest an expansion to include a sample breakdown of terrain features and include an average population size. Also rivers are not just a +1c feature as the are required to even build a watermill.

For instance the case of point #4, a watermill would equal the hill/windmill with +1p +1c. (But of course the same windmill with river would be +2c total). I also can't ignore the watermill (and thus all tech learned bonuses) anyway, as its bonus +1p can come quickly after they are able to be built.


Anyway an example for a nice commerce specialist city will have maybe 80/20grass/plains, and an average one maybe 60/30/10 grass/plains/hills. So your optimum city (80% grass = 16 grass tiles) is in fact all grass when considering its population will not exceed 16 for the bulk of the game, and even the average has 12 grass.
 
Smirk said:
I also can't ignore the watermill (and thus all tech learned bonuses) anyway, as its bonus +1p can come quickly after they are able to be built.

I'm certainly not claiming that you should never use the windmill or watermill.

But, I can't really agree with your parenthetical remark. It's quite a long way from Machinery to Replaceable Parts.

The reason I labeled this thread with (Phase I) is that I plan to do a Phase II analysis that will include the effects of Guilds, Chemistry, and Replaceable Parts. (But not Biology, Electricity, Railroad, State Property, or Universal Suffrage, which come later still.)
 
Zombie69 said:
Let's say that half the people play random leaders, and the other half pick financial leaders 90% of the time.

Let's say that I think that anyone who picks one particular leader trait 90% of the time is missing the whole point of the game, and I don't really care whether my analysis is helpful to them, or not.
 
DaviddesJ said:
I'm certainly not claiming that you should never use the windmill or watermill.

But, I can't really agree with your parenthetical remark. It's quite a long way from Machinery to Replaceable Parts.

The reason I labeled this thread with (Phase I) is that I plan to do a Phase II analysis that will include the effects of Guilds, Chemistry, and Replaceable Parts. (But not Biology, Electricity, Railroad, State Property, or Universal Suffrage, which come later still.)

Did a quick check on that, basically Windmill>Mine (unless you want P>3) and Mine=Workshop=Lumber on Hill
so its (keeping towns at 3)
Farms, Windmills+Towns (all Grassland) [P+C<3, P<2]
Wind=P/2
Towns=(2C-P)/6
Food=(3-P-C)/3
OR
Windmills+Towns (Plains+Grassland) [P+C>3, P<3 or P>2]
Wind=3/2-C/2
Town=C/2-1/2
plain=P+C-3
Food=2-P-C
OR
"Mines"+Windmills (all Plains) [where a lumbermill on a hill is basically the same as a mine] [P>3]
Mine=P-3
Windmill=4-P
Food=2-P
Commerce=4-P

Interesting thing is at This point the Production/Commerce trade off is 1 for 1 at all levels. Perhaps less so if Towns are assumed to be 4 Commerce (more Mature/Printing Press)

phase 3 gets much more complicated (with watermills producing all three resources) I think it may much more strongly depends on the production/commerce ratio desired
Watermills+Mine>Workshop/Lumbermill
Watermill/Plain>Workshop/Lumbermill
Watermill/Grass > Mines+Farms

So it amounts to Towns+Watermills as the base best, with Mines taking over before plains Hills/Lumbermills+ taking over at the 'all plains' max production options.

So if

4P+C<10, P<2 (all grassland, some farms)
Towns= (C-P)/5
Water=(6P-C)/10
Food=(20-2P-3C)/10
a production costs 2/3 commerce

4P+C>10, P<3 (no more farms, some plains)
Town = (C-2)/4
Water = (6-C)/4
Plains = (4P+C-10)/4
Food = (8-C-2P)/2
a production costs 2 commerce

4P+C>14,(all plains, Watermills, Mines, Towns)
Town= (P+C-5)/3
Water = (10-C-2P)/2
Mine= (4P+C-14)/6
Food = (19-2C-5P)/3
a production costs 2.5 commerce

Pure Mines+Towns+Plains
Towns=C/6 or (5-P)/3
Mines=1-C/6 or (P-2)/3
P=(10-C)/2
C=10-2P
F=(-1-P)/3


The value of watermills showing the remaining strength of rivers in the late game.
 
The first assumption, that we have access to any sort of tile that we might want, is such that I find it very hard to see how this could be applicable. Conclusions 3, 4 & 5 saying that "X are never useful" are only true if you have an infinite choice of tiles, which is certainly *not* the case, so the conclusions are misleading at best, and probably more like worthless. A hill/windmill is only better than a flat/watermill if you have plenty hills available to put windmills on. A plains/flat/farm is certainly more useful than a grassland/flat/farm and grassland/hill/mine if you don't have any handy grassland/flat and grassland/hill tiles.

This reminds me of a compiler conference I went to several years ago. I was working for a hardware/software company (Pyramid Technology), in the compiler group, where we spent our days working on improving our compilers so our real-world customers could get the best performance. At this conferance, there were a bunch of people from various universities presenting their research into compiler optimization. Almost every one made various simplifications to make the research easier, but that made their result totally inapplicable. Things like working with a subset of C that doesn't include pointers, "because pointers make the problem too complicated". Great, we just have to tell our customers not to use pointers and we can speed up their code by 20%. They'll love that. The best was a fellow who's presentation was "A novel way to allow using a debiugger to step through optimized code." He basicly had both the unoptimized code (which can be stepped through with a debugger) and the optimized code (which can't) in the same object file, and ran the optimized code when the debugger wasn't being used. When asked what happens if there is a bug in the optimizer that results in the optimized code acting differently, he replied (with a straight face) "We're careful not to have any bugs in our optimizer". That got a huge laugh from the people who worked in the real world, and not in Ivory Towers.

This sort of discussion is useful, but you have to limit the assumptions to something approaching reality, or you start reaching conclusions that aren't applicable to the real-world (or rather, the real-game-world).

Keith
 
Well the assumptions do approach reality in the case of low population cities (where there may be 20 tiles from which 5 citizens can work... and is therefore particularly useful in the early part of the game)

It can also be useful when placing a city, knowing what key things to look for.
 
Back
Top Bottom