Inform 7 and Interactive Storytelling – Pt. 1

Chapter 9 of the 2nd edition of Chris Crawford on Interactive Storytelling is about interactive fiction (IF) and whether it has the potential to be a precursor to interactive storytelling.

At first glance Inform 7 looks like it would be ideal as an interactive storytelling development environment. Code is written using a natural language syntax which, while still a programming language, is light years away from the curly bracket semicolon world of declarative languages.

Here’s a definition of a room, a character and some props.

The Kitchen is a room. The cat is an animal in the Kitchen. In the Kitchen is a bowl, a ball of wool, a newspaper. The bowl contains a quantity of cream.

The cat is wearing a silver collar. The description of the cat is“It is wearing [a list of things worn by the cat].”

The player carries a closed openable container called a bag. The bag contains catnip.

And here’s a slightly more complex definition of a burst sack.

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.

Pretty powerful stuff. Using this syntax, an author can create an indefinite number stages, props and characters and expand on any of their built-in properties. Custom behaviors can be created for any of these entities and triggered on a wide variety of conditions. Numerous extensions have been written that provide additional functions. Gameplay is turn-sequenced – one turn elapses for every typed player command – but delays can be introduced for a specific number of turns by the author.

Yes, I wrote typed. All input is through typewritten commands and the output to the player is also text (Inform was originally designed to write and play the old-style text adventure by a company from the 80s called Infocom).

Here’s an example of some game output and input. Typed user input in the text below is prefixed with the greater than (>) sign.

You are in an open field west of a big white house with a boarded front door. There is a small mailbox here.

> OPEN MAILBOX

Opening the mailbox reveals: A leaflet.

> READ LEAFLET

Welcome to Zork (originally Dungeon)

Dungeon is a game of adventure, danger, and low cunning. In it you will explore some of the most amazing territory ever seen by mortal man. Hardened adventurers have run screaming from the terrors contained within.

> GO NORTH

You are facing the north side of a white house. There is no door here, and all the windows are barred.

You get the idea.

At first glance you’d think Inform would be the ideal tool to create storyworlds. Chris doesn’t think so and he lists what he considers Inform’s major weaknesses – poor handling of numeric calculations, boolean bias and no structure.

On its poor handling of numeric calculations.

[I]t can handle the four basic operators (add, subtract, multiply, and divide) as well as square root. You can do a lot with these. However, mathematical formulas are clumsy to write in Inform 7, and anything more than a handful of numbers becomes a nightmare to keep track of.

On its boolean bias.

This [Inform 7’s predilection for Boolean concepts] is fine for props that can be either broken or unbroken, light or heavy, hidden or visible, and so forth. But it gets a bit silly when applied to human relationships. Does Jane either like or dislike John? Is Fred either friendly or aloof? Is Tom a coward or a hero? . . . [This] encourages the author to approach everything as either black or white.

And on its lack of structure.

These [modern programming] languages make it easier to write big programs without getting lost in a maze of instructions. Not so with Inform 7. . . . [T]he source code for a good storyworld called Alabaster is organized like an outline with 12 high-level entries, at least 60 mid-level entries, and a few score low-level entries. Each entry comprises about a page of code. . . . Reading the code is like traversing a maze that has references to things that you can’t readily find.

The latest build of Inform, 6L02, the first new release in three years, was announced on May 7th, 2014. I’ve only toyed around with Inform over the years but as I scanned the announcement one thing caught my eye.

[T]o implement full floating-point arithmetic in numerical kinds of value, at least on the Glulx virtual machine.

The release notes go into a bit more detail.

Inform has a new kind of value, “real number”, which is only available for projects set to Glulx. “real number” behaves very like the “float” type in C, C++, Java and similar programming languages, since, like them, it follows the IEEE-754 binary32 standard for floating-point arithmetic.

It may seem odd to be creating a second kind of number, having just gone to great effort to unify two kinds of text, but the difference here is that arithmetic is fundamentally different for floating-point numbers.

Real numbers are typed much the way that they would be in science or mathematics textbooks. Thus:

let gamma be 0.5772156649;
let Avogadro’s number be 6.022141 x 10^23;

In Part 2 I’ll dig a little deeper into what’s possible with real numbers in this latest release of Inform 7 to see if this new version addresses Chris’ point about poor handling of numeric calculations in previous versions.

This entry was posted in Other and tagged . Bookmark the permalink.

2 Responses to Inform 7 and Interactive Storytelling – Pt. 1

  1. Pingback: Inform 7 and Interactive Storytelling – Pt. 3 | Objective.Me

  2. Pingback: Siboot in 2017? | Objective.Me

Comments are closed.