City manager

The city manager determines what citizens in a given city shall do. In new cities the city mangager is disabled. Even in the disabled state two basic management functions are still available:
# If the city changes its size or if an enemy occupies one of its tiles all citizens are rearranged for an optimal food output.
# If you click on the city in the mini-map of the city overview all citizens are rearranged for an optimal food output.
Roughly optimal food means that all citizens try to work on available tiles, keep all supported units alive, and optimize production (shields) plus trade as their second priority after food. Where optimal does not match maximal keeping supported units alive might be the difference.
== Concepts ==
Generally units belonging to a city require shields to support them. Units are automatically disbanded to get a non-negative shields production value. There is no warning before this happens, so if you enable city management be careful with plans allowing a "negative" shields production surplus.
The predefined max. production plan allows a production deficit, because this is the only way to minimize unavoidable production losses automatically. Plans allowing no deficit are automatically terminated if the city manager finds no solution with this constraint.
Settlers belonging to a city are supported by food instead of shields. Settlers are automatically disbanded if all food reserves are spent, before a citizen starves and the city shrinks in size. There are warning messages before a city shrinks, and city management plans allowing a food deficit are less dangerous than plans allowing a production deficit. The predefined max. food plan allows a food deficit, because that is the only way to minimize unavoidable food losses automatically.
After shields (production) and food the third and last thing you can spend in city management plans is gold. Gold comes from and goes into the global treasury, you can optimize the gold output in some cities while spending it in other cities manually or automatically as you see fit. There are warning messages before you run out of funds, and if it happens anyway buildings are automatically sold. All predefined management plans permit to spend as much gold as necessary for their goals.
The minimal -20 surplus in any plan guarantees, that a city manager cannot spend more than 20 food, 20 shields, or 20 gold per turn. This limit has no effect for trade, research, and luxury, because there is no way to arrive at some kind of trade, research, or luxury deficit. Check it out on the city manager pages for some of your cities, changing values would have the shown effect. Any negative surplus for trade, research, or luxury always has the same effect as 0.
== Creating new plans ==
To define a new city management plan pick a predefined plan describing your intentions, modify its values until the shown effect matches your ideas, and try to enable the city manager. If you cannot enable the manager no solution for your chosen surplus constraints exist. The predefined plans already employ sound minimal constraints, i.e., you can almost always enable these plans.
If you can enable the city manager the citizens are immediately arranged for the goals of the chosen plan as shown. At that point you could disable the city manager again, go to the overview page, and (try to) tweak the new arrangement manually.
With an enabled city manager the mini-map on the overview page is greyed out, and you cannot modify the chosen arrangement. On the manager page the shown plan has the name of a predefined or saved plan, or it is some unnamed individual plan. To deploy an individual plan elsewhere click on "new" and define a new name for it. New named plans are discarded at the end of the game, click on "game", "options", "save options" to keep good plans.
It is rather hard to find new general plans better than the predefined plans, but some useful modifications are possible, e.g., create a set of "more x" plans based on the predefined "max. x" plans, where you permit a food deficit -1 instead of the predefined 0.
To rename a plan click on it, click "new", pick a new name, click "ok", and delete the old plan. Likewise you can modify a named plan: Click on its name, modify its values, click "new", keep the name, click "ok", and delete the old plan.
While you develop new plans its values are automatically matched with known named plans. Where applicable the (oldest) name for a given set of values is shown, otherwise unknown sets are shown as unnamed individual plan. You cannot deploy individual plans elsewhere by name, and "save options" will not save individual plans.
== Constraints ==
The sliders from -20 to 20 on the left side of the values in a plan define the minimal surplus. If the city manager finds no solution under these constraints you'll get a message, and the city manager will be disabled.
Demanding any surplus in a plan reduces the freedom of the city manager to spend it for otherwise better solutions. The minimal surplus constraints on the left side can be interpreted as "what am I willing to pay for what I want", if what you really want is defined on the right side with sliders from 0 to 25.
In the predefined plans the answer for this question is clear, they are all willing to pay with any surplus, as long as it does not result in a loss of food or production. All predefined plans accept the maximal -20 cost of gold for their goals, and arguably their max. whatever names are misleading, it should be buy whatever. In fact the predefined plans can fail to maximize the desired output, if this maximal output would cause more undesired (wasted) luxury as a side-effect.
Some luxury can be good, it results in happiness, and happiness is required to balance unhappiness by military expeditions, or to trigger the "growth by celebration" mechanism. More luxury as a side-effect of wanting something else is almost always bad, unless you need it at all costs.
Example, to get the Great Library you might need max. research points (bulbs), max. production (shields), or both. Roll your own city management plan for this case in five simple steps:
# Move all sliders on the left side to zero, but for gold pick -20.
# Move all sliders on the right side to zero, and pick a positive (non-zero) value for the desired output.
# Click on "new", pick a new (not yet used) name for this plan, click "ok".
# Enable the city manager, and optionally allow food losses of -1 down to -20 per turn in an unnamed individual modification.
# Click on "game", "options", and "save options" to save your named plans.
After you saved this plan you can use it everywhere by clicking on its name and repeating step 4.
In some situations all predefined plans fail, but clicking on the city still has an effect. To emulate this effect with the city manager permit food, production, and gold losses of -20 per turn on the left side; permit a 0 surplus for trade, luxury, and research on the left side; and on the right side set everything to 0. Curiously the city manager still arranges his citizens for food with this plan, maybe not all zeros are equal.
Quite often you want to get rid of a captured town. For that you have to build a settler at or near city size one, and allow to disband the city in favour of this settler on the "settings" page. A city manager can help to starve all other citizens: Create a plan with a minimal food surplus of -20 on the left side, and permit a minimal surplus of 0 for all non-food values, if you don't want to pay with shields or gold for a faster starvation. On the right side with preferences from 0 to 25 use 0 for food, luxury, and happiness, and the same non-zero value for all other preferences. In your evil starvation plan you don't care what you get, as long as it is no food, no luxury, and no happiness.
== Tips and tricks ==
* Do not allow production deficits on the left side. Disband supported units manually to reduce the costs in shields (production) for a given town.
* Define a minimal food surplus on the left side at or near zero, this can be modified as needed in individual deployments.
* Define a minimal gold surplus on the left side of -20 per turn, this can be modified as needed in individual deployments.
* There is no such thing as a negative trade, research, or luxury surplus, simply use a minimal surplus of zero for these values on the left side.
* With only one preference pick zero for everything else on the right side, and pick one for the desired output. You can also pick the maximal 25 for this output, mis-interpreting this unclear 25 as 25*4=100 percent.
* With two or more equal preferences pick zero for everything else on the right side, and the same non-zero value for the two or more desired outputs.
* With two or more unequal preferences on the right side your plan will not always work as expected.
== Predefined plans ==
If no presets (plans) exist in the saved .freeciv-client-rc-2.3 configuration, notably in a new installation, the code generates five presets, if possible with names in the installation language. In version the predefined plans (default presets) are:
name
food 
shields 
trade 
gold 
luxury 
bulbs 
C happymax. food
-20 
25|
0 
5|
0 
0|
-20 
4|
0 
0|
0 
4|
FALSE 
0max. production
0 
0|
-20 
25|
0 
0|
-20 
4|
0 
0|
0 
4|
FALSE 
0max. gold
0 
0|
0 
5|
0 
0|
-20 
25|
0 
0|
0 
4|
FALSE 
0max. research
0 
0|
0 
5|
0 
0|
-20 
4|
0 
0|
0 
25|
FALSE 
0very happy
0 
0|
0 
5|
0 
0|
-20 
4|
0 
0|
0 
4|
FALSE 
25
Apparently the "click on city tile" reset feature cannot be reliably emulated with the city manager, i.e., a governor could run into avoidable losses of food or shields, where a reset works as expected. For a best effort auto-reset emulation with the city manager disallow food and production losses, resulting in a plan like this:
name
food 
shields 
trade 
gold 
luxury 
bulbs 
C happyreset emulation
     0 
 4|
   0 
 4|
0 
1|
-20 
 0|
0 
0|
0 
1|
FALSE 
 0
Category:Technical docs
Category:Manuals