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

Wednesday, February 23, 2011

Big Fantasy

One of the many things I love about text games is how much control it gives authors over the character's perceptions. Untrustworthy narrators are a much bigger challenge in a game where you've also got a videofeed.  FTA doesn't have an untrustworthy narrator per se, but skills are on the list, and one of the things I would dearly, dearly love to have happen is for the presentation of the world to subtly change as the PC gains knowledge.

So if the PC's plant-knowledge skills were low, she might barely be able to distinguish between trees - descriptions would be pinned on things like size.  As knowledge increased, she might be able to pick out major families - she can identify a maple with reasonable accuracy, even if she doesn't know the species.  Later, the knowledge would not only give her accuracy of naming, but also insight into status.  Verbs could change - "grow" could be "flourish" if the plant is happy, or "languish" or "struggle" otherwise.

The giant initial hurdle is the sheer quantity of text that has to be written with excruciating accuracy and testing, followed immediately by fractal parser wrestling.  Then the player has to stay immersed long enough to experience this transition, and for it to aid the way they play.  It's too much work for a large game written by a single author - it's the sort of thing that demands giant databases and teams, but I hope someone does it.

I may have lied earlier - I think this kind of perception might be easier to do on, say, a tile based graphic game; all you need to do is use the same tile for every tree until the PC is at a high enough "level" to get different trees/flowers/shrubs/etc.  Thus, what initially appears to be sort of repetitive and boring when the PC is ignorant becomes tremendously diverse with knowledge, without any actual change in the world - only in perception.  Level increase in this case becomes less about grinding or unlocking achievements than it does about character development and exploration.

Even some of the non-visually oriented skills could benefit from this sort of mechanic; hunting could initially be fairly routine.  Additional skill gives you insight into animal behavior, and means that a) you notice a lot more tracks and dens and so forth in general, and b) the hunting commands are far more detailed and nuanced, progressing from, perhaps, a simple report ("You catch nothing.") to expanded descriptions and choices that honor the things the PC already knows ("Fresh deer tracks lead into the shadow of wood; they were likely made no more than an hour ago.").  This is something that doesn't need to be nearly as built in as the description-based day-to-day stuff has to be.  It's not easy to replace every reference of trees in game text with a nuanced, PC-appropriate description; it is much easier to go in and fiddle with a specific action.

One advantage is that properly scaled reveals could also let the player pick stuff up gradually as well.  Let's say the player is trying to grow corn.  A beginner farmer may notice only a few big things: if the plants are dry and withered, if the crop is ripe, and maybe a cosmetic issue or two.  By the second season, the PC can recognize that wilted plants need water, and has a better sense for when it will ripen.  She begins to notice insects and leaf condition, and maybe soil quality.  The beginning player picks up on things in the order of importance, too - she will need to make sure there's water, followed by fertilizer and insect control, followed by more esoteric things.  It teaches the player about how the game is prioritizing information (or how the game wants the player to prioritize information), which is helpful when there's lots of bits to pay attention to.  It's also better than a tutorial, in the sense that the player doesn't have to retain all the information at once.  And, of course, there's nothing to stop advanced players from fertilizing the corn even when their PC doesn't recognize that as an issue yet.

There's a potentially ugly issue here: first, if the player likes the way an optional action works, and uses it a lot, it's going to change.  Let's say Bob the Player likes short descriptions, and thus sends Kyle the Character off to hunt regularly.  As Kyle improves, Bob is going to get less and less of what he likes in the first place.  And Chuck the Player would have preferred longer descriptions and more interaction from the start, so never really sent his character hunting much to begin with.

Tuesday, February 15, 2011

Hunting: Initial Stats

I've gotten to the point where I can do some initial stat runs so a big portion of the programming time today has been spent setting up test points and gathering data. It's something that takes a significant chunk of time, but I'm curious how things are shaking out under the hood.  (Also at what point the in-dev interp starts acting really weird.  It's somewhere around 10,000 turns of "hunt / g / g / g / . . .", apparently.  I hope this is just a "stop loading me up" issue, or else resolvable by saving and restoring.)



At this point, player skills have not been implemented at all.  Given that there's no animal when hunting begins, the action chooses prey based on a weighted frequency.  Once chosen, there's a 1 in 10 chance that the PC will encounter the chosen prey - sort of a random encounter sort of thing.  Encountered prey goes directly to simulated combat.  (Or, rather, unimplemented combat.)

