Thursday, October 14, 2010

Let's Make Us A Game! -- Instantiating Mom

If you're just joining us, in this series we're making a simple text adventure game using Inform 7.

In previous installments, we've built a small world for Riley the puppy to explore on his quest to snag the family's turkey dinner.  We've set up a few physical obstacles.  Now it's time to deal with everyone's bigger issues -- Mom.

As is often the case, Inform 7 has some default ideas about how a person works, so we can actually define Mom fairly quickly and simply.  We'll start her off in the Kitchen, and we'll make sure she appears to be doing something appropriate in each of the locations where Riley may encounter her.

Mom is a female person. Mom is in the Kitchen. "[if Mom is in the kitchen]Mom is busy preparing dinner.[otherwise if Mom is in the Hallway]Mom is passing through the hallway.[otherwise if Mom is in the Dining Room]Mom is setting the table for dinner."

This is a reasonable start.  Family dinner is in progress, according to our story, and our map is very small, so Mom only needs to appear in three locations; she has no reason to go into the Back Yard.  If we had more rooms, we might rely on a simple "Mom is here." for general purposes, but we have time and space to be more detailed. 

Now, how do we get her to move from one place to another on her own?  We have to implement a simple "state machine," which we will refer to as Mom's agenda (or "the agenda of Mom" in Inform-ese.)  We'll initialize her state with a value of zero -- this "agenda" value will be used to keep track of her status.  (This is similar to what happens in traditional videogames, so if you see some parallels here, you're not imagining things.)  The initialization code is as follows:

Mom has a number called agenda. The agenda of Mom is 0.


Now we'll write some code to handle Mom's agenda as it changes from turn to turn.  For now, she simply moves from the Kitchen to the Hallway to the Dining Room, and back again, with a change every few turns.  Most of this code is devoted to presenting Mom appropriately based on the player's perspective -- rather than simply warping from room to room (which is actually what she's doing!) we want her to visibly enter and exit if the player is there to see her do so.  We handle this by setting up some code to execute on every turn, regardless of what the player is doing; when her routine has made a complete cycle, we reset her agenda to 0 so she will repeat this indefinitely.  Note that Inform 7 uses indentation to clarify how these statements are interrelated, so the TABs are significant:

Every turn:
    change the agenda of Mom to the agenda of Mom plus 1;
    if the agenda of Mom is 2:
        if the player is in the Kitchen, say "Mom gives you a warning glance, and bustles out of the room.";
        if the player is in the Hallway, say "Mom steps deftly over you as she enters the hallway.";
        move Mom to the Hallway;
    if the agenda of Mom is 4:
        if the player is in the Dining Room, say "Mom enters the room and gives you a glance, as if to ask what you are up to and answer at the same time.";
        if the player is in the Hallway, say "Mom goes into the dining room.";
        move Mom to the Dining Room;
    if the agenda of Mom is 6:
        if the player is in the Dining Room, say "Mom leaves the dining room.";
        if the player is in the Hallway, say "Mom enters the hallway.";
        move Mom to the Hallway;
    if the agenda of Mom is 8:
        if the player is in the Kitchen, say "Mom enters and quickly surveys the room to make sure you haven't gotten into any mischief.";
        if the player is in the Hallway, say "Mom goes into the kitchen.";
        move Mom to the Kitchen;
        change the agenda of Mom to 0.





So now Mom exists, and she has her simple routine.  She does not at this point ever actually finish preparing dinner or setting the table; we've written a simple cycle to give her a semblance of life as part of our game world.  Her role in the finished game will be more complex, but this is a good foundation to build on.

How does the player interact with Mom?  Well, as of our previous installment we already have her throwing Riley out if he comes in with muddy paws; the simple geography of our map makes it plausible that she can step into the Hall at any time, so we don't need to fix any problems there.  So let's look at implementing a way for the player to communicate with Mom.  Riley is a puppy, so we should probably differentiate between random, pointless barking, which we'll call barking, and barking with intent to communicate, which we will translate to mean the same thing as talking.  Let's also implement growling as a verb with an object, similar to talking.  Here's how we'll do that:

Barking is an action applying to nothing. Understand "bark" as barking.

Growling is an action applying to one thing.  Understand "growl [person]" and "growl [something]" and "growl at [person]" and "growl at [something]" as growling.

Instead of barking in the presence of Mom, say "Mom says, 'Shhhhh, Riley!'".

Instead of growling Mom: say "Mom says, 'RILEY! Outside!'  It's much like a magic word, isn't it?"; move player to the Back Yard.

Carry out barking:
    say "You bark merrily.".

Talking is an action applying to one thing. Understand "talk to [person]" and "talk to [something]" as talking. Understand "bark at [person]" and "bark at [something]" as talking.

