Best Practices for Inform 7 Games

Some I7-specific advice: the biggest benefit of I7 over other languages is that it can produce very readable code. Aim for your code to read like English, which will make it easier for you to skim later and figure out what’s going on. Remember that each line of code is usually read many more times than it’s written!

For example, Inform doesn’t care what articles you use with nouns except the very first time you declare them. These bits of code are equivalent:

A desk is in Study.
Instead of taking desk: say "It's too big."
A book is on desk.
There is a desk in the Study.
Instead of taking the desk: say "It's too big."
On the desk is a book.

A lot of people prefer the first style, cutting out extraneous words. Why use “the” if it doesn’t mean anything? But I think it’s good style to include it, because the more English-y your code reads, the easier it’ll be to skim later. Your brain has years and years of practice skimming English to find the most important bits. Using a couple extra words to tap into that skill is a good tradeoff, in my opinion!

6 Likes