Archive for April, 2010

The Swim Meet

Thomas had a “mini swim meet” yesterday as the finale for his 4-week swimming class.  I did not get to go, but Robin did, and took a lot of video, which I’ll get up as soon as I figure out how to import it from Windows 7.

Thomas swam in 3 events — he got 5th place in the backstroke (although 2nd through 5th were all very close), 4th place in the crawl, and 1st in the breaststroke.  He would probably have done even better on the breaststroke had he not paused to look around at his competition during the race.

He was very happy and excited to have done so well — Robin said that he was hamming it up the whole time, particularly during the ribbon awards ceremonies, and I think we now have a future swim racer.  Video to follow (hopefully soon).

Tags: ,

Inform 7 Tips — Syntax Options for Action Responses

There are several ways to approach writing complex behavior in Inform 7.  Two common ones are what I’ll call “action oriented” and “subject oriented”.  It might make more sense to use “object oriented”, but that term already has enough associated connotation and confusion.

The “action oriented” style seems to be the one used most consistently in the Inform 7 documentation, and as you would expect it’s very useful and readable.  An example is something like this:

Instead of examining something in the presence of Dan when Dan is bored:
	say "'Quit gawking at the scenery and entertain me!'";

Note that this code applies to the player whenever he or she examines anything.  Although there are additional qualifiers attached that limit the scope of the rule, and we could certainly add more, it fundamentally works as a modifier (or in this case, a replacement) for a single action against a range of possible objects.

But it’s often the case that you want specialized responses for a number of different actions performed in certain circumstances.  You can achieve this using a more “subject oriented” style:

Instead of doing something to the teak table in the presence of Dan when Dan is bored:
	say "'Quit screwing around with the table and entertain me!'";

We now have a rule that makes anything you do — to the table, and the table only — trigger a generic complaint message.

All this is great as far as it goes, but what if we want to get more ambitious yet?  Let’s say Dan mocks you when he’s bored, and you’d like him to have something different to say depending on what you happen to be doing.  How would we express this?

If we went by the book we could make a bunch of “action oriented” rules, arrange them in a rulebook, and run that rulebook when the proper conditions apply.  If we did that, we’d have something that looked like this (code changed due to Andrew Plotkin pointing out that the Report rulebook doesn’t have a generic version):

The block singing rule is not listed in any rulebook.

After doing something in the presence of Dan when Dan is bored:
	consider the mockery rulebook;

A mockery rule when examining:
	say "'Ooooh, look at me!  I'm wasting time looking at something completely irrelevant!'";

A mockery rule when singing:
	say "'Hold on there, pal!  Ryan Seacrest is holding on line one!  He wants you to be the next audition reject on American Idol!'";

etc.

This works, and works well.  In the case where you want to do anything dynamic to the rules on the fly, this is definitely the way to go.

But there’s another syntax that allows expressing these kinds of constructs in a more straightforward manner, particularly if you don’t need the full power of a rulebook.  The Inform 7 documentation hints at this, but doesn’t always give you full examples of the syntax.  Here are the above rules expressed in this other format:

The block singing rule is not listed in any rulebook.

After doing something in the presence of Dan when Dan is bored:
	if examining:
		say "'Ooooh, look at me!  I'm wasting time looking at something completely irrelevant!'";
	otherwise if singing:
		say "'Hold on there, pal!  Ryan Seacrest is holding on line one!  He wants you to be the next audition reject on American Idol!'";

This is good — I like it because it groups together all the special responses when a particular condition obtains — but often we might want to specify an action that can involve multiple nouns.  In that case, you can use the following syntax (if you have a filling action defined):

...
	otherwise if filling something with something:
		say "'You're wasting your time with that...'";

and, of course, you can specify either or both of the nouns as well:

	otherwise if attacking Dan:
		say "He easily dodges.  'C'mon, wimp!  You'll need to do better than that!'";

It would be nice, as long as we’re valuing brevity, to be able to use the “switch/case” syntax for this — something like:

The block singing rule is not listed in any rulebook.

