Mods / Genelib

Tags: #Library
Authors: sekelsta, safwyl, Shintharo12
Side: Both
Created: May 16th at 10:23 AM
Last modified: 16 hours ago
Downloads: 12271
Follow Unfollow 149

Recommended download (for Vintage Story 1.20.12):
genelib_1.1.7.zip  1-click install


This mod does nothing useful on its own. Install if another mod requires it.

Make sure to fully exit and restart your game when updating the mod version!

 

This mod provides genetic inheritance support for mods which depend on it. Currently that includes:

Truth and Beauty: Detailed Animals - currently only chickens and goats, more animals planned!

Equus: Wild Horses

Genetic inheritance

Basics of how genetics work: Each species comes with a number of genes, each of which may come in multiple variants. Every individual animal has two of the variants for each gene, or two identical copies of the same variant. These determine traits such as coat color.

To give a concrete example, let's look at horses. Horses have a gene called extension that determines which type of pigment colors their fur. One variant called E allows for both black and 'red' (a term geneticists use for a range of shades from coppery to golden), while the other one, e, only allows red and not black. Since every animal has two variants of each gene, an individual horse could have E/E (that is two identical copies of E), E/e or equivelantly e/E, or e/e. You'd probably figure a horse with E/E would be partly red and partly black, while a horse with e/e would be fully red, and you'd be right (with some simplification). But what about E/e, that has one of each variant? For that we need to know that E is dominant over e and therefore hides its effects, so the horse would be partly red and partly black just like with E/E. Conventionally the dominant gene is named with a capital letter and the recessive one with lowercase, which makes it easy to remember which one wins conflicts (but sometimes hard to remember what each one actually does).

Ok, but what does all that have to do with inheritance? Well, when two parents produce a foal, they pass on one of their two variants of each gene, chosen at random. So if the mother has E/e, she has half a chance to pass on the E and half a chance to pass on e. And suppose the father has e/e, he passes one on at random and it's going to be e because that's the only one he's got. Putting those together you have half a chance to get a foal with E/e who looks like its mom, and half a chance the foal will be e/e and look like its dad. It doesn't always have to work out this way! Other pairings might get foals with a 100% chance to look like say their mom, and others still might have a chance that the foal will not look like either parent. You can figure out which situations these happen by doing way too many Punnett squares in your local high school biology class.

This horse example of course only applies if you have Equus: Wild Horses installed.

Sex-linked genes

These are only implemented for chickens in Truth and Beauty: Detailed Animals at the moment. Remember how I said each animal has two variants of each gene? That was actually a simplification that these put the lie to. Depending on its species and gender, an animal may have one or two variants - not two different ones or two of the same one, but actually two or only one - matching the sex chromosomes it has.

