[1.3] Children and Pregnancy - v4.1.0

Started by GhostData, March 22, 2020, 04:32:51 PM

Previous topic - Next topic

Third_Of_Five

#195
So does this mod require humanoid alien races as a dependency now? or is HAR optional?

GhostData

Quote from: Third_Of_Five on June 07, 2020, 03:17:23 PM
So does this mod require humanoid alien races as a dependency now? or is HAR optional?
Optional.

Fakeaccount123

Thanks for keep working on this mod.
Can i make a weird request? Would you consider give support to alien races that lay eggs instead of having mammal pregnancy?
I think it would be fun to have some kind of reptilian race that lay eggs instead of giving birth directly. However i can´t make humanoid races to lay eggs by editting xml files :-\

GhostData

Quote from: Fakeaccount123 on June 08, 2020, 11:45:54 AM
Thanks for keep working on this mod.
Can i make a weird request? Would you consider give support to alien races that lay eggs instead of having mammal pregnancy?
I think it would be fun to have some kind of reptilian race that lay eggs instead of giving birth directly. However i can´t make humanoid races to lay eggs by editting xml files :-\

I personally have no plans to implement something like this, but I have made a point to account for egg laying races when preparing the API. It should be fairly trivial for a mod author to write a pregnancy class for egg layers. Maybe once I work through the current backlog I can add something like that for native support or for an extension, but i suspect that will be a very long ways off.

NeonTheCoder

#199
Quote from: Tragix on June 07, 2020, 02:37:10 PM
Let me know if there are issues. If there is a specific race you would like to see support for, let me know. I would much prefer race author's to provide the patch themselves as they care far more for their race than I do, but it only takes 1-2 hours to setup a basic patch so I'm not completely opposed to it. I'm also not an artist, so any new or modified graphics are out of the question.

Working on a patch for now, but it seems that Alien Races with head pieces that have extra graphics for facing west, flip their headpieces when facing west while still loading the west textures, so the headpieces end up facing the wrong way when facing west.
Wondering if it would be possible to patch it so it could auto detect this and not flip parts if there are specific west graphics for them.
(the race in question is Star Wars Races, so far only noticed it with Twileks, but Rodians, Ewoks, and Wookies(?) have a western textures as well that would likely also need to be patched by hand without an autofix)
I'm still new to Rimworld modding so forgive me if it isn't possible to do this automatically in the CS source, but I figure you could look at an extra HAR part, check it's textures and if it has a texture for west, don't flip the body part when the pawn is facing west.

I've also noticed that Races that have hard incompatibility with CnP (or are possibly not humanlike) if they are enabled in the Mod Settings to have age progression cause a index out of bounds exception when trying to get the default age progression of that race, and it loops indefinately causing you to be unable to generate a planet and start a new game.

Edit: It appears that It's not possible to flip a texture using the scale offset, I even edited the source code of the ModifyScale function and built the solution on my own only to find a negative value won't draw at all. I have no idea what the issue is now, but it's likely the mod I am using also patches the HAR DrawAddons function to even allow for these west facing textures because from what I see there is nothing in CnP's code that flips textures or reuse east textures for west, but I'm still new to this and I have no idea what the harmony Transpiler functions do so if it's on CnP's end it's somewhere in there. Unfortunately SWAR source code isn't available or else I would patch that instead.

GhostData

#200
Quote from: NeonTheCoder on June 09, 2020, 08:43:17 AM
Quote from: Tragix on June 07, 2020, 02:37:10 PM
Let me know if there are issues. If there is a specific race you would like to see support for, let me know. I would much prefer race author's to provide the patch themselves as they care far more for their race than I do, but it only takes 1-2 hours to setup a basic patch so I'm not completely opposed to it. I'm also not an artist, so any new or modified graphics are out of the question.

Working on a patch for now, but it seems that Alien Races with head pieces that have extra graphics for facing west, flip their headpieces when facing west while still loading the west textures, so the headpieces end up facing the wrong way when facing west.
Wondering if it would be possible to patch it so it could auto detect this and not flip parts if there are specific west graphics for them.
(the race in question is Star Wars Races, so far only noticed it with Twileks, but Rodians, Ewoks, and Wookies(?) have a western textures as well that would likely also need to be patched by hand without an autofix)
I'm still new to Rimworld modding so forgive me if it isn't possible to do this automatically in the CS source, but I figure you could look at an extra HAR part, check it's textures and if it has a texture for west, don't flip the body part when the pawn is facing west.

