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

Monday, April 25, 2011

Design Diary, April 25

Spent a good chunk of the weekend with a friend in the hospital, but hanging out in the hospital gave me some nice reading time.  (He was in for non-emergency reasons, so it's not like I was reading about mushrooms while he bled out or anything.)  Read about mushrooms and bogs.  Turns out bogs are cool, and contain some useful stuff, but aren't productive enough to sustain life on their own.  (So it's just as well that mine are located on the far north part of the map, well away from intended habitable areas.)  I'm basically using bogs as one of the world barriers - you can go in a bit, and walk around, and drop things in it (never to be seen again, usually), but that's about it - beyond that point, it's too easy to get lost, or too unstable to continue.  I'd previously considered letting the PC harvest peat as fuel and rejected it, partly because there are literally square miles of forest to harvest, and because I couldn't find good data.  I think that was a good decision; American peat bogs tend to be wetter than their European counterparts, so the peat harvested is less ready to burn, requiring longer dry times.  Not worth it in terms of PC effort or programmer effort.  I do need to make sure there's a cranberry harvest, though.  (I have no idea how people can bear to eat cranberries without *serious* quantities of sugar, but I suppose hunger is a great motivator.)  Sphagnum moss is a possible resource - it's super absorbent, and might make a good field dressing if injuries ever make it in.  Seems like there might be other uses there, but I can't think of any off the bat.  The other big thing mentioned is the presence of white cedar, which is one of those great rot-resistant woods, and thus awesome for fences and shingles (and everything, really).  I am pretty sure that there's enough of it growing around that the player won't need to hike out to the bog (and since there's no rot in-game, it's not a big advantage anyway).  There's not usually much animal life in the poor bogs; plant life is pretty limited, and nutrients are tied up, so it's a good border land; it's poverty should hopefully encourage the player to focus attention elsewhere.  (And, yeah, there's messages to redirect the player, but it's nice that there's subtle in-game reasons to turn aside, too.)
The book noted a lot of different bog types, which will hopefully be helpful in writing descriptions.  

I managed to get my hands on a good field guide to mushrooms in the Iowa-Illinois area, which I'm assuming is close enough to Minnesota-Wisconsin for my purposes.  All the mushrooms I double-checked extended farther north.  I'm so used to edible foods being non-native that it's sort of surprising that so many of the edible wild mushrooms I recognized were native species.  (Chanterelles, oyster mushrooms, lion's mane, and a couple others I can't recall off hand.)  I knew intellectually that identifying mushrooms is a tough thing, but I was taken aback just how difficult it is, even from the carefully chosen pictures that emphasize identifiable characteristics.  I tested myself with the key a couple times, and would have confidently eaten a mushroom that would have melted my kidneys. Oops.

I was also surprised just how many species are "edibility unknown", and how many more were only mostly poisonous - some appear to poison some people but not others, and others are only intermittently poisonous. 

The primary goal for mushrooms is as a wild food source, and I think that will be fairly straightforward.  A lot of the species are strongly associated with a plant species or community, and a lot of them remain in the same place year after year, so first implementation stab is to "seed" appropriate locations with appropriate mushrooms, and then have them show up at appropriate times.  I'd like them to appear in locations in addition to being available via a gathering action (similar to the way wild animals should show up now and then).  If the PC learns where the morels are each spring, more power to her. 

I don't actually want kidney-melting to be a possibility in game, which means that the PC probably needs some sort of way to figure out edibility of mushrooms.  There's the traditional taste test, but for the seriously poisonous mushroom, this is a bad way to go.  I don't really want to encourage people to go around taste-testing random mushrooms, so I'm considering requiring some sort of handbook or a skill check or something.  Lots of possibilities here, but I think it would be worthwhile to reward a player who thought to take a wildlife survival guide or something along; perhaps give them access to some easy to identify shrooms, and more to those who got a dedicated book or something?  I dunno.  A more immersive option would be a requirement to have ID initially, and let the PC gain familiarity with individual species as she IDs them on her own.  (How long does it take to learn the difference between a real morel and a false morel?)  There's some implementation fun to be had with disambiguation and privately named stuff, especially if I let the PC pick mushrooms and ID them somewhere else, rather than IDing before taking.  Worst case scenario is a basket full of a mix of mushroom types, pre-ID.  ("In the basket are some mushrooms, some mushrooms, some mushrooms, and some mushrooms.")  An ID-before taking rule would prevent this, and with some limits to growth patterns, mean there would only be one unidentified mushroom per location at any given time. 



I'd like to at least leave hooks in case I decide to let the PC cultivate certain varieties.  Under ideal circumstances, each species would have certain requirements to fruit, and if those were met, it would fruit, whether those circumstances were artificial or not.  That's a *little* tricky to pull off, though, and would require some serious investment beyond the "mushroom X lives here and here, and has a 1 in 10 chance of fruiting after it rains during the spring" setup that I have in mind.  I don't know quite what to do about that; honestly, cultivation isn't a huge interest for me, but it's a reasonable thing for the player to try, with a modest potential reward.  One option might be to keep soil mushrooms wild, and restrict potential cultivation to stump or log-grown species.  There's only two or three of them, and if the PC is clever enough to haul an elm log to a shaded spot near her house and inoculate it with spores from the elm-growing mushroom, she probably deserves a few years of mushroom crops before the log disintegrates.  This seems potentially exploitable; I don't really want locations with hundreds of logs of mushrooms, although I guess it is a legitimate strategy.  Hopefully the higher irritant factor and relatively low caloric density of mushrooms will make it non-worthwhile; I might also look at realistically quick wilt or storage times, so even if there are fields of mushrooms, the PC can only get so many harvested or eaten before the rest go bad. 

So I guess hookwise, I'd like to set aside mushrooms that grow on wood as their own kind.  Let the mushrooms be associated with certain inoculatble species.  Inoculated logs will have similar chances of sprouting mushrooms under the right conditions that inoculated locations will.  Maybe prevent inoculated logs from being moved/used for anything (because they're too decayed/damp/whatever).  Have a few decay/appear each year.  That would give hooks for deliberate inoculation later, if it seems appropriate, without drawing too much attention initially.  There would probably need to be some additional details at that point (freshly inoculated logs shouldn't just sprout mushrooms the next day, it's more important to make sure the log is somewhere sensible, and not in the kitchen or something).

Side notes:  Mushrooms are a good dye source.  Don't forget to implement them if I ever get around to dyes. 

Random thought: it also seems like there might be uses for the poisonous ones, even if the poison is fairly slow acting.  Maybe as a fish poison or homemade pesticide/deer repellent or something?  It seems plausible that dusting your plants in ground Amanita might discourage locusts, even if I can find no indication anywhere that anyone has ever tried it.  (I'm not about to, because I like my kidneys/eyesight/life, but it seems a shame to just let a perfectly good deadly poison go to waste.)

I got a couple hours to hit bugs last night.  It was . . . surprisingly fun, actually.  As frustrating as programming can be, it's deeply satisfying when I can actually get in there and fix stuff.  A lot of the stuff I'm tweaking is second or third generation code - stuff cannibalized from examples or extensions, then tweaked a couple times and merged with stuff cannibalized from other extensions.  I'm not aware of looming bugs at the moment, except for some disambiguation issues that I'm ignoring.

Friday, April 22, 2011

Main weapons: Fear, surprise, and unflinching determination to get done

Finished sunsets!  I even solved the mysterious bug where occasionally the sky would turn bright white for a couple turns.  Or an hour.  (It turns out that my algorithms for color work very well within parameters, but trying to blend 147% of one color with another borks it proper.)  I also weeded out testing comments that hadn't gotten taken out before.  By all means, add testing comments, but a reference as to which extension they're in, or where they're running from, is a *really* good idea.  Especially if it's just printing a random variable that you can't directly search for.

Also, you know how everyone tells you to comment your code?  Turns out that it can indeed be helpful.

Not so good stuff: I've been trying to layer sprites in on the Canvas Editor that comes with Glimmr.  Unfortunately, the screen is too small, and the control is sort of fiddly - it's tough to get things lined up, or get a good feel for what things will look like in-game. 

Now that it's down to hand-placing individual sprites, I'm reconsidering my options, because typing out code and adjusting the placement via coordinates for hundreds of trees is slow, tedious, painful, boring, and just not very compelling on either a process or a results level.  (It's boring to do, and looks bad when I'm done, basically.)

What to do?

- Create view in Photoshop, and import umpteen individual sprites from there.  (Super convenient on the "I don't have to place stuff via coordinates front, but incredibly wasteful spacewise - each 50-100 px sprite would carry with it tens of thousands of empty pixels.
- Create view in Photoshop, randomly glom trees into a couple layers of full size, and go from there.  (Still convenient, although the glomming bit would require some care.  Less space wasted.  Less uniqueness, since we'd be down to however-many layers rather than individual trees.  Less flexible - if I change the shape of a hill or something, I'd probably need to redo a layer of trees entire, rather than just bumping individuals down or up a bit.)
- Screw the trees - people like grasslands, right?

I'll probably do a mix of the above - a few trees will get handplaced, but most will probably be lumped together into layers, and those'll probably be less central than they were.  I wish I knew more about artistic principles of composition.

Take 2 this weekend.

Wednesday, April 13, 2011

Moar Graphics Stuff (Grassland/Weather)

Picture courtesy of sgt fun from flickr (well, I didn't ask, but pic is under creative commons license)
Grassland graphics have been going poorly.  Trees work well as discrete objects - flowers and grass, not so much.  The impression of grass is much more important than actual individual grasses, and I keep missing stuff as I experiment.  The picture above is a good reference; it has about the same ratios as I sketched out for the border - ~1/3 of the way up is the grass line, ~1/2 -2/3 is the tree line, and 1/2-1/3 sky.

It's hard to tell from the original, but I'm guessing that's a field of false sunflowers, or something in that family.  It's really just an impression of waves, in color; I'm hoping if I get enough reference pics, I can get the feel right.  I think the front grasses might be important to give the grass a sense of height, as well; I've been layering "flower" directly over grass, and a front level might help.  Or it might not.  I guess we'll find out.

The flower bit is actually one of those bonus parts; adding it has the *potential* to improve things, but not the guarantee.  Each one of these bonus bits seems barely worth doing, but I'm finding that cumulatively, it's making the difference.  Other such inclusions have included fringes of grass, a glow on the sun, fluffy clouds, and a random bird or two. 


Especially proud of the right-hand cloud.  That is some fine water vapor there.

(Wow.  The sun does *not* look that big in Photoshop.  I think I better dial it back a bit.)

However, as of this moment, there's a moratorium on more pieces until I actually get what I've got working.  No bushes, no flowers, no piles of snow, no whimsical forest creatures - in short, no distractions from what I actually need to be doing.  This decision is made possible by storm clouds that I don't hate with a firey passion.  (It turns out that fluffy white clouds are difficult, but dark ominous storm clouds are impossible.)  The decision is made *necessary* by the three hours I spent creating various lightning layers in an attempt to procrastinate my way out of having to actually knock this thing together.

It is very pretty lightning, though.


I don't even *have* a lightning mechanic.  There is no way for the game to know if it's ever appropriate to display them.  

I am *creating* mechanics in an attempt to procrastinate on working on the game.  

(I believe a wise developer, having recognized this streak of insanity, would have dropped both the graphic and the mechanic.  That . . . was not what I did.  Now there's notes under weather to add a thunderstorm option.)

So this afternoon, Inform willing, I'm going to start layering in summer sprites.  I think it'll be easier to work backward/forward from the summer states, since most of the sprites are pretty constant then, because so many of the trees are likely to be in different spots during the spring/fall, and I'd rather look at green than white, in the case of winter.

Goals for Friday afternoon:
- have the grass layers working for summer
- have all the summer sprites for the trees imported to the canvas editor
- have a case of porter on hand, in case of emergency

I *think* the tree layering will be the most ungodly part of the process.  All the rest - the arc of the sun, the moon phases, the weather patterns - are either things I clearly can imagine the code for, or are already game mechanics.

Trees are tougher, because you've got several different species, each with 6+ layers triggered at different points, and each sprite of those species should have a *slightly* different trigger (or a random trigger within a certain range).  I *think* I know what I'm doing, but if I've messed up anywhere, it's going to be an ugly weekend.

Basically, every species (or subdivision of species - ie, there's four maples, so they each get their own line) is entered into a table, along with the appropriate figure for seasonal subdivisions.  Initially, figure changes are fired by date alone; this mechanic will be preserved in case I need it.  Primarily, this is for testing purposes, but it's got in-game uses as well; it allows for the possibility of skipping large periods of time (ie a month or more) without worrying that half the trees will be transitioning to spring while others are still in fall color.  It also would be useful if I decide to let players pick when they want to start the game; there can just be a blanket graphical set-up, based on the date chosen. 

The other worry with trees is that there will be so many they'll bog down processing speed.  That's not something I'll know until I get in there; it's not easily predictable from the outside.  It could be quick, or I could need to consolidate trees into groups. 

Tuesday, April 12, 2011

The Pit of Despair

Why don't people make their games with graphic elements more often?  Possibly because it's a giant pain?

I finally exported approximately 8 gazillion layers to individual .png files, then did it again, because if you have any layers non-visible, Photoshop exports an empty file without warning you, loaded those into a NEW experimental game, figured out how to get a text file with just the names of the .png files in the directory (note that it's eight times more complicated than the Mac command), filtered that list through regexer according to Erik's excellent instructions, pasted the ginormous list of doom into my new experimental game, and discovered that my naming conventions for layers, where I noted (front) vs. (back), is incompatible with Inform.  Even when the parenthesis are encapsulated entirely.

I probably should have guessed this, but honestly, I didn't even consider it at the time.  And if I had checked, the Inform documentation would have assured me that "Figure names can consist of any text provided that text starts with the word "Figure"."

The fix is fairly simple theoretically, but every single one of these barriers means more time spent learning new tools (RegExer is not the most straightforward thing to understand), and makes it harder to keep going.  Every time I feel like I'm almost there with the pretty, new issues come up.  It's starting to feel like Zeno's Paradox.


Nevertheless, I finally have moon/sun/stars that I don't hate.  Clouds remain an issue - it's hard to get a consistent look that doesn't look cloned.  None of this is in-game yet, because I hit the point yesterday where I just couldn't deal anymore.  After a while, you just hit a wall, and have to go do something else for awhile.  I have this *way* more with graphics stuff than with internal workings, because I never get into any flow, I never feel like I know how to fix anything straight off, and it just feels like everything gets in my way, which means I stomp around for hours afterwards, feeling sorry for myself.

I have these bottlenecks with code sometimes, too, and the solution is usually to go away and work on something else for awhile.  Here, I *really* just want to be done, though, so I'm going to try to muscle through.

Spring test thrown up in Photoshop; the "bushes" are repurposed tree tops.  Needs more background trees to get the full forest effect, but I like it.  It's kind of kids' art-y, but that's okay. 

Monday, April 4, 2011

Hunting "Quirks"

Did the very first baby implementation of text substitutions in the hunting code.

Take 1:
"You can see your prey through the bushes; it seems to be unaware of you.  You pause, taking aim, and loose the rock with as much force as you can muster.  The rock strikes yourself squarely in the forehead, causing instant death.

There is a carcass of yourself here."

After eight hours, hunting languished, eviscerated and enveloped in test code, comments, and language that real adventurers would never use.  I fixed the bug, but the action is in so many pieces that putting it back together is going to be huge fun.  The longer I procrastinate, the worse it will be; even knowing that, I have this burning urge to do something else.  Anything else.  

Fun fact: Some salamander embryos will feed on their mother's insides with tiny embryonic teeth.