Animal breeding

Started by
11 comments, last by Edtharan 17 years, 1 month ago
Well, what you mention does already happen. For instance if both your parents have blue eyes you can still have green eyes, even though the blue eye trait maybe dominant .

How about using a base two system with this for you genes? You have strength, agility, and intelligence genes the ‘slot’ they are in determines whether the amount of points they get for that gene. So have strength in slot 6 would give +32 strength

So let take the desert dragon
aaIaSS

Water dragon
siISaA

Now if we want to determine which traits the offspring will have we can say that dominant (uppercase) has 45% chance of being inherited and recessive (lower case) has 25% chance, the remainder is the chance for mutation. Mutation being a randomly selected gene and dominance.

So the oasis dragon breeding would look like this:

1- 25% a, 25% s, 50% mutation
2- 25% a, 25% i, 50% mutation
4- 90% I, 10% mutation
8- 45% S, 25% a, 30% mutation
16- 45% S, 25% a, 30% mutation
32- 45% S, 45,% A, 10% mutation



Advertisement
Real-Life Genetics is a pretty good system, in my opinion. The basics are simple and seem like they would suffice. It would be really cool to add in things like gene linkage, codominance, incomplete dominance, etc. but this might be more than you're looking for. First, to avoid confusion when I say genes, a gene is a single unit that specifies one trait, like agility, strength, and intelligence. The organism's genome consists of many different genes.

One way I see to make variable traits for dragons is to have multiple genes for the trait. Have six genes for strength, and have them each add a certain amount to the strength if they're dominant (or recessive, if you want).

One thing no one has addressed is the possibility of negative genes. There should be some detrimental traits, like "smoke-breath" that disables their ability to breath fire or a gene that makes them particularly susceptible to a disease. People have mentioned inbreeding as a penalty, but inbreeding itself is not a penalty. The AP near the top basically had the right idea. Inbreeding basically decreases the number of heterozygotes (organisms with two different copies of the gene) in the population in favor of homozygotes(organisms with two identical copies of the same gene). If you inbreed two lines of an organism separately for a while, then combine them, you get a whole bunch of genetically-identical super-organisms (called Hybrid Vigor) that get the best traits possible. This is how domestic corn was developed. Inbreeding is a problem in reality because there are negative genes (which are pretty much all recessive), and inbreeding make more of the offspring homozygous for the negative genes, which causes disease. If you add some negative genes, you would discourage rampant inbreeding, which otherwise would easily produce super-dragons.

TechnoGoth is right about recessive genes being there. The recessive may get masked by the dominant gene, but it is still present to be passed on. In fact, if you have a randomly mating population experiencing no sort of selection whatsoever, the frequency of the recessive version of the gene (not the trait, mind you) will stay the same through an infinite generations.

That was a long post. If you are intrigued by real-life genetics, there's probably a lot of the web or you could PM me and I could expound on how to implement it more.
-----------------------------If pi is used to find the dimensions of a pie,Is cak used to find the dimensions of a cake?
Quote:(See the "Creatures" games.)

Yes. They used GAs there. They also used Neural Networks too.

Quote:Real-Life Genetics is a pretty good system, in my opinion.

Yes, Real Life Genetics is a good system, however, for games, it can be too complex. You don't want your players to need a Degree in Genetics or Animal Husbandry just to play the game. :D.

Use the K.I.S.S principle. Keep it simple.

I think 2 copies of each chromosome and having multiple chromosomes is complexity enough.

If you just have a letter code (or just a number) that codes for a particular trait and the number of those codes in a chromosome will indicate the level of that trait is good enough for a game.

So using this coding system:
S=Strength
D=Dexterity
I=Inteligence

You might have a creature like this:
Chromosome A1: SSSIDDIDSDIDDDSChromosome A2: DIIDSIISIDSISSI


The creature will select (randomly) which chromosome to use for this creature (when it breeds it will again randomly select one of these chromosomes to pass on each time it breeds).

