Posts Tagged Inform 7

Andrew Plotkin’s Quixe Beta: Glulx Games Directly In-Browser!

In a surge of holiday-weekend coding, Andrew Plotkin (Zarf) has progressed his Quixe project to the beta stage and released it for evaluation.  If you’re very familiar with the excellent Parchment project, you’ll know that Parchment provides a Javascript implementation of the Z-machine, which is one of the major virtual machines used in the interactive fiction community.  When you play a game via Parchment, you don’t need plugins or standalone interpreter software at all — you play directly and natively in the browser.  This has obvious advantages for outreach — many people are leery of downloading unknown executable files at all.  And unless your game runs in Flash, convincing someone to install a browser plugin can be almost as hard a sell.  So Parchment has been a great mechanism to make Z-machine games available to not just a wider audience, but to a wide variety of devices as well.  Almost any device that supports a Javascript-enabled web browser can access interactive fiction through Parchment.

But until now, Glulx games were left in the cold.  Glulx is an alternate virtual machine developed by Andrew Plotkin to address some of the limitations of the Z-machine.  There’s more addressable memory as well as support for multiple windows, graphics, and sound, among other improvements.  Inform 7 gives you a choice of using Glulx or one of the Z-machine formats when you compile a game.

Unfortunately, using Inform 7 for a game of any complexity almost forces you into using Glulx, whether you are making use of its enhanced capabilities or not.  Inform 7 generates large game files that easily push past the Z-machine limits.  Particularly if you make use of the growing extension libraries you are likely to inflate yourself right past even the Z8 format’s cap on size.

So Inform 7 developers have (for the most part) found themselves unable to enjoy the same advantages of accessibility and ubiquity that Parchment gives Z-machine authors.

Enter Quixe.  Quixe provides a native Javascript implementation of the Glulx VM.  When combined with a suitable output layer (in this case I believe Zarf is using his own GlkOte implementation) it enables the same type of direct-in-browser play for Glulx-based games that Parchment enables for the Z-machine.

He’s currently got five games up on his page, but authors are able to convert any existing Glulx games using the zcode2js tool, and run them via his engine.  If you do this, you’ll notice that not everything is functional yet.  In particular, if you play the conversion of Rover’s Day Out you’ll miss much of the text formatting and screen effects that are visible in the game when played via a standalone interpreter.  Also, Internet Explorer does not currently work (!) Presumably these problems will be fixed and capabilities will be added in as development proceeds.  I expect we’ll also see the new style model that Zarf has been discussing over the past few months.

And of course, I had to run a conversion of my own Glulx game, Grounded in Space!  Despite not being very long or complex, I had to use Glulx for this game due the need for fairly high-precision floating-point math for one of the puzzles.  I haven’t gone through it in detail yet, but it seems to have converted correctly.  It doesn’t use any odd tricks that should prevent it from being playable, although the geometry puzzle might be even less comprehensible due to style and font issues.  At any rate, it’s very cool to have this capability, and I hope by the time this year’s Comp rolls around we’ll have a much larger number of games able to be played online due to Quixe!

Tags: , , ,

Inform 7 Tips — Syntax Options for Action Responses

There are several ways to approach writing complex behavior in Inform 7.  Two common ones are what I’ll call “action oriented” and “subject oriented”.  It might make more sense to use “object oriented”, but that term already has enough associated connotation and confusion.

The “action oriented” style seems to be the one used most consistently in the Inform 7 documentation, and as you would expect it’s very useful and readable.  An example is something like this:

Instead of examining something in the presence of Dan when Dan is bored:
	say "'Quit gawking at the scenery and entertain me!'";

Note that this code applies to the player whenever he or she examines anything.  Although there are additional qualifiers attached that limit the scope of the rule, and we could certainly add more, it fundamentally works as a modifier (or in this case, a replacement) for a single action against a range of possible objects.

But it’s often the case that you want specialized responses for a number of different actions performed in certain circumstances.  You can achieve this using a more “subject oriented” style:

Instead of doing something to the teak table in the presence of Dan when Dan is bored:
	say "'Quit screwing around with the table and entertain me!'";

We now have a rule that makes anything you do — to the table, and the table only — trigger a generic complaint message.

