[Rosebush] Studies of ZIL

From our own @SomeOne2, a new Rosebush article that’ll be part of a series looking at ZIL, the Zork Implementation Language; that’s what Infocom used to write their games, and it’s still being used today (you may remember Max’s entry in last year’s Comp, Milliways, which was a sequel to Infocom’s Hitchhiker’s Guide to the Galaxy) This installment starts us out with a deep dive into the various incarnations of the virtual machine created to run games written in ZIL, the Z-Machine, with an eye towards how these technical shifts impacted Infocom’s games:

We’ll be hoping to share future installments, which will get more into the nitty-gritty of how ZIL works, as Max writes them!

26 Likes

Oh hell yeah!! :star_struck:

5 Likes

Is it okay to post nitpicks here? I promise they’re minor…

7 Likes

I will defer to Max on that :slight_smile:

4 Likes

Sure! (I realise I sometimes put things into my own words or similar, which can completely change the meaning of the whole sentence. Hopefully none of it was forgotten…)

5 Likes

Great article!

On the subject of nitpicking, the part about MDL is a bit muddled (pun intended) and not entirely correct on where ZIL starts and MDL ends. I don’t know if I can clarify it better, but anyhow…

The ZIL compiler (on a mainframe computer, PDP-10) was written in MDL. When writing a game, the code could contain some MDL macros and functions but these all got executed during the compilation. MDL was used to format the data (objects, dictionary, grammar, …) parts into bytecode. The code inside the routines was ZIL. The compilation consumed all MDL parts and the output was a binary for the z-machine. Strictly speaking MDL outside routines and ZIL inside routines. But sometimes ZIL is used as a description for both, so it is not easy…

5 Likes

The easiest way to think of it is that the user machine (the Apple 2 or whatever) can only run ZIL. MDL, a much more powerful language, could only be run on Infocom’s PDP-10 mainframe.

It’s confusing because the line between the two languages is fuzzy. Like all LISP-style languages, MDL is highly extensible. You could say that what Lebling etc did was extend MDL by adding Z-machine opcodes, and then cut out nearly everything else (the parts that wouldn’t fit on an 8-bit machine), and that’s what ZIL is! The same syntax as MDL, some of the same data structures, plus Z-machine opcodes.

7 Likes

:point_up:

2 Likes

Other notes:

Versions 1 and 2 were never actually used for released games by Infocom: early versions of Zork I and II used both types, but they were very limited and were used in early demo versions because they took up much less space.

I believe that’s wrong; the pre-v3 versions of Zork 1 and 2 were official releases. I say this because I have a original transcript of playing Zork 2, printed on fanfold paper from our Okidata printer, and I’m pretty sure it’s the .z2 version!

(Unfortunately I’m not sure because I never typed VERSION. But the formatting matches zork2-r7-sUG3AU5.z2 better than gamefiles/zork2-r15-s820308.z3.)

Yes, the Wizard got me on turn 3. I restarted after that.

EDIT: Aha, yes. In my printout, the “Ledge in Ravine” room is missing the line

A short scramble down the rock face leads the the edge of a stream.

So we at least know my version is earlier than r15, which includes that line.

9 Likes

That’s awesome! I didn’t actually know that.

2 Likes

a small program which, according to my knowledge, was integrated into the disks you got (which also contained the game).

Correct!

In the end, it seems that despite their inability to reach a wider crowd because of lack of graphics, graphical games were not Infocom’s strongest point, and ultimately caused their downfall.

Well, that’s a whole argument and it can go on forever. :) The lack of V6 games in the modern (post-Infocom) era is simply because it’s much harder to support V6, so very few interpreters did it.

Also, for the first several years of Inform’s existence, there was no standard way to distribute Z-machine graphics. So even if you wrote a V6 game and created art for it, almost nobody would be able to play it properly.

Here, I’m not sure whether to call it “IF”, “Interactive Fiction”, or “text adventures”.

There’s no good answer to that because popular usage changed from year to year. Remember that even Infocom didn’t start using the term “interactive fiction” until 1984.

Choose Your Own Adventure (CYOA) games like Journey

People generally limit the term “CYOA” to actual books. Back in the 80s, “Choose Your Own Adventure” referred to a specific line of books; I don’t think it was ever applied to computer games.

Today, the term still applies to a specific line of books, and the current trademark holder is pretty draconian about cease-and-desisting anybody else who tries to use it.

Games like Journey (and Twine games, etc) are most often called “choice-based” these days.