Instead of talking something, say "It does not reply."

Instead of growling something, say "The [noun] ignores your direst threats."

Instead of talking Mom, say "Mom says, 'I'm feeling rather [agenda of Mom]-ish.'"



Did you see what I did there?  Right now, we don't have any meaningful communication for Mom to share with Riley.  If Riley barks randomly when she's around, she shushes him.  If he growls at her, she throws him outside.  If he barks at her, we haven't yet defined anything she needs to say in response.  So I'm using her TALK response as a debugging aid, forcing her to mention her internal agenda counter as small talk.  This is useful for verifying that she's doing what we want her to do on schedule, and will continue to be handy as we flesh out her behavior.  We'll remove this later on.

What else do we need to do with Mom right now?  Well, we should make sure that Riley can't climb up onto the table when she is there to supervise.  So we'll modify the climbing code we wrote earlier to handle that.

Instead of climbing the Dinner Table:
    if Mom is not in the Dining Room:
        say "You jump high, higher, and then clamber up onto the dinner table.";
        move player to the Dinner Table;
    if Mom is in the Dining Room:
        say "Mom's look says, 'Don't do it!'"


Now, of course, we have a new problem -- if Riley is already on the table when Mom enters the room, she currently takes no note of it.  To fix this, we need to modify her "agenda 4" code to catch Riley in the act and, yes, toss him outside again:

    if the agenda of Mom is 4:
        if the player is in the Dining Room:
            if the player is not on the Dinner Table, say "Mom enters the room and gives you a suspicious glance, as if to ask what you are up to and answer at the same time.";
        if the player is on the Dinner Table:
            say "CAUGHT!  Mom enters the room and...";
            move player to the Back Yard;
        if the player is in the Hallway, say "Mom goes into the dining room.";
        move Mom to the Dining Room;

All of this setup establishes a consistent puzzle context for the Dining Room -- based on Mom's routine, Riley has a maximum of 5 turns to be on the table before Mom shows up and throws him outside.  This means that, as we proceed, we should try to set things up so that Riley needs every one of those turns. 

Next time, we'll consider the turkey -- how it looks, smells, and behaves for interactive purposes.  Our complete, current Inform 7 source code is below the fold.


Wednesday, October 13, 2010

Commercial Message: Coming Soon - A Review! Of Something!

It seems I've developed enough of a circulation that advertisers are interested in promoting their sundry wares to my readers.  I keep telling them that all y'all are interested in are video and computer games, but they keep coming back.  I presume this is because my readers meet certain demographic qualifications -- mature (by numeric definitions, at least), relatively settled, probably with a house, and very possibly working in an industry that affords them a modicum of disposable income.  And so it develops that CSN Stores wants me to tell you that they operate over 200 online stores, and specifically that if you're in the market for a dining room table, you can find a wide range to choose from at the link.

In exchange for the dissemination of this commercial message, the good folks at CSN Stores are willing to ship me some merchandise from one of their myriad online stores, so that I can write a review.  I'm considering some sort of media storage unit, because keeping old video and computer games (and their varying box sizes) organized becomes a challenge over time.  Perhaps we'll take a look at something along these lines:




So there will be some actual new ad-supported content in the near future, though all I can give you right now is the ad above and the vague suggestion of something interesting in the offing.  I hope that seems like a fair trade.

Elsewhere: Milton Bradley's Big Trak - UK vs. US TV ad

This isn't strictly videogame-related, but Milton Bradley's Big Trak was an interesting application of computer technology to toys circa 1979, back in the days when we thought everybody was going to program computers someday, instead of just using them as tools and information appliances.  I never had one, but it was a cool and memorable toy, and recently a smaller reproduction version has come to market.

It's also interesting to compare the British telly ad to the United States TV version -- both commercials follow the same template, but the UK version is more honest and polite.  It's clear that the toy kind of grinds and trundles along, and doesn't actually shoot lasers.  And Dad is cheerfully impressed:



Working from very similar scripts and storyboards, the American version does its best to make the toy look incredible, as though the US military-industrial complex was now in the hands of your child.  Unfortunately I can't embed it here, so you'll have to bop over to the host page at RetroJunk.com to check it out.  Enjoy!

Tuesday, October 12, 2010

Adventure of the Week: Adventure in the 5th Dimension (1983)

This week, we're playing through a historical artifact I stumbled across via the CASA database.  Brian "Professor" Moriarty is well-known to adventure fans as a talented designer whose career spanned generations of interactive fiction technology, including fine work for Infocom (Wishbringer, Beyond Zork) and Lucasarts (Loom).  But Moriarty's very first published adventure (according to Wikipedia) was written (mainly) in Atari BASIC and published by ANALOG Computing back in 1983:  Adventure in the Fifth Dimension!