You may have heard that males have an X and a Y chromosome, while females have two X chromosomes. This is the case for mammals generally (don't mind the platypus). However, birds do things differently. In birds, the male has two Z chromosomes, while the female has one Z and one W. Don't worry too much about the changed names, the important bit is that in mammals, females have two of the same sex chromosome and males have one of each, while in birds it's reversed.

To give a somewhat obscure but concrete example, in chickens there is a sex-linked gene that can allow or prevent the legs from being black. For simplicity let's only consider black chickens, not brown ones. The brown ones generally have yellow or light legs regardless of the gene we're about to discuss. Anyway, for black chickens, a sex-linked gene called 'inhibition of dermal melanin' affects whether their legs will be black like their feathers, or yellowish. One variant causes black and the other causes yellow, and yellow is dominant. This is sex-linked on the Z chromosome of chickens, that's the one males have two of, so any male chicken has two variants (two of the same or one of each), while each female chicken only has one. Just like the regular genes, a male chicken will pass on one of his two variants at random to each chick. However females have one variant - on their Z chromosome - and then a W chromosome that does not have the gene at all. They could pass on either their variant of the gene together with the rest of the Z chromosome, making a male chick, or they could pass on their W chromosome, for a female chick.

Let's look at an example where a hen with yellow/- is crossed with a rooster with black/black. That's a hen with yellow legs and a rooster with black legs. The rooster is guaranteed to pass on the gene for black legs because that's the only version he has. The hen can either pass on her yellow, also making the chick a male, or pass on her W chromosome, making the chick a female. So when you hatch a batch of chicks from this pair, all of the males will have yellow legs like their mother, while the females will have black legs like their father. I bet you thought it'd go the other way, huh? But no, this is how it works out in this one example. Other pairs of parents might get different results, like if you crossed the male (yellow/black) with the female (black/-) chicks from that pairing you'd get yellow-legged females, black-legged females, yellow-legged males, and black-legged males, each with equal probability.

Don't forget to reverse all that if you're working with mammals instead of birds. :p

Mutations

For every young animal born, there's a tiny chance that a mutation happens and it could inherit a different variant of a gene than what its parents would normally have provided. The chance is really very tiny, I'll leave the exact number vague but just say it's less than one in ten thousand per gene. Mutations are not intrinsically good nor bad, just different.

Inbreeding

Animals in mods using this library may have reduced fertility if they are inbred. If you don't want to think about the details, just try to avoid breeding close relatives like parents or siblings together.

Inbreeding is based on real-life genetics rather than popular conception, so you may find these details surprising:

  • If you do inbreed animals, due to genetic purging the offspring will tend to be more resistant to inbreeding than their parents were. This will not change fast enough to avoid the negative effects.
  • An animal will only be inbred if both its parents are related - so if you have two different very inbred families (say, one player's ranch and another player's ranch), crossing them will produce offspring that are not inbred at all, but are related to both families.
  • Inbreeding for multiple generations in a row is much worse than doing it just once. One of the worst possible strategies is to breed siblings together, then breed their children together and repeat. The only worse strategy is this one.
  • If you are only able to capture one pair of animals from the wild, there are still better and worse breeding strategies you can do with them. Worse ones are as above. Better is to get at least 2 male and 2 female offspring from the original pair (the more the merrier), then you only need to cross siblings once before you can start working with cousin pairings.
  • The system is not based on family trees so you can't trick it by finding obscure relations that don't count. Distant relatives count a tiny bit and close relatives count a lot. Overall I'd recommend trying to keep things around cousins range or less.
  • Small amounts of inbreeding are unlikely to cause problems. If you follow the tree of life back far enough we're all just a little bit related anyway.


Reduced fertility will show as:

 - With vanilla breeding mechanics: The female's portions eaten will go down to 0 without her becoming pregnant.

 - With Detailed Animals: The female will become pregnant, but then miscarry. Or for egg layers, the egg will lose its fertility during incubation.

 

Why was this feature added? Because I want to later add genetics for traits such as size, health, maybe stamina, and so on. And an interesting detail of realistic genetics that most people don't expect is that if you are breeding to maximize or minimize a certain trait you need to avoid too much inbreeding. Inbreeding makes animals very similar to one another, but if you're trying to change a trait, you want them to be different. So this time I added in a reason to avoid that right from the start, and this one was the gentlest possible implementation I could think of.

 

See https://github.com/sekelsta/genelib/wiki/Configuration for info on how you can configure this mod.

 

Languages

English, Spanish (Español). I am a beginner at Spanish so please let me know if there are errors, por favor dime si hay errores.

French (Français) --- Thanks to Flamby38

German (Deutsch) --- Thanks to Brady_The

Polish (Polski) --- Thanks to Niexyk

Portuguese, Brazilian (Português brasileiro) --- Thanks to Zatin

Russian (Русский) --- Thanks to ИгОорКа

Ukrainian (українська) --- Thanks to DeanBro

As of version 1.1.4, English, Spanish, German, Polish, Portuguese, Ukrainian, and Russian are complete and up-to-date.

Mod Version For Game version Downloads Release date Changelog Download 1-click mod install*
1.1.7 202 16 hours ago genelib_1.1.7.zip 1-click install

From 1.1.6:
Features ported from Truth and Beauty: Detailed Animals: Animals display pregnancy length, pregnancy length can randomly vary, and miscarriages from inbreeding now happen partway through the pregnancy.
Possible fix for baby boom bug
Add logging to hunt down the baby boom bug if not fixed

From 1.1.7:
Avoid throwing exceptions when detailedanimals is also used

1.1.5 2122 Jun 30th at 1:18 PM genelib_1.1.5.zip 1-click install

Possible fix for multiple foals from a single mating (more than expected from rare twin chance)

1.1.4 1472 Jun 21st at 3:53 PM genelib_1.1.4.zip 1-click install

Add Ukrainian translation thanks to DeanBro

1.1.3 1009 Jun 19th at 3:53 PM genelib_1.1.3.zip 1-click install

Fix bug where litter size json (specifically spawnQuantityMax) was interpreted incorrectly

1.1.2 305 Jun 18th at 1:46 PM genelib_1.1.2.zip 1-click install

Slightly more specific error reporting

1.1.1
1.20.11 - 1.20.12
3295 Jun 4th at 5:49 PM genelib_1.1.1.zip 1-click install

Fix out of bounds array access from genelib.multiply

1.1.0 313 Jun 4th at 10:29 AM genelib_1.1.0.zip 1-click install

Move naming/info and inbreeding avoidance from Detailed Animals to here

If using Truth and Beauty: Detailed Animals you MUST update that mod to version 0.5.1+ when updating this one

1.0.4 1248 May 30th at 8:53 PM genelib_1.0.4.zip 1-click install

A probable future feature will go better if you play with this version instead of the older one

1.0.3
1.20.11-rc.1 - 1.20.11
809 May 20th at 7:30 PM genelib_1.0.3.zip 1-click install

Recompile for Vintage Story 1.20.11-rc.1

1.0.2 999 May 19th at 3:59 PM genelib_1.0.2.zip 1-click install

Fix wildtype genes being chosen more often than intended

1.0.1 40 May 16th at 2:13 PM genelib_1.0.1.zip 1-click install

Recompile for VS 1.20.11-rc.1

1.0.0 448 May 16th at 10:24 AM genelib_1.0.0.zip 1-click install

First release. Compatible with VS 1.20.10 only, not with VS 1.20.11-rc.1.


4 Comments (oldest first | newest first)

💬 sekelsta , Jun 11th at 10:51 AM

Jasalina I can't do a thing without the error message. Send it through discord or github, please.

💬 Jasalina, Jun 11th at 3:30 AM

I'm having crashing my game issues with over 100k errors from this mod looking to make something pregnant?   was fine for weeks aand then all the sudden  I  can't play for more than 10 mins before the game crashes from the mods errors. 

 

💬 sekelsta , May 29th at 4:42 AM

JustaKobold I've added this info to the description, along with more reasoning for why it is the way it is.

💬 JustaKobold, May 29th at 2:45 AM

what animal mods does this affect?

 (edit comment delete)