All this is great as far as it goes, but what if we want to get more ambitious yet?  Let’s say Dan mocks you when he’s bored, and you’d like him to have something different to say depending on what you happen to be doing.  How would we express this?

If we went by the book we could make a bunch of “action oriented” rules, arrange them in a rulebook, and run that rulebook when the proper conditions apply.  If we did that, we’d have something that looked like this (code changed due to Andrew Plotkin pointing out that the Report rulebook doesn’t have a generic version):

The block singing rule is not listed in any rulebook.

After doing something in the presence of Dan when Dan is bored:
	consider the mockery rulebook;

A mockery rule when examining:
	say "'Ooooh, look at me!  I'm wasting time looking at something completely irrelevant!'";

A mockery rule when singing:
	say "'Hold on there, pal!  Ryan Seacrest is holding on line one!  He wants you to be the next audition reject on American Idol!'";

etc.

This works, and works well.  In the case where you want to do anything dynamic to the rules on the fly, this is definitely the way to go.

But there’s another syntax that allows expressing these kinds of constructs in a more straightforward manner, particularly if you don’t need the full power of a rulebook.  The Inform 7 documentation hints at this, but doesn’t always give you full examples of the syntax.  Here are the above rules expressed in this other format:

The block singing rule is not listed in any rulebook.

After doing something in the presence of Dan when Dan is bored:
	if examining:
		say "'Ooooh, look at me!  I'm wasting time looking at something completely irrelevant!'";
	otherwise if singing:
		say "'Hold on there, pal!  Ryan Seacrest is holding on line one!  He wants you to be the next audition reject on American Idol!'";

This is good — I like it because it groups together all the special responses when a particular condition obtains — but often we might want to specify an action that can involve multiple nouns.  In that case, you can use the following syntax (if you have a filling action defined):

...
	otherwise if filling something with something:
		say "'You're wasting your time with that...'";

and, of course, you can specify either or both of the nouns as well:

	otherwise if attacking Dan:
		say "He easily dodges.  'C'mon, wimp!  You'll need to do better than that!'";

It would be nice, as long as we’re valuing brevity, to be able to use the “switch/case” syntax for this — something like:

The block singing rule is not listed in any rulebook.

After doing something in the presence of Dan when Dan is bored:
	if the current action is:
		-- examining:
			say "'Ooooh, look at me!  I'm wasting time looking at something completely irrelevant!'";
		-- singing:
			say "'Hold on there, pal!  Ryan Seacrest is holding on line one!  He wants you to be the next audition reject on American Idol!'";

… but I haven’t been able to find a variant of this syntax that works properly.  Perhaps the new version of Inform 7, scheduled to be released today, will allow this.

At any rate, I hope this was useful.  Rulebooks are exceptionally powerful and many times they are the proper solution to your design issues, but don’t underestimate the power of the “subject oriented” approach.  By keeping your related actions in close proximity like this, you can keep your code clean, readable, and well-organized.

Tags: ,

Inform 7 Tips — Keyword Disambiguation For Verb/Noun Conflicts

I thought I’d share an Inform 7 programming tip I’ve come up with in recent work on my new game.  As you could probably have guessed from previous blog entries (here and here), I’m using a keyword-based interface in this new work.

At its core, what a keyword-based interface does is to link up a generic single-token input to one or more default actions, such as examining, asking about, or going.  Here’s a very basic example of some code that you might use to effect this:

Understand "[something]" as examining.

Simple, right?  Now if you type a word that refers to an object, the game will examine it.

Well, most of the time it will, except in a couple of annoying cases.  What if you have a drill in your game?  You could refer to the drill as the keyword “drill”, but if you have a drill you likely also have a drilling action as well.  What happens then?

Drilling is an action applying to one thing.

Understand "drill [something]" as drilling.
Understand "drill in/into [something]" as drilling.

What happens here is that whenever you type “drill”, the system immediately assumes that you want to use the specific “drilling” action rather than the generic keyword examination, and it asks you to clarify what you want to drill.

Likely this is not really what you want.  If it is, you’re fine; you can leave things as they are.  But in a keyword-focused game, you might judge it more important to preserve the behavior of the keywords and force the user to actually specify an object to drill if they want to perform the drilling action.

