ZCode: Interacting with the outside world?

6 views
Skip to first unread message

denni...@gmail.com

unread,
Oct 14, 2007, 8:33:29 PM10/14/07
to
I got an e-mail this morning from a multimedia developer who found my
online version of Emily Short's Metamorphoses, asking some technical
questions about whether it is possible to give web-based users tasks
to perform in an interactive fiction game, and have the game notify
the outside world when the task is completed. I'm reproducing it here
with permission.

> Dennis,
>
> Hi. I write with something of a request. I wonder if you can help?
>
> I've been able to find one of Emily Short's IF stories playing within
> a web page on your site <http://jerz.setonhill.edu/if/gallery/
> metamorp/index.html>. This is the only time I've been able to find IF
> playing this way - most IF seems to get played as a self-standing
> application - and so I wondered if you might be able to give me some
> idea about how the web-based IF is accomplished?
>
> As an old (in both senses of the word) player of IF, and now a self-
> professed multimedia developer, I am trying to see if I can use
> INFORM7 to write some "tasks" for users of a web-based 'community'
> site that I'm working with. The idea would be bring up a short IF
> task as an alternative activity for a user who requests one, on the
> web page, get the user to work through it, and get the story to send
> a message to the web server on successful completion (or on saving,
> etc.).
>
> If you have time to reply, and if you can help, I would be most
> grateful.
>
> Regards,
> Denis Williamson
> Hong Kong

I posted the following response on my blog, with hyperlinks that I
won't reproduce here. What am I missing? Probably a lot!

