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

Tuesday, February 23, 2010

Genetics, Redux

More genetics is happening. A lot of research is going on. It's sort of frustrating, because even color genetics is not fully understood for most animals. Interaction between breeds? The basis for heterosis, or hybrid vigour? How long heterosis persists, and what exactly it affects?

Even things like "what genes turn cows white" is a complicated subject. Lots. And some that haven't been fully identified yet. Yes, there's nothing like coding things that no one understands. (For obvious reasons, I'm not coding secret white genes or anything. The game is complicated enough just sticking to what is sort of guessed.)

Don't even get me started on plants, where I will have to start making up stuff. Mendel got lucky when he chose peas - they're pretty easy.

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.

Friday, December 11, 2009

FTA Update

Busy few weeks, with the holiday and all. I'm not feeling inclined to do much programming, so I've been trying to figure out how to implement some larger systems, and occasionally doing some research, like how long a bar of soap might last someone, or what conditions make seeds less viable. Stuff that may or may not make it in, but stuff I think is interesting to know.

I don't think I'll be working on a game for the jayisgames comp - right now I'm pretty overwhelmed with real life stuff, and the one idea I had that I liked requires some significant research to pull off properly. I did have a second idea for a zombie game in a science lab, where you have to combine chemicals to kill the zombies, but the implementation thing pretty much killed the game before I got started. Besides, since zombies don't breathe, most of the reactions I was considering were explosions. Cool, but not what I had in mind. Maybe I'll resurrect the idea at a later date.

Trying to figure out equations for the variables for plants and how they contribute to real life conditions is killing me. I'll probably only be implementing these slowly, but it would be nice to have a goal to work toward. I really need to go back over my statistics books and look at the equations - I think there's some helpful stuff in there, even if I don't include them directly.

My first seed catalogs have been coming in, too, so I've been scanning them, trying to glean potential alleles to include. The Fedco seed catalog has a pretty helpful potato primer - critical variables, including taste, plus a nice table of which varieties have what.

Last, but not least, my "idea" document has gotten really unwieldy, as it's split between several different files and some handwritten notes, with no real order, so I plan to type and reorganize (and upload) it at some point soon.

Monday, November 16, 2009

Weight and Volume

I did some basic weight and volume stuff earlier, based on Eric Eve's Bulk Limiter. I have fixed a few things, upgraded bulk from being a number to being a volume, and added some very boring default messages.

Eventually, I suppose I'll tweak the default messages when the player lifts something very heavy, or picks something up close to her endurance capacity, or maybe add bits where the player drops something, but mostly that's fluff.

Currently, strength is set at 25 kg. That seems okay to begin with - I may even set it a little lower originally. How much can a out-of-shape person carry? I can certainly shift 60 pounds, but I'd be hard pressed to carry it far. (I'm more of a "roll this thing end over end" person anyway.) On the other hand, with a proper pack, I can carry 30-40 lbs for quite a distance. Anyway, I can look up upper-tier numbers for backpackers and what-not later, when I start working on attributes.

How much volume one can swing around is something else entirely, partly because it's based so strongly on distribution. Properly packed and distributed, I can imagine carrying a lot of volume. 500 liters isn't unimaginable, given the use of straps and packs and a light, balanceable weight. On the other hand, 10 bushels seems pretty high, and that's only a fraction of 500 liters. I think I settled for about 10 bushels, assuming most of the stuff the player will be hauling will be heavy enough to prevent abuse. I may have to tweak it down quite a bit, though - for regular items, I can only imagine myself handling maybe a bushel or two on my back, and carrying another 3-4 in my arms.

Also, there's the question of containment - an armful of leaves may only be a cubic foot or two, but you can't just take another one. (A good reason for wheelbarrows and things.)

Still, a simulation has to stop somewhere, and this is it for now. Maybe I'll revisit this if I implement wheelbarrows (which I intend to do, eventually, but it's a helpmeet and not a fundamental requirement, so it's on the back shelf.)

Psychic Controllers

There's a review up of a controller that works via thought patterns. Ooooh.

Now, I am a realist. I know that when Peter Molyneux predicts AI that's dynamic and awesome and changeable, he's lying through his teeth. I know when Bioware claims a dark fantasy world that it will be a generic fantasy world. I have played a virtual reality game (back in the earliest days of such things). I know that robots will not replace human beings for a long, long, long, long time if ever, and their "intelligence" is a complicated fraud. A cool fraud, but not actual intelligence.

And I know that there's got to be serious drawbacks with this thing.

Nevertheless - how awesome is that? Even better, they *claim* the device detects your emotional state (from bored to excited - nothing is said of fear, or surprise). The possibilities there are kind of staggering. I'm not about to shell out $300 for one - I assume this is a pretty crude device, and I prefer third-fourth generation devices, preferably after the price point has dropped - but it's interesting to think about programming a game where you have access to someone's emotional status. If the game could somehow sense the mingled resentment and rage when I hit a maze section, and offer me a way around it? If it could tell what elements (or at least scenarios) were emotionally satisfying (or at least not mind-rendingly boring)? That would be really cool.