I've also noticed that Races that have hard incompatibility with CnP (or are possibly not humanlike) if they are enabled in the Mod Settings to have age progression cause a index out of bounds exception when trying to get the default age progression of that race, and it loops indefinately causing you to be unable to generate a planet and start a new game.

Edit: It appears that It's not possible to flip a texture using the scale offset, I even edited the source code of the ModifyScale function and built the solution on my own only to find a negative value won't draw at all. I have no idea what the issue is now, but it's likely the mod I am using also patches the HAR DrawAddons function to even allow for these west facing textures because from what I see there is nothing in CnP's code that flips textures or reuse east textures for west, but I'm still new to this and I have no idea what the harmony Transpiler functions do so if it's on CnP's end it's somewhere in there. Unfortunately SWAR source code isn't available or else I would patch that instead.
Could you show an example of the error you're seeing? Or steps to reproduce it?
If you're on gitlab, you can open an issue there to track it. I believe I'm familiar with the HAR code that handles the flip for body addons. Until I replicate the issue, I'm not sure how complicated it would be to fix it. Right now, I'm not certain why this would be an issue for CNP's addons and not for adult pawns too, as I don't believe there are any qualifications on the flip.

QuoteI've also noticed that Races that have hard incompatibility with CnP (or are possibly not humanlike) if they are enabled in the Mod Settings to have age progression cause a index out of bounds exception
So races that are incompatible without a patch cause errors when manually enabled without a patch. I'm not sure what you expected here.
When you first run the mod, it will go through every race and select candidates that are "pretty close" to humans, that should theoretically work without special patches. I think there needs to be a few more checks on this process, of course.
If a player goes into the settings and enables one of the disabled races, they should expect errors unless a patch/def is provided. I plan to refine HAR support as we progress, but I highly doubt there will be a one-size-fits-all method to support HAR. I suppose we could just do a global shrink on adult pawn graphics when a def isn't provided. I suspect the result will look pretty bad - granted the current iteration looks pretty bad without custom graphics.


Admittedly, for some races shrinking the head looks pretty alright.

NeonTheCoder

#201
Quote from: Tragix on June 09, 2020, 11:22:33 AM
Could you show an example of the error you're seeing? Or steps to reproduce it?
Yeah, the mod I used was https://steamcommunity.com/sharedfiles/filedetails/?id=1662194938&searchtext=star+wars+races I am unaware of any other mods that add specific west facing textures.
Reproduction, start a new colony, use dev mode to spawn in a twilek colonist pawn, draft them, move them west. attached is a image of the behavior I am talking about, as well as a comparison when facing east.
Quote from: Tragix on June 09, 2020, 11:22:33 AM
QuoteI've also noticed that Races that have hard incompatibility with CnP (or are possibly not humanlike) if they are enabled in the Mod Settings to have age progression cause a index out of bounds exception
So races that are incompatible without a patch cause errors when manually enabled without a patch. I'm not sure what you expected here.
I mean, I expect the errors, but not being able to make a new colony was frustrating as I had enabled the mod for all the "humanlike" races that I believed were humanlike. One or more of Outpost 21's the outer rim star wars races seem to cause these errors as well even though all of them are human like with different heads and or head pieces. But the debug mode doesn't log which race caused the error and you can't even get to the colonists menu to see which race is causing the issue.
Also scailing the head seems to be a good catch all for most races, and of course if there are issues it might be easier for one to make a patch and only worry about those specific issues not head scailing/offsets.

GhostData

