Bay 12 Games Forum

Please login or register.

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

Author Topic: New SCIENCE in breeding: Domestic Sterility Bug  (Read 28238 times)

Dame de la Licorne

  • Bay Watcher
  • Cats? Check. FPS? Uh-oh...
    • View Profile
Re: New SCIENCE in breeding: Domestic Sterility Bug
« Reply #45 on: August 13, 2014, 02:50:40 pm »

Hiya,

If you take a look at this bug report

Toady has marked this one as "fixed next version", so he must have found at least one thing to fix.

I had noticed that, assuming that ORIENTATION will work as expected in the next version (obviously preliminary testing will still be necessary to confirm it really is fixed), but unless he addresses the breeding bug too, we'll still have testing to do.  Though Tacomagic's results seem pretty conclusive indicators that ORIENTATION snuck into the animals at the same time as the civilization races.  Hopefully that means it's a relatively quick fix.

-Dame de la Licorne

Edit: ninja'd
Logged
If software was real world, then it'd be something equivalent of hitting a nail with a hammer and having a building collapse on the other side of town.

Don't worry people, sometimes -moments occur

Tacomagic

  • Bay Watcher
  • Proud Sir Wordy McWordiness at your service.
    • View Profile
Re: New SCIENCE in breeding: Domestic Sterility Bug
« Reply #46 on: August 13, 2014, 02:53:05 pm »

Edit: ninja'd

Take the forum post from my hand, grasshopper.
Logged

Tacomagic

  • Bay Watcher
  • Proud Sir Wordy McWordiness at your service.
    • View Profile
Re: New SCIENCE in breeding: Domestic Sterility Bug
« Reply #47 on: August 13, 2014, 03:43:44 pm »

OK, I have now pretty much 99.2%* confirmed that the problem with animal sterility is in fact the hardcoded default ORIENTATION tag being applied to animals.

You can override this by adding the following to any creature file under the respective castes (Caste tokens included for clarity, you do not need to include extra gender tokens)


[FEMALE]
[ORIENTATION:MALE:0:0:100]
[ORIENTATION:FEMALE:100:0:0]

[MALE]
[ORIENTATION:FEMALE:0:0:100]
[ORIENTATION:MALE:100:0:0]

Order of the tokens MIGHT be important, so use the above order until further testing has been done along those lines.

*I had 3 groups of animals split in 10F:1M groups.  All females across all groups had offspring, indicating 100% fertility. The chances of this being due to luck rather than the orientation token fixing it is 0.8%.

Next bit of work is to explore whether offspring are effected by the bug with vanilla raws.

I updated the bug report with my findings.  I also added justifcation why the inclusion of gay animals may want to be reconsidered if this is intended behavior.  Basically, while the inclusion of gay animals would be great from a representational standpoint, making an effecient meat industry would tend to incentivise slaughting gay animals in favor of ones that produce offspring, which is pobably not the message that Toady was going for.
« Last Edit: August 13, 2014, 04:03:53 pm by Tacomagic »
Logged

Euius

  • Bay Watcher
    • View Profile
Re: New SCIENCE in breeding: Domestic Sterility Bug
« Reply #48 on: August 13, 2014, 05:10:54 pm »

In case you're curious, this is a dump of the unit.status.current_soul.unk1 flag - which as posted in the dfhack thread is supposed to be the orientation of the unit

This is from a brand new embark on 40.08, in a world generated in 40.08.  The Starter Pack with the addition of a pre-release dfhack, but no other changes.  I used the "Ruin Assault" embark which brings a lot of animals, but the script I wrote as well displays foreign ("monster") units as well.  I unpaused after embark and let the game run - dwarves idle - until Summer.

This was an interesting embark as even though I had previous embarks where an entire species would not get pregnant - presumably due to a "sterile" male - this one had every species get pregnant even the single female cat and pig, but did have several examples of sterile females alongside fertile ones.  5 of 6 dogs and 4 of 6 turkey hens are fertile.

Code: [Select]
                BIRD_TURKEY(177)[Female]        00010000  8
                BIRD_TURKEY(177)[Female]        00000000  0
Pregnant:       BIRD_TURKEY(177)[Female]        00100000  4
Pregnant:       BIRD_TURKEY(177)[Female]        00100000  4
Pregnant:       BIRD_TURKEY(177)[Female]        00100000  4
Pregnant:       BIRD_TURKEY(177)[Female]        00100000  4
                BIRD_TURKEY(177)[Male]          01001000  18
Pregnant:       CAT(158)[Female]                00101000  20
                CAT(158)[Male]                  00001000  16
                DOG(157)[Female]                01000000  2