Now I'd guess that this device isn't there yet, despite reports. Nevertheless, very interesting.

Saturday, November 14, 2009

Food and measuring food

Looks like the time vs. time of day typo really was the big issue. The lesson of this story: never blame other people before checking over your own work very, very carefully. And don't leap to conclusions about what's broken - it's likely something very silly.

I can't quite wrap my head around how I want to do hunger yet. A lot of animals, especially grazing animals, seem to eat a lot. That is, they'll kind of hang out and nibble for a lot of hours. So they need regular access to food, and aren't going to eat the few pounds of hay/grass in one minute-long turn.

I'm tempted to say that the sheep will need access to adequately nutritious pasture for a certain number of hours a day, or they'll need a certain quantity of supplemental feed (probably in the barn). This gets a little dicey, since it requires looking at some hard numbers and deciding how I'm going to handle weights and measures and stuff. Since I don't quite have that crystallized, I'm going to work on some other stuff for now.

Before I handle harvest-type things, I need to set up a basic weights and measures system. I've got the most basic weight and volume set-up now, but it's not up to handling hay harvest, much less apple harvest. Part of the difficulty I'm having is that the measures are radically different across the world, plus there's some weird farm measures, like bushels.

I considered breaking this down to "meal-units" - the amount of food a person would reasonably eat in a sitting - but I think that's too vague and variable. Some of the factors I'm juggling:
Storage - Assuming the player will set aside space for storage of foods for both people and animals, what does that look like? What's a bushel of wheat vs. a sack of wheat flour vs. a "pile" of hay? (How big is a ton of hay, anyway?)
Quality - high quality hay has more nutritional value than low quality hay, and in real life, an animal fed high quality hay will eat less of it, and/or require less supplemental feeding
Carriable/describle quantities - I want the character to be able to visualize and handle the quantities of food we're talking about, without fine tuning. So not "You feed 2.5 grams of wheat to the chicken. She's thrilled!" but "You scatter a handful of grain for the flock." How much hay does a sheep eat a day? An armful? A flake? Half that? Would there even be hay flakes if there's no baler?
Different kinds of foods and equivalencies - does it matter if you give chickens cracked corn vs. wheat? What about sheep on turnips rather than alfalfa?
Calories - I'm not planning on handling detailed caloric intake for the animals - probably just quantity of certain foods - but I am considering it for people-food. Eating three solid meals of spinach a day is not the same as eating three solid meals of bread and cheese. Basically, this is an extension of food equivalencies.

A lot of these issues are solved for animals if I can figure out pasturization. On the other hand, I can't assume players won't try grain-only diets for the sheep, so there needs to be some back-up systems in place. I'm not really sure how to program the different factors, so I'm setting it aside for now while I turn over different possibilities. I think if I have a clear conception of where that piece needs to go, it won't be too ugly to slot it in a bit later.

Friday, November 13, 2009

Compiler breaking is fun!

So just got through the first major slog-through of code - basically commenting out everything piece by piece until it worked, and then adding code back in piece by piece until it doesn't.

Since a lot of stuff is interrelated, that involved sorting out stuff individually.

I just found my majorly broken piece. (Apparently - hopefully - the only majorly broken piece.) Surprisingly, the nomenclature stuff didn't seem to be the gamebreaker. Nor did any of the other stuff I was deeply concerned about.

Want to know what was? Here's the smallest 'game' that will break Inform.

"test" by Gravel

Month is a number that varies.
Day is a number that varies.

Ovine Estrus is a recurring scene. Ovine Estrus begins when Month is 11 and day is 1 and time of day is 12:00 AM. Ovine Estrus ends when Month is 1 and day is 30 and time is 12:00 AM.

Testing room is a room.

That's it. Did you catch the typo? It's time vs. time of day. (The one that restores sanity is time of day.) Now, I know that names of things are important, but I would have expected an error thrown here, rather than a complete code shut-down. Inform does use "time" as something separate, in a way I think I understand but haven't worked with (i.e. "At the time when the sheep goes to sleep . . .").

Anyway, it's kind of nice to have the first major bug quashed. The code above worked fine with the previous version, and the change isn't mentioned in the documentation, so I'm glad to have that sorted out. Now I need to decide what to tackle next. There's sort of a lot of basic issues - the sheep get hungry and sort of fake eating if they have access to food, but it's pretty raw - for instance, the food never disappears, and the pasture magically has food for infinite sheep from spring to the end of fall. And sheep don't die except if I explicitly kill them - and even then, they vanish without a trace of a corpse. So, yeah. Good times.