Editing Template:Actual Age
Jump to navigation
Jump to search
Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.
The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.
Latest revision | Your text | ||
Line 1: | Line 1: | ||
− | <noinclude> | + | <noinclude>Returns the actual age at which an animal will reach a life stage age listed in its def files. |
− | |||
− | |||
− | Returns the actual age at which an animal will reach a life stage age listed in its def files. | ||
==Parameters== | ==Parameters== | ||
*adult_age - this has to be the adult_age listed in the animal's def xml, or seen in the in-game information window | *adult_age - this has to be the adult_age listed in the animal's def xml, or seen in the in-game information window | ||
− | *juvenile_age - if a second parameter is given, the number returned will be the actual juvenile age. This number | + | *juvenile_age - if a second parameter is given, the number returned will be the actual juvenile age. This number must be found from the defs files. |
==Formula used== | ==Formula used== | ||
Line 17: | Line 14: | ||
The reason for this weirdness is because the amount the growth stat increases at each tick is proportional to <code>1/ticks_to_adulthood</code>, where ticks_to_adulthood is simply the difference between the ticks since birth and the def file's adult_age expressed in ticks. The consequence of growth updating this way is that initially, the growth stat increases at as you would expect, and then as the animal ages, it increases faster, with an infinite growth rate when it's at the adult age reported in the animal's defs file. | The reason for this weirdness is because the amount the growth stat increases at each tick is proportional to <code>1/ticks_to_adulthood</code>, where ticks_to_adulthood is simply the difference between the ticks since birth and the def file's adult_age expressed in ticks. The consequence of growth updating this way is that initially, the growth stat increases at as you would expect, and then as the animal ages, it increases faster, with an infinite growth rate when it's at the adult age reported in the animal's defs file. | ||
− | {{ | + | {{GraphChart|width=200|height=200|xAxisTitle=Age relative to reported adult age|yAxisTitle=Growth|type=line|x=0.0, 0.02, 0.04, 0.06, 0.08, 0.1, 0.12, 0.14, 0.16, 0.18, 0.2, 0.22, 0.24, 0.26, 0.28, 0.3, 0.32, 0.34, 0.36, 0.38, 0.4, 0.42, 0.44, 0.46, 0.48, 0.5, 0.52, 0.54, 0.56, 0.58, 0.6, 0.62, 0.64, 0.66, 0.68, 0.7, 0.72, 0.74, 0.76, 0.78, 0.8, 0.82, 0.84, 0.86, 0.88, 0.9, 0.92, 0.94, 0.96, 0.98|y2=0.001, 0.02121, 0.04184, 0.06291, 0.08443, 0.10642, 0.1289, 0.1519, 0.17545, 0.19956, 0.22427, 0.2496, 0.27559, 0.30228, 0.3297, 0.35789, 0.3869, 0.41677, 0.44757, 0.47934, 0.51216, 0.54609, 0.58121, 0.61761, 0.65539, 0.69465, 0.73551, 0.77812, 0.82262, 0.86919, 0.91804, 0.9694, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 | y1=0.0, 0.02, 0.04, 0.06, 0.08, 0.1, 0.12, 0.14, 0.16, 0.18, 0.2, 0.22, 0.24, 0.26, 0.28, 0.3, 0.32, 0.34, 0.36, 0.38, 0.4, 0.42, 0.44, 0.46, 0.48, 0.5, 0.52, 0.54, 0.56, 0.58, 0.6, 0.62, 0.64, 0.66, 0.68, 0.7, 0.72, 0.74, 0.76, 0.78, 0.8, 0.82, 0.84, 0.86, 0.88, 0.9, 0.92, 0.94, 0.96, 0.98 | yType=number|yAxisMax=1|xAxisMax=1|linewidth=1|colors=red, black|legend=|y1Title=What you would expect|y2Title=What actually happens}} |
− | |||
− | |||
− | + | A baby animal becomes a juvenile as soon as its growth exceeds <code>juvenile_age/adult_age</code>. For example, horses have a reported juvenile age of 0.2, and a reported adult age of 0.3333, so they become a juvenile when their growth is <code>0.2/0.3333 = 0.75</code>. | |
===Maths=== | ===Maths=== | ||
:<code>with 1 = {sum from [t=0 to actual_ticks_to_adulthood]: 1/(adult_age_expressed_in_ticks - t)},<br>actual_ticks_to_adulthood trends to (1-1/e)×adult_age_expressed_in_ticks as adult_age_expressed_in_ticks trends to infinity</code> | :<code>with 1 = {sum from [t=0 to actual_ticks_to_adulthood]: 1/(adult_age_expressed_in_ticks - t)},<br>actual_ticks_to_adulthood trends to (1-1/e)×adult_age_expressed_in_ticks as adult_age_expressed_in_ticks trends to infinity</code> |