The reason the parser resolves a command of “drill” the way it does is not easy to pin down through standard Inform debugging commands, but is almost certainly due to the same general prioritization rules that it uses throughout the system:  the most specific match wins.  Even though “[something]” and “drill [something]” are both potentially valid matches for an input string of “drill”, Inform counts the exact text match of the drilling action as a closer match, even though it requires a second token. To Inform, that’s not a problem; it knows how to prompt the player for that required noun.

To get around this behavior, you need to provide a match that’s even closer.  Fortunately, this is pretty easy:

Drill-referring is an action applying to nothing.

Understand "drill" as drill-referring.

Instead of drill-referring:
	try examining the electric drill;

Now we’ve implemented an action tied to an exact match to the input token.  “Drill-referring” is now the best match for an input string of “drill”, and we can wire up the “drill-referring” action to do the appropriate thing.

Likely you won’t run into this type of behavior in a whole lot of places, but it can be nice to know how to resolve it if you do.

Tags: ,

New Inform 7 Release Imminent

Great news from vaporware’s post on rec.arts.int-fiction!  Inform 7 will have a new release on or shortly after April 28th!

Items slated for the new build will include:

  • Tidier user interface
  • Easily publish Inform works to the web, including a release mode
    that creates a playable web site using Parchment
  • Many language restrictions removed, and more expressiveness in
    talking about kinds, phrases, relations, etc.
  • Many Standard Rules actions changed to provide default behavior
    closer to what modern authors tend to want (automatically opening
    doors, handling TAKE ALL more naturally, and so on)
  • More than 250 bug reports resolved

Can’t wait!

Tags: , , ,

Keyword Interface for Conversation Package

Following up on my previous articles on integrating Aaron Reed’s Keyword Interface extension with Eric Eve’s Conversation Package system for conversations (part 1 and part 2), I’ve packaged up the interface code as an extension and submitted it to the archive, so it should be showing up there shortly.

The code is a bit different from what was presented in the articles, due to some changes required because of minor issues with new versions of the extensions it builds upon.  The extension should support both Glulx and Z-code text coloring.

Thanks to Strainer for providing me the kick in the pants I needed to get this done!

Edit:  Due to an apparent bug with the OS/X version of Inform where it perhaps adds the author’s name and the extension name together before comparing against the 51-character limit, I’ve changed the name to “Keywords for Conversation Package”.

Tags: , ,

Inform 7 Development: Implementing Single-Keyword Conversations

This is part 2 of a series.  If you haven’t read the first part, you might want to start there.  In that post, I describe how to use Aaron Reed’s Keyword Interface extension alongside Eric Eve’s Conversation Package family of extensions to implement highlighted topic lists for Inform 7 conversations.

In this post, I’ll share how to implement single-keyword conversation analogous to what Aaron Reed does in Blue Lacuna, and also share a few bugfixes for the code from the first section.  By the end of these two posts, you should have the tools you need to integrate these two extensions and implement a robust, TADS 3-like conversation engine using highlighted topic keywords and a single-keyword user interface, with surprisingly little work.  Of course, coming up with good content is another matter…

Read the rest of this entry »

Tags: ,

Inform 7 Development: Integrating Aaron Reed’s Keyword Interface and Eric Eve’s Conversation Package by Way of Emily Short’s Complex Listing

Eric Eve has provided a wonderful conversational extention for users of Inform 7. Called “Conversation Package“, it uses a number of his other extensions to wrap up as full a TADS 3 conversation implementation as he could put together.  If you are curious as to why that’s so great, I encourage you to read the essay by Mike Roberts, the author of TADS 3, that covers his analysis of conversation methods in interactive fiction.  I’m pretty thoroughly convinced by his arguments that an ask/tell conversation system with topic prompting is the optimal way to implement conversation in a game where it’s going to be more than trivially important to the gameplay, and where there’s no pressing reason to handle it differently.

Likewise, Aaron Reed, author of Blue Lacuna, has published an Inform 7 extension called Keyword Interface.  Blue Lacuna uses a very user-friendly system whereby the user can perform certain actions by simply typing highlighted keywords — specifically: examining items, moving to different locations, and selecting topics in conversation.  The Keyword Interface extension provides drop-in support for examining and moving as in Blue Lacuna, but requires significant user implementation to make topic keyword highlighting work in your game.

