Converter from other IF systems to Z-machine and/or Glulx

Something I would like to see is program to convert story files from other interactive fiction systems into Z-machine and/or Glulx.

Especially if it is a harvard VM then I think it would be easier to convert. I would think how it might be done may be a combination of writing the interpreter in Z-machine or Glulx, and of converting instructions into Z-machine or Glulx instructions.

I am working on a converter from OASYS to Z-machine, but I would like to see others, written by whoever work on it, please!

That’s a tall order, even with the source code. Starting from the story file seems even more difficult. I believe that the best that can be achieved is a rough translation that will require tweaking; therefore, it seems wiser to start with the source code instead of a story file. That way it will be much easier to compare and make the inevitable fixes and tweaks. Personally I don’t believe it’s possible to do in any generally applicable, turnkey way, and still achieve fully playable results. I’d be extremely impressed if anyone succeeded!

This boils down to writing interpreters in Z/Glulx, which isn’t impossible… I think the main obstacle is the lack of C compilers for Glulx, which means you’d have to write fresh interpreters (presumably in I6) instead of porting existing ones. For the Z-machine, there’s vbccz, but I don’t know how usable it is.

If you’re up for something really ambitious, I’d suggest writing an LLVM backend for Glulx. That would give you a solid, modern, optimizing Glulx C compiler, and then you could port all the interpreters you wanted without much additional work.

My initial impression is that, while this ought to be possible, it would be a lot of work for relatively little reward. I can’t see any reason in principle why you couldn’t implement a TADS (say) interpreter in Z-code for Glulx, but it would be a colossal amount of work.

Why would this be a useful thing to do?

Instead of requiring a lot of uncommon text adventure systems, they can be converted into common formats such as Z-code and Glulx (many open-source interpreters exist for these, for many systems, too).

OASYS is a relatively simple system, so I don’t know how much you would be impressed with this converter (I am converting to assembly, not Inform; and it reads binaries, not source (but it does make certain assumptions about the binary which will always hold when the OASYS compiler is used)), even if it works perfectly.

I have actually wanted LLVM backend for Glulx; this is one of the LLVM backends I wanted (as well as ARM2, MMIX, and RogueVM). It doesn’t exist, though.

Starting from source files may work for some systems, although starting from binaries may also work. Regardless, if the system uses a harvard VM (OASYS does) then using the hybrid approach I have specified (convert instructions into primitive Z-machine instructions and procedure calls, and then write the rest of the implementation in fixed Z-code) may work whether you are using source or binaries.

Of course, modifying the compilers to support output to Z-machine or Glulx files (even if some of the features of those systems are unsupported, although they can simply be omitted if the output format is changed), may also work, if it is open-source.

I might work on it later, but anyone else who is interested might also help, please.

Hmm. Source code would be interesting; I’m sure an automated script to generate I7 code from AGT source ought to be simple enough, for example, if tedious; I’ve converted a few projects myself by hand.

There is some value to this, but limited I think. The computational part of a VM might be easily ported, but the UI systems are more distinct.

If people have the programming time to spare, Gargoyle could really do with some more developers! If it could be more easily ported then more formats would be playable in more places.

I wrote a tool that converts ADRIFT 4 to Inform 6 (taf2inf: produces games properly written in I6, but generally needs a good deal of post-processing), and one that converts ADRIFT 4 to TADS 2 (tasea: fully emulates ADRIFT execution, entirely automatic).

It may still be possible to allow it to work with a slightly different UI, for example omitting some features, or making them entered differently. Some kinds of UI systems may work in Z-machine, while some may require Glulx or Z-machine version 6, although not all the UI of the other system is necessarily important anyways.

This. The thing about this idea is that it’s utopic - it would be awesome, for the simple reason that currently the ZMachine is the most portable one, but different systems do things different ways, and you’d always have to go there afterwards to adjust some things yourself.

There is also a utility that converts PAWs games into ZCode. I never could get it to work, but I do know you lose the graphics, and I’m not sure the result would be 100%.

It would be simpler to invest in Gargoyle - rather than convert everything to a simple interpreter, support an interpreter that tries to play everything. Better yet, to invest in mobile/Android/iOS interpreters for, say, Level 9 and Magnetic Scrolls and TADS and HUGO and Alan and AGT and Quest (which in nearly there but, IMO, will never be as useful as it could be until its interpreter can be released like, say, iFrotz).

But in theory? Oh yes, in theory, considering the current panorama, a converter that turned any game into a ZMachine (Glulx OR ZCode) would be awesome.