Pregnant:       DOG(157)[Female]                00100000  4
Pregnant:       DOG(157)[Female]                00100000  4
Pregnant:       DOG(157)[Female]                00110000  12
Pregnant:       DOG(157)[Female]                00100000  4
Pregnant:       DOG(157)[Female]                00110000  12
                DOG(157)[Male]                  00001000  16
                GIANT_SPARROW(38)[Female]       01000000  2
                GIANT_SPARROW(38)[Male]         00010000  8
                GIANT_SPARROW(38)[Male]         00001000  16
                GIANT_SPARROW(38)[Male]         00001000  16
                GIANT_SPARROW(38)[Male]         00001000  16
                GIANT_SPARROW(38)[Male]         00000000  0
                HORSE(161)[Female]              00100000  4
                HORSE(161)[Female]              01000000  2
Pregnant:       PIG(164)[Female]                00100000  4
                PIG(164)[Male]                  00001000  16
                Degel Thukkanustuth[Male]       00001000  16
                Goden Rithuthir[Female]         00100000  4
                Goden Ulabthob[Male]            01001000  18
                Rith Sazirluzat[Female]         00100000  4
                Thikut Ingiztarem[Female]       00100000  4
                Udib Edimalath[Female]          00100000  4
                Zasit Arakingiz[Female]         00100000  4

As a further experiment, I set the turkey hens "orientation" that was zero to 4, and the dogs that 2 to 4 and they both got (nearly instantly) pregnant.

So, the problem cause is confirmed, and fixable with dfhack. 

Quote
I updated the bug report with my findings.  I also added justifcation why the inclusion of gay animals may want to be reconsidered if this is intended behavior.  Basically, while the inclusion of gay animals would be great from a representational standpoint, making an effecient meat industry would tend to incentivise slaughting gay animals in favor of ones that produce offspring, which is pobably not the message that Toady was going for.

Let's also note that homosexual is not sterile, and even if you could argue behavior differences and resistance to normal breeding  (a male animal...maybe..a female, almost certainly not) even then, artificial insemination has been practiced as far back as the 13th century.
« Last Edit: August 13, 2014, 05:23:29 pm by Euius »
Logged

Tacomagic

  • Bay Watcher
  • Proud Sir Wordy McWordiness at your service.
    • View Profile
Re: New SCIENCE in breeding: Domestic Sterility Bug
« Reply #49 on: August 13, 2014, 05:22:29 pm »

Did you happen to check the orientation flag of any wild animals or offspring to see if they were being affected too?  Would save me some time testing if you can just take a peek at the flags =P.

EDIT: Never mind, just saw this in your DFHACK dump:

Quote
GIANT_SPARROW(38)[Male]         00000000  0

Looks like it affects all animals, wild or not.  Likely this means it also affects offspring.
« Last Edit: August 13, 2014, 05:26:15 pm by Tacomagic »
Logged

Euius

  • Bay Watcher
    • View Profile
Re: New SCIENCE in breeding: Domestic Sterility Bug
« Reply #50 on: August 13, 2014, 05:25:47 pm »

Did you happen to check the orientation flag of any wild animals or offspring to see if they were being affected too?  Would save me some time testing if you can just take a peek at the flags =P.

The Giant Sparrow's in the post are wild, and they're not breeding.  This is hindered by the single female with an orientation flag of 2

Unlisted was a large group of amphibian men (7 females, 6 males) who were not pregnant, probably for the same reason the dwarves were not yet even though expressing "proper" orientation flags.
Logged

Tacomagic

  • Bay Watcher
  • Proud Sir Wordy McWordiness at your service.
    • View Profile
Re: New SCIENCE in breeding: Domestic Sterility Bug
« Reply #51 on: August 13, 2014, 05:30:24 pm »

Let's also note that homosexual is not sterile, and even if you could argue behavior differences and resistance to normal breeding  (a male animal...maybe..a female, almost certainly not) even then, artificial insemination has been practiced as far back as the 13th century.

Correct.  Mostly the issue with this particular bug is that "sterility" in the population probably shouldn't be based on the ORIENTATION tag, since that implies that the lack of breeding comes from sexual preference rather than a biological inability to breed.  Culling the herd of non-breeding animals starts to be kind of icky if you start to consider the implications.
Logged

Button

  • Bay Watcher
  • Plants Specialist
    • View Profile
Re: New SCIENCE in breeding: Domestic Sterility Bug
« Reply #52 on: August 13, 2014, 06:52:09 pm »

