Design and documentation journal for my interactive fiction (text games); also reviews and other miscellaneous stuff.

Friday, February 19, 2010

Redoing the Genetics

So until now, genes were handled as a table.
There was a Table of Existing Sheep Herd with a lot of open columns of numbers:
Coat 1 Coat 2 Spot 1 Spot 2 Pattern 1 Pattern 2 . . .

There is currently being altered. First, we got to the point where I realized that the table would be INSANELY LARGE. And even if I was never actually entering values, it would bug me forever.

Secondly, since all domestic animals and plants will have genes, it's insane to plan to handle them differently. When I originally did the core sheep appearance genetics, I wasn't really able to pick apart what I needed. But the code is complex, and although it works, going back through it is very daunting. And, really, a bunch of that code is going to be the same for every. single. gene.

Some of that I could manage, but some of it I couldn't. The alleles weren't really connected to the sheep except through the animal's name, which was a problem from the start, but one I worked around.

This is better. Genes are things, which are part of the animal or plant. I haven't decided whether to make them examinable or not. Genes have alleles. Dominance is either handled automatically (if we're talking about simple dominance) or via internal handling (if we're talking about incomplete dominance, co-dominance, etc.)

Numeric genes are for factors where I want/need a lot of leeway. Butterfat, for example, I don't want to be low, medium or high - I'd prefer to have a finer grade than that. Also, when animals breed, numeric values combine and have a chance to go up/down. I haven't ironed out the wrinkles yet, but it should be able to crudely mimic factors that aren't controlled by a single set of genes, and that have a wide range of phenotypes. Body size, muscling, fat, feed efficiency - all these are candidates.

There is still a lot of fiddly stuff involved with genetics, and there's no way around that if I want a complex presentation. Hopefully, this will make it easier to find the existing loopholes and close them, and handle genes in an interesting way. Oh, and make introducing mutations better.

I can't think of any way around this: currently every gene has a table of approved allele values. Since the hair color alleles for one species are rarely exactly the same as another species, this means a gobsmack of tables, plus phenotype handling for the incompletely dominant ones, plus phenotype handling overall, coordinating between two-six different appearance genes to produce one cohesive paragraph about appearance.

That's going to be the first trial by fire for dynamic text. We'll see how it goes.

No comments:

Post a Comment