The game takes some time to initialize, but runs at an acceptable speed once it's underway.  We begin on a street corner, where a handy morning newspaper tersely summarizes our mission -- to retrieve The Declaration (of Independence, it develops) for the local police department, an organization apparently possessed of remarkable patience and/or laziness:


From a historical perspective, it's really interesting to recognize Moriarty's design sensibility (and extra-dimensional tendencies) operating in the limited world of the two-word parser.  Adventure in the 5th Dimension has a degree of imagination, and some interesting puzzles, but it seems intentionally designed as a beginner's adventure so it's not particularly challenging.  I was able to solve it in less time than it took to write this post.

You probably won't need any of the information I reveal below to beat this one on your own, but since I haven't seen a published walkthrough for this title I will provide mine at the bottom.  In the interim, please remember that I'm all about the...

***** SPOILERS AHEAD! *****

I'm sure the original packaging and/or manual described our objective in more detail, but we get the basics from the morning paper, as crammed into the available memory:  Declaration Stolen! Police Anxiously Await Recovery!

Mapping is fairly straightforward, with simple N/W/E/S/U/D navigation, and even the rooms that tell us we're Lost in a maze of city streets are laid out cleanly and consistently. There are, however, some weird wraparounds at the edges, so drawing a map is useful.

An alien symbol appears on the police department's bathroom wall, rendered as three carats:  ^^^.  There don't seem to be any related jokes, no alien rabbits or jewelry puns; actually, this game plays everything pretty straight.

There's a minor puzzle involving some batteries -- the store in town offers GREEN BATTERIES ONLY $1.00!, and the parser uses the traditional reference-by-color convention.  We can BUY GREEN, but the green batteries don't work with the alien spheroid.  For that, we need the blue battery stashed in a broken portable radio -- we can see that there's a battery inside it, but can't discern its color, which makes it impossible to GET BATTERY until we OPEN RADIO and it falls out so we can GET BLUE.  We do need to buy the green batteries, though, as they will work with another alien contraption found later.  (Why alien devices work with Earth-standard batteries based solely on color code, I can't say, but the alien machines have a habit of absorbing the entire battery upon attachment.  Perhaps these extraterrestrials have succeeded in addressing the compatibility problems that always seem to plague humanity's technology.)

Oddly, Adventure in the 5th Dimension has no INVENTORY or TAKE INVENTORY command that I could find.  It does display a You have: list in the output window whenever the player's inventory changes, but I couldn't figure out how to see what we are carrying without dropping a known item and picking it up again.  There aren't a lot of items to juggle, as we can only carry four at a time, and most objects only have one use, so this isn't a major headache, but it is an unusual limitation.

It's not clear exactly who our character is, at least in-game.  I don't think we're a law enforcement official -- we seem to have no compunction about using a stone to break into a locked apartment via the window, at any rate.  Nor do we seem to have any special knowledge of advanced physics, it seems, as we're not able to recognize anti-matter when we encounter it.  As is usually the case in these games, we're just a nameless dude with a mission, but it's an interesting contrast to the detailed player characterization in Moriarty's later works.

Once we have attached the blue battery to the alien spheroid, it displays the same three-carat symbol seen in the police station's restroom.  Returning there, we discover that a transdimensional duct has opened, which leads to a white void that serves as a hub for the second section of the game.  We can't initially return from the white void -- in fact, we are permanently stuck in this area if we fail to bring the Teabag and Green batteries with us.

The transdimensional areas have color-coded backgrounds, making interesting use of the Atari 8-bit computer's display capabilities.  But while the white void is white, the deep forest is green, the infinite void is black and the golden void is yellow, the crimson void is... blue.

There are a couple of standard item guardian puzzles afoot -- we send a thirsty British soldier off with the Teabag (there's no need to actually brew any tea), allowing us to take his bayonet, which we can then use to threaten the 5th Dimensional Beast, scaring him off so we can take the alien cube.  Moriarty's text goes beyond the usual [Creature] WON'T LET ME! convention here, with specific variations on the theme for each guardian; the Soldier won't cooperate, while the Beast won't let me.

The infinite void room contains the Declaration we seek, guarded by a force field that presents the game's most difficult puzzle.  We need to retrieve the strange gloves from the crimson void, which are automatically worn when carried and somehow allow us to safely pick up the strange, shimmering anti-matter mass in the golden void.  It took me a while to realize this, because if we DROP GLOVES in the golden void room, they react fatally with the anti-matter just like anything else:



GET MASS has the same result if we are not wearing the strange gloves, as does dropping most other objects in the same room as the anti-matter (the alien devices seem to be an exception.)  We do need to use the anti-matter mass to destroy the force field, but it took a little doing for me to figure this out.  We can't THROW MASS from any location; if we DROP MASS, it sidles up against the side of the force field but has the same fatal result as before if we try to set it off.   I finally realized I needed to go back to my own dimension and retrieve the stone used earlier to break into the apartment (it's certainly a fine way to destroy evidence!)  We can then THROW STONE into the infinite void from the adjacent white void, and the parser breaks with its normal behavior here to solicit additional input.  Answering W or WEST creates an explosion in the infinite void, while we stand safely in the white, allowing us to enter after the anti-smoke clears and GET DECLARATION at last.  READ DECLARATION yields We the People..., confirming that this is indeed that Declaration.

