Tech Life Because I learned how to write it

Hacking on Mtrek

Mtrek is a real-time multiplayer space combat game loosely set in the Star Trek Universe. Sounds pretty sweet, right? Check out a screen shot.

mtrek

OoooOooh yeaaaaaaaah.

Designed and written by Tim Wisseman and Chuck L. Peterson in the late 80s at University of California, Santa Cruz, Mtrek is completely text-based. To understand where an enemy ship was, you had to visualize the direction via the onscreen data. If this wasn’t enough mental load, it was absolutely required to develop a set of macros on top of the game’s byzantine keyboard commands in order to master a particular ship. Furthermore, if you weren’t intimately familiar with the performance characteristics of your particular ship, you’d get quickly clobbered.

Mtrek was brutally unforgiving to new players. It was a pain in the ass to master, and constantly playing Mtrek was the primary reason I almost didn’t make it through my freshman year at UCSC, but that is not why it’s important to me.

The Mtrek Appeal

Mtrek’s painful learning curve was part of its appeal for me. It was a badge of honor to be able to sit at a Unix terminal, stare at a bunch of numbers, and crush your enemies. Mtrek was also a tantalizing preview of the connected nature of the the Internet. Remember, this was the late 80s and we were years away from the arrival of the consumable Internet afforded us by web browsers. Most important to me, Mtrek arrived when I was early in my computer science career, so it wasn’t just a way to avoid studying; it was a machine I desperately wanted to understand.

After months of playing, I learned that one of the the game’s creators, Chuck L. Peterson (“clp”) was a frequent player. After one particularly successful evening with my Romulan Bird of Prey, I mailed clp and asked if there was anything, however small, I could do to help with the game. Without as much a signal question to vet my qualifications, he gave me a project.

In Mtrek, there are a handful of bots that perform various utility and housekeeping tasks within the game. One of these bots the THX-1138 ran around the quadrants, and he wanted to alter its behavior. He sent me the source, gave me the barest of explanations of the code, and sent me on my way.

Let’s talk briefly about my programming qualifications at the time. My experience had recently peaked at an elegant snippet of Pascal that did an ok job of counting words from a file. The THX bot was written in C and it ran against a real-time game engine which was a programming construct far beyond my current understanding. I was terrified, so I hacked.

Hack Spectrum

MIT defines a hack thusly:

The word hack at MIT usually refers to a clever, benign, and “ethical” prank or practical joke, which is both challenging for the perpetrators and amusing to the MIT community (and sometimes even the rest of the world!) Note that this has nothing to do with computer (or phone) hacking, which we call “cracking”.

This was not the hacking I was doing late on a Thursday night while I avoided studying for my History of Consciousness final. My version of hacking at the time was, “Oh shit, how am I going to write this code in a language I don’t know against a codebase I don’t understand quickly enough that this guy who I respect doesn’t think I’m an idiot?”

The experience involved a set of tasks that I’ve become intimately familiar with over the years. To solve this particular problem, I had to figure out how to comprehend someone’s mostly undocumented code via a series of investigative experiments that started small (“Does it compile?”) and grew larger (“What happens when I change this function?) as I gained confidence.

It was a technical mystery and my job was to unpack and understand the mystery in whatever way I could in a pre-Google world. I searched newsgroups, I read man pages, and when I was stuck and felt I had a credibly hard question, I sent clp a well-researched email to which he’d quickly and briefly respond with delicious unblocking clarity.

Two weeks later, I still didn’t know C, and had only the barest understanding of how the Mtrek game worked, but the THX bot was acting how clp had expected. I shipped. It was a hack, it was an inelegant but effective solution to a computing problem and I had performed it.

An Unknown Someone

I’m not sure why I started thinking about Mtrek earlier this week. I think I was reflecting on the spartan interface. I searched for the game’s name and discovered the original game was no longer online, but a Java equivalent had been written and was alive and kicking. Sadly, I also discovered that clp had passed away in 2012.

I never met the guy, but as I wandered the Mtrek website reminiscing, I discovered he took the time to acknowledge my small, inept addition to the Mtrek universe. But far more importantly, he took a chance on an unknown someone he didn’t know nor would ever meet.

He doesn’t know the impact of a small decision he made many years ago, or that the result of that decision allowed me to not only produce the first piece code that I felt was mine not because I wrote it, but because I learned how to write it. The experience of writing this snippet of forgotten code was my first glimpse into the essential lessons of learning. The end result of clp’s small decision gave me timely and essential confidence to become a software engineer.

Thank you, clp.