In this article I’ll detail the steps necessary to make Aaron’s topic keyword highlighting work in the context of a Conversation Package implementation.  I’m not addressing what you would need to do to get one-word keyword conversations actually functional (mainly as I haven’t gotten around to that yet — when I do, I’ll post it) — this is just to get the highlighting working.

With that said, let’s get started!

Read the rest of this entry »

Tags: ,

“Good Eats”

alton_brown_geek_motivator[1]OK, this will be a special early post so I can get the link out there.  This month we’re hosting Dinner Club, and rather than our usual Iron Chef-style theme ingredient, we decided to go with an Alton Brown theme.

Part of the reason is that we’ve been watching a lot of Good Eats lately in the evenings after the two older kids are in bed but while Jonathan is still active.  Usually the choice is between Star Trek TNG and Good Eats as to decent shows to watch, and Alton has more… general appeal, shall we say.

So we came up with a comfort-food menu based on Alton Brown’s recipes, but I had a brainstorm after finishing the menu:  I’ve been working on interactive fiction lately — why not make an interactive menu?

I didn’t have enough time for that, but I did put together a short, themed interactive fiction work, loaded with Alton Brown quotes and quote-look-alikes, to serve as a companion piece — an appetizer if you will — to this month’s dinner club.

I used a couple of 3rd-party extensions and the core of one of my own proto-extensions to speed development, and after about 3-4 hours of work I ended up with “Good Eats”, an interactive menu.  Click on the link to run it directly in your web browser through Parchment, a Javascript interpreter.  The reason you can do this with this game and not with my competition game is because this one is small enough to fit in the old Infocom Z-machine format, which is the only one currently supported by Parchment.  You can, of course, also download the file directly and play it on your favorite standalone interpreter.

I hope you enjoy “Good Eats” as much as I enjoyed making it!  It was a nice break from longer, more involved projects; I now see the appeal Speed-IF has for participants where I didn’t before.

Tags: , , ,

IFComp 2009 Overview — Grounded in Space Postmortem

pcm_trophy_lrg[1]The Rule 5-induced cone of silence has lifted, and the results are in!  Grounded in Space did reasonably well, placing 10th out of the 24 entries, very close to where I expected it would be (I had mentally blocked out 8th to 14th as the range I was expecting, based on reviews and my own experience playing the competition games).  I learned a lot and met a lot of cool people participating in this year’s competition.  Here are some of the major lessons I took away:

1.  I probably wasn’t ready to release Grounded in Space.  I vastly underestimated the amount of work required to make the game release-quality, especially post-beta work.  And I definitely did not know Inform 7 well enough to accomplish everything I wanted to; the triage required on the design to get the game playable was pretty severe.  Many of the cool parts of the original design ended up on the cutting-room floor, due to either lack of facility with the language or a self-inflicted lack of time.  I slacked a bit in the middle where if I’d put in more effort I might have accomplished quite a bit more.

2.  I’m glad I did release.  The experience of competing in IFComp ’09 was invaluable; there are things I learned from the process, from the other games in the Comp, and from the discussions on the authors’ forums, that I probably couldn’t have learned in any other way.  In particular, I believe that I could not have learned the final process of making a game releasable — the testing and tradeoffs required in the end stages of development — had I not forced myself through it, even with a game that ended up deficient in some ways.

3.  Reviewers are all over the map in terms of what they like or don’t like.  I was pretty unlucky in that the first few reviews all either said or implied “I don’t like Heinlein.”  Well, that pretty much meant those reviews were going to be bad, since Grounded in Space is directly patterned on Heinlein juveniles to the best of my ability.  Later reviewers were more kind in that respect; there are some Heinlein fans out there after all!  Similarly, some folks liked complicated puzzles and some probably would have punched me if I’d been to hand when they got to the engine console.

4.  Notwithstanding #3, there were a number of valid criticisms of my game that were widely given:

  • The premise was really off the wall, and a lot of reviewers bounced off of it.  Sam Kabo Ashwell was very insightful here — it really was the result of me taking the shortest distance between two plot points.  Even a little more thought and effort here would have lowered the suspension of disbelief bar substantially, I think.
  • The introduction lacked interactivity — some objected to this and some didn’t, but there were certainly ways I could have improved interactivity in this section, and I simply didn’t have time to do so.  That was the first section I coded, so it was the one with the least language facility backing it.  I wanted to rewrite it, but bugs with the engine puzzle kept me busy right down to the wire, and I didn’t get the chance.
  • I got criticism that the engine puzzle was not suitable for the text format.  I disagree with this somewhat; I think that with a better text interface I could have made this more palatable for a lot of people.  But a subset of players was never going to be happy with a puzzle that required you to SET THETA DIAL TO -1575, and I didn’t realize quite how large that subset was.

