Mythbusters: Wing Commander I Edition (September 18, 2023)

Bandit LOAF

Long Live the Confederation!
You've probably heard of the famous 'thank you for playing Wing Commander' story. It claims that a programmer on the original Wing Commander was stuck getting an error message when the game unloaded its memory during a quit. Pressed for time, instead of fixing the issue he simply hex edited the memory manager's error reporting to print 'thank you for playing Wing Commander' instead. A funny and relatable story! The anecdote has made the rounds on the internet for the past decade and has even started to make the phrase "thank you for playing Wing Commander" synonymous with a dirty-but-functional hack. The most common version looks like this, sourced from Reddit's /r/shittyprogramming:

Engineers immediately recognize this as a funny and relatable story; it's the exact sort of thing that anyone who has ever worked in software development can recognize immediately. A perfect example of the old aphorism that "if it is stupid but it works, it isn't stupid."1 Unfortunately, it has also in recent years become fodder for unhappy Star Citizen fans looking for reasons to complain about Chris Roberts' abilities. In many retellings, 'thank you for playing Wing Commander' is now supposedly an example of selling shoddy work instead of a funny, recognizable hack. (If the connection feels tenuous, the missing aspect is that unlike most other CEOs, Roberts continues to code on Star Citizen, an aspect of the project that makes it interesting to him.)

Wing Commander I fans, meanwhile, have been understandably cautious about the anecdote and particularly the included screenshot. For one thing, Wing Commander I's default install direction isn't c:/wc1 and the game doesn't actually print "Thank You for Playing Wing Commander!" when you quit. Is the story even real? We decided to look into the history of the story and the game itself and after some work we've conclusively determined that the answer is… kind of.

Our first task was to find the origin (no pun intended) of the quote and screenshot. Where did dozens of 'funny software hacks' articles around the internet find it in the first place? Was it even a real story or just a piece of mythology that had been handed down, perhaps not even really specific to Wing Commander I? Luckily, the original quote ended up being pretty easy to source: it was left as a comment on August 20, 2009 in response to a Gamasutra article called Dirty Coding Tricks by Brandon Sheffield (archive). Here is the original post, verbatim:

Back on Wing Commander 1 we were getting an exception from our EMM386 memory manager when we exited the game. We'd clear the screen and a single line would print out, something like "EMM386 Memory manager error. Blah blah blah." We had to ship ASAP. So I hex edited the error in the memory manager itself to read "Thank you for playing Wing Commander."

Gamasutra was a game development website popular among industry professionals. In 2021, the site was rebranded as Game Developer. The original article is still available at the new site but the comments appear to have been dropped in advance of the transition. The comment was, indeed, signed by Ken Demarest. Ken Demarest III was an ace programmer who started his game development career working for Origin Systems as a software engineer on the first Wing Commander. He would go on to be lead programmer on Ultima VII and would become the growing company's Director of Technology (at a time when that technology was becoming pretty exciting!). While the comment was left anonymously (in that it was not signed into a user's account) it's very unlikely anyone was impersonating a game programmer for the purpose of telling a funny story. Wing Commander writer Jeff George would later say that "other than Chris Roberts, who was the key man, Ken Demarest had more to do with the fact that the game came out than anyone else involved." So if anyone knows what was going on under the hood, it should be him! (Be sure to revisit Wing Commander I & II: The Ultimate Strategy Guide's making of section for a surprisingly thorough contemporary interview with Demarest).

Eagle-eyed readers will immediately notice two minor changes between the original version and the 2015 Reddit version (which itself was sourced from a LinkedIn share by a third party in 2012): the original does not have the screenshot and the wording of the quit message has been slightly edited apparently with the intent to make the ending punchier. Most importantly, the screenshot added after the fact seemed to claim that the game had shipped with this bug which is not stated in the original story. So the original story, which has a reasonable origin, might be true!

The next issue is the message itself. The seemingly daming fact is that Wing Commander I simply doesn't print "thank you for playing Wing Commander" when you quit. We tested this in DOSBox and on period hardware and we searched all of the game's binaries for that text, coming up with nothing. Hitting ALT-X simply returns you to the DOS prompt. There is one exception, though! If you quit by clicking on the airlock door in the Tiger's Claw's barracks…

… then the quit process is different: you're given a y/n prompt and when you drop to DOS it prints "You step out of the airlock and into…", a joke directly relating to this specific method of exit.

We quickly confirmed that this text DOES appear in the game's binary. Is it possible that this is where the crash happened and that the story, told 19 years after the fact, simply forgot (or for the purposes of a funnier punchline) changed the story? Supporting this idea in particular is Ken Demarest's other famous connection to that very screen: he's the person that implemented the water drop that drips into the bucket, long cited as the platonic ideal of Chris Roberts' famed drive for immersion. This felt like the most likely way to establish if the story was true: how was the game displaying this message?

To try and find an answer, we turned to an incomplete copy of Wing Commander I's source code, archived by Electronic Arts. These source files were used for the release build of Wing Commander I and the archive was eventually sent to another team for development of the FM Towns port. Some material has not survived including, sadly, the memory management routines. But there's enough there to know exactly where this message comes from:

This is from BARRACKS.C which sets the functionality of the barracks gameflow screen. Essentially the game unloads the memory and then prints the airlock message followed by a line break. Exactly what you see in action and not a case of hex editing a memory manager. The other method of quitting the game, found in COCKPIT.C, does not print a message.

While discussing this on Twitter, Darren Xczek offered another possibility: Ultima VII DOES drop to DOS with a "thank you for playing Ultima VII" message. Ken Demarest was the lead programmer on Ultima VII–in fact, it was the job he was initially hired for before he was assigned to help get Wing Commander out the door! Is it possible the story was true but it applied to a different game? Ultima VII did famously have memory management issues, so much so that the game's internal system was named the 'Voodoo Memory Manager'!

At this point, I decided there was only one way to solve this mystery: see if we could reach Ken Demarest and ask him. He very kindly responded to a Facebook request in about 45 seconds and made us feel like real idiots for not just asking him first:

In a way I would have loved to ship with that hack in there, but once we found the cause of the error message I couldn't in good conscience leave the hack in there. Besides which hand editing it added time to completing the build, which was inefficient.

And there it is! The best possible outcome: the story was true–it's something that was done during the game's development–but it was also fixed before the game actually shipped… so it's a clever engineering trick and explicitly NOT evidence of a shoddy product!

1 - Interestingly, the Internet frequently attributes this quote to a novel by Wing Commander novelist Mercedes Lackey; this is surely not the actual source but untangling that would take another article!

Original update published on September 18, 2023
I could have sworn that my version of WC had that message. Fascinating! Thanks for the investigation!