Many Unhappy Returns

Many Unhappy Returns

So, once I started reimplementing the Wander interpreter in Javascript, it quickly became obvious where that limitation on synonyms comes from that I mentioned in the post on the limits of the Wander language.  Basically, the interpreter stores each word as a structure (that in, in the C code, a struct) with four fields: one holding the word itself as a string, one holding an index to the “root word” of which it’s a synonym (or 0, if the word is a root word), one holding the flags described in the Wander language overview post, and one holding the location of the object referenced by that word.  (Naturally, these last two fields don’t apply to verbs.)  The problem is that in the C code the index to the root is of type char… which means it can only hold values from -128 to 127, which means, since the index is never negative, that only the first 128 words in the word definition list can have synonyms.  (In practice, that means the number of words that can have synonyms is a lot less than 128, because for all but the last the synonyms themselves also have to be among those first 128 words.)

But wait… I’d said already that the number of words it gets through before it stops recognizing synonyms wasn’t a power of two… and 128, of course, is a power of two.  But that’s because I hadn’t taken into account the fact that the Wander interpreter predefines some default words, which takes up some of those 128 and leaves only eighty-eight or so of those 128 words to be defined in the game file.

Okay, so far so good; I’d figured out why not all the synonyms weren’t being recognized, though there wasn’t much I could do about it.  Sure, if I’m reimplementing the interpreter in Javascript anyway, I can certainly raise that limit in the Javascript implementation… but if I’m trying to use the language as it originally existed, that seems like a bit of a cheat.  I’ve thought of another idea for a game I’m tempted to do which should end up being a bit simpler and for which Wander’s limitations won’t be as much of an issue; maybe I’ll do both games, the simpler one designed to be able to work with the existing version of the Wander interpreter and the original one—the one that as I said was tentatively titled “The Eye in the Forest”—to work with a version of the interpreter with some of the limits raised.

Tentative title for the other game: “It Should Not Be”.

However, now that I knew what was going on with the synonyms, I ran into another problem… when I tried running the game, I found that most of the actions weren’t being recognized either.  It wasn’t because the actions were coded incorrectly; even if I copied actions directly from an existing Wander game, they wouldn’t work in mind.  This had me baffled for a little while, but I ended up figuring it out much faster than I had the synonym problem.  This time the issue wasn’t in my coding; it was in the encoding.  Specifically, it was in the control characters used at the ends of the lines.  By default, the program I’m using to write my code, Notepad++, uses the standard Windows format, with each line ending in a carriage return and a line feed.  The Wander interpreter, however, is rather picky and expects each line to end in just a line feed (the Unix convention), and gets thrown off by the carriage return.  Fortunately, this was easily fixed; a simple menu selection got rid of all the carriage returns, and ensured that Notepad++ would use the Unix convention for that file thereafter.

So, anyway, I guess with that I’m pretty much past the initial stages of figuring out the system and developing my process and on to the fun part of actually creating the game.  (Or games, now, I guess?  I don’t necessarily make things easy for myself.)  But, well, admittedly I’m not sure that’ll be the most fun part to actually read about, so I’ll try to break it up with some other posts.  Like, coming up in the next day or two, I plan to make a post on past Kickstarters for game creation systems…

Spread the love

Leave a Reply

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