Introducing Inform 7

Posted: January 11, 2012 in Books, Interactive Fiction, Real World Applications
Tags: , ,


So regrettably for me, game development involves a not-inconsiderable amount of computer programming. It’s not that I hate programming, but my brain just doesn’t work like that naturally. I like putting things together, I like seeing them all work, and I did tolerably well in the one Flash course I took. However I have very little patience for debugging, and it definitely is a different language.

In an effort to become familiar with the framework of programming, without having to pick up a book on Javascript or C++, I am going back to a very old school type of video game: the text adventure. Inform 7 is a program for developing interactive stories that uses much more natural language.  Here is an example of Inform 7 code:

Every turn when a container (called the sack) held by someone visible (called the unlucky holder) is bursting, say “[The sack] splits and breaks under the weight! [if the player is the unlucky holder]You discard[otherwise][The unlucky holder] discards[end if] its ruined remains, looking miserably down at [the list of things in the sack] on the floor.”

Reed, Aaron (2010-08-19). Creating Interactive Fiction with Inform 7, 1st Edition. Delmar Learning. Kindle Edition.

Inform 6 has a much more traditional structure. The exact same thing would look like this:

{Initialise s;

objectloop (s ofclass sack) {

StartDaemon(s);

}

];

Class sack

with daemon [ unlucky_holder;

! check to see if sack is bursting and its owner is visible

unlucky_holder = parent(self);

if ((self.bursting == 1) && TestScope(unlucky_holder, player)) {

print (The) self, ” splits and breaks under the weight! “;

if (unlucky_holder == player) {

print “You discard”;

} else {

print (The) unlucky_holder, ” discards”;

}

print ” its ruined remains, looking miserably down at “;

WriteListFrom(child(self), DEFART_BIT + ENGLISH_BIT);

print ” on the floor.^”;

}

],

has container;

Reed, Aaron (2010-08-19). Creating Interactive Fiction with Inform 7, 1st Edition. Delmar Learning. Kindle Edition.

Now natural language programming isn’t exactly like “real” programming, but for my purposes it doesn’t have to be. I just want to get experience putting together a game. Excuse me, I meant an “interactive fiction.” So I’ll be working through Creating Interactive Fiction with Inform 7. Hopefully next week I’ll have worked through the exercise the book takes you through. Then I can start putting together my own games. This is gonna be a lot of fun.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s