Node:TTD Town Growth, Next:, Up:New Town Growth Mechanism

4.4.1 TTD Town Growth

This is very technical, and only required if you want to fine-tune your town growth. Otherwise, you can skip over this and the next section.

The basic time unit in TTD is a "tick". In the following, it will be used to describe how often something happens. A tick of the simulation engine takes ca. 27 ms, if your computer is fast enough, otherwise it takes as long as necessary. One TTD day is ca. 74 ticks, which is about 2 seconds of real time on fast enough computers.

The "expansion state" of a town is determined by two fields in town structure: bit 0 in the word at the offset 0x12 (I'll call it the growth_flag) and the byte at 0x0A (idle_countdown):

growth_flag   idle_countdown   state
0 any blocked
1 0 expanding
1 nonzero idle

Town status update (including expansion) is performed on every tick in a round-robin fashion; since the town array can hold 70 entries, the main town status update procedure is called every 70 ticks for each town. If the town is blocked, nothing happens. If it's idle, idle_countdown is decremented. If it's expanding, an attempt to place a new building or a piece of road (or a bridge) is taken; if it succeeds, the expansion state is changed to idle by setting idle_countdown to the byte at 0x39, from now on referred to as growth_delay (extension of an existing road usually doesn't change the state to idle). Therefore, growth_delay determines how often the town will be in the expanding state, and thus is the inverse growth rate of the town. Smaller values of growth_delay mean faster growth.

growth_delay is reset each month, and depends on the number of "active" stations within town's transport zone as follows:

number of growth_delay
"active" stations   normal funded[1] funded[2]
0 160 [3] 60 60
1 210 60 60
2 150 60 60
3 110 60 50
4 80 60 40
5 or more 11 [4] 60 30


[1] When a town building fund is active (i.e., up to 3 months after using the "Fund new buildings" option).
[2] When a town building fund is active and "towngrowthratemode" is set to 1.
[3] In this case the town is blocked with a 11/12 probability, so the effective mean growth_delay is 1920.
[4] This is a bug in TTD (array overrun). TTDPatch now fixes this if any of "generalfixes", "towngrowthratemode" or "towngrowthlimit" is active. If "towngrowthratemode" is 0 or off, growth_delay is set to 80 (which seems to be the original programmer's intention); if "towngrowthratemode" is 1, it's set to 55.

Apart from the random blocking in the case [3], town growth is also blocked:

The switches townminpopulationsnow and townminpopulationdesert may be used to prevent blocking of towns with population less than some threshold, so they get a chance to grow enough to accept food.

If "largertowns" is active, growth_delay is halved for selected towns, making them grow twice as fast (except in the case [3] above, so transport is still necessary to make towns grow; this is different if "towngrowthratemode" is 2, as explained in the next section).

A station is "active" if any cargo has been picked up or accepted there within the last 50 days. The type of cargo is irrelevant, so if there's a coal mine in the middle of a town and you're picking up coal there, it will contribute to the growth of the town. This also means that many single-facility stations make a town grow faster than one multi-facility station, as long as they're serviced regularly.

The town's transport zone is a circular area around the town's central tile. Its radius (in tiles) is a function of the number of town buildings as follows:

number of town buildings   radius of transport zone
0-3 2
4-7 4
8-11 5
12-15 6
16-19 7
20-35 8
36-71 9
72 or more 0

Notice the last row. If there are more than 71 town buildings, the transport zone vanishes and stations no longer contribute to the growth. However, if "towngrowthlimit" is enabled, TTDPatch changes this by extrapolating the function for larger values.

Also note that the internal number of buildings may be incorrect in games save under old versions of TTDPatch or without TTDPatch, due to the bugs mentioned in General Fixes. However, this is not a big problem since TTDPatch recalculates these numbers (and populations) if the extended town data are enabled (see More Town Statistics) and the game without those data is loaded, and all the new town growth switches do enable the extended town data.

The function called if a town is in the expanding state starts by searching for a piece of road in the vicinity of town's centre. If no road is found, an attempt is made to create it. If a road piece is found, the function randomly `walks' along the roads trying to find a place to create a new house, or possibly branch out a new street or extend an existing one. Normally, this walk is limited to 20 steps (where a tunnel counts as one step), which limits the maximum possible extents of a town. The "towngrowthlimit" switch modifies this value.

Regardless of all the town growth processing mentioned above, each town building's status is updated periodically (every 256 ticks). This includes construction progress and "production" of passengers and mail. If the town the building belongs to is not blocked, this also includes destroying the building (and, with 61/64 probability, immediately building a new one in its place) at random intervals. This process is not controlled by growth_delay or any of the new town growth switches, althought is does indirectly affect the growth of a town.