Difference between revisions of "Template:Actual Age"
(deprecated) |
|||
Line 1: | Line 1: | ||
<noinclude> | <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. | Returns the actual age at which an animal will reach a life stage age listed in its def files. |
Revision as of 13:04, 26 March 2023
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
- 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
actual_juvenile_age = (1-1/e^(juvenile_age/adult_age))×adult_age
actual_adult_age = (1-1/e)×adult_age
Explanation
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
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
- 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