Working on a Unified Glulx Input extension

(This came up in a question about hyperlink input. I’ve made enough progress to start a separate thread.)

The Glulx Entry Points extension basically exposes the I6 Glk interface (the input loop, the low-level entry points) at the I7 level. This is very flexible but hard to use correctly.

I am working on an extension that manages all this stuff in a controlled way. That is, the extension is responsible for making and cancelling all input requests. This is a lot smoother because the input request state is, essentially, a hidden global variable – you can’t have two pieces of code trying to manage it; they’ll step on each other.

The other difference is that Glulx Entry Points tries to be polite and only customize the library through defined I6 entry points. My extension is a complete rethink of the I6 input loop. I’m ripping out the assumption that the Inform parser only operates on lines of text.

That is: with GEP, if you want to generate an action from e.g. a hyperlink, you have to generate a line of text (“GET LAMP”) and let the parser get to work on it. With my extension, you can generate an action (the action of taking the lamp) and bypass the parser entirely. This will make life much cleaner for pure hyperlink or choice-based games.

In general, Unified Glulx Input results in simpler solutions. What we have now is a series of hacks accreted onto the old (Inform 5, Z-machine) input model and it’s a bit of a mess.

UGI is a long way from done. However, it’s at the point where you can take a look. … 0Input.i7x

(Hyperlinks and timer input are not yet there. But I have a tidy example that demonstrates keystroke input.) (Using the old generate-a-line-of-text approach, because the action-generation system is not yet there either!)

Because it hacks down to the parser level, it replaces large chunks of the parser template. It should therefore be considered experimental. I expect that the action-generation path will become standard in a future version of I7 – I know that Graham is interested in that capability.

I don’t know whether that means merging my extension in with I7, or adapting UGI’s features into GEP and merging that in, or leaving both extensions as optional add-ons. Hopefully, once I get to a stable UGI, people can start trying it in games and getting an idea for how good a solution it is.

I understood this bit!

The rest was a bit over my head, but it all seems like terrific good news. Thank you.

This sounds like a very helpful feature.

This sounds great.

This has now reached 1.0 status.

Current release: … 0Input.i7x

There are seven examples there now, demonstrating a range of game styles. Hopefully they all look straightforward enough to be encouraging. (The “ask for a number” example is the only one that requires I6 code.)

Major features still missing:

  • status-window input
  • noecho mode (what you need to alter the player’s input “in place”)
  • integration with Multiple Windows

BTW, would it make sense for me to add a directory for myself under ? I’d still be doing dev work in my own repository, but I could copy release versions over.

Probably not. If anyone has bugs or patches you’ll be active enough to deal with them in your own repository.

I think it would be a good idea to copy or mirror releases to i7/extensions. People already find locating extensions confusing enough as it is…

We will have a new extensions site in the near future which will help with that. But yeah, I guess there’s no harm in either.

Oh, well, I’m happy to wait for that then. Easier than changing gears twice. :slight_smile:

Release 2 of this extension is up. This improves UNDO support. If your game does keystroke or hyperlink input, you can designate a particular key/link as an UNDO command and the ParserInput loop will treat it accordingly.

Current release: … 0Input.i7x

(This is the version I posted in the “CYOA Framework for Glulx” thread recently. I’ve just added documentation of the undo rulebook.)

Thanks and hooray, more so.


I’ve found there is a Release 3, “Version 3/160213 of Unified Glulx Input (for Glulx only) by Andrew Plotkin” now. The examples seem pretty extensive and I’m trying to get them all working on yet-to-be-named Glulx interpreter for Android.

Where did you find this?

here: … 0Input.i7x

I’ve discovered a bug. When you try to combine multiple commands with periods, the game only executes the first command, over and over again, in an endless loop.

[code]Include Unified Glulx Input by Andrew Plotkin.

Test Chamber is a room. An umbrella is here.

Instead of going nowhere, say “You try going [noun], but there’s no exit there.”

Test 1 with “n. s”.

Test 2 with “get umbrella then drop umbrella”

First saw this with Version 2, by the way. It’s still there with v3.