Glk, author control, and player control

Continuing the discussion from Glk extension proposal: CSS:

(because I’ve got a rant in me)

It’s subtle, because I think part of the magic of Glk is the push and pull between player control and author control, including the interpreter overriding authorial intent for the player’s benefit.

I think a lot of authors don’t think at all about dark mode support, for example. When authors do attempt to set a foreground color, many authors implicitly assume that the background color will be whatever their favorite interpreter’s default color is. For example, authors will set a dark red foreground color, assuming the background will be white. And when authors do get a bug report from a player whose default background is dark, (“I can’t read your dark red text on my dark background”) authors generally try to hard-code the background, forcing it to be white, ignoring the player’s preference for dark mode. That forces players who insist on dark mode to set a preference in their interpreter to ignore all author colors. Best of all is to prompt the user at startup to choose a color scheme, but that’s annoying.

It would be better, in this example, for authors to have only partial control over the color scheme. Here’s my light-mode color scheme, here’s my dark-mode color scheme, let the interpreter decide which one to use (automatically, based on the player’s system settings, with overrides in the interpreter’s Settings menu).

Or, to your point about layout, what about mobile support? Authors who assume control of layout typically assume that the player has a large landscape window. Those assumptions often fail wildly on mobile.

For example, Marbles, D, and the Sinister Spotlight is buggy on mobile. It’s hard to even click on the invisible <input> to type 1 to get started. Once you do get started, the multi-line status line is scrolled off the screen when the keyboard is visible; if you do scroll up to the status line, it’s still trying to print the title of the game in the center, but it can only squeeze in a few letters, Ma here, Sinist there; it looks buggy.

When I see that sort of thing, I think of how much better it would be if Glk had a richer API, offering the author less control over layout. Look at a typical Quest game, like Whitefield Academy of Witchcraft. Marbles is using a text grid to build its own “Places and Objects” window.

But what if Glk had an API for that? What if the author provided a list of named lists that the interpreter could show however it needed to? Maybe on landscape screens, Locations and Important Landmarks would each appear in their own sidepane window, like Quest. On mobile screens, perhaps they’d appear as horizontally scrolling lists, pinned to the top of the screen. Since the interpreter would decide where to put the UI, there could be settings for the player to control how to show it, or even to hide the UI, if the user doesn’t want to see it.

A text grid gave you absolute control over the position of the Locations and Landmarks UI, but I claim that it would have worked even better if you had less control.

And what about that invisible <input>? As long as the author is in full control of the style of the <input>, the interpreter can’t intervene to help. But, on mobile, the standard UI for chat-based transcripts is to add a separate <input> bar at the bottom of the screen, in its own pane. (That would make it obvious where to tap in order to press any key.) If the author is in full control, the interpreter can’t intervene to add an <input> bar.

I’ve been thinking about this a lot for my proposed Glk Mapping API. The Adrift runner has a complicated tool bar to allow players to hide/show the map, to let it float around as an OS window, or to pin it to the main window (to the top, to the right, to the left, or to the bottom).

I don’t think Adrift’s UI for this is very good, but the idea of letting the player decide where the map belongs (or whether to show the map at all) is just right.

Adrift also has a player-configurable graphics window, normally used for a visual depiction of the current room. We can let the author decide whether that image belongs in the main scrolling text-buffer window or in a pinned window pane, but putting that in the player’s control allows them to decide whether to show it or hide it, or whether to include it in the text, or in a floating OS window, or to pin it to the window.

Long term, my goal is to make APIs in Glk that would make it possible to implement a UI like the Hadean Lands Journal, in a way that “just works” on mobile.

Why does the GUIDE in Repeat the Ending use a keyboard-driven menu system? What if Glk had its own menu API for help/hints, that rendered with a UI that you could click on, with a back button, with larger tap targets on mobile?

Look at Cairn. It’s not attempting to reproduce the original author’s vision for Zork’s UI. The Apple II version didn’t have an inventory pane, a tabbed UI for the map/manual/hints. Seizing control away from the author is where Cairn adds value.

2 Likes

I don’t agree. I think games should have reasonable defaults, but authors should be free to make bad formatting decisions if they like. If someone can write a bad puzzle, why can’t they pick a bad color? I think there should be sensible defaults, or even sensible schemes that can be picked without fuss, but they author should always have the last word regarding the presentation of their work.

