Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Inform is a programming language for creating interactive fiction (ganelson.github.io)
131 points by tta on Dec 22, 2022 | hide | past | favorite | 32 comments


I discovered Inform 7 last year and was impressed at the sophisticated platform it provides for writing interactive fiction in semi-natural English. In the 1980s there were plenty of books about writing text adventure games (as they were more widely called then) on home microcomputers, and I learned a lot about programming Acorn computers from Peter Killworth's "How To Write Adventure Games for the BBC Microcomputer Model B and Acorn Electron". So to give Inform 7 a try, I implemented the mini four-room adventure from that book, and wrote a walk-through of how to do it quite neatly with the building blocks of Inform 7 here in case anyone's interested: https://www.eclecticstacks.com/post/mini-adventure-in-inform...


> In the 1980s there were plenty of books about writing text adventure games (as they were more widely called then) on home microcomputers

Indeed. Adventure games were the most sophisticated games around. Companies like Infocom and Magnetic Scrolls ruled the roost. Teenagers like myself aspired to one day work there, which for me was a major reason to go and study AI (which was mostly parsers and tree walks at the time).

And then along came iD software. One day I walked into the shared computer facility of my university and everybody was playing Castle Wolfenstein and I remember thinking: o shit...

Fortunately AI did not turn out to be such a bad choice after all.


I had the pleasure of being taught mathematics by the creator of Inform, Graham Nelson, at Oxford (and Oxford class sizes are _small_, 2-5 students). He’s a super interesting guy - created Inform, teaches pure mathematics at the highest level, but seems to most enjoy writing poetry.


As I posted about 4 months ago on "The Futures of Inform" <https://news.ycombinator.com/item?id=32571293>:

The "Inform 7 Programmer's Manual" by Ron Newcomb explains Inform 7 from the point-of-view of someone who knows how to program in other languages. Version as of August 15, 2011: http://www.plover.net/~pscion/Inform%207%20for%20Programmers...

An older 2009 version (if PDF is a problem): http://www.plover.net/~pscion/inform7.html


Inform 7 code is interesting from a conceptual perspective —- “How could we build a programming language that looked like natural language?”

In practice though, I think it ultimately falls into some kind of uncanny valley, where it’s just enough like natural language that it seems like a certain sentence or grammatical construction should work, but it doesn’t.


> some kind of uncanny valley, where it’s just enough like natural language that it seems like a certain sentence or grammatical construction should work, but it doesn’t.

Luckily, the target audience of Inform are people who like adventure games (people who are used to playing "guess the verb").


There is definitely a lot of fiddling with the text when writing, because you aren't really writing in English but instead a programming language.

On the other hand, the results can be remarkably readable, and in a fascinating way. As an example, here's a small game I wrote using it:

https://dwheeler.com/accuse/source.html

I don't know if there's a lesson to be learned, but as someone who's learned many programming languages, Inform 7 is intriguingly different.


There's a popular programming language for writing Minecraft plugins in called "Skript", it also looks like "natural language" and I find it jarring to use.


If the end result is Literate Programming, that's worth learning their programming language, yes?


Related: Has anyone tried ChatGPT to generate Inform code? Could be interesting.


Yes, it works well. The first time it misunderstood my query "write a very short story in Inform 7", but after clarifying ("I wanted a short story written as an Inform 7 program"), it wrote me the exact same story but in Inform 7.

Not sure if it's because I said "very short", but it basically locked me into a cabin without letting me go anywhere. It did describe a fair amount of objects inside the cabin though.


It would be a real boon for non-programmers if you could build a text adventure game just using text dialogue with a system like that, interactively describing all the locations, objects and interactions.

After that you could of course add AI-generated images, videos, music and voice (TTS).


It would be amazing yes. Debugging is the other skill you'd need.


I’m much more interested in how a language model could be leveraged by an interactive fiction language. Obviously there is a lot of potential, but integration of scripted rule based logic with a machine learned logic has always been difficult.


