It seems like a great deal of care has been placed into managing the number of dwarfs that immigrate to a fortress based on food, mined tiles, etc. Currently however, pet and livestock populations grow slightly faster than exponentially until they hit a ceiling, at which they stop breeding. These dynamics can be troublesome, as evidenced by the recent slowing of pet growth rate to prevent early forts from having war dog plethoras. I'd like to propose a solution to the growth rate of pets and livestock that I think is both realistic and fun for the player.
I'd like to use dogs as an example here, without loss of generality.
Current dynamics are similar to the following curve: dogs increase somewhat exponentially, as more dogs means more breeding pairs which means even more dogs.
Slowing the breeding rate of dogs (by increasing time to maturation) slows this exponential growth, but does not change the basic shape of the curve. More dogs still means faster growth, until the ceiling is reached.
Many dynamical models exist for describing the growth rate of populations with a finite resource, including the logistic model, the Ricker model, and the Beverton-Holt model. It is this third I'd like to focus on because it precludes the possible oscillating and chaotic dynamics of the other two (see May and Oster's papers if interested).
The Beverton-Holt model in its simplest form describes population growth as:
N(t+1) = rN(t) / (1 + [r-1]N(t)/k),
where N is the population size, r is the growth rate when the population is infinitessimally small, and k is the carrying capacity (most dogs allowed).
These curves apply for semalparous organisms (those that die immediately following reproduction). Dogs are iteroparous, surviving to reproduce multiple times, but although this makes analysis complicated it does not affect the ability to use Beverton-Holt dynamics in the game. To do so is computationally inexpensive as well. When two dogs conceive, simple apply the following probability to decide whether or not they create a puppy:
1 / (1 + [r-1]N(t) / k).
Here the quantity [r-1] should be greater than zero and less than one (the smaller it is the slower the population will grow), N(t) should be the current dog population size (this can consist of only adults, only reproductive females, or, as would likely make most sense, all dogs including puppies), and k should be the limit of the population size. In psuedocode:
[CODE]
function breed
while(mom = get.next.breeding.female && dad = get.random.breeding.male)
if (rand(0,1) < 1 / (1 + rate * pop_size / max_pop_size) )
create.puppy
end
end
endfunction
[\CODE]
To make the game interesting, k can be scaled with the amount of available food or the number of dwarfs. Or if dogs are perfectly capable of sustaining themselves with whatever they find, a cap of say 200 can be applied from the beginning of the game.
[ November 17, 2006: Message edited by: Andrew Ridgely ]