Skip to content
David Cornelson edited this page Jan 14, 2014 · 6 revisions

Welcome to Zifmia!

You're here because you're interested in traditional, parser-based Interactive Fiction and specifically Inform 7 and the Glulx engine. You want to build your own interpreter, integrate an interpreter into some other platform, or just want to play around.

Glulx, FyreVM and Zifmia

Before we get to Zifmia, we need to talk about FyreVM and Glulx. Glulx is a specification freely available from Andrew Plotkin's website. When constructed as a computer program, it allows the user to execute a game file created using [Inform] (http://inform7.com). FyreVM is an implementation of the Glulx specification in Microsoft .NET and C#.

It gets a bit technical, but there is one significant difference between all of the other Glulx implementations and FyreVM. All of the other interpreters use an I/O layer called [Glk] (http://www.eblong.com/zarf/glk/). Inform has a history of handling the game mechanics and allowing authors to control the game output. There's little separation between the two when using Glk.

FyreVM does things differently. Instead of the author defining physical output (like placing text at the top of the screen, bottom, left, right, etc), it instead allows the author to categorize all output. You have various parts of the content like Title, Score, Turn, Location Name, Chapter Name, and Main output that can be differentiated with FyreVM. The author can add as many "channels" as they like for other things like Help, Hints, Progress, and Maps. It can get even more complicated if the author wants to develop custom controls in their own interpreter. I've developed a command builder using nouns and such. I've also developed a compass rose that shows available exits. My Hints are done by sending a large JSON object through the Hints channel.

FyreVM also is an encapsulated library. The actual interpreter is a wholly separate program. To use FyreVM, the program must connect to five events: LineWanted, KeyWanted, LoadRequested, SaveRequested, and OutputReady. These should be self-explanatory.

Zifmia is a very small piece of code that wraps around FyreVM and turns it into a state-machine. Normally a virtual machine continues to wait upon user interaction. Zifmia will start a game, run a command, save the game state, then stop running. The channel data is set on a public property as well as the byte array of the saved state (Quetzal format). That extra step to save every turn is a bit of overhead and it can be commented out if prefer.

Inform 7

In order for all of this to work, you need an Inform 7 extension called Zifmia Support. Once included in your source, you can change channels through code.

select the main channel.

You can create new channels by adding an Inform 6 constant in the extension and a small piece of Inform 7 code to wrap that constant's usage.

Example of Inform 6 channel definition:

Constant FYC_MAIN = ('M' * $1000000) + ('A' * $10000) + ('I' * $100) + 'N'; ! MAIN

Corresponding Inform 7 definition:

To Select the Main Channel: (- if (is_fyrevm) FyreCall(FY_CHANNEL, FYC_MAIN); -).

Usage

I've used FyreVM and Zifmia in command line mode, Windows apps, Silverlight apps, Web apps, and now Windows 8 Store apps. The libraries allow any programmer using .NET to build their own interpreter for general or specialized content. Given full use of the .NET Framework, a programmer could embed video, websites, music, PDF's, integrate with Unity 3D, or anything else one can imagine.

Clone this wiki locally