If there's no animal encounter, the PC will look around for evidence of the prey.  There's a couple different types, and each animal's odds for each type of evidence vary.  (Overall rates should eventually vary with other factors, but as of now, they're straight from tables.) 

If the PC finds tracks, the odds for finding the prey increase for the next try, on the assumption that if you find deer tracks, you're more likely to be near a deer.  This is around a 10% bonus, and is cumulative.  Finding one set of tracks should also increase the odds of finding another set of tracks, but at the moment, that doesn't happen.  Looking for signs of prey is around 15-20 minutes, which seems a little high now that I think about it. 

Not finding tracks reduces the chance of running into prey by 10% (down to a minimum 10% chance).  The PC will then move to an adjacent location in the wilderness, and start looking for the prey again.  Moving takes an arbitrary 10-30 minutes.  (Eventually, locations will have built in distances, and this will be less arbitrary, but I'm assuming that this is slower than normal, due to trying to be quiet, looking around for clues, etc.) 

Out of a sample of 1800 hunting trips, odds are running at 74% +/- 1%  for no prey encountered at all (for a hunting trip of roughly two hours).  So there's an average of one encounter per day hunting, which is definitely low, but isn't totally absurd, and especially isn't absurd if these are base values, and assumes that there's basically an untrained office worker careening through the undergrowth.  I'd like to see numbers closer to 55-65%, but there's also going to be random encounters outside of the hunting action.  The PC can "hunt" those animals directly, so the rates are a bit more favorable than they appear initially.  So it's not ideal out of the box, but it seems workable.  One text-based possibility would be to introduce a some senses that the PC is not truly alone, but just doesn't have an opportunity to kill every creature she runs across - a few sentences here and there that note birds singing, movement in the bushes, squirrels scampering just out of sight, movement out of the corner of the PC's eye, etc. might not actually increase the kill rate, but might ease the sense that the wilderness is a vast wasteland.

I also ran some individual animal counts to get some sense of actual ratios of what's chosen and what's seen, to get a better handle on how the table values are playing out. (One representative run is included below in case my notes go AWOL, but the numbers are average.)  About half the encounters are going to be with a deer, some sort of rabbit, or some sort of squirrel.  The 6 rarest animals make up about 1% of encounters; most PC's will need around 1400 kills to get all 37 mammals.  This will undoubtedly go up with additions of birds, and probably dip with whatever special events or encounters are added, but maybe it'll give completionists something to gun for. (Ha, ha.) 

There's still some tweaks I'd like to try.  Non-deer ungulates seem low - more elk, bison, and caribou (possibly with a reduction in deer/rabbit/squirrel)?  Squirrel populations in general seem too high; fishers too low.  Probably a few more wolves, both because of the recent info from Wisconsin DNR, and because features that the PC can do extra things with should be favored; tameable species with normally low representation are probably worth boosting upwards. 

Other notes: There's either too much movement or too much reporting of movement in my example tests; what is usually 1-3 paragraphs of description is interrupted by several bold room names/paragraph breaks in awkward places. 

HUNTING: Time out ratio: 74 % (out of 10024).
Animal choice ratio.
badger: chosen 337 times (3.36 %).
small black bear: chosen 34 times (0.34 %).
small grizzly bear: chosen 18 times (0.18 %).
small beaver: chosen 328 times (3.27 %).
small bison: chosen 10 times (0.10 %).
small bobcat: chosen 25 times (0.25 %).
caribou: chosen 28 times (0.28 %).
large coyote: chosen 73 times (0.73 %).
small white-tailed deer: chosen 714 times (7.12 %).
small elk: chosen 129 times (1.29 %).
ermine: chosen 122 times (1.22 %).
large fisher: chosen 79 times (0.79 %).
gray fox: chosen 262 times (2.61 %).
red fox: chosen 207 times (2.07 %).
lynx: chosen 21 times (0.21 %).
large pine marten: chosen 78 times (0.78 %).
small mink: chosen 159 times (1.59 %).
small moose: chosen 63 times (0.63 %).
small mountain lion: chosen 7 times (0.07 %).
large muskrat: chosen 277 times (2.77 %).
small opossum: chosen 366 times (3.66 %).
small river otter: chosen 289 times (2.89 %).
small porcupine: chosen 310 times (3.10 %).
cottontail rabbit: chosen 897 times (8.97 %).
large snowshoe hare: chosen 522 times (5.22 %).
large white-tailed jackrabbit: chosen 576 times (5.76 %).
large raccoon: chosen 772 times (7.72 %).
small spotted skunk: chosen 224 times (2.24 %).
large striped skunk: chosen 336 times (3.36 %).
large fox squirrel: chosen 301 times (3.01 %).
gray squirrel: chosen 719 times (7.19 %).
red squirrel: chosen 744 times (7.44 %).
small least weasel: chosen 256 times (2.56 %).
long-tailed weasel: chosen 268 times (2.68 %).
large gray wolf: chosen 21 times (0.21 %).
wolverine: chosen 40 times (0.40 %).
large woodchuck: chosen 412 times (4.12 %).

Monday, February 14, 2011

Recursive Loop in Three, Two, One . . .

Took me five minutes to write an infinite loop, and twenty to write in a serious bug that took me an hour to iron out completely. 

Early findings: an hour is not a long enough time to go hunt something.  With that, there's only time to go one or two places.  The default is two hours now, and I might bump it up to three.  Looking and moving around are the big time sinks - actually fighting is essentially timeless. 

Rates for encountering fairly frequent creatures like deer are around 1 per 3 hours, which is a bit high, since I haven't implemented all the trail checks I'd like to.  (As of now, the game runs the odds for finding an actual animal, followed by the odds of finding tracks, followed by the odds of finding a den, followed by the odds for finding other evidence.)  I could fix the issue by implementing a simple "check to see if the PC finds some evidence", followed by deciding what kind of evidence is found.

The numbers I'm getting are a *little* difficult to match up to real world data, since the game picks prey instead of just sending the PC randomly through the forest to see what's encountered.  (That is, the sort of animal you run into is set before you start out.)  On the surface, at least, that's not an insane proportion; the Wisconsin Deer Hunter Survey of 2009 (pdf) indicates that a range of .14 to .31 deer per hour is normal.  So I might need to ratchet the numbers down a bit, but it's not terrifically awful.  Northern forest areas have less deer, less farmland, and more wolves, which suggests that deer might not be quite so numerous in places where there's no free lunch, so that might be the number to aim for.  Also, because of the way prey is picked in-game, there's fewer encounters of deer than usual, which may well balance out the higher results when the game goes looking for one.

It's kind of amazing how quickly a few combinations of random numbers obscure actual stats.  There is an actual, hard-coded chance to find and kill a deer, but it would be a real job figuring out what those actually are.  Mostly, I collect data via the Recompile and Recount Method (tm). 

Also, the Deer Hunter Survey reminds me that I totally forgot about gamebirds.  I remembered turkey once, absently, weeks ago, but I've been really caught up in mammals.  Hunters were spotting just about as many turkeys as deer. 

What really surprises me are the other animals.  Overall, the odds of spotting a wolf are about 1/100 hours, which seems really high.  I'm not a biologist, but I would have guessed that wolves are rare, relatively shy, and sneaky.  The data could be inaccurate, of course - wolf-like dogs aren't that unusual, and beer is consumed on these trips, but still.  To put this in context, you're about as likely to see a wolf as you are to see a red fox, ten times more likely to see a wolf than a possum, and three times more likely than a raccoon. 

That just seems . . . off.  Have I done too much mythologizing of the rarity of wolves?  Was there some pack who followed a bunch of hunters around all season and skewed the data for the rest of the state?  The data hasn't been adjusted to account for size, mobility, or diurnal habits, but . . . yeah.  Huh. 

But in good news, I've got the beginnings of a framework to hang text on.  (I need to do attacking and clean up non-tracking clue finding.)

Sunday, February 13, 2011

Hunting

Google seems to have gotten into the spirit of my odd inquiries, and now it thinks I might want to know how to kill undead bears.  Which I don't, actually.  Just regular, old-fashioned grizzlies and black bears. 

I've got a pretty good map on the hunting action now, I think.  (Thanks for the suggestions on flow chart tools - they were all better than what I'd been trying, and Cmap was indeed just about perfect.)  For most of the FTA stuff, I feel like I have some sort of footing in real life.  I've gone fishing (years and years ago, but how different could it be?).  I garden.  I take walks.  I own animals.  But I've never gone hunting, nor have any interest in going hunting, and the only guy I know who hunts is not the sort of person one wants to talk to.  So I've been spending a lot of time in hunting forums, which is interesting, but is only marginally helpful.  (Also, my browser history now includes people who think the apocalypse is actually coming any minute *and* people who are extremely enthusiastic about guns.  Including a thread by someone who wondered whether you could kill a bear with an AK-47.  I can only hope that person was working on a game, too. 

