Skip to content

3. Population and City Growth

Milan Ender edited this page Aug 22, 2016 · 6 revisions

Modifying the population

Currently you can modify the population as soon as you have the EntityRefof a settlement. Then you can interact with the population like any other storage. You can find relevant information on how that works in the economy wiki. Just make sure you specify the correct resource type (currently popUnit, you can find it in the Population component. At default a linear growth rate is deployed, with the value specified in the culture component. If you want to have something more intricate, you can set this growth rate to 0 and modify the population to your liking.

Settlement Growth

Two important things to note first: The population growth is separated from the city growth, meaning that each has it's own update rates and system. While the population growth is based on the economy mechanics, the city growth happens mainly in the SettlementEntityManager.

Firstly, the demand for zones is calculated with the values defined in the respective culture component multiplied by the population size. Keep in mind that the BuildingNeedsPerZone is specified as square meters (one block length = one meter). Afterward the system tries to spawn a blank parcel of that zone inside the settlement radius. If it fails to find one after the maximum iterations value is reached the settlement radius grows if it isn't at the maximum yet. If it finds one, the parcel is added to the building queue.

The system won't try to spawn a parcel of that zone if either the demand is too low or the event-based precondition check failed. See the event references for more details on the precondition.