After doing something in the presence of Dan when Dan is bored:
	if the current action is:
		-- examining:
			say "'Ooooh, look at me!  I'm wasting time looking at something completely irrelevant!'";
		-- singing:
			say "'Hold on there, pal!  Ryan Seacrest is holding on line one!  He wants you to be the next audition reject on American Idol!'";

… but I haven’t been able to find a variant of this syntax that works properly.  Perhaps the new version of Inform 7, scheduled to be released today, will allow this.

At any rate, I hope this was useful.  Rulebooks are exceptionally powerful and many times they are the proper solution to your design issues, but don’t underestimate the power of the “subject oriented” approach.  By keeping your related actions in close proximity like this, you can keep your code clean, readable, and well-organized.

Tags: ,

Inform 7 Tips — Keyword Disambiguation For Verb/Noun Conflicts

I thought I’d share an Inform 7 programming tip I’ve come up with in recent work on my new game.  As you could probably have guessed from previous blog entries (here and here), I’m using a keyword-based interface in this new work.

At its core, what a keyword-based interface does is to link up a generic single-token input to one or more default actions, such as examining, asking about, or going.  Here’s a very basic example of some code that you might use to effect this:

Understand "[something]" as examining.

Simple, right?  Now if you type a word that refers to an object, the game will examine it.

Well, most of the time it will, except in a couple of annoying cases.  What if you have a drill in your game?  You could refer to the drill as the keyword “drill”, but if you have a drill you likely also have a drilling action as well.  What happens then?

Drilling is an action applying to one thing.

Understand "drill [something]" as drilling.
Understand "drill in/into [something]" as drilling.

What happens here is that whenever you type “drill”, the system immediately assumes that you want to use the specific “drilling” action rather than the generic keyword examination, and it asks you to clarify what you want to drill.

Likely this is not really what you want.  If it is, you’re fine; you can leave things as they are.  But in a keyword-focused game, you might judge it more important to preserve the behavior of the keywords and force the user to actually specify an object to drill if they want to perform the drilling action.

The reason the parser resolves a command of “drill” the way it does is not easy to pin down through standard Inform debugging commands, but is almost certainly due to the same general prioritization rules that it uses throughout the system:  the most specific match wins.  Even though “[something]” and “drill [something]” are both potentially valid matches for an input string of “drill”, Inform counts the exact text match of the drilling action as a closer match, even though it requires a second token. To Inform, that’s not a problem; it knows how to prompt the player for that required noun.

To get around this behavior, you need to provide a match that’s even closer.  Fortunately, this is pretty easy:

Drill-referring is an action applying to nothing.

Understand "drill" as drill-referring.

Instead of drill-referring:
	try examining the electric drill;

Now we’ve implemented an action tied to an exact match to the input token.  “Drill-referring” is now the best match for an input string of “drill”, and we can wire up the “drill-referring” action to do the appropriate thing.

Likely you won’t run into this type of behavior in a whole lot of places, but it can be nice to know how to resolve it if you do.

Tags: ,

I’m Not Dead Yet

Sorry for the lack of updates; I’ve had a bad cold that knocked me out of work for a day and a half, and came back to the office in the midst of work and family emergencies.  I’ll try to get back to a proper update schedule starting next Monday, after I’m caught up and (hopefully) sane again.

Until then, have a good week and weekend!

Tags:

Third Time’s the Charm…

… or is that “three strikes and you’re out”?  Jonathan and Robin are sharing their third cold in about a month.  The two of them just don’t seem to be able to catch a break.  Jonathan seems to have an ear infection this time around; he’s still the happiest little guy you could ever meet, until he goes to nurse on Robin’s right side.  Apparently that position combined with the suction or swallowing really hurts his ears, and he just bursts into pitiful tears.

With any luck, they’ll come out of this one quickly, with renewed immune strength, and we’ll have a nice, illness-free spring and summer!

Tags: ,

New Inform 7 Release Imminent

Great news from vaporware’s post on rec.arts.int-fiction!  Inform 7 will have a new release on or shortly after April 28th!