I'm just about to get cracking on implementation.  I'm going to start with a barebones implementation of the functions/odds, with really basic debugging reports attached.  Once I get that ironed out, I can start on the text and the random variations of the text. 

There's a few basic checks that show up over and over that involve things that aren't implemented at all, or haven't been merged in yet, so there's going to be more loose ends than usual to tie up, but it'll be nice to have a general flow to work with.  Programming-wise, I expect it to be pretty straightforward.  The truly tricky bit is going to be balancing the thing. 

It's a challenge to decide what the odds should be for any one piece of the puzzle.  There's a couple issues going on:
- the actual quantity of huntable animals - the hard population.  Theoretically, this could fluctuate, but it's probably not noticeable except for larger predators, so right now it's stable.
- the PC's ability to find huntable animals, which boils down to knowledge of the land, knowledge of animal behavior, and knowledge of the clues left by the animal behavior.  (I'm not sure these will be separate skills at all; I suspect land knowledge will be some amalgam of rooms explored and time passed, and the rest will be either tracking alone, or tracking + some other factor.)
- the PC's ability to sneak close enough to an animal to do damage.  Part pure skill, part environmental.
- the PC's ability with a weapon, and the animal's . . . resistance to damage?  I mean, even you're *really* good at throwing rocks, there's a difference between nailing a rabbit and a grizzly bear with one.  This is especially tricky given the shoddy weapons available to the PC - I mean, it's certainly possible to kill a bear with a bow and arrow, but maybe not with the one you made from a random branch, old fishing line, and a sharpened stick. 
- the PC's self perception.  I'm not exactly thinking of implementing this in itself, but it plays a factor in the choices I make the PC make.  Because, honestly, unless I was really desperate, I would not go around shooting at dangerous things.  Moose are like the hippos of the north - they look all funny, but those things kill.  I would have to be really sure of myself, my weapon, and my escape route before I shot at a moose, and I think the PC should have some of the same sense, rather than "Look!  A deadly animal!  Let's kill it!"  This gets a little sticky, since the player may very well prefer the PC to be more aggressive, so I may experiment with asking the player what she thinks instead. And then have the moose attack the PC.  (Never let it be said that my games are not educational.)

