Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Play Zork on OS X! Apps
OS X may be the world?s most advanced operating system, but tonight, I took it back into the early 80?s. In the early days of the internet (or Arpanet, back then), a text-based game known as Zork was all the rage. I remember playing it on a TI Silent 700 dumb terminal with thermal paper, connected to the net at a whopping 300 baud.

Zork was the second big computer adventure game (after Adventure, of course), and it featured an amazingly detailed universe, and a slick English-language command parser. Infocom eventually published the Zork games for the PC, but my memories are strictly from the dumb terminal era. The first three Zork games are available freely on the web; more recent versions are still owned and protected by Activision.

Zork was originally coded in MDL (pronounced muddle), but over the years, it was rewritten in C, so I set out on a mission to get it running on OS X. After some searching, and a little bit of editing, I got it to work (as the screenshot shows; click here for a larger version). It turns out the hardest part was finding all the pieces. Read the rest of this article if you?d like to know how it works, and for step-by-step installation instructions.

If you don't want all the details and just want to play, grab the binary download of a UNIX Zork engine (Jzip), the first three Zork game data files, and a Read Me from my "Griffman's OS Collection" page.

And yes, I know about (and own) "The Lost Treasures of Infocom" I & II for the Mac; that's not the point -- I wanted to see if Zork could be run in a terminal window on OS X -- and it can!

Zork runs courtesy of an interpreter which understands Zork data files. Zork?s developers created a standardized system for handling adventure games (this made it quite easy for them to create follow-on games), which future programmers have used to recode the original game engine. So the first thing we need to do is get a Zork game engine. There are a number of them out there, for a number of platforms.

I used one called Jzip, primarily because it was the first one my google.com search came across. Jzip will run all games written by Infocom except for Zork Zero, Journey, Shogun, and Arthur (remember, only the first three Zork games are free; you?ll have to own other versions in order to use them legally). Other engines may work better, but this article deals solely with Jzip. Here?s how to get the engine running.

NOTE: You need to have the Developer Tools installed to compile Zork yourself. If you don't want to install them, download the precompiled binary.
  1. The Jzip home page has the source available for version 2.1, under the Source Distribution button at the top left. This will place a file called ?jzip21-10oct2000.zip? in your downloads folder. You can also click on the filename above for a direct download.

  2. Create a temporary working directory for Jzip. We?ll call it ?jzip_work? in this example. This directory can be anywhere you like; I put the sample directory in my ~/Documents folder. NOTE: If StuffIt Expander expands the archive automatically, that?s OK. Just use the folder it created as your working folder.

  3. If you didn?t use Stuffit to expand the file, start a terminal session, and unzip the download into the working directory:
    cd /path/to/your/download/folder
    unzip jzip21-10oct2000.zip -d ~/Documents/jzip_work/
  4. Move into the working directory, and copy one data file into a makefile:
    cd ~/Documents/jzip_work
    cp unixio.mak makefile
    This step creates the makefile we?ll use to compile the source. There are three different UNIX .mak files you could use, but this one seemed to be the best option (see the docs on the Jzip home page for more info on the .mak files).

  5. We now need to edit the makefile to change one line:
    vi makefile
    Find the line that reads LIBS = -lz -ltermcap and change it to read LIBS = -lz -lcurses. This changes out one of the libraries we compile Jzip with.

  6. Save your changes and exit the editor.

  7. Type make and watch the screen fill with text for a minute or two. NOTE: You?ll see a couple errors go by, but they didn?t seem to affect my ability to run the compiled code. If anyone can modify the makefile more to remove the errors, I?d be interested in learning what needs to be done. Since there are errors, I feel compelled to say ?Use this at your own risk!? I have no idea if anything bad will come of compile-time errors; my machine seems fine, though.

  8. When the compile is finished, you now have a Zork game engine in the working directory, named simply jzip. I took this file and moved it into my /usr/local/bin, so I could run it from anywhere. If you want other users to have access to it, you?ll also have to change the ownership of the program.

  9. You can delete everything else in the working directory; it's no longer needed.
The working game engine isn?t much good without some game data to display. So we need to go get some Zork data files. You can download the three freely available Zork games here:

Zork 1 Zork 2 Zork 3

NOTE: You can also download a data file called "dungeon," which is based on the original MDL source, and (I believe) contains all the original text and game -- it's about twice as big as the ZORK1.DAT file. Download dungeon to check it out yourself!

Once you?ve downloaded the games, you need to expand them (Stuffit is fine). From the expanded folder, the only thing you need is the ZORKx.DAT file. The path to this is /zorkfolder/DATA/Zorkx.DAT (where ?x? = 1,2, or 3). You can take this file and put it anywhere you like; I stuck it in my ~/Documents/ folder. Throw away everything else; the files aren'tneeded. You may want to view the README.TXT file if you?re new to Zork; it contains a brief ?how to play? guide.