I agree with this, but so far as I know this is just the way the interpreter behaves with the browser during a wait for any key prompt… I’m not sure that a cursor would print. I don’t think this is actually input, wait for any key is strange. I didn’t decide to withhold the prompt, for instance. Inform is not offering a prompt. For my part, I can add a line break there, which should make things better. But the problem there is missing white space, not my decision to honor white space.

Sure, I’ll own that. I’ve always meant to return to that. But you are the first person who has mentioned it over the past 18 months. It is hard to find people to test or discuss development for parser games on mobile. My thread about parser interfaces on mobile did not really go anywhere. I need to return to it, now that Danii has released a new version of Parchment, but in the time since I’ve taken on other projects.

My position is that I did not make a good mobile status window for the game, but I would rather make bad things than be prevented from making what I want.

Candidly, Inform has been in a very strange position these past five years because it has no flexible windows. So the only place to cram things that aren’t form-feed text is in the status window. I can’t really say why that was decided, but that choice does prevent the kinds of niceties you share above. Should Inform be able to do such things? Absolutely! If I had access to such features, I would use them. Hopefully Inform 11 will lead us to better days.

I get where you’re coming from, but I disagree that authors need to be protected from themselves to the extent that they have no access to overrides. I spend a lot of time, anecdotally, on spacing in Inform programs, and it frequently requires a lot of handholding. I have rulebooks that do nothing but do line spacing. So I already have one thing I have to constantly fight against re: formatting that I personally think I should be able to control as an author.

I think this is a misrepresentation, Dan. I did not say an author would never accept feature enhancements or improvements to parser interfaces in mobile. Mobile behavior with parser games can be weird. That annoying press any key situation isn’t something I cooked up, that’s how it comes out of the box. I’m not shoving anyone out of my way to make “wait for any key” prompts look like that. I’m not sure it can be made better with the setup as it currently is, honestly (though I’ll check momentarily). I’ve invited discussion on these challenges and still do.

If there’s a better way on mobile, I"m all ears. Of course. Edit: though I am not personally sold on Cairn, I would rather have some kind of framework I could engage with

Still, I strongly believe that an interpreter should never strip text content from my games, which is what ignoring whitespace does.

1 Like

Aren’t interpreters free to ignore Glk style hints? Doesn’t that mean the interpreter has the final word anyway?

I perhaps wasn’t clear enough, but I think there mostly isn’t a better way on mobile right now, and so I don’t think the bugs in Marbles are your fault.

I think the platform has (mostly) failed you. The question is how best to support you (and other authors) in the future.

For example, if there were an easy-to-use Inform extension for supporting dark mode (which there isn’t right now), I’d recommend that authors use that instead of just hardcoding colors.

In the short term, I think the best thing to do is to is to give the <input> a clear border, which will hopefully make it clear enough where the player should tap to begin typing.

(Also, I think the interpreters’ defaults are bad here. IMO, Quixe/Glulxe should render the input line in its own window pane, outside the main transcript.)

In the long term, Quest displays a “Continue…” hyperlink whenever it expects the player to press a key; you can tap the hyperlink (which disappears when you click it) to make the game progress. I think that would require Glk to support a feature like that.

re: Flexible Windows by Jon Ingold, I’m hazy on what’s going on there. Has nobody gotten around to re-implementing it for Inform 7 v10? The underlying Glk API is still accessible. You can still write I6 code in Inform 7 v10, so it seems like it should be straightforward to re-implement Flexible Windows without a lot of fuss…?

FWIW, I think a Cairn-like or Quest-like UI would need more than just the features offered in the old Inform 7 Flexible Windows. Even with those features, you couldn’t create a window that the user can drag/close/reposition, or a horizontally scrolling window (occupying a minimum of vertical space on mobile), or a side-pane window that automatically converts to a horizontally scrolling window on mobile. That stuff would require new features in Glk.

Parchment and Quixe support style hints by default, and don’t offer any settings UI for players to select color schemes/fonts, or to decide whether to override author stylehints. If the author selects a light color scheme but you’d prefer a dark one, in HTML, you’re currently stuck.

1 Like

I think we lose a bit of what’s interesting about parser games when we make strenuously prescriptive decisions (as authors) about presentation, which is why I personally don’t do it—I like to think it’s productive to operate inside the constraint of “you could play this over a teletype”, and if I wanted something with a more exacting presentation I probably would either not be targeting Glulx in the first place, or I’d be distributing my game as an application that embeds Glulx (rather than as a file you can play in any interpreter) to have that control. I feel like user control over the exact details of UI and presentation is part of the “contract” of an interpreter.

