Trait genetics

**Trait genetics** is the system the game uses to determine if a hero has a particular trait and how that hero may pass traits to children.

The game somewhat simulates basic genetics where the presence or absence of each trait is determined by a gene pair with the trait always being attached to the recessive gene. This means that a hero only has a trait if both genes in the pair are positive for the trait, but if only one gene is positive, the hero will not have the trait pass the trait on to his or her children, but has a hidden chance of passing the trait to children if paired with another hero with at least positive gene for the same trait. Additionally, traits that are opposite of each other cancel each other when the hero has both. For these "duality" traits, which represent most of the game's traits, a hero will not have either trait if they have all positive genes for both traits, though it increases the odds they may pass either on.

Just as in biological genetics, the gene pairs of a child are created by selecting one random gene from the father and one from the mother for each pair. There is a 50% chance of either gene in each pair being passed on. Just as in real genetics, this means the chances of a trait being passed down can be estimated through the use of Punnett squares.

The game mechanics also introduce a small chance for genetic mutation that minutely alter those odds by providing a tiny random chance that a gene pair will be completely random. But unlike biological genetics, there is a limit on the number of active traits. This can decrease the chances of any particular trait being inherited well below the normal genetic chances.

## Singularity (unpaired) traits

Resulting traits

Resulting gene pairs

Legend for above tables
 **x** | Recessive gene **positive** for trait X

"Singularity" traits have no opposite trait that can cancel them out, simplifying the probabilities that a given trait will appear in a child.

The singularity traits are:

* Arthritis
* Asthmatic
* Spry

For these traits, the odds of passing the trait to a child are not particularly complex:

 One parent has the trait
 Neither parent has the trait

The average chance reflects the weighted average of all possible gene pairing combinations that the situation covers, but the actual odds of passing on the trait will be determined by the specific gene pairs of the parents. *They are also further affected by the chance for genetic mutation and by the trait limit, which are not reflected in the above figures.*

## Duality (paired) traits

Resulting traits

Resulting gene pairs

Legend for above tables
 Y
 **y** | Recessive gene **positive** for trait Y

"Duality" traits are traits that have an opposite trait. When a hero has all positive genes for both traits in a duality, the two traits cancel each other out and the hero has neither trait.

The pairs of duality traits are:

* Bear Strength and Puny
* Brainy and Dimwitted
* Bountiful and Infertile
* Hawk Eye and Nearsighted
* Hearty and Sickly
* Impressionable and Strong Willed
* Kingmaker and Queenmaker
* Longevity and Heart Disease
* Nimble and Clumsy
* Quick and Slow
* Quick Study and Slow Learner

Because each pair of traits cancels each other out, the presence of each trait is effectively determined by two gene pairs rather than just one. This makes determining the odds much more complex as there are 256 possible parental combinations to consider. We can divide these combinations into six general cases to determine odds. The following refers to the first trait in the pair as "trait X" and the other as "trait Y."

Note that the above table treats inheriting both traits as the child ending up with neither, but the child will carry all positive genes for both traits, making it more likely they may pass one on to their children. Again, the odds do not reflect the chance for genetic mutation or the effects of the trait limit.

## Limit of three traits

Trait limit effect on inheritance odds
 2
 3
 4
 5
 6
 n

If a child ends up with more than three active traits, then traits are randomly deactivated until there are only three. This is done by randomly switching one of the positive genes in the pair to a negative one.

This random deactivation only affects the odds of inheriting a particularly trait if a child ends up with more than three, but when this happens, the effect is quite significant. For example, if both parents have a trait, they would normally be guaranteed to pass it on, but a single random deactivation would effectively reduce those odds to 75% because only three of four traits will be kept. A trait that would normally have a 50% chance of inheritance would effectively reduce the odds to 37.5% (50% times 75%).

The odds continue to fall for each trait removed as determined by simple division: three divided by the total number of traits the child ended up with. As parents will only have up to three traits, a child will probably very rarely end up with more than six, though it wouldn't be impossible as nothing in the system prevents heroes from having many positive-negative gene pairs. And with duality traits, they could have positive-positive pairs canceling traits out for themselves, but making it more likely they get passed on.

