Thursday, October 17, 2013

Heredity is finished!

Just finished scribbling the last lines of code in my notebook.  Hellz ya!

Alright so the following is how it works:

Start of world - all mobs spawn with preconfigured genes (within a random choice)
Afterwards Mother Nature takes over.

If sex results in sperm and ovaries coming into contact, a check is made to determine if races are compatiable and if it's true then there is a chance for pregnancy (determined by race pregnant likelihood).  Afterwards then the first thing that is selected is the race of the offspring.  Depending on the parents (and their race genes) this will either result in a full breed, (double dom alleles) Dom breed (one Dom allele, one Rec allele) or a half half breed. (two Rec alleles)

Then parents each donate their genes to the offspring.  In some cases the parents won't be able to pass their genes along for some traits, and when that happens the gene pool for the race is consulted and used to fill in the blanks.

I did cut a few features that I had initially planned on but decided to leave for later.  Those were inheriting a transgender/nongender gene and gene mutations.  Right now transgender/nongender is pre-determined by the race.  And the mutations were for when certain traits become extinct, which shouldn't happen because the gene pool should replenish the traits into the population when parents are missing genes.  (kind of a hack, but it gets the job done)

So this worked out better than I thought.  I still feel like there are a few things I need to tweak and some bug testing that needs to be done.  Overall, I'm very satisfied though!

Going to work on polishing up the fetish menu, and then maybe AI behavior?  We shall see.

Thursday, October 3, 2013

Heredity 202

Just a quick post before I head off to bed!

Progress is tangible!!!
https://www.dropbox.com/s/ee4ixdag0jmx0df/2013-09-30%2020.17.40.jpg

Turned the above into the following:


Test.lua
http://hastebin.com/riyajebowo.vhdl

(The c/p from gmail messed up the font size...  =/ )

I ran outta time typing it up and doing some testing at the library, but I should have it finished soon-ish.

So I just wanted to further expand on the old heredity 101 convo, and this is what I've come up with:

Both sperm_type & egg_type carry genes that determine offspring limitations which is,

Dominant race = RR
Full race           = R
Half race           = r

  • Dominant race (RR) always triumphs over any other race genes when it comes to offspring.  (and they cannot have recessive mixed race genes either)
  • Full race (R) means when there are offspring it cannot be mixed.  It has to be one race or the other.
  • Half race (r) is a recessive race gene, that allows races to mix together (50/50).

Some examples:

Goo girls are RR, and they crossbreed with a human who can be half breeds r, or full breeds R.  In this case it doesn't matter, the goo girl doesn't need the race gene from the sperm donner. (Offspring will always be slimes)  The offspring doesn't get passed any race genes from the other parent, only the parent with the RR genes.

A mermaid (R) produces offspring with a male Nagga (also R).  The offspring either have to be a mermaid or a Nagga.  Cannot be mixed.  But offspring can carry the recessive gene!  Mermaid offspring could be (Mn).  If that mermaid later breeds with someone else who has a Nagga racial gene then that could be an outcome.

Last thing, is if both parents have the ability to be half-races (r) then the offspring will have mixed genes from the two races.  A good example irl is if you breed a white rosé with a red one you will end up with pink.

Anyway this is the list of egg_types for female races in the game now. (Subject to change/be tweaked)

Dom - RR

Goo girl
Spider girl
Bee girl
Dryad
Alaruane
Imp girl

Full - R

Mermaid
Naggas
Harpie
Cowgirl
Unicorn girl
Grizzly woman
Kitsune

Half - r

Siren
Dragon
Elf
Human
Vampire
Neko

Likewise, these same rules will apply to the male sperm_types for races!  (But that is much later)  In the case of sperm and egg both being, RR, it nullifies offspring.

Another thing planned regarding this system is to have transgender/single gender/normal gender choices for races.  Very similar to the above.

Gender types:

One gender = GG
Normal gen = G
Transgender = g

Some races are exclusive to only one type of sex. (Ie. only females for siren).  The rest is self explanatory.

Also if your egg_type or sperm_type is false in the case of certain races, then obviously you can't have offspring.  Gender can also be false for certain races (ex. slimes) that means they are considered to have no gender.

This idea sorta came from how blood types work, o, a, b, ab.  I was doing some research on that and stole a few designs from that system.  Other thing was I remember in Jurassic Park the part where they were explaining how they managed to clone the Dino's by filling in the missing DNA with a frogs.  That gave me the idea to make some races be Dom - RR, that needed the sperm/egg to fill in the missing genes not related to traits.  So we don't end up with half slimes, 1/10 th human, 1/4 spider, 1/8th golem kind of races.  Not only would that be a headache to program, but it gives a not very sexy vibe to a lot of monsters. (Granted some people are into that, but mostly a minority)

Anyway, this feels like it will work out really well when I convert it into code!