Jump to content
artexercise

Random Fish

Recommended Posts

I was thinking about the dragon breeding and while this is outside of the scope of DG, I decided to come up with a little exercise for myself to generate some random elements. I'm hoping I can turn it into a bigger project.

 

Assigned 3 Genes to a sprite and then picked out a host of colors. I named the color pallete Jellyfish for my future project.

Then randomized two parents and had them produce one offspring. This can be seen at the top of the referenced web page.

 

Of the Three Alleles, A is dominant and B and C are co-recessive.

I may have missed the mark on how the genetics really happen but I have good results nonetheless.

 

You can see the Genetic Code at the Top and the Results at the bottom of the page are First Parent, Second Parent, and Offspring in that order. The images at the bottom are generated on the fly as is the genetic code. There are 64 different possible fish. 65 if you include the base fish at the top.

 

Used PHP and the GD2 module in PHP.

 

http://artexercise.mygamesonline.org/Animus/gdtest.php

 

Basically just sharing my excitement. The sprite is my original work as well.

Share this post


Link to post

Ooh the idea of doing adoptables with actual genetics is really cool!!

 

What do you mean by co-recessive though? Like codominant genes, but both recessive to A? If we're talking actual biological terms...codominance refers to each trait dominating the other in "patches", like red and white on roan cows. Incomplete dominance would be the colours blended together. ;3

 

Then there's skin colour in actual humans, which is determined (kinda, genetics is complicated) by three genes A, B, and C; every time you get an uppercase letter that's more melanin produced and therefore darker skin. You could incorporate a system kind of like that too with different genes contributing different hues maybe?

 

(Ignore me I'm a high school kid who took a biology course but damn if fish aren't hella exciting)

Edited by Fractional Pi Day

Share this post


Link to post

So the Rules I am using for each pair in the code.

Capital Letter is dominant over lower case.

A is expressed over B or C

if BC or bc then blend.

 

Example.

 

ABBccb = 1) AB, 2) Ba, 3) cb

in 1 A is expressed

in 2 B is expressed

in 3 c and b are blended to created a new color.

 

I am calculating the color by adding the red values together then dividing by two and likewise for green and blue.

 

Example.

Red 255 and Red 11 = Red 133.

Share this post


Link to post

To make it clear, the reason roan is codominant in cattle is because RR is solid white, rr is solid red, and Rr is where each individual hair is EITHER red or white in a blend. If it were incompletely dominant, all the hairs would instead be a lighter red/pinkish colour.

Share this post


Link to post

...Yeah that's. That is pretty far from real genetics.

 

How it works mostly is that each person (barring weird mutations) has a certain gene that determines a certain trait (colour, fin shape, etc.), and (usually) two alleles of that gene that will determine what that trait is (pink, triangle, etc.). Children inherit one allele from each parent.

 

In proper notation the alleles are represented as capital (dominant) and lowercase (recessive) letters of a single letter - e.g. P for purple flowers and p for white flowers. The possible genotypes (combinations) are then PP, Pp, and pp, and the first two of those would be purple because the presence of a dominant allele masks the recessive one. So I don't really have any idea what you're doing here.

 

If you want to delve into some more accurate models of genetics and inheritance I can totally explain more!! But if you just want to play around with stuff the way you have it that's cool too :3

Share this post


Link to post
...Yeah that's. That is pretty far from real genetics.

 

How it works mostly is that each person (barring weird mutations) has a certain gene that determines a certain trait (colour, fin shape, etc.), and (usually) two alleles of that gene that will determine what that trait is (pink, triangle, etc.). Children inherit one allele from each parent.

 

In proper notation the alleles are represented as capital (dominant) and lowercase (recessive) letters of a single letter - e.g. P for purple flowers and p for white flowers. The possible genotypes (combinations) are then PP, Pp, and pp, and the first two of those would be purple because the presence of a dominant allele masks the recessive one. So I don't really have any idea what you're doing here.

 

If you want to delve into some more accurate models of genetics and inheritance I can totally explain more!! But if you just want to play around with stuff the way you have it that's cool too :3

I'm making it more complex.

 

I have a passing familiarity with genetics and rather than trying to mimic life so closely I've created a set of rules that would make it interesting to play around with. I'm also dealing with a simple sprite graphic and the goal to generate color mutations on the fly that had some basis on a history. The history being ancestry.

 

If however you had some suggestions I'm willing to hear and consider what that would mean in code. Color is all I want to deal with at the moment however.

Share this post


Link to post


  • Recently Browsing   0 members

    • No registered users viewing this page.