All we have to do now is leave the transdimensional area, walk out of the bathroom to the police sergeant's desk, and deliver the goods.  Victory is ours!


This game is certainly not a fifth-dimensional beast, nor even a minor fourth-dimensional monster -- I was able to solve it in less than 90 minutes.  It's a fun little title, and well-suited to beginners -- everything gets used, the puzzles all make sense in game terms, and it's fairly forgiving, with only a few fatal and dead-end scenarios.  It's not bad at all, but veteran adventurers will find it interesting mostly as an early Brian Moriarty effort.

For history's sake, I'm posting a complete walkthrough below the fold, and have also uploaded it to the CASA database.

***** WALKTHROUGH ***** (below the fold)

Monday, October 11, 2010

The LoadDown - 10/11/2010 - Sonic the Hedgehog 4!

Every week, we round up the latest games not available on disc...

WiiWare -- Two games this week.  One is Triple Jumping Sports, a simple track-and-field sports game focusing on long jumps and pole vaults.  The other is Sega's highly anticipated Sonic the Hedgehog 4 Episode I -- at long last, a proper 2-D side-scrolling sequel in the classic Sonic style.  Early buzz has been very positive.  And it looks great - classic style with subtle modernizations:



Wii Virtual Console -- Quiet this week, leaving room for retro fans to indulge in Sonic 4.

DSiWare -- Three new titles on the handheld this week.  Ivy the Kiwi? Mini is an awkwardly-titled platformer sending a young kiwi on a quest to find her mother (the kiwi last starred in Taito's The New Zealand Story.)  Datamine seems to play a bit like Buster Bros. with puzzle elements.  And G.G. Series SUPER HERO OGRE is a fast-paced, minigame style action contest with an emphasis on chaining attack moves.



XBox Live Arcade -- Another substantial game from this fall's Game Feast lineup -- Comic Jumper: The Adventures of Captain Smiley, the latest from Twisted Pixel, throwing a sales-challenged superhero into various comic book genres, with hilarious results.

Game Room -- Four games last week.  Activision's rare Private Eye graces the Atari 2600 platform, Konami GT is a pseudo-3D racer from the mid-80s coin-op arcade scene, and the Intellivision lineup expands with the rare Body Slam! Super Pro Wrestling and the simple shooting game Sharp Shot.

PS3 on PSN -- One new title in the past week:  Deadliest Warrior: The Game, based on the Spike TV series, which came out on XBLA during the summer to middling reviews.  It's a weapons-based one-on-one fighter featuring eight warriors, each inspired by a specific era in the history of human warfare.

Sunday, October 10, 2010

Columns III Won't Give You Zits

Apples-and-oranges department... addictions are fun!


Unlike, say, Tetris, and all those other puzzle-play pimple-pushers.

Something strange thing about this whole situation is that the Columns puzzle-game series was a Sega arcade franchise, and Columns III was developed as a Sega product, but this Genesis cartridge was ultimately released and promoted in the US by Vic Tokai Inc.  Perhaps the line had begun to run out of steam by this time, and Sega couldn't be bothered to bring it to the States on its own.

But at least it won't give you zits.  You should buy it.

Saturday, October 9, 2010

List Your Enemies! Now Make Them Play Shaq-Fu!

I've written previously about the odd basketball idol fighting game Shaq-Fu, but recently ran across this even more bizarre pre-release magazine ad for the game:



Why, exactly?  In what bizarre universe did kids make an enemies list, pray, and then do something undefined regarding Shaq-Fu?   This open-ended suggestion would never fly today; even attempting the first step is likely to create a heap of trouble in this post-Columbine era.

I suspect the idea was to list some despicable lowlifes, i.e. your neighborhood bully and your geography teacher, so you could imagine beating them up as the powerful, virile, rich and eloquent Shaquille O'Neal after picking up your copy of Shaq-Fu on October 28th.

But now that we've all seen the finished game, the lingering impression here is that, deities willing, they're all going to be stuck playing Shaq-Fu.

Or that would be the case, if not for the frustratingly inconsistent pronouns.  YOU'LL GET YOURS, indeed.  But it's not really clear what's going to happen to THEM.