How a settlement consider its food situation

First I would like to you to check out the game mechanics for collecting food in a settlement. It can be found in this post: Collecting food.

One of the most important factors for a successful Settlement AI is to make sure that the population has enough food. A good food situation increases the population growth and loyalty among the civilians while a poor food situation might lead to disastreous effects.

A rule of thumb is that the foodPerPop variable should always be above 1 (otherwise the population starves). The maximum value is 2 and as the population get better fed they also breed faster. A settlement has two ways of increasing the food output; either it can improve the terrain around the settlement or it can build food buildings. To improve terrain more than the first level the empire must complete food research.

Winter is a special case as no food is collected during this season.

First we’ll look at how we want the Settlement AI to function:

    if foodPerPop >= 2.0: Settlement is satisfied and send a low priority request for more civilians.
    if foodPerPop > 1.5 && canImproveTerrain: Situation is fairly good but if the economy is good we improve the terrain outside the settlement.
    if foodPerPop > 1.5 && !canImproveTerrain: As the situation is fairly good we don’t do anything.
    if foodPerPop > 1.0 && canImproveTerrain: Situation could be better. Improve terrain even if economy is a bit bad.
    if foodPerPop > 1.0 && !canImproveTerrain: If room for more buildings and the settlements isn’t constructing a building we build one. A low priority request is sent for better food technology.
    if starving && canImproveTerrain: Start improving terrain even if economy is poor and swap building construction to food buildings.
    if starving && !canImproveTerrain: As above but also send a high priority request for better food technology.

The foodPerPop variables 1.5 and 1.0 is set in the Governor and allows us make sure that different settlements AIs can behave differently.

One thought on “How a settlement consider its food situation

  1. I’ve been doing some additions to the SettlementAI and how/when it requests more population (I’m currently testing the first Objective AIs and the Strategic AI :)).

    The first thing is that a settlement will not request more population while there is an active objective with the goal of sending more population to the settlement in question. This good since otherwise the AI might send a little bit to many settlers to a settlement… The other is that the capital (home city) won’t request more population until its own population is below a certain level. Otherwise we risk that the AI creates objectives with the aim of increasing the population in the capital which is the main population centre.