Items slated for the new build will include:

  • Tidier user interface
  • Easily publish Inform works to the web, including a release mode
    that creates a playable web site using Parchment
  • Many language restrictions removed, and more expressiveness in
    talking about kinds, phrases, relations, etc.
  • Many Standard Rules actions changed to provide default behavior
    closer to what modern authors tend to want (automatically opening
    doors, handling TAKE ALL more naturally, and so on)
  • More than 250 bug reports resolved

Can’t wait!

Tags: , , ,

Weekend Travel

For the third weekend in four weeks, we took it on the road up to Nebraska.  The event this week was my niece’s first Communion.  Thomas had a soccer game this week, and we’d missed last week’s already, so we decided to stay for the game and travel up after that, making the trip was pretty short.

Despite that, it was more pleasant than last time, particularly for Robin.  The last trip was great for me, but Robin was horribly sick.  This time Robin was healthy, so she could actually participate in conversation.  The kids slept well, so even though we had to get up at the crack of dawn to go to the church service, everyone was pretty much ready without major attitude issues.

We went to my brother’s house after the service for a great breakfast.  Brooke opened her presents and then challenged Thomas to a giant Super Smash Bros. tournament in the basement.  Watching her perform combos as Zelda with the Wiimote while wearing what looked like a miniature wedding dress was pretty funny — I wish I’d gotten pictures of it.

All in all, a good trip, but we’re looking forward to being in town for a few weeks so we can get caught up on home maintenance and geared up for spring and summer!

Tags: ,

The Fruits of My “Research”

I recently took what ended up as a 2 1/2 month break from interactive fiction development.  Most of that time got spent on Dragon Age, but I also played through Left 4 Dead 2 due to an offhand comment by Zarf on rec.arts.int-fiction.  In addition, over the Easter weekend I traveled to my in-laws for the holiday and also to celebrate the birthdays of a niece and nephew.  While at Chuck E. Cheese for the latter event, I found an interesting game called “Let’s Go Jungle”, which in addition to sounding like something my daughter might say, incorporated an interesting gameplay mechanic that adds interest to what is otherwise a garden-variety rail shooter.

So to rationalize to myself that I didn’t just flush the last couple of months down the toilet, here’s some of the musings I drew from my “research”:

Read the rest of this entry »

Tags: ,

Game Review — Left 4 Dead 2

While gearing back up for some more interactive fiction development after my two-and-a-half-month detour through Dragon Age, I made a comment on rec.arts.int-fiction to the effect that the Drama Manager in Blue Lacuna, Aaron Reed’s XYZZY Award-winning interactive fiction title, was unique in my knowledge in terms of providing an auto-adapting pacing mechanism for gameplay.

Zarf (Andrew Plotkin) responded with a link to a design postmortem presentation for the game “Left 4 Dead“, by Valve Software, which talked about their use of procedurally-generated content to provide dramatic pacing for that game.  Now, Left 4 Dead is substantially different from an interactive fiction title, but I like a good FPS as much as the next guy, and was intrigued by the paper.  In a coincidence that was happy for my wallet but not for my productivity, Valve was having a half-price sale for Left 4 Dead 2 right after this exchange, so I was able to pick up the game for just $25 and give it a spin.

The premise of the L4D series is that there’s been some sort of contagious infection that is turning people into zombies.  You play one of the four Survivors, humans that have proven immune to the contagion.  The goal is simple — escape the zombie hordes before your brains are eaten.  To do this, you have to work together to protect each other and carve a path through the ravening hordes of zombies to reach an extraction point at the end of the level.

It’s a cooperative first-person shooter game — even if you play alone, the game spawns three “bot” players to help you.  And it’s a good thing it does, because the gameplay depends on close cooperation between players.  If one person gets separated from the group, it’s very likely they’re going to get killed before too long, because certain of the enemies — the “special Infected” — can pin or otherwise incapacitate lone Survivors.  If one of your friends doesn’t quickly kill whatever’s on you, you’ll watch helplessly as the zombie rips you apart.