Quote from: NeonTheCoder on June 09, 2020, 06:45:00 PM
Quote from: Tragix on June 09, 2020, 11:22:33 AM
Could you show an example of the error you're seeing? Or steps to reproduce it?
Yeah, the mod I used was https://steamcommunity.com/sharedfiles/filedetails/?id=1662194938&searchtext=star+wars+races I am unaware of any other mods that add specific west facing textures.
Reproduction, start a new colony, use dev mode to spawn in a twilek colonist pawn, draft them, move them west. attached is a image of the behavior I am talking about, as well as a comparison when facing east.
Quote from: Tragix on June 09, 2020, 11:22:33 AM
QuoteI've also noticed that Races that have hard incompatibility with CnP (or are possibly not humanlike) if they are enabled in the Mod Settings to have age progression cause a index out of bounds exception
So races that are incompatible without a patch cause errors when manually enabled without a patch. I'm not sure what you expected here.
I mean, I expect the errors, but not being able to make a new colony was frustrating as I had enabled the mod for all the "humanlike" races that I believed were humanlike. One or more of Outpost 21's the outer rim star wars races seem to cause these errors as well even though all of them are human like with different heads and or head pieces. But the debug mode doesn't log which race caused the error and you can't even get to the colonists menu to see which race is causing the issue.
Also scailing the head seems to be a good catch all for most races, and of course if there are issues it might be easier for one to make a patch and only worry about those specific issues not head scailing/offsets.


Okay, so I've been testing with this version of Twileks:
https://steamcommunity.com/sharedfiles/filedetails/?id=2018388859
I don't see the same issue here. Looking at the code for HAR, your statement seems to be true - that west facing graphics are not supported. HAR is open source, so any developer can post a PR to change that, but the issue lies with HAR. Of course, I haven't found any documentation for HAR's defs, so as far as I know the race mod you posted may be violating the contract/assumptions made by HAR, hence the break. Hard to say without poring through both mods.


For the purpose of CNP, humanlike means "uses human lifestages."
If you review CNP's def, you'll see something like this:
<lifeStageDef>HumanlikeToddler</lifeStageDef>
<lifestageType>Toddler</lifestageType>
<minAge>2</minAge>

The first is used to identify a pawn's current lifestage. The second is used to assign a broad categorization to that lifestage (how should the pawn be treated by CNP at this stage.) The last is a qualifier to expand the "primary key" so we can have more than one development stage per lifestage.

The important part here for native support without a patch is lifeStageDef. This maps directly to a race's lifeStageAges. In order to properly support a race, that race needs to use the same lifestages as a human. For example, Ratkin and Orassan both clones the lifestages of the human race, so CNP will automatically tick those as valid candidates (even if they still need a patch for alignment and scaling.)
For Twileks, they use custom stages such as BabyTwiStage, ChildTwiStage, etc. If enabled without a patch, they will cause errors like you're seeing.

Personally I view modding as either a plug-and-play, or a hobbyist process. I assume that a person modding their game is prepared to deal with the consequences if they get under the panel and adjusting settings without understanding what's going on. That said, there might be some checks I can perform to at least provide more context when a player breaks something. What I most likely cannot do is let the player enable an incompatible race and then swallow all of the errors. We add a component to the race at runtime if it is enabled, and trying to fuss with that would not be worth the effort. I can probably throw some errors on game load warning the player, though.

NeonTheCoder

Quote from: Tragix on June 09, 2020, 07:32:21 PM
Okay, so I've been testing with this version of Twileks:
https://steamcommunity.com/sharedfiles/filedetails/?id=2018388859
I don't see the same issue here. Looking at the code for HAR, your statement seems to be true - that west facing graphics are not supported. HAR is open source, so any developer can post a PR to change that, but the issue lies with HAR. Of course, I haven't found any documentation for HAR's defs, so as far as I know the race mod you posted may be violating the contract/assumptions made by HAR, hence the break. Hard to say without poring through both mods.
...

Personally I view modding as either a plug-and-play, or a hobbyist process. I assume that a person modding their game is prepared to deal with the consequences if they get under the panel and adjusting settings without understanding what's going on. That said, there might be some checks I can perform to at least provide more context when a player breaks something. What I most likely cannot do is let the player enable an incompatible race and then swallow all of the errors. We add a component to the race at runtime if it is enabled, and trying to fuss with that would not be worth the effort. I can probably throw some errors on game load warning the player, though.
Yeah that version of twileks is a good substitute, but I dislike that it adds an entire faction to the game, and the lekku are hair pieces rather than body parts. Plus SWR plays nicely with Outpost 21's mods, and also has a bit more accurate depiction of their heads, and also includes twilek specific clothing. I've left a comment about this experince on his mod page as well, not sure when they will see it but it's likely they won't patch it themselves as someone else had the same issue with Children and Schooling, and he just put the blame onto that mod instead. There always is the hacky fix of litterally just flipping the images though, which I will probably end up doing, but I have no idea if I would be able to distrbute such a patch or if just shoving the new textures into a new mod folder would do anything, figure I would have to overwrite them in the SWR mod folder itself.

