New FyreVM/Zifmia Repository

I removed the old SourceForge repo and created a new repo on Github called Zifmia. This has the latest C# code and extensions for Inform 7. The solution is in VS 2013, but the code can be pulled into any project. There is an exception for WinRT/WinPhone. There is one small change in the Engine class I’ll add later as an optional compile block.

Github Repo: github.com/ChicagoDave/Zifmia

There isn’t any documentation at the moment, but it’s pretty simple. In the Zifmia Support.i7x extension you will find channel definition information like this:

Inform 6 code…
Constant FYC_MAIN = (‘M’ * $1000000) + (‘A’ * $10000) + (‘I’ * $100) + ‘N’; ! MAIN
Constant FYC_PROMPT = (‘P’ * $1000000) + (‘R’ * $10000) + (‘P’ * $100) + ‘T’; ! PRPT
Constant FYC_LOCATION = (‘L’ * $1000000) + (‘O’ * $10000) + (‘C’ * $100) + ‘N’; ! LOCN
Constant FYC_SCORE = (‘S’ * $1000000) + (‘C’ * $10000) + (‘O’ * $100) + ‘R’; ! SCOR
Constant FYC_TIME = (‘T’ * $1000000) + (‘I’ * $10000) + (‘M’ * $100) + ‘E’; ! TIME
Constant FYC_DEATH = (‘D’ * $1000000) + (‘E’ * $10000) + (‘A’ * $100) + ‘D’; ! DEAD
Constant FYC_ENDGAME = (‘E’ * $1000000) + (‘N’ * $10000) + (‘D’ * $100) + ‘G’; ! ENDG

Note: You can add your own channels…like this:

Constant FYC_MYCHANNEL = (‘M’ * $1000000) + (‘C’ * $10000) + (‘H’ * $100) + ‘N’; ! MCHN

and later in the extension…

Inform 7 code…
Chapter 4 - Channel Rules

Section 1 - Required Channels

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

To Select the Prompt Channel:
(- if (is_fyrevm) FyreCall(FY_CHANNEL, FYC_PROMPT); -).

To Change the Prompt to (T - text):
Select the Prompt Channel;
say T;
Select the Main Channel.

To Select the Location Channel:
(- if (is_fyrevm) FyreCall(FY_CHANNEL, FYC_LOCATION); -).

To Select the Score Channel:
(- if (is_fyrevm) FyreCall(FY_CHANNEL, FYC_SCORE); -).

To Select the Time Channel:
(- if (is_fyrevm) FyreCall(FY_CHANNEL, FYC_TIME); -).

To Select the Death Channel:
(- if (is_fyrevm) FyreCall(FY_CHANNEL, FYC_DEATH); -);

[Adding my own channel]
To Select My Channel:
(- if (is_fyrevm) FyreCall(FY_CHANNEL, FYC_MYCHANNEL); -);


In your game file, include the extension…you can direct output to any channel (and you can create new channels as you wish)

EXAMPLE:
To send info on mychannel:
select my channel;
say “This text will appear in my channel.”;
select the main channel. [always change output back to the main channel]

There are three ways to use the library code.

  1. You can use FyreVM directly and hook up the five events:
    LineWanted, KeyWanted, SaveRequested, LoadRequested, and OutputReady.

  2. You can use the Zifmia wrapper which handles all of the events, automatically saves “blindly” every turn and exposes the results in a couple of properties.
    FromHash() returns a Dictionary<string,string> with all of the channels as keys (“MAIN”, “TURN”, “HELP”, etc). The value is whatever content you wrote to that channel.
    SaveFile is a byte array of the Quetzal file. This can be used with the SendCommand method to restart the VM, process a command, and have the new results ready.

  3. Zifmia on a web server. There are two sets of code in the wrapper for creating XML or JSON output. If you want to use the library in a browser, you’d probably uncomment the JSON creation code and use that to return to the client. You could theoretically setup a web service that will run a game. (I’ve done this so I know it works).

If you have any questions, feel free to ask.

Note: The code is still Textfyre copyrighted and corporate commercial use requires a license. Hobbyist use and individual commercial use is freely allowed.

David C.
www.textfyre.com

I’m a hobbyist working on a 3D text adventure in Unity. Sounds ridiculous, and it probably is, but I’ve had more success than I thought I would creating the 3D interface in Unity. I’ve been scripting everything in C#, because that’s the language I’m most comfortable with (I have a Computer Science degree, and I use C# in my profession, but programming hasn’t been my focus pretty much since I was at University, so I’d probably categorise myself as an amateur who really doesn’t know much).

When I went to build my own parser I hit a brick wall. I think with enough time I could make a basic one, but it still wouldn’t be as good as what’s already out there. So the obvious solution was to somehow incorporate Inform 7 into my Unity project. And the best way I can think of to do that would be some sort of C# Class that behaves as a Glulx interpreter - one that I can send input strings, and which spits out the output strings. So, for example, I’d call GlulxClass.Input(“look cat”) and it would return “The cat is a small black fluffy cat.”, or GlulxClass.Input(“i”) and it would return “You are carrying:\n\ncatnip\na cat toy\n”. Something like that.

After a couple of days of Googling, Zifmia sounds like the most promising way of doing something sort of like that. But I’m not sure exactly how to use it. Could I compile the project I downloaded from GitHub into a .dll that I can include in my Unity C# scripts? If so, which classes from the library would I use and how?

Thanks.

Hey Mark,

I have a set of newer code that works better than the code on GitHub, but to answer your question, yes…FyreVM and Zifmia can solve your problem. Drop me an email (david/textrfyre.com) and let’s try to connect over TeamViewer to get the code integrated.

Happy to help.

David C.
www.textfyre.com