Improvements for the Inform Language
by Maxwell Joslyn. (updated
2020-02-10T18:38:07-0800: This page is unfinished. I have not actively worked in Inform for about a year now, but hope to do more work with it in the future.
Introduction
Here I am documenting problems of language design and usability that I've noticed while using Inform 7 to implement Ryan Quest and Fedoradventure.
Inform 7 (hereafter just "Inform") is a programming language and game engine specialized for creating interactive fiction (IF), a genre of software which grew out of text adventure games. Classic examples include Colossal Cave Adventure, Zork, A Mind Forever Voyaging, and The Hitchhiker's Guide to the Galaxy. The distinguishing feature of interactive fiction is that it primarily uses text to convey its world and narrative (although many games supplement this with images or audio.) The player types in commands for their avatar, the game logic updates the game world as necessary, and the resulting update is described in text for the player to read.
Despite my grievances here, my overall attitude toward Inform is quite positive. Most of the time it is pleasant to use, and no other game-creation system gives me such a quick design-develop-test loop. I hope that expanding and sharing this page will lead to some of these criticisms being addressed -- even if only by myself, in a language extension that only I will use.
Inform code is quite readable even for those who have never encountered it before. However, before continuing, please note that a comment in Inform source code is set off in square brackets, [like this].
Inconsistent Syntax Keywords
You can use either "of" or "from" to express two rooms being linked to each other by a direction.
Room A is a room. Room B is a room. Room C is a room.
Room A is north of Room B. Room B is south from Room C.
However, once you have created such a connection between rooms, only "from" is valid for testing that connection. "Of" won't work.
[wrong; will not compile]
If Room A is north of Room B:
do nothing.
[right]
If Room A is north from Room B:
do nothing.
Wordy Syntax
This code iterates over each element of a list.
let L be the list of muddy rooms;
repeat with X running through L:
do nothing.
Here is my proposed replacement.
let L be the list of muddy rooms;
for each X in L:
do nothing.
"For each X in (the) Y" is a common idiom, whereas "repeat with X running through" sounds like robot-speak. It is therefore a bit friendlier for English-speakers who are learning Inform, and much friendlier for non-native English speakers. My proposed change is also shorter, easier to type, and not yet an existing Inform keyword -- so far as I know.
Unwise Defaults for "Release Website" Templates
I haven't investigated whether this is still a problem in more recent releases of Inform.
In Inform's IDE, the "Release Website" command compiles your game's code and any "materials" (digital assets, such as pictures) into a webpage. That webpage also displays some bibliographic information about the game, the display of which can be controlled by applying a user-suppliable template.
I dislike how the default template for "Release Website" exposes some information to the end user about the system which compiled the game. Here are examples of two materials to which this occurs:
- the small cover image gets renamed to /Users/yourname/path/to/game/source/Small Cover.png
- the large cover image becomes /Users/yourname/path/to/game/source/Cover.png
In other words, these two absolute paths on the system compiling the game get leaked in the release metadata.
I think that releasing an Inform game should instead make these metadata filepaths relative to the game/materials
folder, i.e. they should simply be "Small Cover.png" and "Cover.png". I know that's possible because it happens with other materials which the compiler moves into those folders.