The Curious Cat - City Upkeep Explained

This is interesting. I am planning a very large game on a huge map and I'm concerned about distance maintenance. I'm going to put together a little spreadsheet that will give me the optimal location for my Palace, Forbidden Palace and Versailles. I will post some results and a screen shot or two later.

Should the size of the map really be an issue? The distance maintenance is scaled by the size of the map:

DistanceScale = (MapHeight + MapWidth) {from CvMap.cpp L925}
 
No, the size of map won't be an issue. But I am planning a very long, very big game with lots and lots of cities and that will be an issue. I want to get these three items positioned optimally. I would expect some form of equilateral triangle but I'm not sure of the orientation of said triangle.
 
No, the size of map won't be an issue. But I am planning a very long, very big game with lots and lots of cities and that will be an issue. I want to get these three items positioned optimally. I would expect some form of equilateral triangle but I'm not sure of the orientation of said triangle.

Oh, sorry. I had misunderstood you.

An interesting question. It's probably very dependent on the shape of the various continents and therefore will typically be different in every game.
 
It appears that on the settings used, the distance-based corruption is equal to the distance to the palace divided by 4.5, as long as the city in question is along a straight axis from the palace. I also tested distance along a diagonal distance and found that the diagonal distance does not obey Pythagoras’ theorem. Instead it appears that the program counts diagonal distance as equaling 1.5 times the value of horizontal distance, rounded down. This makes sense as this was the method used to calculate distance in Civ3.
Can someone explain what it means by 'diagonal distance as equaling 1.5 times the value of horizontal distance' with some examples. I cannot seem to see how to apply this formula to the diagram also shown on the first page.
 
Can someone explain what it means by 'diagonal distance as equaling 1.5 times the value of horizontal distance' with some examples. I cannot seem to see how to apply this formula to the diagram also shown on the first page.

Diagonal distance is measured fairly simple in civ4. The first diagonal step is consider a size 1 step, the second a size 2 step, the third size 1 again, the fourth size 2 again, etc. Or in formula: max (horizontal distance, vertical distance) + [1/2 min (horizontal distance, vertical distance)], where [number] means that you should round that number down.

This formula is used to calculate cultural borders (basic expansion is at distance 1, next one which contains the fat cross is at distance 2, next one distance 3, etc) and bombing distance of fighters and bombers. It is not used in unit movement where diagonal steps are consider size 1 steps.
It is used in the distance calculation for city upkeep.
 
Thanks for the formula.

Here are my results. I am looking at a Huge Rainforest map (84 x 52) and I want to get the biggest civ land area possible. Domination limit for this map is 56%. This means I can have a civ that is 47 x 52 or 84 x 29 (this is my target civ land area). The first results in a civ land area that is almost square while the second results in a civ land area that is long and skinny.

Using the formula above, I set up an excel file with three possible city locations (C1, C2 and C3) and then set up calculations as follows:
  • calculate the distance from these city sites of every tile (all 4368 of them)
  • calculate the minimum distance for each tile from these three city locations - - the value for any tile outside of my target civ land area is set to zero
  • divide the minimum value by 4.5 (value pulled from the first post of this thread)
  • sum the total distance for every tile
  • adjust the locations of C1, C2 and C3 such that this total distance is a minimum (I used excel's solver for this)

Using the target civ land area of 47 x 52, I get these city locations ...
  • 25, 40
  • 11, 16
  • 36, 15
These cities are shown in the diagram below ... as expected, the three cities are in a (sort of) equilateral triangle.


Using the second target civ land area of 84 x 29, I get these city locations ...
  • 14, 15
  • 43, 15
  • 70, 15
These cities are shown in the diagram below ... again, as expected, the three cities line up at the half way mark vertically (15) and are evenly spread horizontally (14, 43, 70).


The question is - which layout is better from a minimum distance point of view. The answer ...
Spoiler :
... is the second one. The first one (triangle) results in a minimum calculation of 6720 while the second (line) results in a minimum calculation of 6291
Note: I have taken some liberties by calculating the minimum distance for every tile. Technically, I should probably position city locations and calculate for these cities but that is just a little (actually way) too much work. Also, I have ignored the features on the rainforest map (there is 1 large area of desert and 1 or 2 large areas of mountains)
Spoiler screenshot showing rainforest map - lots of jungle ... lots :
 
Just reed the Article, I usually don't read technical stuff becasue most of the time I don't understand the diagrams and Formula but is it really true?

Courthouses don't affect civic upkeep? that means civic upkeep never gets's halved by courthouses? wow I've honestly never realized this before, I've always assumed that Civic upkeep was apart of Maintenance cost now I know... this is still true for BTS and WL right?
 
Just reed the Article, I usually don't read technical stuff becasue most of the time I don't understand the diagrams and Formula but is it really true?

Courthouses don't affect civic upkeep? that means civic upkeep never gets's halved by courthouses? wow I've honestly never realized this before, I've always assumed that Civic upkeep was apart of Maintenance cost now I know... this is still true for BTS and WL right?

Courthouses don't affect civic upkeep. This has always been true and is true for every version of civilization 4.

Civic upkeep is completely different from city upkeep. It is even in a different category from city upkeep in the financial advisor. I don't know why you would expect courthouses to halve civic upkeep.

I wrote an article on civic upkeep a long time ago, but it's still correct and can also be found in the War Academy. The organized leader trait is the only thing that can seriously reduce civic upkeep.
 
Just reed the Article, I usually don't read technical stuff becasue most of the time I don't understand the diagrams and Formula but is it really true?

Courthouses don't affect civic upkeep? that means civic upkeep never gets's halved by courthouses? wow I've honestly never realized this before, I've always assumed that Civic upkeep was apart of Maintenance cost now I know... this is still true for BTS and WL right?

True. They don't affect it. Never gets halved. True for all expansions.

Civic upkeep is cut by the Organised trait.
 
Read OP and skimmed thread. Really good work, thankyou alot :)