I'm working on the theory that in Winnesogan, animal populations have grown and sort of balanced out in the years since large human populations.  Some of the extirpated species have moved back in, including the occasional bison herd or grizzly.  (Essentially I look at the population dispersal projections pre-1700's, and if the range includes a reasonable chunk of Minnesota, Wisconsin, or Michigan, it's in, as long as I can think of something interesting to do with it.  Sadly, this does not include rice rats.  RIP, rice rats.)

It should be totally possible to survive by hunting.  It should also be totally possible to starve by hunting, especially for the inexperienced.  One way to address this is to set up some measurement of weapon quality and weapon skill vs. animal size.   Difficulty scales pretty well to the weight range of the animal, but I may need modifiers for the extra quick or predatory, because by that measure, bobcats would be *way* easier to kill than deer, and that seems off to me.  Also, should bison be twice as hard to kill as bears?  Hmm. 




Basically, I'd like to see minimally skilled hunters with adequate weapons be able to bag something small an average of once every 1-2 days, with the major difficulties being tracking prey and killing it.  To alleviate the sting of the tracking prey issue, I'm planning on increasing encounters with wildlife, especially garden-variety wildlife (rabbits, squirrels, small birds when they're implemented), so that the PC can "hunt" animals that he just runs into.  The first jump or two in weaponry skill should get the PC to the point where he can regularly get small game - probably not enough to be his sole food source, but a significant contribution if the player chooses to go that way.  By my rough estimates, an average wild rabbit would provide the player with ~1500 calories, which is nothing to sneeze at.  This may be on the high side, since some number were for domestic rabbits, which are bred to have better meat characteristics.  By contrast, an average rainbow trout might provide ~1300 calories.  So a couple rabbits would be just over subsistence level living. 



Average hunters with adequate weapons - fire-hardened spears or crafted slings or average-quality bows - should be able to count on small game - a good catch might be 2-4 smaller animals, with the occasional deer or lone coyote.   

Expert hunters with good weapons will probably experience only a slight uptick in the amount of food brought in, but they can probably bring down most any animal, although very large prey (e.g. bison) and large predators (mountain lions) or those in packs (wolves) remain dangerous and may take some luck to bring down.    


I also need to look at the relation of seasons to availability of prey.  I strongly suspect that winter needs the odds scaled back, and autumn needs them scaled up, but I don't know that for sure, and I'm not sure if that should be tied to a particular thing or just the general season. 

So: today - get the basic functions in place, do some testing to see how things are shaking out.  Set up hooks for future features like injuries.  Test more. 

Fun fact of the day:  A moose bit my sister once.

Thursday, February 10, 2011

Yay Netflix

Just noticed that there's a subtitles tag on Netflix for some titles.  Hallelujah.  It's even a sans serif font. 

Monday, February 7, 2011

Flow Charts

I'm not usually a flow chart kind of person.  I like writing things out, and I can keep stuff in my head/notes pretty well until the time comes to implement. 

I've been told that flow charts are a relic of the 90's, a mere blip in the scheme of things, but I've been feeling an itch to do some explicit diagramming of some of the more difficult actions - partly to figure out the best way to go about implementing, and partly just to nail down a tricksy, convoluted process.

I've tried a couple ways of making them, including the built-ins for Excel and Open Office Draw, but it feels slow and clunky.  I'm almost down to drawing them on a pad (if I can find mine) or by hand and scanning them in.  Anyone have a free tool they like?  I don't need shapes or fancy connectors or pretty colors - just something fast and dirty. I can imagine quite a few tools that *might* work - Photoshop's not terrible, except it doesn't allow for easy movement of the graphics.

Or is there something that accomplishes the same goal - visual organization of complex tasks?

Saturday, February 5, 2011

FTA Update

The most urgent of the windows stuff is done, with only a little cleanup to be done around PCs climbing through windows.  Cleaning is sidelined, since I may do a more general command with other stuff that can be washed, and I need to figure out how quickly windows get dirty.  (True confessions: mine get washed only when someone else points out that they're dirty - it's not something I ever notice on my own.)  None of the atmospheric stuff is done yet, but I've started taking notes for the sorts of things that should be included.  Lots of weather-based stuff so far.

There's still floors and roofs to do, but that's basically an extension of wall building, with a different selection of materials.  I'll probably save that for a day where I just feel like implementing. 



I'm considering taking a break from the house and doing some work on hunting next; the research on the main mammals is done, and this would be a good time to begin implementing them in the world.  This would include random encounters (atmospheric and actual), as well as indicators of their presence (paths, foot tracks, dens/dams/holes), and interaction (hunting, trapping).  I'd like there to be interaction beyond the "kill" phase - perhaps capturing and breeding rabbits, or taming a wolf pup - but that would come much later in the game, and is probably more aligned with livestock anyway. 

I need to do some experimenting with hunting, which will make a nice break from pretty straight implementation. Then again, I'm not entirely excited about hunting at the moment, so I may see what comes up.  Furniture is a possibility; so is some other early game thing - fire, perhaps, or fishing, which is sort of languishing half-done.  (I really do try to leave things in a workable state, and then come back a few times for polishing and tweaking, but sometimes it just doesn't happen.) 


Fun fact: It's really better not to think about all the programming tasks that you have yet to implement as a group, especially when you're running a fever and high on cough syrup; otherwise you may dream about being in a death camp run by rulebooks, where you could escape, if only a thousand check actions weren't blocking your path and smashing your legs with bricks.  (I really do enjoy programming 90% of the time, but clearly something in my subconscious would prefer that I be working on a shorter project.  Too bad that part hasn't stepped up with a shorter project idea that I find as interesting as working on FTA.  It's not like I *asked* for a monster project.)