Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1] 2

Author Topic: Guide to inducing pregnancies via DFhack?  (Read 8492 times)

D_E

  • Bay Watcher
    • View Profile
Guide to inducing pregnancies via DFhack?
« on: September 16, 2017, 07:11:51 pm »

Like the title says, can someone point me to/give me some pointers on what does and doesn't work when using DFhack to induce pregnancies?

Based on the ectobiology and catsplosion scripts, this seems to be the basic format for inducing a pregnancy (or rather, instant birth in this case):
Quote from: ectobiology
        unit1.pregnancy_timer=1
        unit1.pregnancy_genes=unit1.appearance.genes:new()
        unit1.pregnancy_spouse=unit2.hist_figure_id
        unit1.pregnancy_caste=unit2.caste

But, I'm curious how flexible/crash-prone the process is.

Specifically, I'm curious:

What happens if the pregnancy_spouse id belongs to someone of a different species.

What happens if the pregnancy_spouse id belongs to someone of a different civ.

What happens if the pregnancy_spouse id is left blank.

What the pregnancy_caste field is used for.

(I'm hoping to be able to use DFhack to allow gerudo to have children with visitors to their fortress)
Logged
Mods I've done:
Zelda mod-mod, Beta in the Wild DF 47.04
Illithid Empire mod DF 31.25 (update canceled)
Spotter's Guide to Illithids (Genesis mod-mod) genesis 3.19a4 (update canceled)

Roses

  • Bay Watcher
    • View Profile
Re: Guide to inducing pregnancies via DFhack?
« Reply #1 on: September 16, 2017, 10:43:13 pm »

I'd suggest trying it out and letting us all know how it works out. I don't remember seeing many posts about forced pregnancy results.
Logged

Fleeting Frames

  • Bay Watcher
  • Spooky cart at distance
    • View Profile
Re: Guide to inducing pregnancies via DFhack?
« Reply #2 on: September 17, 2017, 06:42:57 am »

Well, interspecies breeding can induce crashes when done wrong, and results in the overwriting of some traits otherwise:
Step 5 SEX CHANGE
This is where the fan-fiction comes up. Using dfhacks Transform-unit i turned Urab into a lady teddy
got the two pregnant then switched back.

And Done!

The kids were satyrs because making them teddies crashed the game.

Snipped from "Making a half-breed" thread.
« Last Edit: September 17, 2017, 06:45:00 am by Fleeting Frames »
Logged

Nolimit

  • Bay Watcher
    • View Profile
Re: Guide to inducing pregnancies via DFhack?
« Reply #3 on: September 17, 2017, 06:57:01 am »

I'm not sure about spouse id, but if I recall correctly, for pregnant creatures when father is not a historical figure (animals) it is set to -1, and it doesn't cause any problems. So I'll assume that spouse Id will only be used for relationships of a child and in legends mode and wouldn't cause any problems for different species and civs, but I am interested to see your results.

If it works, I can see some interesting possibilities for this. Like creating dwarven messiah, by making histfigure of a deity as pregnancy_spouse.

What definitely can cause crashes is genes. If creature has appearence values of different species game can crash when you'll try to view status screen of that unit (thoughts and preferences screen 'z'). Some races, like dwarves for example, have wider range of possible appearances and colors than others. Because of that they could use appearance values from other creatures (at least most of the time, but still there could be some exceptions). But animals and animal people will often result in a crash if their appearance and colors were taken from different species. I found it when I was trying to transform a dwarf into some animal person (by changing unit.enemy.normal_race). When transformed they keep their original genes and it may or may not result in a crash when viewing their screen.
« Last Edit: September 17, 2017, 07:07:00 am by Nolimit »
Logged

Putnam

  • Bay Watcher
  • DAT WIZARD
    • View Profile
Re: Guide to inducing pregnancies via DFhack?
« Reply #4 on: September 17, 2017, 07:50:49 am »

What happens if the pregnancy_spouse id belongs to someone of a different species.

What happens if the pregnancy_spouse id belongs to someone of a different civ.

What happens if the pregnancy_spouse id is left blank.

What the pregnancy_caste field is used for.

1. Crash.
2. Probably nothing unusual.
3. No goddamn idea, might be a crash.
4. I don't know and encourage experimentation.

D_E

  • Bay Watcher
    • View Profile
Re: Guide to inducing pregnancies via DFhack?
« Reply #5 on: September 17, 2017, 08:29:13 am »

What definitely can cause crashes is genes. If creature has appearence values of different species game can crash when you'll try to view status screen of that unit (thoughts and preferences screen 'z'). Some races, like dwarves for example, have wider range of possible appearances and colors than others. Because of that they could use appearance values from other creatures (at least most of the time, but still there could be some exceptions). But animals and animal people will often result in a crash if their appearance and colors were taken from different species. I found it when I was trying to transform a dwarf into some animal person (by changing unit.enemy.normal_race). When transformed they keep their original genes and it may or may not result in a crash when viewing their screen.


Ah, that makes sense as a source of crashes.  Is there an API anywhere?  I ask because the catsplosion script is able to do some editing of genes, but I have no idea how the author knew, for example, that the appearances genes could be accessed via .appearance.genes.appearance (searching the Github repo for 'genes' finds only the catsplosion script).

Quote from: catsplosion lua
            local preg = df.unit_genes:new()
            preg.appearance:assign(female.appearance.genes.appearance)
            preg.colors:assign(female.appearance.genes.colors)
            female.pregnancy_genes = preg

(For the purposes of gerudo reproducing, daughters should simply be able to use their mother's genes without issue.  But it would be nice for the father to have SOME influence on the child, if genes for body size or something can be isolated.)

Also, I just had a mother and daughter gerudo show up at my (non-DFhack) test fortress.  The mother has no husband, and the daughter has no father.  So it seems that leaving the father_id field blank should be fine :D.

(Most gerudo have no family listed; the wacked-out male/female ratio means DF is constantly having to promote out of the abstract population whenever it needs a new hist fig, but this is the first time I've seen it produce a child and mother)

What happens if the pregnancy_spouse id belongs to someone of a different species.

What happens if the pregnancy_spouse id belongs to someone of a different civ.

What happens if the pregnancy_spouse id is left blank.

What the pregnancy_caste field is used for.

1. Crash.
2. Probably nothing unusual.
3. No goddamn idea, might be a crash.
4. I don't know and encourage experimentation.

#1 there is disappointing :(

EDIT: Re #3: catsplosion DWARF results in a generation of dwarven babies (male and female as usual) with the same hair and skin color as their moms and no listed father.
« Last Edit: September 17, 2017, 10:51:33 am by D_E »
Logged
Mods I've done:
Zelda mod-mod, Beta in the Wild DF 47.04
Illithid Empire mod DF 31.25 (update canceled)
Spotter's Guide to Illithids (Genesis mod-mod) genesis 3.19a4 (update canceled)

D_E

  • Bay Watcher
    • View Profile
Re: Guide to inducing pregnancies via DFhack?
« Reply #6 on: September 17, 2017, 12:06:44 pm »

What happens if the pregnancy_spouse id belongs to someone of a different species.

What happens if the pregnancy_spouse id belongs to someone of a different civ.

What happens if the pregnancy_spouse id is left blank.

What the pregnancy_caste field is used for.

1. Crash.
2. Probably nothing unusual.
3. No goddamn idea, might be a crash.
4. I don't know and encourage experimentation.

Sorry to double-post, but new results+question:

I've been tinkering around with your ectobiology script, and I'm able to do #1, at least under some circumstances.

I just changed it to always use 10 as the id (which happened to be a female roc in the testing world), and the children were born right 2 out of 3 times (with a mysterious crash the first time, which might've been related?  Same parents worked the second time, though)

How much testing did you do around #1?

Edit with an update: With the help of your ectobiology script, my potter has given birth to a daughter fathered by a visiting poet.  The various unit details screens don't seem to cause crashes.  I'll see what happens when he leaves the map.

Edit2: I've induced a second pregnancy between my weaver and a visiting merchant (two separate trials).  So far no crashes.  That poet seems to have taken up unauthorized permanent residence in my dining hall, but the merchant took off and the various info screens still don't crash.

(the poet's name is Ecod Rapidslaps.  Perhaps we need to slap him rapidly until he goes home?)

Edit3: There are now 7 children in the fortress fathered by various visitors, permanent residents, and impromptu permanent residents, the oldest of which is two years old.  Mr. Rapidslaps has been 'temporarily visiting' my tavern for the past two years, showing no signs of moving on.  No crashes so far.

Edit4: Year three: Mr Rapidslaps is still loafing in the dining hall; however, I induced a pregnancy between my Planter and an applicant for permanent residence, then booted him off the map.  As with the merchant test, the father successfully left the map without turning his daughter's info and relationships screens into crash-fests.

Also, an interesting finding: A pregnancy between one of my citizens and a father with an (off-site) son resulted in his info and relationships screens listing both his son and his daughter, while the daughter's relationship screen lists only her mother and father, not her (half-)brother.  On the other hand, I induced a pregnancy between a visitor and the mother of the randomly-generated-child-immigrant, and the info screens of both of those children list each-other as sisters.  I'm guessing that Dwarf Fortress tracks sibling-ness through checking for shared mothers?

Edit 5: Year five: Mr. Rapidslaps finally stopped crashing in my dining room and moved on, completing the initial experiment.  As expected by this point, his daughter's info screens have successfully negotiated him leaving the map. 

I did have a run of crashes, but they were strongly associated with protracted combat involving a deku scrub raid, and I eventually got past it by slaughtering the scrubs with my elite squad as they tried to enter the map.
« Last Edit: September 20, 2017, 10:27:37 pm by D_E »
Logged
Mods I've done:
Zelda mod-mod, Beta in the Wild DF 47.04
Illithid Empire mod DF 31.25 (update canceled)
Spotter's Guide to Illithids (Genesis mod-mod) genesis 3.19a4 (update canceled)

D_E

  • Bay Watcher
    • View Profile
Re: Guide to inducing pregnancies via DFhack?
« Reply #7 on: September 23, 2017, 11:48:01 am »

Having failed to turn this into a crash-fest, I'm now looking into automating this process.

I've found how to access personality facets, age, and marital status (which all seem relevant to the project), but I can't find how to check the population and child caps (which would need to be respected by any automated version of this script to avoid extreme irritation for the user).

So, how do you check the fort population and child caps in dfhack?

Logged
Mods I've done:
Zelda mod-mod, Beta in the Wild DF 47.04
Illithid Empire mod DF 31.25 (update canceled)
Spotter's Guide to Illithids (Genesis mod-mod) genesis 3.19a4 (update canceled)

Fleeting Frames

  • Bay Watcher
  • Spooky cart at distance
    • View Profile
Re: Guide to inducing pregnancies via DFhack?
« Reply #8 on: September 23, 2017, 05:00:00 pm »

df.global.init has population_cap, strict_population_cap, etc. things in d_init.txt.

lethosor

  • Bay Watcher
    • View Profile
Re: Guide to inducing pregnancies via DFhack?
« Reply #9 on: September 23, 2017, 09:45:03 pm »

I'm assuming you meant df.global.d_init (since you got the field names right).
Logged
DFHack - Dwarf Manipulator (Lua) - DF Wiki talk

There was a typo in the siegers' campfire code. When the fires went out, so did the game.

Fleeting Frames

  • Bay Watcher
  • Spooky cart at distance
    • View Profile
Re: Guide to inducing pregnancies via DFhack?
« Reply #10 on: September 23, 2017, 10:33:10 pm »

Yes >_>. Derp.

D_E

  • Bay Watcher
    • View Profile
Re: Guide to inducing pregnancies via DFhack?
« Reply #11 on: September 24, 2017, 10:53:36 am »

Thanks :)

Is anything known about the field names/values in genes?  catsplosion uses unit.appearance.genes.colors and unit.appearance.genes.appearance.  Based on how catsplosion babies look neither of those are primitive types, so they presumably have additional fields inside them.  Presumably there are other fields in genes, as well, but I don't know how to find out what they are.

Generally, what is the proper way to find this information out (I mean, everyone can't just ask the forums, right?)?  I haven't found an API specification, and I haven't found definitions for these structures in dfhack's sources.  Are they directly from Dwarf Fortress?
Logged
Mods I've done:
Zelda mod-mod, Beta in the Wild DF 47.04
Illithid Empire mod DF 31.25 (update canceled)
Spotter's Guide to Illithids (Genesis mod-mod) genesis 3.19a4 (update canceled)

D_E

  • Bay Watcher
    • View Profile
Re: Guide to inducing pregnancies via DFhack?
« Reply #13 on: September 25, 2017, 12:07:15 pm »

That works, thanks.

Specifically, I'm curious:

What happens if the pregnancy_spouse id belongs to someone of a different species.

What happens if the pregnancy_spouse id belongs to someone of a different civ.

What happens if the pregnancy_spouse id is left blank.

What the pregnancy_caste field is used for.

(I'm hoping to be able to use DFhack to allow gerudo to have children with visitors to their fortress)

To summarize the data gathered so far:

1) Appears to work without issue.

2) Appears to work without issue.

3) "blank" means -1, and almost certainly works without issue (DF can randomly generate children for which this is true).  Such children have no listed father.

4) "pregnancy_caste" is somewhat misnamed, as is "pregnancy_genes".  These are the genes and caste of the father.  The mother's genes and caste are presumably read by DF at the moment of birth, by which time the father might have died or moved out of active memory somehow.  Based on Nolimit's observations, this is the crash-prone part of the whole thing: DF crashes when a creature's appearance genes assume more options than there actually are for that creature's appearance.  My guess is that pregnancy_caste is used to decode the information in pregnancy_genes.  If true, pregnancy_caste needs to match the actual caste of the unit that the pregnancy_genes were taken from.  Given that pregnancy_caste is an integer ID, it may not be possible to inform DF that the genes were taken from a different species than that of the mother (depends on what exactly aux-value='$$._global.race' does, my understanding is that it assumes that the father's race is the same as the mother's race).  This wouldn't mean that proper cross-species reproduction is impossible, but it would mean that the script-writer must manually translate the appearance genes of the father's species into a matching set of genes for the mother's species. 

[This would mean that the gerudo example has been working because I've been using a second copy of the mother's genes as the father's genes, instead of the actual father's genes... and then accidentally claiming those genes came from a unit belonging to caste #1 (which is the ID of the male caste in the human species, but the ID of a four-armed female in the gerudo species), instead caste #0 (female gerudo) like I probably should have done.  However, it happens that the ancient-cistern-race gerudo caste has exactly the same appearance modifiers as the regular female gerudo caste, which I think is what let me get away with the mistake.]

Logged
Mods I've done:
Zelda mod-mod, Beta in the Wild DF 47.04
Illithid Empire mod DF 31.25 (update canceled)
Spotter's Guide to Illithids (Genesis mod-mod) genesis 3.19a4 (update canceled)

Roses

  • Bay Watcher
    • View Profile
Re: Guide to inducing pregnancies via DFhack?
« Reply #14 on: September 26, 2017, 07:52:12 am »

So how does a unit with a father with a different species behave? Do they just take the mothers information?
Logged
Pages: [1] 2