Difference between revisions of "Template:Actual Age"
(created template) |
|||
Line 10: | Line 10: | ||
==Explanation== | ==Explanation== | ||
− | + | If the values from the defs files were to be believed as-is, you would expect to see (0.3333-0.25)*60 = 5 days of juvenile stage for horses. However, the time they actually spend in game as a juvenile is only about 2 days. This method accurately predicts this. | |
− | The consequence of growth updating this way is that initially, the growth stat will increase slowly, and then as the animal approaches 100% growth, it increases faster. | + | The reason for this weirdness is because the amount the growth stat increases each tick is proportional to <code>1/ticks_to_adulthood</code>, where ticks_to_adulthood is simply the def file's adult_age expressed in ticks. The consequence of growth updating this way is that initially, the growth stat will increase slowly, and then as the animal approaches 100% growth, it increases faster. |
==Example uses== | ==Example uses== |
Revision as of 10:13, 30 September 2021
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 must 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 values from the defs files were to be believed as-is, you would expect to see (0.3333-0.25)*60 = 5 days of juvenile stage for horses. However, the time they actually spend in game as a juvenile is only about 2 days. This method accurately predicts this.
The reason for this weirdness is because the amount the growth stat increases each tick is proportional to 1/ticks_to_adulthood
, where ticks_to_adulthood is simply the def file's adult_age expressed in ticks. The consequence of growth updating this way is that initially, the growth stat will increase slowly, and then as the animal approaches 100% growth, it increases faster.
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