(If you like, you can see the post at
http://jerz.setonhill.edu/weblog/permalink/question-about-inform7-if-play/)
---

The Inform system produces game files that run on the Z-machine, which
is a virtual machine that exists only in software. When you see an IF
game running in a web page, it is probably using Matthew Russoto's
ZPlet, which is a Java interpreter for the Z-machine. I wouldn't know
how it is possible to send a message from within the virtual machine
to the outside world, but my programming skills are very modest, so
just because I can't imagine how to do it doesn't mean it's
impossible. I don't know all that much about the Z machine -- Andrew
Plotkin or Matthew Russoto would be the ones to ask (both of whom read
the rec.arts.int-fiction Usenet group).

It should be a fairly trivial thing to have a small stand-alone ZPlet
program that ends with the player finding a magic word, which the user
would then just manually key into some other program. I embedded a
few small IF programs in a web page designed to teach my students
about exposition in interactive fiction -- that might give you some
idea of what you can accomplish. I don't try to communicate to the
outside world from within the sample games, but there is some crude
interaction (in in the form of questions the web site asks about the
in-game experience.)

The Glulx interpreter has some significant multimedia capability, and
there is a Java interpreter for Glulx, Zag, by Jon Alfred Zeppeiri.
Inform 7 can output gamefiles in the Glulx format. (It requires the
Java Runtime environment to be installed on your local computer, so
it's not as point-and-click simple as ZPlet.)

TADS also has some multimedia capabilities, but it is a completely
different system from Inform and I have not recently checked out its
capabilities. It has had HTML hyperlinking for some time, so I imagine
it should not be too hard to send a message to the outside world.

The website Homestarrunner.com created a flash-based spoof of text
adventures called Thy Dungeonman. I don't know whether the flash code
has been released, or whether some other text-adventure fan might have
released a homebrew version of the code. But that game was released
long before Inform 7, so my guess is the creation of such a flash-
based game would be hackish.

I just Googled and found Flashonate, a flash-based z-machine
interpreter, by Peter Rogers. He has released the code as GPL.

I hope you will share whatever you learn as you investigate the
possibilities.

Fredrik Ramsberg

unread,
Oct 18, 2007, 4:48:28 AM10/18/07
to
On 15 Okt, 02:33, dennis.j...@gmail.com wrote:

> The Inform system produces game files that run on the Z-machine, which
> is a virtual machine that exists only in software. When you see an IF
> game running in a web page, it is probably using Matthew Russoto's
> ZPlet, which is a Java interpreter for the Z-machine. I wouldn't know
> how it is possible to send a message from within the virtual machine
> to the outside world, but my programming skills are very modest, so
> just because I can't imagine how to do it doesn't mean it's
> impossible. I don't know all that much about the Z machine -- Andrew
> Plotkin or Matthew Russoto would be the ones to ask (both of whom read
> the rec.arts.int-fiction Usenet group).
>

> The Glulx interpreter has some significant multimedia capability, and
> there is a Java interpreter for Glulx, Zag, by Jon Alfred Zeppeiri.
> Inform 7 can output gamefiles in the Glulx format. (It requires the
> Java Runtime environment to be installed on your local computer, so
> it's not as point-and-click simple as ZPlet.)

Both Zplet and Zag require the JRE to be installed on your local
computer. Zplet can run as a an applet, meaning it can quite easily
be embedded in a web page, while I think Zag has to be downloaded and
run as a regular application.

Looking at Z-code interpreters, Zmpp is better than Zplet. Also, it's
actively maintained. Perhaps you could collaborate with its author to
create an extension, allowing simple communication using HTTP. Zmpp
can run both as an applet and as a standalone application.

/Fredrik

David C.

unread,
Oct 18, 2007, 12:22:04 PM10/18/07
to
<denni...@gmail.com> wrote in message
news:1192408409....@z24g2000prh.googlegroups.com...

>I got an e-mail this morning from a multimedia developer who found my
> online version of Emily Short's Metamorphoses, asking some technical
> questions about whether it is possible to give web-based users tasks
> to perform in an interactive fiction game, and have the game notify
> the outside world when the task is completed. I'm reproducing it here
> with permission.

Conceptually, what Mr. Williamson has suggested is entirely possible, but no
one has implemented an environment that would offer this capability.

In developing the interpreter for Textfyre, we plan to have the ability to
setup a testing version so that the game player's interactions are sent back
to our servers over the Internet. This is for market testing and will allow
us to build a repository of commonly missed commands and sentence
structures. (This will not be enabled in the production version for those of
you concerned about spyware!)

But as a side benefit, we would also be able to do as Mr. Williamson
suggests. We would be able to notify some external entity of game progress
or receieve a notification from somewhere outside the interpreter. I can
think of a myriad ways this would be useful, but at this time Textfyre isn't
really focused on communication aspects outside of test marketing.

But it's a cool idea. We'd thought of getting into developing content based
on domain expertises (educational tools) and this might be one of the
aspects of that type of system.

I had personally thought to develop the setting of our downtown (Geneva,
Illinois) which is a 150 year old boutique shopping district and then add
interactions within the game that went out to the Internet to gather product
information for participating stores. The idea is that you could download
the Geneva Shopping game, "walk around 3rd street", visit stores, talk to
the people, and look at real products. You could even purchase things. I
wonder if people would buy things this way.

David C.

denni...@gmail.com

unread,
Oct 19, 2007, 4:34:30 PM10/19/07
to
On Oct 18, 12:22 pm, "David C." <david.cornelsongmailcom> wrote:

> I had personally thought to develop the setting of our downtown (Geneva,
> Illinois) which is a 150 year old boutique shopping district and then add
> interactions within the game that went out to the Internet to gather product
> information for participating stores. The idea is that you could download
> the Geneva Shopping game, "walk around 3rd street", visit stores, talk to
> the people, and look at real products. You could even purchase things. I
> wonder if people would buy things this way.

Put that on a PDA with GPS, and it sounds like a good recipe for an ad-
supported alternate reality game -- kind of like those localized
Monopoly games.

Andrew Hunter

unread,
Oct 20, 2007, 5:51:19 AM10/20/07
to

On 2007-10-15 01:33:29 +0100, denni...@gmail.com said:
>
> I posted the following response on my blog, with hyperlinks that I
> won't reproduce here. What am I missing? Probably a lot!
>
> (If you like, you can see the post at
> http://jerz.setonhill.edu/weblog/permalink/question-about-inform7-if-play/)
> ---

Hmm, I thought about this. CocoaGlk and ZoomView both have extensive
automation capabilities, and they both separate the interpreter from
the UI. You could implement the classes in the Protocol directory of
CocoaGlk to create an interpreter that presented itself as a web
interface instead of a Cocoa interface. Ought to be easy on a
WebObjects server :-)

Something similar is possible using ZoomServer instead of a GlkClient:
the protocol is no where near as easy to implement, though. The
advantage that you'd get would be is that ZoomServer can produce a save
game at any time, so you can store the game state on the client instead
of the server. You'd be limited to the Z-Machine rather than anything
written against glk, though.

If you don't have access to a Mac webserver, it should still be
possible to do this, by compiling against libFoundation or GNUstep: I
think both ZoomServer and GlkClient should compile cleanly but I've
never tried it.

If you want a UI interpreter that interacts with a webserver, things
are even easier, though. Link against the GlkView framework, add it
into a window using Interface Builder and then implement a
GlkAutomation object to do the talking to the outside world: this is
how Inform implements the skein, the transcripts and run-time error
detection.

Andrew.

de...@learning-on-line.com.hk

unread,
Oct 21, 2007, 7:40:08 PM10/21/07
to
Hi, as the guy who asked the original question, can I say 'thanks' to
all who helped, especially Dennis who passed on my question.

I have both Zplet and zmpp and will set up those first and get used to
working with them. I'll then have to rely on others in my project to
work out how to fit one of these applets into the web site we're
working on, while I try and write some "quests" in I7. This forum will
be here for us all to refer to.

Thanks again.

Denis Williamson
Hong Kong

Reply all
Reply to author
Forward
0 new messages