A big chunk of the magic of this game, as the paper I read indicated, is in the pacing.  L4D2 generates loot and enemies procedurally, depending on where you are and what your calculated level of “emotional intensity” is.  If you’ve been fighting hard, with lots of zombies on you, the game will hold at that level of intensity for a little bit and then back off to give you a breather.  If you’ve had some downtime, the game will slowly start spinning up more enemies and eventually subject you to a “horde”, where a mob of common Infected rush you, trying to overwhelm you with a human wave attack.  And every so often you get a special Infected or boss Infected thrown into the mix.

These special Infected are by far the toughest part of the game.  Each of the specials has a powerful ability it can use to wreak havoc on a team of Survivors.  Spitters can spit globs of caustic saliva, causing damage and potentially cutting off escape routes.  Chargers can sprint into a group, grab someone, and carry them along in a straight line until they reach a wall, both damaging and separating them from the group.  Jockeys can jump on your shoulders and force you to run away from your friends, and can even force you off ledges.  The dreaded Tank can absorb a ridiculous amount of firepower, and does amazing damage and knockback if you are foolish enough to let it close to melee range.

The complement to the dynamic pacing is the atmosphere.  Level design is excellent, with decaying architecture, weather effects, low-light areas, and close quarters all serving to keep the tension heightened.  The music used on each level is different, and thematically matched to the play environments.  Hordes and bosses all have special theme music, which is again different depending on the level you’re playing, and it wasn’t uncommon for me to start getting twitchy and panicky when I heard that horde theme start up again while I was stuck hip-deep in swampwater.

Your fellow survivors have a great deal of scripted conversation that is triggered in certain circumstances; you definitely get to know their personalities as the game goes by.  In addition to the level-specific dialogue, there are a lot of coordination comments they use, from alerting you to weapons nearby to reporting their imminent death.

I guess a good illustration of the intensity of the gameplay is my reaction to the weapons available on each level.  You always start a level in a “safehouse” — an impregnable room with a selection of health packs, weapons, and ammunition.  You can choose a single heavy weapon (such as a rifle or shotgun) to take with you, and you can’t change it until you find either another safehouse or a hidden stockpile of guns somewhere in the level.  And since the levels are procedurally generated, you don’t always get the same selection of guns on every playthrough.

In most first-person shooters I have weapon preferences — in Half-Life I’m a pretty big fan of the shotgun (if I don’t have the gravity gun) — but if I can’t get my weapon of choice, or if I’m out of ammo, it’s not a big deal.  I’ll just use one of the other ones.

In L4D2, if I don’t get either the AK-47 or the M-16 (on levels where that tier of weapon is an option) I feel naked and exposed.  It’s very uncomfortable not to have the precise weapon I’m most skilled with, and it’s just nervewracking and not very fun to play the game until I find an acceptable gun.  I think this more than anything else is the triumph of the Left 4 Dead series — that they can control pacing and atmosphere to such a degree that they can give you that “character in a horror movie” feel, just from your expectation of what’s coming next.

I’ve really only played the single-player campaign, so I don’t have the experience of going out and playing with three other guys using voice chat.  They do have several player-vs-player variants, including a very fun one where two teams of four alternate being the Survivors and the special Infected and then see which team can make it farthest through one of the levels.  It seems there’s a lot of replayability here, and I’m looking forward to giving some of those other modes a shot.

Even the single-player experience, however, was well worth the $25.  As an illustration of how procedural, dynamic content can serve the gaming experience, and as a darn good FPS game itself, L4D2 is well-worth playing if you have any taste for first person shooters — or zombie movies.

Tags: ,

Knee Update

So after two days of getting serious about the strengthening exercises and wrapping my knee, the pain is almost completely gone.  I’m still going to keep this up for at least a couple of weeks, but I’m pretty amazed at how quickly I’m bouncing back now that I put some effort into figuring out the right way to go about taking care of my injury.

Corporate Challenge here I come!

Tags: ,

The Quern is Digg proof thanks to caching by WP Super Cache