Aw man, you guys ninja'd my research :( I was gonna let it run another couple years for a better sample, but yeah. You guys know that the zeroes aren't the problem already :P
Logged
I used to work on Modest Mod and Plant Fixes.

Always assume I'm not seriously back

Art

  • Bay Watcher
    • View Profile
Re: New SCIENCE in breeding: Domestic Sterility Bug
« Reply #53 on: August 31, 2014, 09:31:12 pm »

Can anyone upload their txts, if they have fixed this?
Logged

Tacomagic

  • Bay Watcher
  • Proud Sir Wordy McWordiness at your service.
    • View Profile
Re: New SCIENCE in breeding: Domestic Sterility Bug
« Reply #54 on: August 31, 2014, 10:46:48 pm »

Can anyone upload their txts, if they have fixed this?

I haven't modded my raws for this bug, I just deal with the issue by brining extra animals on embark and culling out sterile females right now.

If you have it, you can use DF hack to fix the orientation flags in real time and get them breeding correctly (There is now a version 40.10 of DFHack, so it's a very workable solution right now).  Pretty quick and easy fix when you need to do it.  Just pull up the gui on a creature, go to status > current-soul > orientation and set the appropriate interest flags.

For my part, I just embark with 2m2f of whatever domestics I want to breed.  That gives around an 87.8% chance of ending up with at least one viable breeding pair.  Good enough odds for me.  If I really, really need them to breed, I bring 3m3f, and that gives exceptionally good odds for a breeding pair.  If a female doesn't breed, either recycle her, or DFHack the appropriate interest.

If you really want to mod all the creatures, you could probably write a quick Python or Bash script to loop through all the txt files looking for the two male/female caste tokens and adding the appropriate orientation tokens under each.  Probably only take about an hour or two to write it.

Actually, now that I think about it, it would be next to trivial to do it with notepad++ using extended features.  However, it would also mod all the civilized races to get rid of their chance to be gay/uninterested in children/asexual.  Though you could go back and manually remove the tokens from the sentient races.

Essentially you do a find and replace in files of:

\t[CASTE:MALE]\r\n

with:

\t[CASTE:MALE]\n\t\t[ORIENTATION:FEMALE:0:0:100]\n\t\t[ORIENTATION:MALE:100:0:0]\n

And the opposite for female.  Quick and easy.  Just have to go in and manually remove the orientation tags from anyone that you don't want to be 100% heterosexual.
« Last Edit: August 31, 2014, 10:51:59 pm by Tacomagic »
Logged

Ostar

  • Bay Watcher
    • View Profile
Re: New SCIENCE in breeding: Domestic Sterility Bug
« Reply #55 on: September 04, 2014, 06:51:54 pm »

Could this lack of breeding also be why fish, turtles, etc. go extinct when fished? (Bug 0002780). They start on the map at embark as well.
Logged

Tacomagic

  • Bay Watcher
  • Proud Sir Wordy McWordiness at your service.
    • View Profile
Re: New SCIENCE in breeding: Domestic Sterility Bug
« Reply #56 on: September 04, 2014, 06:59:42 pm »

Could this lack of breeding also be why fish, turtles, etc. go extinct when fished? (Bug 0002780). They start on the map at embark as well.

No, that's a different issue that was supposed to be fixed but is still around to a certain extent because animal populations are set too small for fish. They get depleted very quickly and take a long time to recover with the "fix."
Logged

Tacomagic

  • Bay Watcher
  • Proud Sir Wordy McWordiness at your service.
    • View Profile
Re: New SCIENCE in breeding: Domestic Sterility Bug
« Reply #57 on: September 06, 2014, 08:19:17 pm »

Since there was some interest in this, I created a DFHack script to repair sterile units.  As an option, I also included a way to sterilize units if you want to (so that you can have your cats stop breeding, for instance).

The script (and directions to use it) are here:
http://dffd.wimbli.com/file.php?id=9637
Logged

Art

  • Bay Watcher
    • View Profile
Re: New SCIENCE in breeding: Domestic Sterility Bug
« Reply #58 on: September 07, 2014, 08:06:57 pm »

Thanks a bunch Tacomagic! I will check it out.
Logged

The Bard

  • Bay Watcher
    • View Profile
Re: New SCIENCE in breeding: Domestic Sterility Bug
« Reply #59 on: October 13, 2014, 12:18:00 am »

I'm trying to get my Giant Leopards breeding. They all seem to be the 'right' orientation. What tag do I check in DFHacks' GUI to tell is a creature is pregnant?
Logged
Pages: 1 2 3 [4] 5