1 Like

To an extent this can be done by user code.

The Inform 11 version of Flexible Windows will tell you if the screen is landscape or portrait, the aspect ratio, and it will guess whether it’s mobile (or at least a mobile with a virtual keyboard).

Heuristics for adjusting the position of windows (or even whether they should show at all) would make sense for utility extension, or maybe even included in FW itself.

I do wonder if the “more correct” solution to a lot of this doesn’t run through Glk enabling games to specify exact presentational details (like the positioning of windows) but through:

  1. Glk provides some interface to pass structured data to the interpreter
  2. There are some standards about what that structured data can mean (eg, an “inventory standard”, a “map standard”, a “stat screen standard” etc)
  3. Interpreters make their own presentational choices about what to do with this data

Basically allowing for those kinds of ancillary UX without breaking the separation of concerns or putting a burden on authors to solve UX questions like responsive layout.

2 Likes

That’s basically @DavidC’s channel IO concept. It’s been around a while, but authors haven’t shown much interest so far.

That sounds like a chicken-egg problem.

Interpreters would have to support it, and some game would have to use it, and then somebody would have to say “I want to do it like they did.”

I think channel IO is more about talking directly to the browser/accessing the browser’s js apis? Which is not quite what I’m thinking here. The idea is more to complement the text output with a (interpreter- and platform-agnostic) structured-data representation of world state, which again the interpreter decides what to do with.

When it comes to things like a putative “inventory standard” or “map standard” I don’t view these as things that a game implements but probably something that lives in an extension (or, more ideally, as part of the standard library). It is after all closely tied to the world model. But yeah obviously adoption would require not just implementation but end to end implementation (of an interpreter feature, and an Inform extension to use it), in addition to the Glk extension itself (which I’d think would be extremely thin, it just amounts to defining a stream that exists for this purpose that the game writes to)

Sharpee’s “interpreter” is a browser so channel io is seamless.

No David’s Channel IO was first implemented in FyreVM which wasn’t a web based interpreter. It was indeed about sending structured data which the interpreter would then decide how to layout.

Ah, ok! I didn’t catch that sentiment. I will try to do something with the individual line, maybe a different color or your outline suggestion.

I cannot say why, but it is established orthodoxy that the extension is not possible in Inform 10, and that is why there is no Inform 10 extension in the Friends of Inform repo. My understanding is that far more capable programmers have made this assessment. To my knowledge, any recent games with Flexible Windows were written in Inform 9.

Hopefully, some kind person will make a general flexible windows solution for Inform 11, and multiple nice persons will make author-configurable extensions for handling common interface widgets like inventory. I personally will try to help out, if I understand the underlying tech.

So far as an interpreter with Cairn-like features (I don’t want to make this a Cairn-specific conversation) goes, I personally would want to make my own behavior for things like inventory. Others probably wouldn’t, and I think it’s cool that they might have general-purpose methods for displaying inventory in friendly ways, but I’d want something to match narrative voice in my own work. I’ve never printed a standard inventory response, and I probably never will. It’s not possible for me to say how well something would work for me without a prototype or something.

In any case, I do think that having solid, off-the-shelf options for things like color schemes is a good idea, I’m not down on providing authors with useful places to start (and end, if they like). I’m just always in favor of leaving a door unlocked.

I genuinely thought Inform 11 would have been released by now, but that’s how it goes. The Git version is pretty much stable though.

I’ve also written the Inform 11 version of Flexible Windows: extensions/Jon Ingold/Flexible Windows-v16.i7xd at 11.0 · i7/extensions · GitHub

It needs a slight update again for some of the more recent Inform 11 changes (in particular I7’s Glk window kind was renamed to IO window), but it’s basically done.

The fact that Inform 11 is just around the corner and will handle all of this in a new and incompatible way has, to my eyes, somewhat stifled work on any of these things for Inform 10. The problem is that Inform 11 has been just around the corner for years now with no visible progress.

The result is that the people with a deep knowledge of both Inform internals and Glk, like Dannii, are putting their efforts toward Inform 11 instead—and thus it looks like Inform 11 will have a truly beautiful API for handling window layout. It’s just not clear when we’ll ever get to use it. (And no shade is intended here; I fully understand not wanting to sink large amounts of work into something that’s about to be rendered obsolete!)

I added this feature to Dialog a few months back, and so far it seems to be working well. The author specifies, not a foreground and background color, but a color palette to use: five shades of the main color and two shades of an accent color. The interpreter then decides which of those colors to use for each element based on the browser settings.

