Difference between revisions of "Template:Actual Age"
m (no redirect) |
|||
(6 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
− | <noinclude>Returns the actual age at which an animal will reach a life stage age listed in its def files. | + | <noinclude> |
+ | {{Obsolete|reason=This template is deprecated as of the fix to growth in [[Version/1.3.3200]].}} | ||
+ | |||
+ | 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 can only be found from the defs files. |
==Formula used== | ==Formula used== | ||
Line 10: | Line 13: | ||
==Explanation== | ==Explanation== | ||
− | If the lifeStageAges minAge values from the animals' defs files were to be believed as-is, you would expect | + | If the lifeStageAges minAge values from the animals' defs files were to be believed as-is, you would expect that horses, which have a reported minimum adult age of 0.3333, and a reported minimum juvenile age of 0.25, to be juveniles for (0.3333-0.25)*60 = 5 days. However, the time they actually spend in game as a juvenile is only 2 days. This method accurately predicts this. |
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. | ||
− | {{ | + | {{Graph:Chart|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}} |
+ | |||
+ | :An animal becomes an adult as soon as its growth hits 1. From the graph above, it can be observed that this happens when the relative age is at about 0.63. Applied to horses that have a reported adult_age of 0.3333, this relative age of 0.63 occurs at an age of <code>0.3333×0.63 = {{#expr:0.3333*0.63 round 2}}</code>. In fact, this ~0.63 number is <code>1-1/e</code>, where e is [https://en.wikipedia.org/wiki/E_(mathematical_constant) Euler's number]. | ||
− | 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. | + | :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.25 and a reported adult age of 0.3333, so they become a juvenile when their growth exceeds <code>0.25/0.3333 = 0.75</code>. From the graph above, or from the equation <code>actual_juvenile_age = (1-1/e^(juvenile_age/adult_age))×adult_age</code>, you can work out that the actual age at which a horse becomes a juvenile is <code>(1-1/e^0.75)×0.3333={{#expr:(1-1/2.7182818^0.75)*0.3333 round 3}}</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> |
Latest revision as of 10:29, 6 January 2024
Template:Actual Age has been deprecated or removed from the wiki; it is no longer updated or in use. Reason: This template is deprecated as of the fix to growth in Version/1.3.3200. |
Returns the actual age at which an animal will reach a life stage age listed in its def files.
Parameters[edit]
- 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 can only be found from the defs files.
Formula used[edit]
actual_juvenile_age = (1-1/e^(juvenile_age/adult_age))×adult_age
actual_adult_age = (1-1/e)×adult_age
Explanation[edit]
If the lifeStageAges minAge values from the animals' defs files were to be believed as-is, you would expect that horses, which have a reported minimum adult age of 0.3333, and a reported minimum juvenile age of 0.25, to be juveniles for (0.3333-0.25)*60 = 5 days. However, the time they actually spend in game as a juvenile is only 2 days. This method accurately predicts this.
The reason for this weirdness is because the amount the growth stat increases at each tick is proportional to 1/ticks_to_adulthood
, 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.
- An animal becomes an adult as soon as its growth hits 1. From the graph above, it can be observed that this happens when the relative age is at about 0.63. Applied to horses that have a reported adult_age of 0.3333, this relative age of 0.63 occurs at an age of
0.3333×0.63 = 0.21
. In fact, this ~0.63 number is1-1/e
, where e is Euler's number.
- A baby animal becomes a juvenile as soon as its growth exceeds
juvenile_age/adult_age
. For example, horses have a reported juvenile age of 0.25 and a reported adult age of 0.3333, so they become a juvenile when their growth exceeds0.25/0.3333 = 0.75
. From the graph above, or from the equationactual_juvenile_age = (1-1/e^(juvenile_age/adult_age))×adult_age
, you can work out that the actual age at which a horse becomes a juvenile is(1-1/e^0.75)×0.3333=0.176
.
Maths[edit]
with 1 = {sum from [t=0 to actual_ticks_to_adulthood]: 1/(adult_age_expressed_in_ticks - t)},
actual_ticks_to_adulthood trends to (1-1/e)×adult_age_expressed_in_ticks as adult_age_expressed_in_ticks trends to infinity
with (juvenile_age/adult_age) = {sum from [t=0 to actual_ticks_to_juvenile]: 1/(adult_age_expressed_in_ticks - t)},
actual_ticks_to_juvenile trends to (1-1/e^(juvenile_age/adult_age))×adult_age_expressed_in_ticks as adult_age_expressed_in_ticks trends to infinity
Example uses[edit]
- Horse adult: {{Actual Age|0.3333}} -> 0.21068578097385
- Horse juvenile: {{Actual Age|0.3333|0.25}} -> 0.17587203545609
- Fox juvenile: {{Actual Age|0.3333|0.1}} -> 0.086392694342281