16 ms·
The DUNGEON (Zork I) source
- homarp 9y agoIn http://blog.zarfhome.com/2017/08/your-load-is-too-heavy-zork-deep-reading.html http://blog.zarfhome.com/2017/08/your-load-is-too-heavy-zork... , Andrew Plotkin was pointing to an Inform 6 version of Zork by Allen Garvin , http://plover.net/~agarvin/zork1.txt http://plover.net/~agarvin/zork1.txt derived from the original decompiled Z-machine code.
- homarp 9y agoAnd http://plover.net/~agarvin/zorkbugs.txt http://plover.net/~agarvin/zorkbugs.txt is a list of Zork bugs.
- JoeDaDude 9y agoThis was also discussed a couple of days ago: https://news.ycombinator.com/item?id=15138114 https://news.ycombinator.com/item?id=15138114
- larrykwg 9y agoreading old C like this, I always wonder how could people code like this back then but apparently it was transpiled from fortran. So I'd assume the original code looked better. I dug around and found it, for comparison here is the original rooms.f vs. rooms.c: https://paste.ubuntu.com/25458063/ https://paste.ubuntu.com/25458063/ https://github.com/mgius/zork/blob/master/rooms.c https://github.com/mgius/zork/blob/master/rooms.c Here is the full fortran code: http://gunkies.org/wiki/Zork#Source_code http://gunkies.org/wiki/Zork#Source_code
- ajross 9y agoPretty sure the fortran was itself a port. My apocryphal memory is that the original is for some custom system, which wikipedia tells me was "MDL". The fortran was the result of it being carried to more common systems.
- ghaff 9y agoYes. The Infocom games were written in MDL, which was a LISP derivative.
- digi_owl 9y agoAnd developed on a PDP-11 almost too the end of the company...
- abecedarius 9y agoWeren't they using a 10? I don't remember but it'd at least be surprising not to while they were still at MIT.
- digi_owl 9y agoAh yes, my bad. And it is not even that long since i read the history on Filfre. Guess i have been reading so much about the 11 i got the two mixed...
- abecedarius 9y agoThe 11 had such a pretty instruction set, though it was kinda small for developing a program like Zork.
- ghaff 9y agoI think they eventually had a TOPS-20.
- jghn 9y agoOne of the gnarliest code bases I ever worked in was a very large C project where the inner core had been run through a f2c transpiler. Over the subsequent decade the surrounding code was a hodgepodge of people taking their own interpretations of autogenerated C code because folks didn't question why the code looked the way it did and thus they did their best to maintain the same look and feel. Oh and no one really knew how that original inner core worked, there were no docs, no oral tradition, and it was over 20 years old. While I was still working there we accumulated enough major change requests to the application that finally got the go ahead to throw the original code base out and start from scratch.
- emddudley 9y agoThe download links at http://gunkies.org/wiki/Zork#Source_code http://gunkies.org/wiki/Zork#Source_code are all broken.
- larrykwg 9y agoatleast this one worked: http://simh.trailing-edge.com/games/dungeon.zip http://simh.trailing-edge.com/games/dungeon.zip (Bob's port to Fortran)
- DonHopkins 9y agoThe original MDL source code is beautiful to read: https://github.com/itafroma/zork-mdl https://github.com/itafroma/zork-mdl
- larrykwg 9y agothanks I hope thats the end of that rabbithole, that MDL almost looks like XML neat: https://github.com/itafroma/zork-mdl/blob/master/rooms.mud#L827 https://github.com/itafroma/zork-mdl/blob/master/rooms.mud#L...
- pkaye 9y agoHonest question as someone who never got comfortable with Lisp languages. Is the code in parser.mud easy to read. One of those 100 line functions, could you jump to the middle of it and start understanding the meaning as someone familiar with C like languages? Even though I can figure out the syntax it looks like line noise to me but perhaps it is because i've not done much Lisp coding.
- jsnell 9y agoI wouldn't call that code easy to read, and that's coming as someone who has actually at some point learned enough MDL to actually know the syntax rather than have to reverse engineer it on the spot. There's a couple of reasons why that code is rough to read today: - It's doing very complicated operations that operate on mutable global data, and structuring it as huge and deeply nested functions rather than splitting the operations up to smaller chunks with meaningful names. But you'd see exactly the same kind of thing in non-Lisp source code of that era; it's just different sensibilities. - The code is incredibly heavy on conditionals. Which makes sense given the problem domain: parsing a pseudo-natural language. But MDL is a language where the conditionals kind of suck. COND is basically unreadable in any Lisp, you'd very rarely see people use it today. In CL you'd have more readable options like IF, WHEN and UNLESS. In MDL the only option is misusing short-circuiting AND/OR as a poor man's IF. Which they do in places, which doesn't help readability either. - The use of angle brackets makes everything look like a sea of less-/greater -than comparisons. At least I just can't help it. It's especially bad when combined with the array indexing syntax.
- michaelcampbell 9y agoWhat version of c used integer and logical as type decls?
- scelerat 9y agoA cavalcade of GOTOs
- contingencies 9y agoBack then, stacks (and the private namespaces resulting from the use of functions/methods in most modern languages) were probably considered a superfluous resource indulgence: 1970s bloatware.
- smegel 9y agoMight have been ported from assembly, this is not really the very original source. As someone said, version one was for mainframe or something.
- Narishma 9y agoIt was ported from Fortran, and that version itself was ported from the original written in a LISP derivative called MDL.
- rhspeer 9y agoIt would be interesting to refactor zork into HTML+CSS and set it up like cssZenGarden.com so folks could add their own designs. Although a much smaller text adventure game would me more achievable.
- SoMisanthrope 9y agoThe Zork Anthology is available for $6 on Steam.... just saying :-) I'm reliving my childhood. Used to play it on a TRS Model III. Good times!
- teddyh 9y agoSee also Open Adventure: https://gitlab.com/esr/open-adventure https://gitlab.com/esr/open-adventure “This code is a forward-port of the Crowther/Woods Adventure 2.5 from 1995, last version in the main line of Colossal Cave Adventure development written by the original authors. The authors have given permission and encouragement for this release, it obsolesces all the 350-point versions and previous 2.x (430-point) ports.”
- taeric 9y agoKnuth has a version of this game. Fun read: http://www-cs-faculty.stanford.edu/~knuth/programs/advent.w.gz http://www-cs-faculty.stanford.edu/~knuth/programs/advent.w....
- svat 9y agoNote: Best to run that program through `cweave` and read the typeset output, rather than read the `.w` file directly.
- taeric 9y agoIndeed, I should have mentioned this. Thanks! This is also a chapter in https://smile.amazon.com/Selected-Papers-Games-Lecture-Notes/dp/157586584X/ https://smile.amazon.com/Selected-Papers-Games-Lecture-Notes... I would be lying if I said this was super easy to read. It is easy, though. Not sure if it is a good exposition for literate programming. I certainly like it, but I think I was predisposed to.
- svat 9y agoYeah when reading some of Knuth's literate programs, I get the feeling that they are probably the best possible exposition of programs that are not so good to read. :-) That is, the programs aren't structured modularly like good modern programmers would write (encapsulation, separation of concerns, etc.) — instead they freely use global variables, gotos, etc., in the programming style of the 60s with some of Knuth's idiosyncratic improvements. But given that "bad" program, the one with the globals and the gotos, Knuth's literate programming system produces what is probably the best possible exposition of that program — at least for reading as printed material (on paper not on screen).
- crocal 9y agoThat Makefile made my day... # On SCO Unix Development System 3.2.2a, the const type qualifier does # not work correctly when using cc. The following line will cause it # to not be used and should be uncommented. Write once, run anywhere provided all the tweaking is done properly. Those were the days. EDIT: formatting.
- __david__ 9y agoNot exactly Zork 1. Zork was originally written on MIT mainframes, but when they decided to start Infocom and release the game for profit they couldn't get it all to fit on the personal computers of the time, and so they split it into 3 parts. Zork 2 had the coal mine and the Bank of Zork, I think, and Zork 3 had the endgame. They then added some extra stuff to Zork 2 and 3 that wasn't in the original mainframe version. The history of the source code is interesting. It was called Zork and written in MDL. At some point they renamed it to Dungeon, but then a little while later named it back to Zork. During the time it was called Dungeon, a DEC engineer logged into their system (open to the world on purpose so people could play the game) but instead of playing the game copied the source code off. Then they translated the game into Fortran so they could run it on PDP-11s. This source code is the descendant of that translation.
- davidjhall 9y agoA version of it has been ported to the z-machine ( available on almost every platform) : http://penguincentral.com/retrocomputing/zdungeon/ http://penguincentral.com/retrocomputing/zdungeon/ Also referenced here: http://ifdb.tads.org/viewgame?id=4gxk83ja4twckm6j http://ifdb.tads.org/viewgame?id=4gxk83ja4twckm6j
- spilk 9y agoNeat. compiled right up on my SunOS 4.1.4 machine with only a slight modification (dsub.c had some C++ style comments that the old BSD cc didn't like). phoenix$ zork Welcome to Dungeon. This version created 11-MAR-91. You are in an open field west of a big white house with a boarded front door. There is a small mailbox here. >
- DonHopkins 9y ago4.1.4? Yummy, my favorite! Is it running on real hardware or in a VM? If the former, what software do I need and how can I get an image please?
- spilk 9y agoI'm running it on the real deal - a 1991-ish SPARCstation IPC. 25MHz of SPARC goodness. Most of these machines are dead because the power supply output capacitors have failed, but a fairly easy soldering job and they are back up and running. My original SCSI HD also failed (a 424MB Seagate ST1480N), but I've subbed in a SCSI2SD. Works a treat. I basically just play Nethack on it. I've also been experimenting with TeX 3.141 on it. As far as a VM, I believe it is possible to run 4.1.4 within QEMU. I haven't personally tried, but I have had success in the past running some versions of Solaris 2.x for sun4m in QEMU. I believe you can emulate a SPARCstation 5 with tcx graphics fairly well with that.