Where I’m Wandering

Where I’m Wandering

Well, dang.  It’s been over a week since my last post.  The thing is, I wanted to make another post about Wander, the text adventure system from 1974, since after all the focus of this blog was initially supposed to be on old game creation systems, and… I didn’t think I had anything to say about it.

As far as the game goes that I’m writing in Wander, well, I’ve basically got all the puzzles planned; I just have to finalize the map.  And I’ve got a good start on coding it—the initial rooms, anyway, and some bits I don’t need the map finalized for.  But I don’t really have anything I can easily show for it here on the blog.

I was also working on implementing an online version of the Wander interpreter in Javascript, and… well, that’s where things got bogged down a bit.  See, I figured that’s one thing I could post about here, when I got that done, and that’s something I’d want to have done before I finished the game anyway.  (Otherwise there’d be no easy way for anyone to play the game when I did finish it.)

The problem was, I was going about implementing the interpreter in just about the stupidest way possible.

So, the currently available version of the Wander interpreter is in C, and dates from about 1978, according to the copyright date, though it may have been written earlier.  (The original version of the Wander interpreter, according to its creator Peter Langston, was written in 1974, but that original version doesn’t survive… or at least, if it does, it hasn’t turned up yet.)  So I’ve been going through the C code and working on reimplementing it in Javascript, which has been maybe a little more difficult than it could have been because the code isn’t just in C.  It’s very in C.  It does all sorts of weird C-y tricks with pointers.  Negative array indices.  Most of the game’s text being stored as one big block with pointers indicating the beginnings of particular bits.  That sort of thing.  It’s actually a bit surprising that the code makes so much use of these sorts of C shenanigans, because apparently the code wasn’t originally written in C; the original version was in HP Basic.  But apparently when Langston rewrote the interpreter in C, he basically rewrote it from scratch, and heavily C-ified it.

Now, of course I can’t do all those kinds of pointer tricks in Javascript, and I don’t think I’d want to even if I could.  So implementing the interpreter in Javascript isn’t so much a matter of directly translating the C code as it is seeing what the C code is trying to do and then figuring out a more Javascript-friendly way of doing it.  This means, incidentally, the behavior of the Javascript interpreter won’t be exactly the same as the behavior of the C version, but only in the sense that I’m not arbitrarily imposing limitations that were present in the C version due to set buffer sizes but don’t have to be there in the Javascript version.  Any game that the C interpreter can handle the Javascript version should be able to handle just fine.  (Which isn’t saying much, since currently there are only four known surviving games anyway…)

Okay, all of that isn’t the stupid part.  The stupid part is that I was going about the coding completely backwards.

I was just essentially going function by function through the C code and writing an equivalent Javascript function.  But I didn’t really have any basic input/output functions, because the input and output was of course going to be handled through the webpage, and I didn’t have the webpage set up yet.  That means I had no way of actually testing that the code worked, and, since I was kind of putting off worrying about the input and output until the end, wouldn’t have a way until the code was done.  So apparently I was going to write all the code and then test it and debug it.  Which… makes no sense at all, and I’m an idiot.

And the thing is, I guess kind of knew that, which is why I put off working on the interpreter.  But since that was the next thing I wanted to finish, that meant putting off working on the game as well.  So essentially I’ve gotten nothing done on the Wander game because I was put off by what a hassle the interpreter was going to be.

Of course, it wouldn’t be a hassle if I just did things the right way around, taking care of the basic input and output routines first so the code would actually do something, and then coding one bit at a time and testing as I go to make sure each piece works instead of just tossing the whole thing together at once and hoping it wasn’t a total disaster.  So… I finally just went ahead and did that.  The first thing, I mean, doing things the right way around.  I finally did what I should have done first, before I even started working on reimplementing the C code in Javascript, and got the website set up where it’s going to go, along with the means to pass basic input and output to and from the game code.

If you want to take a look, it’s at http://comparativecreation.com/Wander, but right now the basic input and output is pretty much all that’s there; I haven’t put in the actual interpreter code yet.  As for that code… well, the work I’ve done isn’t going to go completely to waste, but I’m going to test a bit at a time rather than throwing the whole thing into the webpage at once.

So, now that I’m going about this in a way that isn’t completely ridiculous, I hope to have the online Wander interpreter up and running within the next week or two.  And I still hope to have the Wander game I’m working on, “It Shall Not Be”, done by the end of the month, though we’ll see how realistic that ends up being.  In the meantime, I do have plans for some other posts about recent games that I hope to have up shortly…

Spread the love

Leave a Reply

Your email address will not be published. Required fields are marked *