I’m not sure if anyone except me has used this ability yet, though, and Dialog leaves a lot of things to the interpreter that, in I7 land, would typically lie in some I6 library. Dialog also lets the author explicitly say “yes, my creative vision really does require crimson text on neon magenta background, it’s absolutely vital” if they really want to. (And also because Z-machine interpreters have no way of telling the code if they want a light or dark color scheme.)

Still, my take is that the interpreter can handle a lot of these things more sensibly than the author can. Already, every Z-machine and Glulx interpreter I know of does mess with the author’s whitespace, by inserting line breaks every so many words to make them fit on the page. This can utterly ruin ASCII art, but authors typically accept the loss of control as a necessary sacrifice, because (1) people use all sorts of different screen dimensions which means predicting how many words fit on a line is difficult, and (2) most of the time the absence of line breaks within a sentence isn’t an important part of the text.

I think it’s very reasonable for interpreters to do the same about word spaces and paragraph breaks: in 95% of cases, authors want exactly zero or one spaces between their words, and zero or one paragraph breaks between their sentences. Dialog provides ways to override this when you really want two spaces or three paragraph breaks in a row, but (our logic goes) when 95% of the time authors want one specific behavior, that behavior should be as easy as possible to produce.

In the FyreVM days and in Sharpee, channel-io was always about contextual client design flexibility.

A Sharpee story does not print text. Each turn it publishes a set of named values called channels: the room name, the score, the prose of what just happened, a sound cue. The client decides what each one becomes.

Channels are independent. A client renders the ones it understands, ignores the rest, and is never sent the ones it cannot use. A terminal is not told the image channels exist.

The 37 channels a story can publish
Group Channel Carries
Prose room-name The room’s title line
Prose room-description The room’s body prose
Prose room-contents What is visible in the room
Prose action-result An action’s success narration
Prose action-blocked Why an action refused
Prose error Parser and system errors
Prose game-message Story and game-level messages
Status preferred-layout The order this turn’s prose reads in
Status prompt The input prompt
Status location The player’s current room name
Status score Current and maximum score
Status turn The turn number
Status info Story metadata: title, authors, version
Status ifid The story’s IFID
Status banner Opening title, subtitle, credits
Status prologue The story’s opening prose
Endings story-ending Whether the story has ended, and how
Endings death The death message
Endings endgame The end-of-game message
Endings score_notify A score change
Endings lifecycle Save and restore outcomes
Media image:background An image in the background layer
Media image:main An image in the main layer
Media image:overlay An image in the overlay layer
Media image:preload Images to fetch ahead of use
Media sound A sound cue
Media music The current music track
Media audibility Sounds the player just heard
Media animation A CSS-style animation
Media animate A generic animation directive
Media transition A scene transition
Media layout Layout configuration for split-pane clients
Media clear Clear accumulated output
Author character An NPC’s internal model
Author scene The current scene
Author exchange-affordances What a conversation currently offers
Author thread-affordances The conversation threads available

The four Author channels reach authoring and testing surfaces only, never a player’s. A story adds its own channels beside these, carrying whatever it likes: a clock, a compass, a discoveries panel.

Dynamic Channels

Authors can create dynamic channels that can be added to a custom template. This is available in Sharpee and Chord.

define channel clock
  mode replace
  gated by sidebar
  return "The clock: (hour)" from estate-clock
end channel

Laying them out

Because each value arrives under its own name, a browser client can put it anywhere. The renderer looks for an element named for the channel and renders the value into it:

<span id="location"></span>
<span id="score"></span>
<div id="room-description"></div>

Move those around and the page changes. Leave one out and that channel falls back to a default panel rather than disappearing. Nothing in the story changes for any of it. The story emits the same values whatever the page does with them.

A declarative layout file is the next step, so an author can describe the page in the vocabulary of publishing (left-adjust, center, wrap, keep-top, keep-bottom, columns) instead of writing HTML. That design is settled and not yet built.

For some values of “visible”; development is being done out in the open now, and can be followed on GitHub and Jira. There has been a bit of a “scope creep”, and I also have no idea when it’s coming out, but there is visible progress.

1 Like

There’s a even a handy repo just for documenting breaking changes and additions to the language.

The scope creep is mainly what I mean. Development is definitely happening, but as far as I can tell the number of open issues and proposals is remaining fairly constant.

2 Likes