Update: Find out more about the 50 Years of Text Games book and the revised final version of this article!
The Hobbit
by Veronika Megler and Philip Mitchell
Released: late 1982 (UK, Melbourne House); 1985 (US, Addison-Wesley)
Language: Z80 Assembler
Platform: ZX SpectrumOpening Text:
You are in a comfortable tunnel like hall To the east there is the round green door You see : the wooden chest. Gandalf. Gandalf is carrying a curious map. Thorin. Gandalf gives the curious map to you. Thorin waits.
Spoiler note: this article discusses in depth the game’s puzzle of escaping from the goblin dungeon.
In Australia the academic year starts in January, so it was just a few weeks into 1981 when a computer science student named Veronika Megler returned to the University of Melbourne for her senior year. On the hunt for a new part-time job to pay the bills, she noticed a terse note pinned to the bulletin board outside the computer center: someone needed students for some part-time programming work. The pay was ten dollars an hour. When Megler dialed the phone number on the ad, it turned out the man who posted it had started an Australian software company to make computer games, of all things, for the burgeoning UK market. The position he hoped to fill, he explained eagerly, was straightforward. He wanted to find someone to “write the best adventure game ever. Period.”
Megler had been hacking hardware and software for years, ever since giving up first-year plans to become an actuary: “I discovered I was bad at statistics and good at computers.” Her old job had been managing the campus mainframe, and her few spare hours outside work and school were often spent on hobby projects like writing control programs for a model railroad (typing them in on a hexadecimal keypad, in assembler) or building her own computer from kits in magazines. “I would go to the electronics parts store with my list of chips, resistors, capacitors and diodes,” she later recalled. “In the store they’d say, ‘tell your boyfriend we don’t have these’—it was not even considered possible that I might be the person purchasing them.” Sexist attitudes were “alive and kicking” on campus; in “self-defense,” Megler teamed up with one of the few other women in the program, a friend named Kerryn, to do group projects. The pair were sometimes joined by a guy named Philip Mitchell and a buddy of his “who were amongst the few men willing to partner with us.” Megler didn’t often need the help. In her interview with the Australian game company, Melbourne House, she so impressed the owner that he hired her on the spot. She quickly recruited her three group project friends, too.
But the four had little experience with computer games. The company’s founder was familiar with the microcomputer titles from Adventure International like Pirate Adventure, and hoped to improve on them with new generations of more capable machines. But the only earlier text game Megler knew was the original Adventure, which she’d played “obsessively for some time, mapping out the ‘maze of twisty little passages,’” until she beat it: “At that point it instantly lost interest for me, and I don’t believe I ever played it again.” Thinking back on Adventure with the prospect of designing her own game now at hand, she realized the root of her boredom was its static, unchanging structure: “It played the same way every time. Each Non-Player Character (NPC) was tied to a single location, and always did the same thing.” She decided her game would be different.
You go southeast. You are in Rivendell Visible exits are: east west You see : Elrond. Thorin enters. Elrond says " Hello ". > SAY TO ELROND "HELLO" You talk to Elrond. Thorin says " Hurry up ". Gandalf enters. Elrond gives some lunch to you. > GIVE LUNCH TO THORIN You give some lunch to Thorin. Thorin says " Thank you ". Gandalf takes the curious map. > GET MAP GANDALF IS CARRYING THE MAP. > SAY TO GANDALF "DROP MAP" Gandalf says " No ". Gandalf says " What's this ? ". Thorin waits. > SAY TO GANDALF "GIVE MAP TO ELROND" You talk to Gandalf. Gandalf gives the map to Elrond. Elrond says " What do you expect me to do with this ? ". Thorin waits. > SAY TO ELROND "READ MAP" You talk to Elrond. Elrond examines the curious map. Elrond says " Go east from the misty mountain to get to a narrow place ". Thorin sits down and starts singing about gold.
Since none of the team felt qualified to write an original story, they decided to base it on an existing property. Melbourne House had been a book publisher before getting into games, and its owner had years of contacts and experience licensing Australian rights to US and UK titles. The company worked out an arrangement with the Tolkien estate for a book-to-videogame adaptation, probably the first such deal ever made.
Megler’s game took a unique approach unlike nearly any previous text adventure. She designed her NPCs not as static objects little different from props or treasures, but “animals” that could move across the map and take their own actions: they would even act in real-time if the player didn’t type anything at the keyboard for a while. (Though she didn’t know it, she was taking a parallel track to Richard Bartle’s real-time MUD and its “mobiles” with “instincts.”) Megler’s characters “just ‘played’ the game themselves according to their character profile,” she later wrote:
I conceived of an NPC’s character as being a set of actions that the NPC might perform, a sequence in which they generally performed them and a frequency of repetition. The individual actions were simple and were generally the same actions that a player could do (run in a given direction, attack another character, and so on); [but] these routines could be overridden for a specific character. ...The apparent complexity of the character comes from the length and flexibility of its action sequence; the character “emerges” as a result. For example, Gandalf’s short attention span and kleptomania were represented by a sequence like: “[go] . [Pick up] [Say, ‘what’s this?’]. [Go] . [Put down] .”
“I went through the book [of The Hobbit],” she wrote, and “tried to identify common sequences of behavior that I could represent through a sequence of actions that would capture the ‘texture’ of that character.” A troll might simply move about at random and try to kill anything it saw, while Thorin had a penchant for complaining, following Bilbo’s lead, and singing about gold. Combined with a heavy use of randomness for both action results and map layout, the result was a simulated world at turns frustrating and fascinating: no two games would be exactly alike. In one, Gandalf might have wandered off and gotten killed by a warg; in another Elrond’s secret directions might change, or he might refuse to give them at all; a carefully made map of the goblin dungeons on one playthrough would be altered by the next; and the sword you were counting on for defense might have shattered because you used it to break down a locked door.
This last kind of outcome was enabled by Megler’s choice to make even the static objects in the game more dynamic. Each had properties like weight, size, and fragility, and rather than define puzzle solutions as particular commands (such as KILL DRAGON) the game often merely looked for a state (such as the dragon being dead) which might have come about in any number of ways. It wouldn’t matter whether you convinced Bard to shoot the dragon with an arrow, bulked up on elf food and clobbered him to death yourself, or even if he blundered into another enemy of his own volition, fought it, and was defeated: if the dragon was dead, the puzzle was solved.
Working with other characters—who could take actions that Bilbo the hobbit could not—was also a key part of gameplay. A good example comes when Bilbo is imprisoned in the goblin tunnels beneath the Misty Mountains, and discovers (or waits around until) another companion has been captured too:
The nasty goblin captures you. You are in the goblins dungeon To the north there is the goblins door To the west there is the window You see : some sand. Gandalf. Gandalf is carrying the large key.
Bilbo is too short to reach the window, but the wizard is not.
> SAY TO GANDALF "OPEN WINDOW" You talk to Gandalf. Gandalf opens the window. > SAY TO GANDALF "PICK ME UP" You talk to Gandalf. Gandalf carries you. > SAY TO GANDALF "GO THROUGH WINDOW" You talk to Gandalf. Gandalf goes through the window. You are in the dark winding passage
But another solution, if you’ve mapped the tunnels, is to give your companion a sequence of orders to escape and then come back to set you free: SAY TO GANDALF “OPEN WINDOW, GO WEST, GO SOUTHWEST, OPEN DOOR”. There’s three possible outcomes to this strategy, one walkthrough notes: either the door will open with your companion waiting outside; they’ll end up back in the dungeon with you because they were recaptured along the way; or you never see them again because they got killed trying to carry out your plan, leaving you alone in the lurch.
Unlike most contemporary text games written in higher-level languages like BASIC, Megler wrote The Hobbit directly in assembler. This meant the game’s complex code could run at more than a snail’s pace, but it also had serious drawbacks: debugging it was extraordinarily difficult. Assembler code moves individual numbers in and out of memory registers, making high-level behavior like Megler’s proto-AI harder to visualize and follow:
L6E11 CP #08 JR NZ,L6E22 BIT 7,B JR NZ,L6DF5 LD A,#08 CALL L7589 INC B DEC HL JR L6DF5
Modern debugging conveniences did not yet exist in 1981 for Z80 Assembler. “The Basic programmer’s technique of inserting ‘print’ statements to find out what is happening is not available,” Megler remembered grimly. “We had characters interacting with each other in distant parts of the game, and only actions in the current location were printed on the game player’s console.” A crash might have been caused by some NPC action halfway across the map, which could only be diagnosed, if at all, by poring through core memory dumps. Even simple needs were hard to meet: the game’s target platform had no reliable random number generator, not even a system clock, so Philip Mitchell spent endless hours experimenting with pseudo-randomness that could lend the game the unpredictability Megler wanted. Even when everything was working as designed, the game’s emergent behavior often led to outcomes that seemed like bugs, such as a rampant baddie killing all the NPCs in the game before the player could even meet them.
But Megler loved the game’s unpredictability. “I didn’t make any attempt to stop that,” she said of unexpected NPC deaths, “because I thought it was cool.” Unlike Adventure, you never knew quite what would happen when you booted up her game. It was exactly the kind of nondeterministic serendipity she had hoped to create:
I was really aiming for something like life, where the outcome is the result of many independent occurrences and decisions by many people, and sometimes things just don’t work out. ...I actively wanted the unpredictability.
While Megler worked on the game engine and scenario, her old lab partner Philip Mitchell was tasked with building a next-generation parser which Melbourne House would eventually brand as “Inglish.” The goal was to improve on the two-word parsers in most microcomputer games: Zork had only just come on the US market and hadn’t made much of an impression outside the country. Mitchell coded an impressive parser capable of handling commands like TAKE THE LAMP AND THE ROPE OUT OF THE BARREL. It even understood certain adverbs, so it was possible to VICIOUSLY ATTACK THE TROLL WITH THE SWORD. In the end, perhaps because Inglish and the simulation system were designed independently, The Hobbit doesn’t make much use of its parser’s extended capabilities: it’s a bit hazy even today, for instance, whether it actually paid any attention at all to those adverbs. But the marketing hype around the new parser made a stronger case that the game was breaking new ground, a serious attempt to raise the bar for what microcomputer text adventures might be capable of.
The bar was also lifted by the game’s graphics, made possible by the release of the ZX Spectrum home computer in Britain just in time for The Hobbit’s launch (the team had done development on a TRS-80 clone). The Spectrum was the first color computer in Sinclair’s line of entry-level machines: a model that could play the new Melbourne House game sold for just £175, far cheaper than many competitors’ systems. It rapidly became the bestselling computer in the United Kingdom despite its rubbery keyboard, flimsy plastic case, and limited capabilities. The team had to fit not only the game engine, data, and all its text, but also color illustrations for half of its 50 locations into a 48K memory footprint. Since the whole game had to be loaded into memory from a cassette tape, there was no way to access extra data at runtime, as a disk-based system could do: everything had to fit into those 48,000 bytes of RAM. Artist Kent Rees was brought on to draw simple line-art pictures that would be sketched out and flood-filled one instruction at a time on the user’s screen, far more efficient than storing images as pixel data. Rendering pictures this way could be painfully slow, but was made bearable at all by Megler’s optimized assembler code.
Working part-time through the 1981 school year (out of the large and mostly empty Melbourne House offices, optimistically sized for expansion) Megler and Mitchell inched The Hobbit toward completion between classes and other responsibilities. When Megler graduated at the end of the year, it fell to Mitchell to see the project through to its release in late 1982. It proved to be a landmark event in early British computing, leaving an indelible impression on players and reviewers who found it sometimes compelling, and sometimes maddeningly frustrating. Megler’s “animals” were indeed unpredictable, but often in buggy, uninteresting, or ridiculous ways. “Gandalf the wizard sadly lacks much of the wisdom of the character in the book,” wrote one commenter (rather more kindly than others had phrased a similar sentiment); another suggests that if you find the wizard’s odd behavior of stealing objects and wandering off with them bothersome, “you can have him enter the cave, close it on him, and lock him in.” The game’s assembly code and emergent behaviors proved a nightmare to debug: the manual even claimed that “due to the immense size and complexity of this game it is impossible to guarantee that it will ever be completely error-free.” Some bugs became famous exploits: Bilbo could pick up Elrond and carry him around, which many walkthroughs advised doing to procure a continuous supply of elven lunches. Many players despairingly noted the tendency of Bard the Bowman, when led to the dragon Smaug and ordered to slay him, to reply “No”—just before getting roasted to a crisp.
But the game’s quirky, unexpected, unpredictable behavior is often memorable, capturing the same emergent charm of much later games like Dwarf Fortress or the Versu stories. You’re playing through the book of The Hobbit, one retrospective noted, “but you’re not. It’s freedom to break the strait-jacket of the book and play a new adventure, a new story that is filled with the same familiar locations and characters [that’s] remembered by the players.” Today one can still find collections of anecdotes recalling the many strange adventures players had in Megler’s Middle-Earth:
In one game I played, Gandalf had an odd habit of picking up dead bodies and walking around with them. ...[In another, the goblins] captured the wood elf and when I was thrown into the goblins’ dungeon, [the elf immediately] threw me into the Elvenking’s dungeon. ...I once managed to kill Smaug with Gollum’s corpse.
“To say that the game’s reach exceeds its grasp hardly begins to state the case,” writes games historian Jimmy Maher: “the thing the game is reaching for is somewhere in orbit... But still, The Hobbit plays like no adventure before it. ...It’s a staggeringly ambitious, visionary thing to be attempting.” Despite its quirks or because of them, the game would become a massive bestseller, even priced at three times the typical £5 for a Spectrum adventure. It was ported to nearly every other platform that could run it, and is often credited for helping to jump-start the British home computing market. A US launch in 1985 found equally widespread success, part of a wave of other book-to-game adaptations inspired by its UK success story, including Infocom’s The Hitchhiker’s Guide to the Galaxy and properties by authors from Stephen King to Robert Pinsky. The Hobbit itself would eventually become, by some estimations, the best-selling text adventure of all time.
Megler for years was little aware of the game’s success. After graduating, Melbourne House offered her a full-time position, but she was sick of assembler debugging and turned it down: “I have a very low tolerance for doing the same thing over and over again.” She accepted an entry-level job at IBM, who “made it very clear that having written a game was not regarded as any kind of relevant work experience,” and would go on to a long and successful career as a computer professional—but never again worked in games. It wasn’t until the 2000s that she learned the extent of The Hobbit’s popularity, and its impact on a generation of players around the world: players who had first learned English to solve it, or had their imaginations fired for their own computer careers by the magic inherent in the game’s simulated possibilities.
“I’m a divergent thinker,” Megler has reflected. Looking back at her game in 2016, she wrote that she was “struck again by the power a few simple ideas can have, especially when combined with each other. It’s my favorite form of innovation.”
Next week: a young science fiction writer crosses paths with the designer of Zork, sparking a surprisingly experimental game where the player experiences reality from six unique perspectives.
Bonus feature: Check out Kate Willaert’s new Youtube series Video Dames, an ongoing deep dive into the history of playable female protagonists in gaming, and support Kate’s great work on Patreon.
You can play The Hobbit on a ZX Spectrum emulator, read up on its source code and data format, peruse the instruction manual for the BBC Micro release, or visit Veronika Megler’s website. Major sources included Megler’s 2016 retrospective “There and Back Again: A Case History of Writing The Hobbit” (which quotes unattributed inline are taken from), the period companion book “A Guide to Playing The Hobbit” by David Elkan and a more modern walkthrough by Jared Davis, and this extensive article from Retro Gamer magazine.
I was an owner of the ZX Spectrum, which due it's simplicity was the first choice of microcomputer for smuggling behind the Iron Curtain. But my limited knowledge of english that time when playing The Hobbit and lack of access to book itself /published only once in soviet sattelite country with limited impression - Lord of the Rings was blacklisted by censorship in soviet sattelite countries at all/ made a very different game target - my objective was to visit as many locations as possible with a limited english knowledge, far away from finishing the game up to the end. And of course I had no idea who they were in fact - Gandalf, or other personalities in the game, because the only contact with Tolkien imaginary work was through this game, or illegal copy of the game, in coutry where they were not selling any software in shops, nor Tolkien books in bookstores. :D
I got to know Veronika a little bit when she was working through her PhD at my school a few years back. An absolutely delightful person: smart and creative and energetic. I had no idea she'd written that game entirely in Z80 assembly: that's pretty amazing. Thanks for a great piece!