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 13: | Line 10: | ||
==Explanation== | ==Explanation== | ||
− | If the | + | 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 | + | 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. |
− | + | ===Maths=== | |
− | + | :<code>with 1 = {sum from t=1 to actual_ticks_to_adulthood: 1/(ticks_to_adulthood - t)},<br>actual_ticks_to_adulthood trends to(1-1/e)×ticks_to_adulthood as the ticks trend to infinity</code> | |
− | : | ||
− | |||
− | |||
− | |||
− | :<code>with | + | :<code>with 1 = {sum from t=1 to actual_ticks_to_juvenile*(juvenile_age/adult_age): 1/(ticks_to_adulthood - t)},<br>actual_ticks_to_juvenile trends to(1-1/e)×ticks_to_adulthood as the ticks trend to infinity</code> |
==Example uses== | ==Example uses== |