As for the modding aspect, it would be nice to get a few catches and error logging in there. One of the races that I was having the issue with were naga, which I thought could easily scale down but the way the mod operates that's not the case, unless you were to make it so which seems like a decent catch all imo.

Venusgate

Quote from: Fakeaccount123 on June 08, 2020, 11:45:54 AM
Thanks for keep working on this mod.
Can i make a weird request? Would you consider give support to alien races that lay eggs instead of having mammal pregnancy?
I think it would be fun to have some kind of reptilian race that lay eggs instead of giving birth directly. However i can´t make humanoid races to lay eggs by editting xml files :-\

Actually, you could add a new bodydef, make the bodydef texture an egg, and make the new lifestage def for that reptilian race to replace the child bodydef with the egg bodydef. At least thaat's how I'd butcher it.

GhostData

#205
Took a close look at Twileks and spotted some problems with the way we're rendering right now - the issue is with CNP.
I'll work on it.

Quote from: Venusgate on June 10, 2020, 11:47:33 AM
Quote from: Fakeaccount123 on June 08, 2020, 11:45:54 AM
Thanks for keep working on this mod.
Can i make a weird request? Would you consider give support to alien races that lay eggs instead of having mammal pregnancy?
I think it would be fun to have some kind of reptilian race that lay eggs instead of giving birth directly. However i can´t make humanoid races to lay eggs by editting xml files :-\

Actually, you could add a new bodydef, make the bodydef texture an egg, and make the new lifestage def for that reptilian race to replace the child bodydef with the egg bodydef. At least thaat's how I'd butcher it.
This definitely true. There is even some prep work for egg lifestages in case another modder wanted to do something special with them. It would probably still need a custom pregnancy hediff or class, as it probably doesnt make sense for a reptilian birth and mammalian birth to operate in the same way.

NeonTheCoder

Quote from: Tragix on June 10, 2020, 01:08:48 PM
Took a close look at Twileks and spotted some problems with the way we're rendering right now - the issue is with CNP.
I'll work on it.
Thanks man! I really appreciate it!

Venusgate

Quote from: Tragix on June 10, 2020, 01:08:48 PM

Quote from: Venusgate on June 10, 2020, 11:47:33 AM

Actually, you could add a new bodydef, make the bodydef texture an egg, and make the new lifestage def for that reptilian race to replace the child bodydef with the egg bodydef. At least thaat's how I'd butcher it.
This definitely true. There is even some prep work for egg lifestages in case another modder wanted to do something special with them. It would probably still need a custom pregnancy hediff or class, as it probably doesnt make sense for a reptilian birth and mammalian birth to operate in the same way.

I'm for an egg in toddler texture that just "walks" around. Realism is nice, but half-assed features are better than no-assed ones :P

GhostData

3.0.1 released: https://gitlab.com/Tragix/children-and-pregnancy-collab/-/tags/v3.0.1

Includes some def validation for enabled races. Basically the assumptions we make about modder-made defs are now enforced. Also includes a few fixes to how body addon offsets and scales work, including the east-west flip problem. Twileks will still need a patch for now to deal with the actual offsets, since it looks like the default scales don't work. The race also has a custom head graphic used to connect the head tentacle things, which isn't present on the toddler graphics, so some graphic work would be needed.

I have defaulted the child stage for unsupported races to use the adult head graphic scaled. We'll see how well it works.

NeonTheCoder

Quote from: Tragix on June 10, 2020, 07:34:25 PM
3.0.1 released: https://gitlab.com/Tragix/children-and-pregnancy-collab/-/tags/v3.0.1

Includes some def validation for enabled races. Basically the assumptions we make about modder-made defs are now enforced. Also includes a few fixes to how body addon offsets and scales work, including the east-west flip problem. Twileks will still need a patch for now to deal with the actual offsets, since it looks like the default scales don't work. The race also has a custom head graphic used to connect the head tentacle things, which isn't present on the toddler graphics, so some graphic work would be needed.

I have defaulted the child stage for unsupported races to use the adult head graphic scaled. We'll see how well it works.

awesome thanks man, I really appreciate it. Going to start making patches for the races in SWR, as well as the Outpost 21 outer rim races now, been wanting to do this all day.
Might even make a patch for Naga if I have the time.