## Genetic mutation

When two heroes have a child, there is a 1 in 500 chance for each gene pair that two completely random genes will be chosen, rather than one random gene from each parent. Overall, if this is triggered for a gene pair on a trait the child did not have, this means a 1 in 2000 chance for a singularity trait. The same is true for duality traits if the opposite trait is not present; otherwise, this works out to a 1 in 2000 chance of deactivating the opposite trait in the duality.

This does not significantly affect the odds of trait inheritance. It means that the actual maximum chance of passing on a trait to a child is 99.85%, and it will never affect odds by more than 0.15%.

## Random heroes

Many heroes are not acquired by a player's heroes reproducing and do not gain traits via inheritance, such as the initial heroes of a new game or those acquired through adoption or as combat rewards. Instead, their genes are simply generated randomly with a 50% chance of each gene being positive for a given trait. For singularity traits, this represents a simple 25% chance of the hero having any particular trait before the trait limit is applied. Because duality traits can cancel each other out, their chance falls to 18.75% before application of the trait limit.

## Odds in detail

This section covers in detail how the odds for various combinations work out. These odds ignore the effects of genetic mutation and the trait limit.

### Singularity traits

Table legend
The table is divided based into groups based on the trait information viewable in the game interface. The subgroups combine statistics for all the pairings within that group that have the same odds of passing on the trait.
* **Group**: One of the following:
	+ xx: Indicates genetic pairings where both parents have the trait.
	+ xn: Indicates genetic pairings where only one parent has the trait. The other may carry a positive gene for it.
	+ nn: Indicates genetic pairings where neither parent has the trait, though each might carry a positive gene for it.
	+ All: Includes all possible gene pair combinations.
* **Pairings**: Indicates the number of gene pair combinations in that group that give those odds of passing on the trait.
* **Chance**: The chance the child will inherit the trait from parents with one of those pairings.
* **Group pairings**: The total gene pair combinations in the group.
* **Average chance**: The average chance for all gene pair combinations within the group. This is rarely the actual odds the child will inherit the trait, as it depends on the exact gene pair combination of the parents.

### Duality traits

Assuming "trait X" are "trait Y" are paired duality traits:

Table legend
The table is divided based into groups based on the trait information viewable in the game interface. The subgroups combine statistics for all the pairings within that group that have the same odds of passing on the trait.
* **Group**: One of the following:
	+ xx: Indicates genetic pairings where both parents have trait X. Each might carry a positive gene for trait Y as well.
	+ xn: Indicates genetic pairings where only one parent has trait X and the other has neither trait, though may carry positive genes for either.
	+ xy: Indicates genetic pairings where only one parent has trait X and the other has trait Y. They may carry one positive gene for the opposing trait.
	+ nn: Indicates genetic pairings where neither parent has either trait, though they might carry up to one positive gene for each.
	+ yn: Indicates genetic pairings where only one parent has trait Y and the other has neither trait, though may carry positive genes for either.
	+ yy: Indicates genetic pairings where both parents have trait Y. Each might carry a positive gene for trait X as well.
	+ All: Includes all possible gene pair combinations.
* **Pairings**: Indicates the number of gene pair combinations in that group that give those odds of passing on the trait.
* **X Chance**: The chance the child will inherit trait X from parents with one of those pairings.
* **Y Chance**: The chance the child will inherit trait Y from parents with one of those pairings.
* **XY Chance**: The chance the child will inherit trait X and trait Y, which results in them canceling out so the child effectively inherits neither. These outcomes aren't counted in "X chance" or "Y chance."
* **Group pairings**: The total gene pair combinations in the group.
* **X average chance**: The average chance of passing on trait X for all gene pair combinations within the group.
* **Y average chance**: The average chance of passing on trait Y for all gene pair combinations within the group.
* **XY average chance**: The average chance of passing on trait X *and* trait Y for all gene pair combinations within the group. Again, these outcomes are not counted in "X average chance" or "Y average chance" since they cause both traits to be canceled.