RimWorld

RimWorld

Children, school and learning
Dylan  [developer] 16 Aug, 2021 @ 7:04am
1.3 Lifestage issues - investigation and fixes (technical stuff, most likely not interesting for most)
I think I have finally found the issues related to lifestages and growth (especially with AlienRaces) please make sure to re-enable the two previous options 'Try fix growth/life-stage too small' and 'Try fix growth/life-stage too large' (under the 'Child'-section) in addition there is now a new option 'Fix minAge for Lifestages' right above them - with all of them enabled together they should fix future and also previous issues (when all are disabled it should be like it is in vanilla, but this is only really recommended when using no other species, but even then vanilla might have issues)

The version is: 1.7.1.6 +
(make sure the modlist shows this version or higher / you see the new mod option)

If you can please test it with the saves you know have issues and where you know how they should be. (Having all three options enabled!)
(if everyhing is fixed you technically only need the new option 'Fix minAge for Lifestages' enabled, but I would recommend leaving the others on, if they don't cause issues after the fix)

Here are the issues (in vanilla Rimworld) that I have found and hopefully now worked around:

-(1) The previously mentioned integer overflow in 'TicksToAdulthood'
(triggers if the configured lifestage-ages are above ~596 years)

-(2) The basegame always uses the last lifestage for most of the growth/age stuff
(this does not have to be the adult-lifestage for a lot of AlienRaces, this is also the case for the Logann @Crimson Bolt
<li> <def>BabyStageWolvx</def> <minAge>0</minAge> </li> <li> <def>ChildStageWolvx</def> <minAge>4</minAge> </li> <li> <def>TeenStageWolvx</def> <minAge>13</minAge> </li> <li> <def>AdultStageWolvx</def> <minAge>18</minAge> </li> <li> <def>ElderStageWolvx</def> <minAge>250</minAge> </li> <li> <def>AncestorStageWolvx</def> <minAge>650</minAge> </li> <li> <def>ProgenitorStageWolvx</def> <minAge>1000</minAge> </li>
This will of course break with point 1)

-(3) Growth is used in 1.3 instead of age to see what lifestage should be active and once growth reaches 1.0f (Adult) this is never checked again (it was in 1.2) I now use the age here again which also should fix most isues
(this would result in the cases where a lifestage does not match the age, which first lead me to even take a look at this)

I also do not plan to touch any of this further, so if it works for you or you disable the options, it should be fine / not change until the basegame or other mods change things.

-----

Well I at least also found a issue with it by looking through it again ^^

Version 1.7.1.8 (Changes only for Rimworld 1.3+)

- Minor improvement on 1.7.1.6 lifestage fixes - this may cause some 'old enough to work'- messages, but should be otherwise ok

- A file is now included with the code that makes up the lifestage fixes, so other mods can implement them easier 'Helpers\lifestageFIX1.3.cs.txt'

@troopersmith1 - Also take a look at the comments in 'PawnDefaultAdultAge'!
(Maybe you know of a good way to cache this other than a static list, which I may look into otherwise)
Last edited by Dylan; 16 Aug, 2021 @ 7:04am
< >
Showing 1-6 of 6 comments
Dylan  [developer] 16 Aug, 2021 @ 7:15am 
Originally posted by troopersmith1:
troopersmith1 15 Aug @ 5:28am
@Dylan

Hey, I'm trying to implement the LifestageFix into Age Matters, and I'm having some technical difficulties, it doesn't seem that the LifestageCorrectionGrowth void is being called, because I set it so it *should* log succeed or fail, and I'm not getting any logs at all. Your comment says it is called on map load, but it doesn't seem to be. Would you mind taking a moment to talk with me? I don't want to clutter this comment thread with technical stuff, so perhaps DMs? I'm also available on Discord as well.

Sorry, I think that may have been a bit misleading (I will correct that text), it needs to be called from your mods controller class in 'public override void MapLoaded(Map map)' that is where CSL calls it from like this:

foreach (Pawn pawn in map.mapPawns.PawnsInFaction(Faction.OfPlayer)) { LifestageCorrectionGrowth(pawn, true, 0.0125f); }
Last edited by Dylan; 16 Aug, 2021 @ 7:15am
troopersmith1 16 Aug, 2021 @ 7:27pm 
Oh, well I suppose that would make sense. I was trying to figure out how it was being called and couldn't figure it out. I guess that would make sense then, if it actually wasn't being called, ha. Well, I'll have another go at it and see how it goes this time.
troopersmith1 20 Aug, 2021 @ 11:45am 
@Dylan

I set it up so that the actual lifestage patch didn't run if your mod was active regardless of settings on my end, but I forgot to set it up so the other stuff doesn't run either. Should be a simple fix to sort out on my end.
Dylan  [developer] 20 Aug, 2021 @ 11:57am 
nice, I also already put a check in on my side to only log a warning not an error if AM is active (I am not sure if you changed the "CSL:" in the logs in the helper-class, that might have also added to the confusion aswell ^^)

There were some sporadic mentions that could indicate that there are still situations in which the fix might not be aggressive enough, but worst case a reload might fix it still, I think it is a balanced approach that does not mess to much with a running game, but we will have to see
Last edited by Dylan; 20 Aug, 2021 @ 12:00pm
troopersmith1 26 Aug, 2021 @ 3:15pm 
Dylan, I was curious, the aggressive fix you added with the most recent update, what is the difference between it and the normal fix? Is it firing in other situations besides map load?
Dylan  [developer] 27 Aug, 2021 @ 1:36pm 
it is only in the LifestageCorrectionGrowth-function (so map load) and it only calls it with:
LifestageCorrectionGrowth(pawn, false);
instead of:
LifestageCorrectionGrowth(pawn, true, 0.0125f);

(so it always changes them and does not require there to be a bigger difference)

There is some more stuff to check if the change did work and throw a warning etc. I will put it in the file or another one with the next update. (but functional, the call should be mostly it - I did put another check for the lifestage after it, but that never gets called for me in testing, as the normal stuff works - I am not sure why this would change anything, but it seems like it did with @Cairyth in the main comments - which makes it even stranger ^^ especially because it did not work when changing the age up and reloading, which should be the same in my opinion)

(it is not enabled by default, so it is mostly to test with the people we saw that still seem to have the issue or have it again - I could not see that Vanilla changes anything relevant with the last update - they also did not fix that interger overflow sadly)

Last edited by Dylan; 27 Aug, 2021 @ 1:38pm
< >
Showing 1-6 of 6 comments
Per page: 1530 50