Inform7 it's cool but the generated adventures are 'huge' and the might run slow on m68k based machines. If you like oop (much easier than Python, even a kid from Elementary could understand the basic syntax) and supporting legacy machines, inform6 is still maintained. IBG.pdf for an introduction to if6 and DM4 for mid-high complex stuff such as writting libraries and setting up non-standard objects with twisted grammars.


For some data on the game size (based on my implementation and analysis of a BBC BASIC four-room game "MINI" which I referenced in another comment and won't self-promotionally spam again...)

The source code for MINI weighs in at 4.6 K, saved in the tokenised form used by BBC BASIC.

In comparison, the Inform 7 source is around 3.3K in size. But that isn’t executable - it can be run in Inform 7, or it can be compiled into a “story file”, of which Inform 7 supports two formats. In the older, more portable, Z-Code format, I got a blorb (package) of 406 K; in the newer, more sophisticated Glulx format, I got a blorb of 602 K.

And to actually play the story file, you need an interpreter - for example, Windows Glulxe, an interpreter for (as the observant reader might guess) playing Glulx story files under Windows, is a further 275 K. Inform 7 can also produce a story file and bundled Javascript interpreter for a version playable in a web browser: for MINI, this bundle weighs in at 1.1 MB.


For 8 bit computers I'd use Puny Inform. Much easier to develop and the resulting ZMachine V3 file will run everywere. Even on Game Boys and PostScript interpreters.


Related:

Inform: A Language for Interactive Fiction - https://news.ycombinator.com/item?id=9279639 - March 2015 (50 comments)

Inform 7: An adventure game programming system based on natural language - https://news.ycombinator.com/item?id=134541 - March 2008 (1 comment)


Related comment from yesterday's thread about the Ink language: "Inform7 internally works like a very primitive rules engine..."

https://news.ycombinator.com/item?id=34081090


What are the most popular languages for writing IF?

Why would I choose one over another?


If you're a beginner, I can definitely recommend Adventuron to get started very fast. It has a browser-based IDE and compiler, and gives you a simple portable html file for your game. Last IF jam we took part in, even veterans in Inform did not have the same level of polish that Adventuron has as default. Some even struggled to get a portable executable at all.

Why would you choose why over another? It's like general programming languages, the design makes trade-offs between expressiveness and simplicity, makes one approach more canonical than the others (e.g. in state management, choice between focusing on transition or locus, etc).


Your primary decision is parser vs. hypertext, with Inform being the default choice for parser and (I think still) Twine for hypertext with Undum also being a popular choice.

Most companies producing commercial IF have in-house tooling focused on their "house style", e.g. ChoiceScript for CYOA with "chunky" dynamic content versus StoryNexus (or whatever its modern iteration is) for a more fine-grained RPG-like approach.

How (or whether) you simulate time passing also differentiates many engines.


CYOA is boring, it's just hypertext before the hypertext. Even the easiest if6/ZMachine adventure such as 9:05 has more choices and interactivity.


"More choices is better" is bullshit.


Sure? Go play Anchorhead, I-0 or, under the roguelike domain, compare the now combat-linearized DCSS against Nethack/Slashem.

Text adventures are not CYOA games, a lot of emergent gaming can arise. For instance, All Thing Devours has several methods to win by exploiting the time travelling puzzles.


Does anyone have any experience integrating Inform into something like a C++ based game as a rules engine to add emergent complexity for objects/interactions/dialog?


Inform 7 is a work of art and one of the most interesting programming languages out there.


What in particular makes it so compelling?


I tried Inform years ago, and finding Rosetta Code solutions in Inform 6 and 7 intrigued me. The '99 Bottles of Beer' solution was the first I looked at then[1]. This was even after I had played with NLP in the 90s. It seemed right and strange at the same time.

This has been blown away by ChatGPT now!

[1] https://rosettacode.org/wiki/99_bottles_of_beer#Inform_7


Does inform generate the story (like ChatGPT)? Explored the Inform website. Not sure what am I looking at.


I don't think it generates the story for you, no. I think it handles parsing inputs as natural language, though.





Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: