Okay, I finished investigating what happens to DF genetics when colors are defined separately for males and females. Incoming wall of SCIENCE. Don't say I didn't warn you.
Also, just to reiterate, the conditions this post covers will never come up in an un-modded game. For how genetics function in vanilla creatures, look back at the first post.
GOALIn DF, it's possible to define different sets of potential colors for males versus females. For example, male peacocks are always born blue and female peacocks are always born brown. Because no vanilla creatures with this arrangement have more than one potential color per sex, nobody knows how this affects the system of inheritance. I wanted to find out if it works differently than normal genetics, and how it accounts for the possibility of colors that show up in one gender but not the other.
EXPERIMENTAL SETUPTo start off, here is the slightly modified version of my test creature that is used for these tests:
[CREATURE:ZENGOOSE]
[DESCRIPTION:A very small mammal with short legs and a long tail. It hunts small animals to eat.]
[NAME:zengoose:zengeese:zengoose]
[CASTE_NAME:zengoose:zengeese:zengoose]
[CHILD:1][GENERAL_CHILD_NAME:zengoose pup:zengoose pups]
[CREATURE_TILE:'z'][COLOR:7:0:1]
[NATURAL]
[PETVALUE:1]
[COMMON_DOMESTIC]
[LARGE_ROAMING]
[POPULATION_NUMBER:10:20]
[CLUSTER_NUMBER:1:1]
[BIOME:SAVANNA_TROPICAL]
[BIOME:SHRUBLAND_TROPICAL]
[BONECARN]
[BENIGN]
[GRASSTRAMPLE:0]
[PREFSTRING:agility]
[PREFSTRING:cunning]
[BODY:QUADRUPED_NECK:TAIL:2EYES:2EARS:NOSE:2LUNGS:HEART:GUTS:ORGANS:THROAT:NECK:SPINE:BRAIN:SKULL:4TOES_FQ_REG:4TOES_RQ_REG:MOUTH:GENERIC_TEETH_WITH_LARGE_EYE_TEETH:RIBCAGE]
[BODYGLOSS:PAW]
[BODY_DETAIL_PLAN:STANDARD_MATERIALS]
[BODY_DETAIL_PLAN:STANDARD_TISSUES]
[SELECT_TISSUE:HAIR]
[INSULATION:200]
[BODY_DETAIL_PLAN:VERTEBRATE_TISSUE_LAYERS:SKIN:FAT:MUSCLE:BONE:CARTILAGE]
[BODY_DETAIL_PLAN:BODY_HAIR_TISSUE_LAYERS:HAIR]
[USE_MATERIAL_TEMPLATE:NAIL:NAIL_TEMPLATE]
[USE_TISSUE_TEMPLATE:NAIL:NAIL_TEMPLATE]
[TISSUE_LAYER:BY_CATEGORY:TOE:NAIL:FRONT]
[SELECT_TISSUE_LAYER:HEART:BY_CATEGORY:HEART]
[PLUS_TISSUE_LAYER:SKIN:BY_CATEGORY:THROAT]
[TL_MAJOR_ARTERIES]
[BODY_DETAIL_PLAN:STANDARD_HEAD_POSITIONS]
[BODY_DETAIL_PLAN:HUMANOID_RIBCAGE_POSITIONS]
[USE_MATERIAL_TEMPLATE:SINEW:SINEW_TEMPLATE]
[TENDONS:LOCAL_CREATURE_MAT:SINEW:200]
[LIGAMENTS:LOCAL_CREATURE_MAT:SINEW:200]
[HAS_NERVES]
[USE_MATERIAL_TEMPLATE:BLOOD:BLOOD_TEMPLATE]
[BLOOD:LOCAL_CREATURE_MAT:BLOOD:LIQUID]
[CREATURE_CLASS:GENERAL_POISON]
[GETS_WOUND_INFECTIONS]
[GETS_INFECTIONS_FROM_ROT]
[USE_MATERIAL_TEMPLATE:PUS:PUS_TEMPLATE]
[PUS:LOCAL_CREATURE_MAT:PUS:LIQUID]
[BODY_SIZE:0:0:300]
[BODY_SIZE:1:0:1500]
[BODY_SIZE:2:0:3000]
[BODY_APPEARANCE_MODIFIER:LENGTH:90:95:98:100:102:105:110]
[BODY_APPEARANCE_MODIFIER:HEIGHT:90:95:98:100:102:105:110]
[BODY_APPEARANCE_MODIFIER:BROADNESS:90:95:98:100:102:105:110]
[MAXAGE:10:20]
[ATTACK:BITE:CHILD_BODYPART_GROUP:BY_CATEGORY:HEAD:BY_CATEGORY:TOOTH]
[ATTACK_SKILL:BITE]
[ATTACK_VERB:bite:bites]
[ATTACK_CONTACT_PERC:100]
[ATTACK_PENETRATION_PERC:100]
[ATTACK_FLAG_EDGE]
[ATTACK_PREPARE_AND_RECOVER:3:3]
[ATTACK_PRIORITY:MAIN]
[ATTACK_FLAG_CANLATCH]
[ATTACK:SCRATCH:CHILD_TISSUE_LAYER_GROUP:BY_TYPE:STANCE:BY_CATEGORY:ALL:NAIL]
[ATTACK_SKILL:GRASP_STRIKE]
[ATTACK_VERB:scratch:scratches]
[ATTACK_CONTACT_PERC:100]
[ATTACK_PENETRATION_PERC:100]
[ATTACK_FLAG_EDGE]
[ATTACK_PREPARE_AND_RECOVER:3:3]
[ATTACK_PRIORITY:SECOND]
[DIURNAL]
[HOMEOTHERM:10067]
[APPLY_CREATURE_VARIATION:STANDARD_QUADRUPED_GAITS:900:453:302:151:1900:2900] 58 kph
[APPLY_CREATURE_VARIATION:STANDARD_SWIMMING_GAITS:9000:8900:8825:8775:9500:9900] 1 kph, NO DATA
[APPLY_CREATURE_VARIATION:STANDARD_CRAWLING_GAITS:9000:8900:8825:8775:9500:9900] 1 kph, NO DATA
[MUNDANE]
[LITTERSIZE:10:10]
[CASTE:FEMALE]
[FEMALE]
[SET_TL_GROUP:BY_CATEGORY:ALL:HAIR]
[TL_COLOR_MODIFIER:WHITE:1:IVORY:1:CREAM:1]
[TLCM_NOUN:fur:SINGULAR]
[SET_TL_GROUP:BY_CATEGORY:ALL:SKIN]
[TL_COLOR_MODIFIER:RED:1:SKY_BLUE:1:PURPLE:1:BLACK:1]
[TLCM_NOUN:stripes:PLURAL]
[SET_TL_GROUP:BY_CATEGORY:EYE:EYE]
[TL_COLOR_MODIFIER:GOLDEN_YELLOW:1:BLACK:10]
[TLCM_NOUN:eyes:PLURAL]
[CASTE:MALE]
[MALE]
[SET_BP_GROUP:BY_TYPE:LOWERBODY][BP_ADD_TYPE:GELDABLE]
[SET_TL_GROUP:BY_CATEGORY:ALL:HAIR]
[TL_COLOR_MODIFIER:WHITE:1:IVORY:1:CREAM:1]
[TLCM_NOUN:fur:SINGULAR]
[SET_TL_GROUP:BY_CATEGORY:ALL:SKIN]
[TL_COLOR_MODIFIER:RED:1:SKY_BLUE:1:PURPLE:1:BLACK:1]
[TLCM_NOUN:stripes:PLURAL]
[SET_TL_GROUP:BY_CATEGORY:EYE:EYE]
[TL_COLOR_MODIFIER:GOLDEN_YELLOW:1:BLACK:10]
[TLCM_NOUN:eyes:PLURAL]
The only difference between this one and the first is that instead of all the possible colors being defined under [CASTE:ALL], they are defined under [CASTE:MALE] and [CASTE:FEMALE].
I decided to establish a baseline by leaving the color and dominance options identical between the two sexes. By doing it this way, there's a chance the behavior will exactly match what we saw before. If it doesn't, there's obviously a different system in place.
Apart from that, I did breeding experiments in the arena like I described before.
RESULTSThe results of my first two breeding experiments were… interesting. The colors of the offspring
seemed to be following the normal dominance and inheritance rules, but the ratios were all screwed up.
For example: on a cross where I would have expected the stripes to be 50% red, 25% sky-blue, and 25% purple, I was instead getting 10% red, 50% sky-blue and 40% purple. Not very informative, but pretty weird.
Then on the third cross experiment, I got this:
Pair #3
M/F | Fur Stripes Eyes
--------------------------------------------------------------
Father M white black black
Mother F ivory red black
--------------------------------------------------------------
Pups:
#1 F ivory sky-blue black
#2 F ivory red black
#3 M white black black
#4 M cream black black
#5 F ivory red black
#6 M white black black
#7 M white black black
#8 M cream black black
#9 F ivory sky-blue black
#10 M cream black black
...Yeah, there's a problem here. Look at the stripes. We have 2 reds, 2 sky blues and 6 blacks.
The dad is black-striped, and black is the most recessive color, which means dad has to be carrying two black stripe genes (BB). That means the red and sky-blue stripes both have to come from mom (RS). But then… for
any of the babies to have black stripes, they would
also need to be carrying two black genes (BB). They got one from dad… but mom doesn't have any to give. So what's going on?
Then I noticed a pattern. If you sort the offspring by gender...
Pair #3 sorted by gender
M/F | Fur Stripes Eyes
--------------------------------------------------------------
Father M white black black
Mother F ivory red black
--------------------------------------------------------------
Pups:
#1 F ivory sky-blue black
#2 F ivory red black
#5 F ivory red black
#9 F ivory sky-blue black
#3 M white black black
#4 M cream black black
#6 M white black black
#7 M white black black
#8 M cream black black
#10 M cream black black
...Suddenly the system it's using becomes obvious.
It looks like when colors are defined separately for each gender, babies receive the genes
only from the parents of the same sex. The males only receive genes from the father, and the females only received genes from the mother, with absolutely no crossover.
-------------------------------------------
Now, I
could have easily left it here, but this raised another nitpicky question I wanted to answer:
What system is the game using to decide what genes the single-parent passes on?
Because the babies only recieve genes from one parent, there's basically two main options here:
Option 1: The game looks at the parent's genes, duplicates them, and then runs the usual mating algorithm on those. Basically, it treats it like the parent breeding with itself.
Example: Father is carrying red and black stripe genes (RB). For a male offspring, the game simulates breeding an RB with an RB. (possible outcomes: RR, RB, BR, BB)
Option 2: The game looks at the parent's genes, picks one at random, doubles it and passes it to the offspring.
Example: Father is carrying red and black stripe genes (RB). The game flips a coin, chooses one, and sends two copies to the child. (Possible outcomes: RR, BB)
This actually kind of matters for breeding, because if that uses the latter system, there are no more "hidden genes" after the first generation. So from the second generation onwards, red-striped males could only ever have red-stripes sons, etc.
I ended up testing this in two different ways:
TEST 1Quickest way to test this was with our old friend, Punnet square ratios!
Take a parent with two different color genes.
- If the game uses the "breed-with-self" system, you'd expect to see the dominant gene color option from the parent showing up 75% of the time, and the recessive color 25% of the time, due to the recessive gene being "hidden" 50% of the time. (from the above example, RR = red, RB = red, BR = red, BB = black)
- Alternatively, if it uses the "pick-one-and-double" system, you'd expect to see them both show up equally (50% dominant / 50% recessive) because no hidden genes are present.
To test this I just did a simple breeding experiment with the litter size cranked up to 40. Recorded all the appearances of the babies, and did some math.
Results:
The litter conveniently had 20 girls and 20 boys. After tallying everything up, I found that in this litter, dominant colors showed up
41% of the time and recessive ones
59% of the time.
Then I did some
Chi-squared bullshit to statistically confirm what was already pretty obvious: 41% is nowhere near 75%, so we can pretty confidently
reject the "breed-with-self" model based on this data set.
This means we can throw out one model, but that doesn't necessarily prove the other one is correct. Luckily, there's another way to test it.
TEST 2....Here's where that second-generation testing comes in.
The idea behind this one is really simple: If the "pick-one-and-double" model is true, every child born past the second generation will be a perfect clone of its same-sex parent. Again, because there's no more hidden genes in the population. All it would take would be a single child looking different from their parent to disprove the entire thing, so this test should be pretty definitive!
So here I just did a series of second-generation breeding tests like I described in my last big post, with the litter size set to 20 for a larger sample size.
Results:
I had three tests that failed because one of the starting pairs refused to breed (
) but finally got some results:
Second-Generation Cross #1Father: ivory fur, black stripes, golden yellow eyes
Mother: ivory fur, red stripes, black eyes
Offspring:
9 males with ivory fur, black stripes, golden yellow eyes
11 females with ivory fur, red stripes, black eyes
Second-Generation Cross #2Father: white fur, purple stripes, golden yellow eyes
Mother: cream fur, purple stripes, black eyes
Offspring:
14 males with white fur, purple stripes, golden yellow eyes
6 females with cream fur, purple stripes, black eyes
...Yeah, I think I'm ready to call it.
Option 2 wins.--------------------
CONCLUSIONSWell, that was a huge amount of work for something very few people will ever care about, but that's okay!
To summarize what I found:
If a creature is modded so that the color options for their hair/skin/tissues/etc. are defined separately for each gender, the game
does not use the normal genetics system for inheritance. Instead, offspring receive all of their genes from the parents that is the same sex they are, and no genes from the opposite parent. Daughters inherit genes only from their mothers, and sons inherit genes only from their fathers. As a side effect of how the system apparently handles this, all breeding done from the second generation onwards will produce only perfect clones of their parents, meaning a huge amount of genetic diversity is inevitably lost.
Differences or similarities in the color list between males and females don't matter because they are essentially two completely separate gene pools.
I guess this way of dealing with it makes the most sense, given all the potential weirdness with DF's caste system, but it's still a bit disappointing. It means that it's impossible to add even a single gender-specific color without sort-of-breaking the entire genetics system.
But at least now we know.