writing interactive fiction without a programming language

Warning ahead for a rambling post.

The English-like syntax of Inform 7 gets a lot of flak, mostly from programmers who say something like how programming languages should express concepts in concise and symbolic ways due to the nature of programming itself.

However one of my favorite things about Inform is not really the English-like expressions of ‘The Kitchen is a room’ or stuff like that, but how you can create new phrases. For example, from the I7 docs:

To make (character – a person) lose (point value – a number) points in the eyes of (voter – a person): …

To use that phrase, in your code you’d write something like ‘make Biff lose 10 points in the eyes of Buffy‘. Now if you were to translate that to a more conventionally symbolic language like Python for example, it might look like biff.score_points(-10, ‘Buffy’). In other words it’s a more verbose expression of the function.

It’s not that I necessarily prefer one syntax over the other — but what the first does is let you create a mini-language for describing that procedure of the program. Of course, that’s exactly what the Python function does as well. But because the first example is not necessarily couched in the syntax of I7 itself, I think the possibilities become much, much greater and more powerful.

Exactly how, well I’m still a little fuzzy on that. I’ve read a little recently about domain-specific languages, in particular I found this article about language-oriented programming. It’s rather out there but worth perusing.

I think I’ve said this before, but in using Leo recently it’s made me think more about what a program really is. It’s rather obvious it’s not a syntax file. However it seems, primarily, that few people examine and write programs in something other than a syntax file.

Leo takes that next step with its outline; I guess other tools such as debuggers and code browsers do something similar.

A question I seem to be orbiting lately is the somewhat unique case of how IF combines code and prose. In that sense IF isn’t too unlike a structured markup language like HTML, only markup languages rarely contain process — well, unless you count things like JavaScript. Regardless, language-oriented programming feels like it offers something to interactive fiction development. I think the synchronicity of the two terms is not a surprise. Dave Cornelson made an interesting post with regard to domain-specific languages at Intfiction. I don’t really like his choice of platforms but the core idea is worthwhile.

To get back to what a program is (forgetting the presumption of that statement for a moment) — an IF language that really was an IF-language creation language is another way of getting at that. If the IF author could specify how they create the work (and I mean really specify, not just within the specification of a syntax), is that another way of realizing the program?

A poet or a novelist is free to invent new constructs of language, new devices of storytelling or expression, in order to communicate the work. I guess an IF author does that by creating the process of the program — but is doing so within a defined syntax an unnecessary limitation?

A defined syntax obviously creates a framework an author can hang their hat on, and it makes it easier for authors to exchange examples and extensions to the core language. If every author created their own language for their work I can imagine any community collaboration could become difficult.

On the other hand it might turn out that certain mini-languages are more appropriate for some implementations than others. Does the barrier to entry become too high when, to write a work, you need to understand five or six mini-languages rather than just one syntax specification? Probably an IDE would obviate some of these difficulties…tools like the T3 Workbench or the I7 IDE do some of that already. But at the same time I’m not sure you’d want a very strictly defined IDE. Maybe something more like a Smalltalk environment? One with live code reloading…

Is it strange how these ideas keep turning in circles?

Advertisements

2 comments so far

  1. chisai motekite on

    um, does anyone use Prolog for IF?
    Lisp/scheme for this seems the most natural to me…
    ugh

  2. georgek on

    No one is actively using Prolog to write games now (or ever, as far as I know), though I think the old Oz Project at CMU used it for some things in their research. You could say Inform 7 borrows some ideas from Prolog too.

    As far as Lisp goes, there’s no ‘modern’ Lisp IF system, though of course there’s ZIL which is Lisp-like, and if you search for that you’ll find a recently released compiler I believe.

    I think with the right abstractions Lisp would be very good for IF, but at this point I think I’m convinced that the best thing for an IF language is for there to be very little friction in printing the prose to the player (in both how you as an author can arrange things like timing, order and arrangement, and how you deal with the material of the code itself).


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

%d bloggers like this: