Could Bocfel/Emglken support Z-Machine Version 6 (Z6)?

It is extremely complicated to run the four graphical Infocom Z6 games today. (Arthur, Journey, Shogun, and Zork Zero)

I documented how to do it in Frotz here: https://www.ifwiki.org/Arthur%3A_The_Quest_for_Excalibur

I wish, instead, that I could direct people to play Z6 games in Parchment, or in other popular interpreters based on Bocfel, including Gargoyle, Lectrote, and Spatterlight.

But Bocfel has only “partial” support for Z6, and, specially, as far as I know, it has no support for graphics.

@cas Would this be a lot of work? A little work? Is it possible in principle, given the architecture of Bocfel?

2 Likes

I couldn’t tell you about Bocfel, but SDL Frotz handles these games perfectly.

So…

Doing Z6 games properly would be a lot of work, which is almost entirely due to the screen model.

Versions 1-5 (including 7 & 8) are “simple”, really only needing the ability to draw characters to specific locations on the screen and/or have a scrolling screen of text. Glk conveniently provides this, so Bocfel latches onto that for its drawing.

Version 6 is wildly different. It’s basically a canvas to draw on in kind-of weird ways (through “windows” which are really more like constrained viewports to the canvas rather than windows as we tend to think of them), with all sorts of operations to handle text & graphics in a different way than all other versions.

This is completely incompatible with Glk, so for Bocfel to really work with these games, it’d have to have a new UI that does all the work, meaning handling what Glk already does plus the new graphics work.

I would love to add complete support for version 6 games, but I have absolutely no time frame in mind for it. Maybe one day it’ll happen…

That being said, the next Gargoyle release will include basic graphics support for the Z-machine. It won’t do any fancy layout, but depending on the game (Journey’s right out), you can at least get a somewhat acceptable feel for its graphics.

Some examples:

Arthur (the sword in the stone is a bit out of place!)

The images aren’t placed up at the top like they should be, but they’re there:

Zork Zero’s rebus:

But without proper layout support…

1 Like

Yeah, and that’s what I documented on IF Wiki, but I’d love to be able to point people to a “Play Online” link for these games.

It sounds to me like the easiest path from here to a web-playable Z6 interpreter would be to create an SDL Frotz web app, using Emscripten. Does that sound right?

So, uh, just @draw_picture pn y x; should do it? And put the PNG pictures into blorb file? Any recommended resolution?

@draw_image works (or, will work in the next release), but the coordinates are ignored. That’s because the main window is a Glk text buffer, which supports graphics, but places them at the current cursor position (not exactly true but close enough as far as the Z-machine is concerned).

PNGs in Blorb files work just fine.

The Blorb format supports a resolution chunk which allows games to specify how images ought to be scaled. This might be the best way to go, since it should allow you to scale based on the actual size of the user’s display.

2 Likes

I wonder if it would help to split the main screen into two Glk windows for Z6, and draw all graphics in one and all text in the other. Not ideal, certainly, but it would let you put graphics at arbitrary positions in the graphics window.

I thought about that and rejected it because, while that’d improve some graphics (e.g. those out-of-place Arthur pictures), there are other times where the text needs to be inline, e.g. the drop cap “A” at the beginning of Zork Zero.

But now that I’ve thought some more, at least for the Infocom games, it may well be possible to do a bunch of special-casing and improve the appearance, at least in some cases. Arthur, Zork Zero… though something like Shogun mixes text and graphics too much to work.

But I’ll explore this, and see how good (or bad!) it can look.

That may not help old games, but new games will certainly benefit! Think of Inform games that look just like Adventuron.

I don’t know if this helps, but they purposefully printed an “A” to the printer (screenreader support, transcripts) so it wouldn’t look weird.

With only 4 Z6 Infocom games, and each having a finite number of images, it would be feasible to special case which ones should be inline and which should be shown in a separate graphics window. That could be a good addition to Bocfel.

But Dan’s idea of an Emscripten port of SDL Frotz might be the best way to get them to play online. It could also bundle the images all in together to remove any complications.

I wrote an interpreter in Rust that plays all zcode games including Z6. It isn’t 100% complete yet and I wasn’t planning to release it until it was (I’m kind of a perfectionist). Unfortunately I can’t work on it at the moment as I am trying to find a new job. :frowning:

Truthfully the interpreter is just meant to be sort of a reference implementation. All the Z-machine behavior is actually encapsulated in a Rust library of which the interpreter is merely a front-end application for it. The front-end is split between a web assembly client and a web server back-end, allowing running of zcode games purely on the server, with the webassembly serving as the UI.

1 Like

Hey lookie

Needs a lot of polish, and I’ve found a randomly occurring Emscripten bug, but it’s a promising start! Note that it is not at all mobile ready yet.

2 Likes

:heart_eyes:

Let’s start a new thread about this. And share some code?

I was thinking of waiting to post a proper announcement until it’s much more polished. But the code is at GitHub - curiousdannii/infocom-frotz: Online Frotz for Infocom's Z6 games

While it’s nowhere near as polished as Frotz’s proper version 6 support, I’ve had some good results with special-casing graphics in Bocfel.

Arthur doesn’t look half bad. Palette shifting isn’t implemented (and will require either a Glk extension or a custom Blorb file), and the banner staffs that flank the sides of the screen aren’t shown, since they really are meant to be used with a fixed screen size, e.g. 320x200… but it’s serviceable:

The map could use a little work:

Shogun’s doing OK, though as with the banner staffs in Journey, the borders aren’t displayed.

The maze is in decent shape, too:

Journey is still unplayable, and I’ve only just begun a bit of work on Zork Zero. But this is progressing much more nicely than I expected.

5 Likes

Quick update to anybody interested:

Palette shifting now works in Arthur, via a custom Blorb file:

Journey is in pretty good shape:

If you look carefully you’ll see jumbled text at the bottom. At the moment, a lot of F6 is needed to refresh the display because of that. If I can fix it I will, but if not, it’s more of a nuisance than anything else.

Zork Zero is just too intricate to get done in any reasonable amount of time; but I do expect that by the next Gargoyle release, at least Arthur, Journey, and Shogun should be playable.

5 Likes

Ok, here’s (probably) the final update before the next Gargoyle release:

I’ve got all of Infocom’s V6 games more or less supported. Zork Zero wasn’t quite as much of a challenge as I expected it to be. The experience in all games won’t be seamless, but should be good enough to play the games comfortably.

This will work with any Glk implementation that supports graphics, so won’t be limited to Gargoyle.

7 Likes