I have two questions:
1) Krikkitone mentions that the max city upkeep increases with difficulty level. This does not seems apparent to me by the Warlord/Monarch Graph. Can anyone confirm or decline this? It seems as if Warlord is gaining maintenance slower (ie more cities are needed before hitting the plateau), but that the plateu is almost same height.
2) Can a graph like the one mentioned above be made for Emperor, Immortal and/or Deity. It would be nice know where the Plateaus are on these difficulties.

Thanks for a good article :)
 
From reading this it seems that...

When you build a new city some of the new maintenance is spread around your empire; however, a courthouse only reduces the amount in that city. Say you build a city that costs you an extra 10 in that city and another 10 spread about the empire - so an extra 20. The courthouse however only reduces the maintenance cost by 5 correct?
 
From reading this it seems that...

When you build a new city some of the new maintenance is spread around your empire; however, a courthouse only reduces the amount in that city. Say you build a city that costs you an extra 10 in that city and another 10 spread about the empire - so an extra 20. The courthouse however only reduces the maintenance cost by 5 correct?

Correct, even though the example is flawed as a city has a cap of 6 :gold: in City Maintenance.
 
Read OP and skimmed thread. Really good work, thankyou alot :)

I have two questions:
1) Krikkitone mentions that the max city upkeep increases with difficulty level. This does not seems apparent to me by the Warlord/Monarch Graph. Can anyone confirm or decline this? It seems as if Warlord is gaining maintenance slower (ie more cities are needed before hitting the plateau), but that the plateu is almost same height.
2) Can a graph like the one mentioned above be made for Emperor, Immortal and/or Deity. It would be nice know where the Plateaus are on these difficulties.

Thanks for a good article :)

From reading this it seems that...

When you build a new city some of the new maintenance is spread around your empire; however, a courthouse only reduces the amount in that city. Say you build a city that costs you an extra 10 in that city and another 10 spread about the empire - so an extra 20. The courthouse however only reduces the maintenance cost by 5 correct?

Correct, even though the example is flawed as a city has a cap of 6 :gold: in City Maintenance.

While the original post was extremely interesting at the time it was written, some code readers have found the exact formulas for the city distance maintenance and number of cities maintenance. The original graphs just show the upkeep for one single situation: one difficulty level, one population size and one map size. The actual formula is dependant on map size, population level and difficulty level and thus is a lot more complicated than what can be captured in one single graph. The pattern that emerges from the graphs is still interesting, but you can understand the upkeep a lot better if you know and understand the formulas. They can be found in post number 89 of this thread (written by eg577). Note that the original poster of this thread could never have found these formulas as he wrote the article at a time that the SDK wasn't available yet. The article was very interesting when it was written and the nature of the graphs is still interesting although I prefer the exact formulas.

Some information that might answer a part of your questions (and can also be found in eg577's post):

City upkeep is divided into 2 parts, number of cities upkeep and city distance upkeep. It's the number of cities upkeep that goes up for all of your cities when you found a new city. The city distance upkeep doesn't change when you found a new city. However, the number of cities upkeep also has a maximum which is dependent on difficulty level (the value of 6 which is mentioned in Diamondeye's post is the maximum at prince and monarch level). So after you have founded a certain number of cities (dependent on map size and city size and difficulty level), you won't see it go up anymore for the older cities as the maximum level has been reached (which is named the conquerors plateau by the original post).

It's a lot of work to create new graphs for different situations and there are many many different situations as the graphs would change dependent on map size, difficulty level and size of the cities. I don't think it's a very useful exercise.

The courthouse only reduces the upkeep locally and adding a new city can also increase the number of cities upkeep in older cities. Eventually, all of your cities will have a number of cities upkeep equal to the maximum number of cities upkeep (which is a value between 4 and 8 dependent on difficulty level). This upkeep usually makes it interesting to eventually build a courthouse in every one of your cities, especially on the higher difficulty levels where the maximum number of cities upkeep is a lot higher. Of course, a courthouse in a distant city is more interesting as these cities also have a high city distance maintenance.
 
Am I the only one who does not see any diagrams in the first page?

I can see several pictures (graphs and such in jpg-format) in the first page. Maybe your browser settings are too strict and block the pictures.
 
These formulas don't seem to work for me (in BTS). What has changed? In which files (civ4 files I mean) can I look up these myself?
 
Who knows how to influence to the city upkeep of quality vassals?

How vassal increases the upkeep of city ? Who knows the formula ?
 
One of the best guides I have ever read on civfanatics and also very useful!:goodjob:
 
Who knows how to influence to the city upkeep of quality vassals?

How vassal increases the upkeep of city ? Who knows the formula ?

They don't.
 
Top Bottom