5.  The game is likely unsalvageable.  At this point there are enough flaws baked into the design that trying to improve the game experience would require gutting and rewriting large sections of it, and I’m not going to do that.  I started on another work the day I submitted this one, and I’m planning to move forward with that instead.  There will, however, be a sequel to Grounded in Space at some point in the future.

6.  Inform 7 is awesome.  The learning curve is… interesting — you can get off the ground quickly, but getting really good with it requires you to cross the natural-language equivalent of the “uncanny valley”.  But the expressive power of the language is amazing, and I’m sure the pleasure (and it is, truly, a pleasure) of developing in Inform 7 is one of the main reasons — along with the great people in the community — that I’m so excited about continuing to write IF.

7.  Develop like you were developing any other kind of software.  I didn’t do this at first, treating it as if I were typing up an email.  Oh, I designed up front, of course, and had plenty of design documentation.  But I didn’t have source code control, nor any kind of issue tracking/prioritization system, and so I found myself wasting time on trivial issues or, worse, fearing to make changes in complex code (the reflectors, anyone?) for fear of breaking more things than I was trying to fix.  For my next project, I’ve addressed this; I’m now using Perforce for source code control and I already feel more fearless, comfortable, and productive as a result.

8.  Some of your beta testers should be from the IF community.  I used exclusively non-IF friends for testers, and although they found staggering amounts of bugs, helped me with aspects of the story, gave me a great insight into how newbies might interact with the game, and really got me to widen my net of synonyms, a few IF vets in the mix would probably have latched on to the more structural shortcomings of my work and made suggestions early on that might have helped me avoid some of the big design/architecture pitfalls I stumbled into.

9.  The whole experience was great, and an encouragement to proceed.  Even the negative reviews usually had something nice for me to take away.  The good ones (and there were more of these towards the end of the Comp, for some reason) were extremely encouraging.  Knowing my work clicked in a good way for some people, no matter how few, is a very powerful motivator to continue, and I will certainly be writing more IF and entering the Comp again.

So thanks to everyone who played the games this year, particularly to those who took the time to write reviews and let us know what you thought of our works.  I enjoyed writing for you and hearing both what you considered good about Grounded in Space and what you considered bad.  Next year I hope to improve quality on all fronts and produce something that will knock your socks off!

Tags: , ,

IFComp 2009 Final Pre-Submission Update

The “last” bugs have been squashed.  The walkthrough is written.  BB1162-002The beta testers have been credited.  The file is uploaded.

Grounded in Space is finished.

You won’t hear much from me on the subject until November 15th, when the judging is complete.  As per Rule 5 of the Interactive Fiction Competition, I cannot comment on my game or respond to reviews at any time during the judging period.  I do hope to have an extensive postmortem after that point, where I go into detail about what I learned and what I’ll do differently next time.

I will say that I’m already planning at least one new project; this one was so fun, challenging, and rewarding that I’m sure I’ll be motivated to try again at least one more time.

I’ve put a lot of time and effort into this, but it’s absolutely been time and effort well spent, no matter how I do in the competition.  It’s helped me to learn a new programming language and practice my writing, exposed me to some excellent interactive fiction in a community that I had no idea even existed before, and motivated me to follow through and finish a fairly large project purely on my own, with my own willpower and resources, giving me confidence that I can handle a project of this scale outside of the confines of work.

This last week was a doozy.  At the very last minute, one of my testers found a couple of issues that exposed a whole class of bugs that neither me nor my testers had found previously.  I spent Saturday evening frantically rooting them out, prior to bringing my wife home from the hospital with our new son on Sunday.  I’m pretty confident the bugs are cleaned up.  Of course, I’m also fairly confident there are others, and that there are weak spots in my writing that another pass might have addressed.

In the end, though, you have to call it a day sometime, and I choose now.  Play it and enjoy it; it’s yours now.

Tags: , ,

The Quern is Digg proof thanks to caching by WP Super Cache