Skip to content

town_growth_function

Source: base/tealdef/scripts/util/town_growth_function.d.tl

Notes

Types of /scripts/util/town_growth_function.tl (TownGrowthFunction), the polynomials that scale town and company growth with level.

TownGrowthFunction

record global base/tealdef/scripts/util/town_growth_function.d.tl:3

global record TownGrowthFunction

Load: local townGrowthFunction = ug_require "/scripts/util/town_growth_function.tl"

Notes

Growth polynomials returned by ug_require "/scripts/util/town_growth_function.tl".

Functions

worldGrowthFactor(integer) : number base/tealdef/scripts/util/town_growth_function.d.tl:4

Call as townGrowthFunction.worldGrowthFactor

Notes

Cubic growth factor by level with F(1) = 1 and F(15) = 12.5; the company progression uses it to compute the experience needed for a rank.

Returns number

Used in the base game: 1 time in 1 file

base/content/game_mechanics/game_mechanics/company/company_progression_util.tl:13

return math.max(rank, math.floor(interpolatedBasePopulation * townGrowthFunction.worldGrowthFactor(rank)) - interpolatedBasePopulation + basePopulation)

getGrowthFactor(level : number) : number base/tealdef/scripts/util/town_growth_function.d.tl:5

Call as townGrowthFunction.getGrowthFactor

Notes

Cubic growth factor of a town by level with F(1) = 1 and F(18) = 40; the town growth script uses it with the levels gained since the town's initial level.

Returns number

Used in the base game: 1 time in 1 file

base/content/game_mechanics/game_mechanics/towns/town_cargo_util.tl:109

return townGrowthFunction.getGrowthFactor(l)