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.
{{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 can only be found from the defs files.
+
*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.
  
{{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}}
+
{{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}}
 
 
: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.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>.
+
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>

Please note that all contributions to RimWorld Wiki are considered to be released under the CC BY-SA 3.0 (see RimWorld Wiki:Copyrights for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource. Do not submit copyrighted work without permission!

Cancel Editing help (opens in new window)

This page is a member of 1 hidden category: