One more Ultima Underworld story

March 17th, 2011

I can’t believe I forgot this one.

One of the levels (5, I think?) was largely populated by ghouls, with standard flesh-eating names like Eyesnack and Kneenibble. Naturally you could talk to them instead of just fighting them. Jon Maiara (the same guy responsible for the Pac-Man homage) was writing the conversations for them, and included all sorts of things like the opportunity for you to make fun of Eyesnack’s name, to which he would respond by making fun of your name in return. You see the edge case, of course, right?

That’s right, part of our precious 640K was devoted to checking for whether the player’s name is also Eyesnack, in which case, in response to your mockery, the ghoul proclaims indignantly, “But your name same as mine!”

Maybe that will make you feel better about Judy falling into the lava.

Double pin

March 5th, 2011

It’s not every day you get to make a move like this. From a 3-minute ICC game:

2r1kb1R/5p2/1Bnp2p1/pp4P1/4n1q1/1N6/PPPQ4/1K2R3

It was very pleasing to be able to play 25.Qxd6.

Ultima Underworld bugs

February 21st, 2011

While I’m reminiscing about the old days…

As we (Blue Sky Productions, later Looking Glass Technologies / Studios) were developing Ultima Underworld in 1991-1992, largely in a basement room in an office building in Somerville’s Davis Square, we received bug reports both from our own people and the QA team at Origin Systems, who published the game. “Our own people” largely meant MIT friends of the core programming team (me, Doug Church, and Jon Maiara) who we roped into helping out.

Our lead tester was Tim Stellmach (now at Vicarious Visions), a math major. You could tell he was a math major because his bug reports would start with “Consider a door.”

Our producer from Origin was Warren Spector, already a pretty important guy in the industry but someone who has since received yet more accolades for working on, well, Ultima Underworld, not to mention other games such as System Shock (with us), Deus Ex, and Epic Mickey. He is a super down-to-earth guy and we wasted no time in making fun of him, which he took with impressive grace. I guess it was a tradition at Origin to insert characters based on Warren into their games, so we figured we had to as well. Luckily we already had a “spectre” type of monster so it took no work to name one of them Warren. We made sure that Warren was in town the day that Tim was reading through the daily bug report list and said “Bug: There is no reference in the game to Warren Spector”, to which the rest of us immediately piped up, “Fixed!” without further explanation, much to Warren’s chagrin.

We were working with a lot of pretty raw graphics technology, as you can imagine, and it created some unintended graphical results fairly often. The upside was that whenever we ran into some heinous graphics bug that resulted in crazy psychedelic effects, once we figured out what was causing it, after fixing it we kept the code that would make it happen and enabled it when you ate too many mushrooms.

Speaking of graphics… well, probably most of you are far too young to remember the Apple ][, but it had a seriously weird graphics mode, which had not only a crazy palette (black, white, green, blue, orange, and purple) but also placed additional restrictions on how you could use the colors near each other (see here if you really need to know the gory details). Paul Neurath, our CEO, never tired of telling stories of what a pain it was to work with that system when he had written his earlier game Space Rogue. So naturally we added code that would specifically look for a certain file we had planted on Paul’s computer, and if it found it, would switch to a green-blue-orange-purple palette for one frame every half hour or so. Unfortunately I honestly can’t remember whether Paul ever actually noticed it.

One part of one of the levels, designed by Jon, was a Pac-Man homage. You had to run around a maze, which I believe faithfully duplicated the first level of Pac-Man picking up “ore” while avoiding ghosts. How Origin let this through I’ll never know, but they did have one complaint: Jon had named the ore “unobtanium” (yes, the same joke that Avatar used 20 years later), and they insisted that that name was too silly. So we changed it to “zanium” in protest… and apparently they were perfectly fine with that.

The worst bug that made it into the shipping game was probably mine. One of the quests involved talking to a woman named Judy, who could be found hanging out next to a river of lava. It turned out that, given our emergent-gameplay physics-driven simulation philosophy, we never actually prohibited characters from walking into the lava (although of course their AI tried to avoid it). So it was possible (although thankfully rare) for Judy to wander into the lava and die, making your game unwinnable. If you have been enraged at me for the last 20 years, I apologize.

But the best bug report I remember came from Origin. We rendered the world in true 3D but most of the objects (monsters, objects you could pick up) were 2D sprites. There were a few actual 3D polygonal objects, though, such as boulders. When we added the 3D object capability, we needed something to test it out, and we hadn’t created any ourselves yet, so we used a red sports car from some friends who were developing a game with the Car & Driver license, which we plopped down in the middle of a cavern. Sure enough, you could walk all around it and it looked just like a red sports car.

Then the bug report came in, of course. “On the fifth level, at this particular location, there is a red sports car sitting on the floor.” OK, I guess we could have expected that. What we did not expect was the next sentence: “I should be able to enter it and drive around.”

The dangers of self-modifying code

February 20th, 2011

One of my coding stories recently showed up on reddit and spawned a giant thread. Having it brought up again reminded me of another fun bug from the early days, in this case 1991.

I had just graduated from college and joined Blue Sky Productions, soon to be renamed Looking Glass Technologies, where we were working on the PC game Ultima Underworld, a first-person 3D dungeon crawl. I needed a machine so I was given an 33 MHz 80486 PC. Everybody else was jealous because not only was it immediately the fastest PC in the office, it was also the only one with a floating point unit. The downside was that everybody wanted to run their tools requiring floating point on my machine.

Anyway, of course the first thing to do as soon as the machine showed up was to run the in-progress version of Underworld on it to see how zippy it would be—perhaps it could get all the way up to 15 frames a second! Unfortunately, the game completely failed on my machine. I can’t remember whether it just crashed, or everything on screen was just black, or what, but it just did not work at all.

After much hair-tearing, we figured out the problem. The texture mapper (in software, not hardware, of course), which had been written by an outside guy (Chris Green—I see he’s now at Valve) and handed to us, was using self-modifying code in an attempt to squeeze as much performance as possible out of the system. Where a normal program might have a loop that accesses a variable each time through the loop, our texture mapper’s loop would just refer to a constant value. Before entering the loop, it would do the variable lookup once, poke that value into its own code, replacing the constant, and then run the loop a bunch of times without having to waste time looking up the value again. Brilliant! Impossible to debug, but brilliant.

Unfortunately, the 486 had its own optimization—an instruction cache. So we were dutifully poking new values into program memory that had already been read and was never reread, which meant that all of the updates were completely ignored. Oops.

I see that the Wikipedia article on self-modifying code has a section on exactly this problem.

Carlos Ruiz Zafón: The Shadow of the Wind

February 19th, 2011

I feel like too many of my book posts lately have been of the form “Eh, didn’t really float my boat.” Well, in this case my watercraft was 100% buoyant. The Shadow of the Wind not only should have been my thing, it actually was my thing.

I guess it was a big hit in Spain, where it was originally published, and I can see why. It’s full of books and (metaphorical) ghosts and romance and melodrama in a way that is slightly over-the-top but always enjoyable. It’s set in post-WWII Barcelona, and I really enjoyed the evocation of the time and place. It has a fairly standard metaplot of Young Man Digs Into The Mysteries Of The Past While Getting Dragged Into A Modern-Day Plot And Also Falling In Love With Someone Who May Or May Not Be Good For Him, but it implements it superbly. The characters are kind of two-dimensional (which is to say, they don’t really have three dimensions, but at least they don’t have only one), but who cares. I found myself tearing through it, both wanting to know What Happens Next And What Is The Real Identity Of That Mysterious Guy but also wanting to see how the personal relationships played out. I would call it a guilty pleasure but it was too well written for that.

Zafón has written a few other novels, and I have a feeling I’ll be reading one of them during my next summer vacation.

Zoran Živković: Seven Touches of Music

February 12th, 2011

I have a list I keep in my head of things (books, musical artists, etc.) that I should love, based on the other things I like, but don’t do it for me. In some ways it’s more interesting than the opposite list, of things that you’d never think that you’d like but you love. The reason I mention it is that, as you have probably guessed, this book is on it.

Every mention I see of Živković makes me think I would adore his work, and it’s not like those descriptions are false. Seven Touches of Music is a group of vaguely related slightly fantastical minimalistic short stories, in which each protagonist fleetingly catches a glimpse into a weirder world (in each of these cases triggered by music), which then (in most of these stories) fades again, leaving an unsettling feeling. Sounds like just my thing! But somehow, as I read each one, it faded from my memory just as these glimpses of alternate reality or deeper connections underlying the world did. I don’t doubt that the fault lies in me; I have the feeling that there were some beautiful subtleties going on that flew under my radar. Perhaps I read it at the wrong time, but it somehow failed to get under my skin the way that I imagine it was meant to.

Cardiacs: “Odd Even”

November 6th, 2010

Six months ago I made some general comments about the musical vocabulary of Tim Smith (of Cardiacs). Here are some notes on “Odd Even”, a song that illustrates a lot of his standard tricks. The song is on YouTube here and my transcription is here (PDF file).

The form could not be simpler: three repetitions of verse (a 7-bar phrase repeated twice) and chorus (8 or 12 bars; in the second and third choruses the last 4 bars are repeated). The third verse is instrumental.

The introduction (which foreshadows the end of the verse phrase) is a straight-out “Smith cadence” (♭III–v–I in the key of E), which already renders it unclear whether we’re in the key of G major (starting on the tonic and repeatedly raising the tension) or E major (starting on the flat mediant and repeatedly resolving the tension). This ambiguity will persist throughout the song.

The start of the verse seems to resolve the question by claiming that we’re in G major, and could not refer more explicitly to the Lydian mode, with a C♯ over the G chord. Already this is a hint that we might be moving back to the sharp side soon. There’s an interesting clash between that C♯ of the melody and the C♮ of the C chord that arrives on the second bar. The harmony then moves through A and E back to G, apparently establishing that E is subordinate to G—but then immediately repeats the introductory Smith cadence twice, reestablishing the ambiguity.

The phrase rhythm of the first verse phrase is also quite interesting. From the melody alone it looks like a pretty straightforward [4+4]+4 beats, but the harmonic rhythm, as well as the way that the instruments enter during its first statement, implies 6+6.

The chorus starts by moving fairly strongly to the flat side of G, going all the way to E♭ before slowly relaxing back to G, and right through G all the way to Bm and E again. The feeling of resolution provided by G is lessened this time by it happening for only two beats on the second half of a bar, rather than lasting a whole measure as it did before. The melody here is really nice; a drone-like D is continually returned to on the bottom (it’s a common tone of all the scales passed through, including the E Mixolydian implied by the final destination of E) while the upper implied voice of the line descends from B♭to A to G, then returns up to B♮ and G♯ to both chromatically fill that third and also strongly establish the “surprising” E (not so surprising in reality since the G–Bm–E sequence has been repeating the whole song).

The chorus ends by following yet another path from G to E, this time by repeating the triple plagal cadence G–D–A–E and sitting on the final E for an additional bar. That relaxation of the harmonic tension certainly makes it seem like E was the final destination after all—but when the next verse starts up again, back in G, it feels like a return to the tonic rather than a jump away from it.

The instrumental verse suddenly triples the melodic speed, and it’s interesting to see such a relatively hyper solo in the middle of what is otherwise a fairly sedate song. I wouldn’t have thought of it when I first heard the song, but after listening to a lot of jazz in the last month, the solo has sort of a bebop feel to it, at least when you look at it on the page and imagine it being played by a saxophone rather than by a keyboard.

It looks complicated but it is largely doing the same things found elsewhere in this song or Smith’s work in general—emphasis on that Lydian C♯, liberal use of whole-tone scales, and near the end a gleeful insistence on B♭, a note dissonant against both G major and E major.

The song ends with a final chorus, repeating that G–D–A–E progression four times in a long exhalation and landing with relative finality on E. So maybe it was in E major all along? But I think the fight between the two potential tonics the whole time was a charade; the whole point is that both G and E are equally important, and to proclaim one of them superior to the other is to force one point of view on a song that is all about presenting two.

Bud Powell: “Cleopatra’s Dream”

October 11th, 2010

I’ve always liked the sound of jazz but have never been as interested in it as rock or classical. Recently my interest has flared up a bit, and I’ve been trying to make up for lost time by listening to more of it with active ears. The standard approved way to work on your analytical technique seems to be to make transcriptions of classical recorded solos, so I picked up the first random jazz CD that was at hand, Bud Powell’s The Scene Changes, and sat down to transcribe the first number, Cleopatra’s Dream. Unfortunately 1) it’s a very fast tune (quarter note = 240), 2) it’s in A flat minor (that’s seven flats), and 3) Bud Powell, like I suppose any good pianist, uses both hands. So maybe it was not the best song to transcribe first. Nonetheless I ended up with something that is at least moderately accurate, especially in the right hand, and it can be found here (PDF file).

I did learn a bit from this exercise about how Powell improvises, and it was good practice for my ears, so it was certainly a success on those fronts. If anyone has suggestions or corrections, especially actual jazz musicians who can tell me, for example, “this line you sketched out in the left hand is not what anyone would ever actually play, he must be doing this instead”, I’d love to hear them.

(By the way, I noted on Twitter that I hear this as being in Ab minor (7 flats), and not G# minor (5 sharps), which you’d think would be more “simple”, and I think I realized why. The leading tone is an important part of the scale, and the major dominant chord that contains it is an important chord; and it’s much easier to think about a V chord that’s an Eb major (Eb, G, Bb) than a D# major (D#, F##, A#). So I think I chose the right key after all.)

Steven Erikson: Deadhouse Gates

October 3rd, 2010

The second volume of the ten-book epic fantasy series The Malazan Book of the Fallen, which was begun with Gardens of the Moon, Deadhouse Gates is regarded by many fans (though not me) as the best of the bunch. It’s true for sure that you can see Erikson hit his stride here in a way that is new.

For one thing, the plot feels a lot better controlled. There are still a half-dozen independent threads going on, and in fact they don’t even all end up tying together in the way that they did in the first book, but perhaps it is that independence that lets Erikson take each one to a conclusion instead of trying to combine them all in the last chapter. This book also contains the famous Chain of Dogs sequence, which is pretty wrenching and gives the whole book an emotional weight that was less present before.

Once again, all the stuff going on can seem pretty random, most memorably when a ship of manages to go through a series of weird dimensions in quick succession, each crazier than the last. It is easy to regard this as Erikson just randomly chucking in every weird idea he can think of, but as I mentioned before, if something is introduced out of nowhere that seems to bear no relation to the plot, it is likely to be a call-forward to something in a future book. This can be a little frustrating but it certainly does contribute to the epic feel.

I would say that at this point the dimensions of the larger plot start to become clear, but that’s a lie—the most important plot thread in many ways doesn’t even really get hinted at until book 3. But you do start to get a sense of the scope of the thing. That scope will widen even more in the next book…

Andrew Crumey: Sputnik Caledonia

September 19th, 2010

I discovered Andrew Crumey a while ago through his awesome novel Pfitz, about which all I really remember now is that there are lots of neat fictional-worlds-within-worlds tricks. I also really liked his next, similar, novel, D’Alembert’s Principle, and his first, more conventional, novel, Music in a Foreign Language. Some part of the appeal additionally came from the fact that his books were often not published in the US (he’s Scottish), or published after great delay, so I’d have to order them from the UK, which made it more exciting, like I had stumbled on a private secret route to great fiction.

So I’ve kept buying his novels as they are published, but the last three just haven’t done the same thing for me. Maybe it’s me; Sputnik Caledonia in particular seems to have been received very well.

Crumey is still doing a lot of the same things I really like in fiction—nested stories, parallel worlds, weird unexplained correspondences between different parts of the story—but maybe I’ve read enough of his books by now that it seems more like a formula than new. There’s also a sensibility that doesn’t always mesh with mine; in Mr Mee a lot of intended humor derives from a senile old man not understanding anything of modern life, which I just rolled my eyes at, and a lot of this book reads like an adolescent fantasy—and the fact that after a while there are hints that it actually is an adolescent fantasy doesn’t really help.

There are still a bunch of ideas in here that I liked, and it was an interesting read with an affecting ending, but maybe it’s time to stop ordering his new books from the UK and go back and reread the ones that excited me originally and which I have forgotten.