5 Likes

I think it’s very interesting that the IF community has stuck with something like the Z machine, or VMs/interpreters in general. Even Twine I would categorize as something like that: The story format is the interpreter for the story, and it’s packed together in the HTML file, like a Z machine interpreter and the bytecode on a disk.

And I mean niche/custom ones, not something widespread like the JVM for example.

3 Likes

When I started plans to create a post-Z-machine VM, I thought about using the JVM as a basis. It was certainly seen as The Future of Portable Computing at the time. (The late 1990s.)

But I was very wary of tying our community to a spec that we didn’t control. A single person could implement the Z-machine from scratch. I wanted to stay close to that ideal. So I invented a new spec from scratch; the first Glk/Glulx stack was 100% my own code.

When the Google v Oracle lawsuit began – two giant companies deploying armies of lawyers to fight over who got to use what parts of Java – I felt very justified in retrospect. Nothing good would have come of being entangled in that disaster.

8 Likes

To be fair, if Oracle had won it would have been a disaster, not only for the hypothetical IF using the JVM, because that would mean you could own interface definitions. WINE probably wouldn’t exists, and maybe the IT world would be quite different. In common sense, Oracle never had a chance, but laws sadly don’t follow that.

I actually like the idea that you can have an interpreter made by people you do trust and run programs by people you maybe don’t trust.

4 Likes

I could be wrong, but some things I suspect contribute to the continued use of the zmachine and similar VMs in this space:

  1. Since games in this genre have remained computationally simple, we’ve never really hit performance issues that make the portability not worth the added overhead. This cannot be said for Java and other bytecode compiled languages used for developing modern style apps and games or for virtualizing one x86 OS on top of another.

  2. There’s a lot of legacy games using zmachine and there’s an appeal to being able to play new games in the same fashion you play old games and the genre lends itself to not needing entirely new frameworks to do things the existing frameworks don’t, so there’s less incentive to break from tradition.

  3. Because this genre is even more retro than modern indie games that use pixel art resembling 8-bit graphics and music resembling 8-bit chiptunes, I suspect we have just as much overlap with retro hardware fans as the people such deliberately lo-fi video games appeal to, and keeping the zmachine alive makes it easier to play modern IF on hardware from the genre’s hayday as a mainstream genre(or as mainstream as a genre could be in the days when admitting you owned a personal computer was enough to earn the nerd label).

  4. It keeps most games in the genre near universally available. Computationally simple these games might be, but if we didn’t have a cross-platform standard, we’d probably have the same problem as mainstream gaming where a lot of PC games are Windows-only or only have native builds for one out of OSX/Linux or a lot of mobile games being iOS or Android exclusive, and vanishingly few available for even a subset of both PC and mobile OSes, and if there is a Linux build in there, it’s probably x86-only, possibly even x86-64 only… And this is a genre so niche that any barrier to universality just fragments a already tiny potential user base.

6 Likes

Mostly this.

This community shifted pretty steadily from Z-machine to Glulx over the years from 2007 (when I7 launched) until 2020. There was a huge history of Z-machine games, yes, but it wasn’t much of a target for new work. So I would say that Glulx’s popularity came from its support in Inform, and the fact that it played like “Z-machine only bigger”, rather than any ongoing interest in the Z-machine itself.

In 2020 there was a revival of interest in retro platforms. (That’s when people said “Hey, .z3 support is broken in Inform 6, can we get that fixed?”) So there’s been more interest in the Z-machine per se since then. But again, most in service of making small .z3 games. It’s a bit of a niche within a niche.

5 Likes

It’s niches all the way down.

4 Likes

It keeps most games in the genre near universally available.

I have an alternative view here;

It might have been that in the past it has helped to make games more available, but I would claim the platform doing this nowadays is the browser. A lot more people than before now want to play Inform games in the browser. And i claim this trend is the direction of travel.

If that is true, then virtualising your story in a VM isn’t helping much anymore for portability. Instead, it doesn’t matter what system you write in, so long as you can compile for browser.

6 Likes

9 posts were split to a new topic: Glulx to Webassembly

That is true. But if you go back to Tarek’s original point, the VMs he mentions (Z and G) (plus Twine) are the ones that are now available in a browser. The JVM ain’t browser-standard any more. Native binaries, well, you can now play DOS games in a browser emulator but the IF community hasn’t adopted that as common practice.

So your alternative view comes out to the same answer.

3 Likes