So it might choose the first Chromosome and have it's Stats:
Strength: 5
Dexterity: 7
Intelligence: 3

or it might have selected the second chromosome and ended up with stats like:
Strength: 5
Dexterity: 3
Intelligence: 7

You could have a second chromosome pair used for something completely unrelated to the creatures Stats, like the colouring of the creature (you could use another chromosome for each graphical component).

Like this:
R=Red
B=Blue
G=Green

Chromosome B1: RRGBGBRGRBRGRRBGGBGChromosome B2: GRBBBRBBGBBRGGBRRGB

Which would set the colour of the creature.

Also when breeding you can make random mutations to the chromosome too. So Chromosome A1 might mutate like this:
S'D'SIDDIDSDIDDDS


Mutation insures there will always be variation.

People have mentioned inbreeding as a penalty, but inbreeding itself is not a penalty.

I don't think inbreeding should be explicitly made a penalty. Keep it simple. The fun a game like this has is in the breeding. The players will want to be able to take two good creatures and breed them for specific traits. They won't want to have to deal with the creature's breeding history (which if they can trade them between each other they will not be easily able to track anyway) to avoid inbreeding.

What you really need to capture in any GA system for this kind of game is Variation and Selection. Anything else just begins to complicate matters and makes it harder for players to understand what is going on and then use that understanding to make meaningful decisions.

If the game was just about the breeding, this kind of complexity would be justified, but as breeding isn't the main focus, then more complexity like this (just to make it closer to real life genetics), in my opinion, is not justified.

Quote:What I also like about this system is that you can control how many letters each animal has. If a low-level animal (each letter in the gene is one level) mates with a high-level animal this could result in an animal with a number of letters in the gene between high-level (lets say 40) and low-level (say 10).

Variable length Chromosomes can be handled, but it adds a lot of complexity to your GA system. I would say it isn't really worth it for this type of game.

The easies way (but not exactly how it occurs in real life genetics) is to allow 3 more mutations, rather than just the mutation that changes one code into another code (like in my example earlier in this post).

The 3 new mutations are:
1) Additions: This allows you to add in a new code letter at a random point in a chromosome, which extends the length of the chromosome.

2) Deletions: This is the opposite of the Addition mutation. This causes a random code letter to be removed shortening the length of the chromosome.

3) Breakages: this is designed to stop genomes becoming too long. The longer the chromosome length, the more likely this mutation will occur. The breakage causes the chromosome to split at a random point along it and one part being discarded. The other section is kept and use as the chromosome in the creature.

This will cause very dramatic mutations (that would essentially be a genetic disease that can be passed on and might not actually show up for a couple of generations). This would make the more powerful creatures (longer genomes so they can have more code letters to increase traits) harder to breed (and thus be rarer and more valuable), which works in well for the trading aspect of the game.

This is another complexity that I would not recommend adding unless you thought it would contribute to the fun of the game. It might be justified, as it adds to the trading aspect of the game, and not just to the breeding aspect.

Quote:I just have to find a good way to sore everything in the database.

If you are having set length chromosomes, then Arrays are your friend here. Each Chromosome can be stored in an array and if you are using paired chromosomes, then just add an extra dimension to the array. Multiple chromosomes can be handled by using multiple arrays in a data structure

For example:
If you have a chromosome length of 15 codes, then you could just use an array like this:

GenomeA [15][2]
GenomeB [20][2]
GenomeC [5][2]
...

This will allow you to have different sized chromosomes in the same creature (however, each pair has to be the same length and each creature has the same length chromosomes).

Variable length chromosomes can either be handled by a linked list, or by dynamic arrays.

For files, just use something like a delimited file (like Space delimited - where each chromosome is separated by a space) and read it in as a text file one character at a time.

Eg:
SSSIDDIDSDIDDDS DIIDSIISIDSISSI RRGBGBRGRBRGRRBGGBG GRBBBRBBGBBRGGBRRGB

This topic is closed to new replies.

Advertisement