That?s it -- you?re done! To play Zork, open a terminal, and ?cd? to the directory where you stored the ZORKx.DAT file. Then (assuming jzip is in your path), just type jzip ZORKx.DAT, and you?ll be playing!

NOTE: I don't think my compile is perfect, as I don't have access to some color options that Jzip claims to offer (I can?t change background or foreground colors). If anyone can do better, please let me know!
    •    
  • Currently 2.33 / 5
  You rated: 2 / 5 (9 votes cast)
 
[97,106 views]  

Play Zork on OS X! | 22 comments | Create New Account
Click here to return to the 'Play Zork on OS X!' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
JZip is old news - but still Great!
Authored by: tomhackett on Apr 07, '01 07:28:29PM


I actually had JZip version 2.0.2 running on Darwin / OS X Terminal back in September of 2000.

Check out the page at Stepwise's Softrak Archive for more info!

Zork is fun but I like Hitch Hiker's Guide to the Galaxy Game better. The best part of JZip is that you can play almost any of the old INFOCOM games!


- Tom Hackett



[ Reply to This | # ]

JZip is old news - but still Great!
Authored by: jtino on Jun 16, '03 04:52:22PM

I can't get my G4 running on 10.2.6, to recognize the command jzip. I followed the downloaded instructions exactly, first creating /usr/local/bin/, then moving jzip into it, then typing rehash, then going to dir where zorkx.dat files are and finally trying jzip zorkx.dat.

The command is not recognized in terminal.

Can someone help????



[ Reply to This | # ]
The REAL Zork...
Authored by: robg on Apr 10, '01 01:29:27AM
After writing this hint, I actually found a much better version for the Mac. There's a program called dungeon, which was written from the original MDL (programming language) source from MIT. When Infocom published the series, they (at least, this is my newly remembered version of what they did!) split the original game into two parts - Zork 1 and 2 (or maybe 1 and 0?). They may have also removed some rooms and puzzles from the game.

The data file you want to get if you want to play the truly original game is dungeon. Luckily, it was pretty easy to find on the web:

ftp://ftp.gmd.de/if-archive/games/zcode/zdungeon.z5

Grab this, put it in with your other data files, and then just 'jzip zdungeon.z5', and you'll be playing the truly original Zork. The data file is nearly twice as large, and if you type 'score', you'll see you can amass 646 points, as opposed to 350 with the ZORK1.DAT file.

Now that's the Zork I remember!

-rob.

[ Reply to This | # ]
Hitchhiker's Guide to the Galaxy!
Authored by: thinkyhead on May 17, '01 12:52:14AM
Douglas Adams may no longer be with us, but he left something behind, folks. The Hitchhiker's Guide to the Galaxy data file is posted on his web site free for your downloading! Hitchhiker's Guide to the Galaxy

[ Reply to This | # ]
OPTION-CLICK THE LINK!
Authored by: thinkyhead on May 17, '01 12:54:44AM

My browser just tries to display it, so option-click to get it to download.



[ Reply to This | # ]
Hitchhiker's Guide to the Galaxy!
Authored by: porkchop_d_clown on Mar 23, '02 10:33:26PM

Frustratingly, it appears that douglasadams.com is offline.



[ Reply to This | # ]
An I missing something obvious?
Authored by: Charles on May 17, '01 09:46:22AM

I'm unable to move the jzip file into the /uswr/local/bin directory, it gives me a permission denied. Do I need to be logged in as root? I'm always nervous about doing things as Root in case I blow something up. :)



[ Reply to This | # ]
Fixed it
Authored by: Charles on May 17, '01 10:44:17AM

Ok.. Never mind. I logged in as Root, moved the file to the bin directory just fine.
It still didn't work, instead asking if I was trying to use gzip.
I fixed that by making jzip executable (chmod +x jzip).. then it worked fine. :)



[ Reply to This | # ]
Fixed it
Authored by: thinkyhead on Jul 02, '01 03:14:32AM

Sometimes if you can't execute something you've just moved it means you need to update the lookup cache for executables in your path. To do this type 'rehash' in the terminal.



[ Reply to This | # ]
quick easy one
Authored by: pyrohotdog on Mar 23, '02 08:25:31PM

there is something similar built right in, open up terminal and type:
emacs
then, push esc+x
at the bottom it should say "M-x"
type:
dunnet

for more games (instead of typing "dunnet")
type:
ls /usr/share/emacs/20.7/lisp/play/



[ Reply to This | # ]
quick easy one/update
Authored by: doug123mox on Jan 25, '03 11:23:14AM

As of this date in OS X 10.2.3, the "20.7" directory is now "21.2" -- and will probably change in the future?



[ Reply to This | # ]
quick easy one/update
Authored by: pete on Feb 26, '09 04:06:27PM

yup as of Leopard 10.5.6, it is

/usr/share/emacs/22.1/lisp/play/



[ Reply to This | # ]
make warnings
Authored by: porkchop_d_clown on Mar 23, '02 10:47:14PM

The warnings both appear to be benign and caused by stupid programmer tricks rather than compiling under OS X. While I find that code that compiles with warnings to be in "bad taste" - these two problems won't cause any real issues.

On the other hand, it SEGV'd when I quit; I'm gonna dig into it a bit.



[ Reply to This | # ]
Errors
Authored by: n1mie on Oct 25, '02 08:41:12PM

When I try to do this, with jzip v2.1, I receive the following errors.

dyld: jzip Undefined symbols:
_tgetent
Trace/BPT trap

Any ideas how to fix this?

I also wasn't able to follow the directions for performing the "make" function. "Make" doesn't seem to be installed. I tried to locate it but was only able to find something called "automake".

Any ideas?



[ Reply to This | # ]
Errors
Authored by: avion on Nov 03, '02 01:16:37PM
I had the same problem which is why I had to compile it from scratch. After building it myself, it work OK, but seg faults on exit. In order to compile it, you may need to install the developer tools first. I found another package which was easier to compile (no changes needed at all). It is called frotz and you can download it from here.

[ Reply to This | # ]
IF Archive
Authored by: MemeTransport on Nov 03, '02 08:05:16PM
Assuming late is better than never:

There is a large archive of interactive games--many of them using the z interpreter and many recent too--available at:

http://www.ifarchive.org/indexes/if-archiveXgamesXzcode.html

[ Reply to This | # ]

Now working in 10.2...
Authored by: robg on Mar 18, '03 09:50:57PM

I recompiled jzip with the 10.2 Developer Tools. It still shows "segmentation fault" when it quits, but it runs just fine now.

-rob.



[ Reply to This | # ]
Now working in 10.2...
Authored by: Mitchell on Mar 20, '03 11:36:46AM

I got the previous version of the jzip interpreter going in 10.2 as well, with the segmentation fault on quit, same as Rob. For true, working-without-a-net interactive fun, though, try playing in single-user mode by starting with puppyfoot-S depressed. You can't save a game, but the text fills up the entire screen of your computer to replicate that summer of 1981 VT 100 experience.



[ Reply to This | # ]
Segmentation fault
Authored by: Oddjob3x on Mar 21, '03 04:15:52AM

Hi,

The crash log seems to point to the close_script routine in fileio.c:

Thread 0 Crashed:
#0 0x000041b8 in close_script
#1 0x00002548 in main
#2 0x000022bc in _start (crt.c:267)
#3 0x0000213c in start

Added some test logs in the function, and seemed to have pinpointed the following line as causing the problem:

set_word( H_FLAGS, get_word( H_FLAGS ) & ( ~SCRIPTING_FLAG ) );

Anyone who knows a bit more about this (not difficult!) able to shed some light? I'll have a play with it for a while.

Ta.



[ Reply to This | # ]
Segmentation fault ... workaround
Authored by: Oddjob3x on Mar 21, '03 07:23:13AM

Actually, you could just comment out the offending bit of code and then recompile it - in fileio.c, find the close_script function and then copy/paste the following in the appropriate spot:

/* Set the scripting flag in the game file flags */
/* SKIP THIS BIT
if ( scripting == OFF )
{
set_word( H_FLAGS, get_word( H_FLAGS ) & ( ~SCRIPTING_FLAG ) );
}
else
{
set_word( H_FLAGS, get_word( H_FLAGS ) | SCRIPTING_FLAG );
} */
} /* close_script */

(added the /* SKIP THIS BIT and the closing */)

Gets rid of the seg fault but assumes you're not using scripting ... not elegant I know.



[ Reply to This | # ]
Better Infocom interpreters
Authored by: dharkhig on Mar 22, '03 03:16:35PM

JZip is pretty poor as Infocom interpreters go, and much better ones have been around for a long time...

The ubiquitous "frotz" is the most popular, and available for just about every platform imaginable, including OS X.

I prefer Zoom for OS X, however, which will play every Infocom game (including all those tricky graphical ones) as well as all the modern games available from www.ifarchive.org. Grab it from:

http://www.logicalshift.demon.co.uk/unix/zoom/



[ Reply to This | # ]
Play Zork on OS X!
Authored by: luc69 on Jul 21, '11 03:51:06PM

http://homepage.mac.com/rgriff/zork.html

this url need psw...



[ Reply to This | # ]