Update: Find out more about the 50 Years of Text Games book and the revised final version of this article!
Super Star Trek
by Mike Mayfield and Bob Leedom
Released: Unpublished original (1971); STTR1 (published by HP 1973); SPACWR (EDU, 1973); Leedom version (1974); Super Star Trek (Creative Computing, 1975)
Language: BASIC
Platform: SDS Sigma 7Opening Text:
,------*------, ,------------- ‘--- ------’ ‘-------- --’ / / ,---‘ ’-------/ /--, ‘----------------’ THE USS ENTERPRISE --- NCC-1701 YOUR ORDERS ARE AS FOLLOWS: DESTROY THE 10 KLINGON WARSHIPS WHICH HAVE INVADED THE GALAXY BEFORE THEY CAN ATTACK FEDERATION HEADQUARTERS ON STARDATE 2025 THIS GIVES YOU 25 DAYS. THERE ARE 4 STARBASES IN THE GALAXY FOR RESUPPLYING YOUR SHIP
The final episode of Star Trek aired on June the 3rd, 1969, just as superfan Mike Mayfield was finishing his sophomore year of high school. It was called “Turnabout Intruder” and it was not a very good episode. Trek had been saved from cancellation once before through a devoted letter-writing campaign, but this time it had proved harder to rally the troops. The show’s third season had been on the whole less inspired, and it seemed now to be going out with a whimper. A rerun of The Mod Squad scored twice as many viewers that night. It would be more than a decade before any new live-action Trek would appear. In the meantime, the fans would have to keep the flame burning themselves.
Mayfield, like other tech-minded Trekkies, saw in the increasing power of minicomputers a way to keep the show’s spirit alive. Trek games with varying levels of complexity had appeared on mainframe systems in the late ’60s and early ’70s, copied, re-shared, and improved ad-hoc like most other early programs. Today it’s hard to piece together the genealogy of these dozens of early games, in part because attribution and even self-attribution were rare, but also because so many of them were entitled simply Star Trek. While it proved difficult to capture the big ideas of episodes like “The City on the Edge of Forever” in a game, easier to simulate were the tactics and strategy of ship-to-ship combat, as in season one fan-favorite “Balance of Terror” where Kirk plays a cat-and-mouse game with a Romulan commander. Trek also provided a ready-to-hand frame story for a game in a time when there was little storage space or inclination to create one from scratch. But all this was academic for Mayfield, quite literally: computers were still precious resources locked away in university labs, and the 16-year-old had no way to access one.
Not long after the TV series had ended, Mayfield saw a demonstration on the UC Irvine campus near his school of SpaceWar! (probably the other most influential early space combat game). SpaceWar! used a cutting-edge CRT monitor to draw tiny vector-graphic spaceships that players could maneuver around a mostly-empty screen, firing torpedoes at each other and trying to avoid the gravitational pull of a central star. It was fun, it was addictive, and it seemed like the future: most computing was still done via teletype printer, so a dynamically-updating screen was a revelation. Mayfield’s mind was duly blown by the experience, and he began to yearn desperately for computer access of his own. He knew connecting to a distant computer via teletypewriter was within the realm of possibility—other schools across the country had started to do it, just not his—but at first he could only daydream:
“A bunch of my other geek friends from high school and I spent a lot of hours brainstorming what we could do if we didn’t have a video terminal. Since I was the only one in the group that had any knowledge of computers (little as it was), we ended up coming up with a lot of unimplementable ideas. One idea that did stick was the idea of printing a galactic map and a star map to give you some idea what to shoot at.”
Eventually, Mayfield arranged for remote access to the Sigma 7 at UC Irvine by borrowing an enrolled student’s account (something which was not, strictly speaking, allowed). He slowly taught himself BASIC from a textbook, typing in lines one at a time on the teletypewriter. His account had no access to permanent storage space, so each time he worked on a program he’d have to output it on punch tape after finishing for the day, and carefully load it back in the next time he wanted to make any edits. Progress was slow. But by the end of the summer after his senior year in 1971, he’d managed to make himself a Trek game that struck a surprisingly mature balance between playability and complexity.
Originally bearing no title other than just STAR TREK, Mayfield’s game puts you in command of the Enterprise and tasks you with hunting down Klingons spread throughout the galaxy. The terrain is divided into an 8x8 grid of 64 quadrants, each of which in turn encloses a square of 64 sectors, resulting in a map with about four thousand possible positions. Each quadrant has a handful of stars, which serve as cover for Klingons and obstacles for navigation. Some quadrants have a starbase where the Enterprise can restock photon torpedoes and recover the energy expended to power her warp drive and shields. The goal is to find the Klingons and defeat them all within thirty stardates. In the map, a * marks a star and <*> is your ship.
[Note: all transcripts are from the 1974 Mayfield/Leedom version of the game discussed further below. Mayfield's original looks similar but with slightly different formatting and some terser messages. I have removed some horizontal whitespace to try to minimize word-wrapping.]
--------------------------------
<*> STARDATE 2004
CONDITION GREEN
* QUADRANT 1 , 4
SECTOR 1 , 4
* * PHOTON TORPEDOES 9
* TOTAL ENERGY 2602
* SHIELDS 300
* KLINGONS REMAINING 8
--------------------------------
COMMAND? LRS
LONG RANGE SCAN FOR QUADRANT 1 , 4
-------------------
: *** : *** : *** :
-------------------
: 004 : 006 : 007 :
-------------------
: 005 : 001 : 004 :
-------------------
COMMAND? NAV
COURSE (0-9)? 8.5
WARP FACTOR (0-8)? 2
DAMAGE CONTROL REPORT: SHORT RANGE SENSORS DAMAGED
NOW ENTERING DENEB II QUADRANT . . .
COMBAT AREA CONDITION RED
*** SHORT RANGE SENSORS ARE OUT ***
COMMAND? PHA
PHASERS LOCKED ON TARGET; ENERGY AVAILABLE = 2276 UNITS
NUMBER OF UNITS TO FIRE? 500
264 UNIT HIT ON KLINGON AT SECTOR 1 , 8
(SENSORS SHOW 23.480438 UNITS REMAINING)
17 UNIT HIT ON ENTERPRISE FROM SECTOR 1 , 8
<SHIELDS DOWN TO 283 UNITS>
COMMAND? PHA
PHASERS LOCKED ON TARGET; ENERGY AVAILABLE = 1776 UNITS
NUMBER OF UNITS TO FIRE? 200
145 UNIT HIT ON KLINGON AT SECTOR 1 , 8
*** KLINGON DESTROYED ***
COMMAND?
The map, printed out along with all other text on the user’s teletype, was an early example of what would later be called ASCII graphics: positioning characters of text to create primitive visuals. Years later, the genre of roguelikes would turn this into a well-recognized aesthetic. But more fundamentally, the design of Mayfield’s game provided more emergence and room for strategy than most contemporary titles. Eight different commands let you control the engines, shields, phasers, photon torpedoes, short- and long-range scanners, damage control, and a library computer. Most commands take additional parameters: how much energy to transfer to shields, which computer commands to access, or what speed and direction to feed into the warp drive (using a numbered cardinal rose printed in the instructions). Fractional values are allowed, letting players fine-tune movement in or between quadrants: with enough precision, you can warp halfway across the galaxy and arrive in the perfect position for an attack. The combinatorial space of commands feels refreshingly larger than in earlier games like ROCKET (1972) or Hunt the Wumpus (1973), and the grid of terrain which must be explored and scanned to hunt down the enemy creates a sense of danger and discovery. Ship systems can be damaged through taking enemy fire or overusing the warp engines, and each kind of damage offers different trade-offs for deciding whether to continue to hunt baddies or lose time finding a starbase for repairs.
Most plans in the game require a sequence of steps to execute, enhancing the illusion of commanding a complex starship and not just an asterisk. Finding the scattered Klingons, for instance, means deploying your library computer and both types of scanners. Long-range scans show the quadrants surrounding your present location with a three-digit code which you must learn to decipher: 114 would signify a quadrant with one Klingon, one starbase, and four stars. When you warp to a quadrant with an enemy, after diverting some energy to your shields you might need to decide between using phasers or torpedoes, each with different strategic considerations. You can spend an amount of energy of your choosing on a phaser shot, which can hit multiple enemies regardless of positioning: but the damage varies based on distance, randomness, and the strength of the enemy’s shields. Torpedoes, however, always destroy a single enemy, but you need line of sight to use them, which means you might need to maneuver around a star and open yourself up to counterattacks in the process. You must also calculate the proper trajectory to fire a torpedo, or learn how to use the library computer to calculate it for you and then manually input its suggested parameters. Playing Mayfield’s Trek required paying attention. It suggested a level of seriousness and attention to detail that had rarely been seen in earlier computer games.
The game’s code has to use a number of clever hacks to get around the severe limitations of early BASIC. Its 4,096 grid locations would have surpassed the memory limits of many systems of the time, so rather than storing the randomly generated contents of each galactic quadrant in a 2D array, this data is lossily “compressed” into the same three-digit numeric code revealed by the long-range scanners. When a sector is entered, the appropriate number of stars and Klingons are distributed onto the sector map at random. This sleight-of-hand works in large part because you rarely have cause to re-enter the same quadrant twice. If you do, it’s usually because you had to flee from an enemy, and it makes sense for them to be in a different position once you return. Most players would be unlikely to notice that the stars had moved, too.
At the same time, the code is filled with hints betraying its “learn as you go” origins, with various features of HP2000C BASIC used once or twice as if to try them out, then abandoned. The program defines exactly one function (a relatively new concept in BASIC at the time) and only uses it twice, instead relying on traditional GOSUB/RETURN blocks for the bulk of its reusable code. An 8x8 array stores the 3-digit quadrant signature, but the current quadrant’s contents are tracked with a much hackier method possibly written earlier. It works by rendering the current quadrant’s map image into three strings Q$, R$, and S$: because of a 72-character limit for string variables, three of them are needed to store the contents of a grid containing 64 areas each three characters wide. Checking positions or updating the map happens through laboriously calculating which set of three characters in which string correspond to the X,Y coordinates in question. Here’s the code (circa 1973) to update the sector at Z1, Z2 with the map symbol stored in A$, picking through each of those partial map arrays Q$, R$, and S$ to find the one with the 3-character block it’s looking for:
5520 S8=Z1*24+Z2*3-26
5530 IF S8>72 THEN 5560
5540 Q$[S8,S8+2]=A$
5550 GOTO 5600
5560 IF S8>144 THEN 5590
5570 R$[S8-72,S8-70]=A$
5580 GOTO 5600
5590 S$[S8-144,S8-142]=A$
5600 RETURN
The code is representative of the challenges of writing complex programs in early ‘70s BASIC, with variable names limited to a single letter and optional number, no distinction between global and local variables, and no way to give code blocks meaningful names. While BASIC was a big step up from earlier languages, working out what an unfamiliar program did was often still a difficult chore. And yet this was part of the fun for early hackers, who loved to sit down with a listing for an interesting program and figure out, line by line, how it worked.
As Mayfield’s Trek passed through various hands during the early 1970s, it was updated to new versions of BASIC or enhanced with extra features. The most well-known revision was by Bob Leedom, a professional coder at Westinghouse working on their Data General Nova line of minicomputers. Leedom worked on and off throughout 1974 on an updated Trek that left most of Mayfield’s core systems and gameplay intact, but added a few nice touches that gave the game more polish and dynamism. His version replaced the original’s numeric commands with three-letter codes (like LRS for long-range scan, or NAV to engage the engines) reminiscent of the cryptic buttons from the onboard computer system the Apollo astronauts had used. He added better instructions and punched up the in-game messages: Mayfield’s text for a torpedo intersecting a star—“YOU CAN’T DESTROY STARS SILLY”—was replaced with the somewhat more mature and immersive “STAR AT 7,3 ABSORBED TORPEDO ENERGY.” Blowing up a starbase in the original simply removes it from the map; in Leedom’s version it results in Starfleet considering a court-martial. Memorably, many status reports and error messages were rewritten as if the show’s famous bridge crew were relaying them. Trying to warp off the edge of the map in Leedom’s version results in:
LT. UHURA REPORTS MESSAGE FROM STARFLEET COMMAND:
'PERMISSION TO ATTEMPT CROSSING OF GALACTIC PERIMETER
IS HEREBY *DENIED*. SHUT DOWN YOUR ENGINES.'
CHIEF ENGINEER SCOTT REPORTS 'WARP ENGINES SHUT DOWN
AT SECTOR 8,2 OF QUADRANT 7,8.'
Leedom also gave the game’s numbered quadrants evocative names like RIGEL IV, gave the library computer additional helpful functions, and made Klingons move to a random position after being fired on (rather than waiting around like sitting ducks for you to line up a torpedo shot). These tweaks went a long way to increasing the fun factor of Mayfield’s original, while preserving its successful core gameplay.
DAMAGE CONTROL REPORT: PHOTON TUBES REPAIR COMPLETED.
NOW ENTERING POLLUX II QUADRANT . . .
COMBAT AREA CONDITION RED
SHIELDS DANGEROUSLY LOW
--------------------------------
* +K+ * STARDATE 3115
CONDITION *RED*
* QUADRANT 8 , 2
* <*> SECTOR 4 , 3
PHOTON TORPEDOES 4
TOTAL ENERGY 1866
* SHIELDS 0
* KLINGONS REMAINING 4
--------------------------------
COMMAND? SHE
ENERGY AVAILABLE = 1866 NUMBER OF UNITS TO SHIELDS? 500
DEFLECTOR CONTROL ROOM REPORT:
'SHIELDS NOW AT 500 UNITS PER YOUR COMMAND.'
COMMAND? COM
COMPUTER ACTIVE AND AWAITING COMMAND? 2
FROM ENTERPRISE TO KLINGON BATTLE CRUSER
DIRECTION = 2.6666665
DISTANCE = 3.1622777
COMMAND? TOR
PHOTON TORPEDO COURSE (1-9)? 2.6
TORPEDO TRACK:
3 , 3
2 , 4
1 , 4
*** KLINGON DESTROYED ***
COMMAND?
Leedom’s improved program was published by David H. Ahl in “Creative Computing” magazine under the name Super Star Trek to differentiate it from earlier versions, and later appeared in the million-selling book BASIC Computer Games, cementing its place as the best-known Trek game of the decade. Countless other spin-offs and improvements continued to proliferate, rarely crediting the original authors. A two-player version called WAR evolved into the multi-player DECWAR and later the popular MegaWars strategy game series on CompuServe. A version called Apple Trek came out for the Apple II; Radio Shack released one called Space Trek for the Tandy. A more involved enhancement that added 3D combat against a moving starfield appeared for the Atari in 1979’s Star Raiders. Widely recognized as one of the platform’s breakout titles, it would directly inspire later games like Elite and Wing Commander that defined space combat sims for a generation. Paramount’s own officially licensed Trek games, once it got around to releasing some, would never have a remotely equivalent impact.
Super Star Trek was not the most literary nor the most complex Trek game of the decade. A 1973 version by William K. Char, for instance, featured extensive dialogue from the bridge crew and dozens of commands to do things like jettison the warp core or try obscure strategies from the original show like Kirk’s Corbomite Maneuver. There were plenty of other Treks floating around at all levels of complexity, many of which have since been lost to bit rot or neglect. But Mayfield and Leedom’s program settled into its role as the standard in part by occupying a useful middle ground: it was complex enough to be interesting, but short enough to be printed in a magazine or book, in an era when that was still the best way to widely disseminate software. As the longest program in BASIC Computer Games (at about 500 lines of code without the instructions), it required a smaller font than other listings, bordering on illegibility. But it fit. Had it been much longer, it might have been deemed too difficult to include, and never reached a wider audience.
It would be neither the first nor last time that technical limitations restricted the upper bounds of a text game’s complexity, but Super Star Trek provided one of the final examples of a case where those limits—page counts and print size—would have been understandable to a creator from an earlier century. Games were soon to boldly go where no book printer had gone before.
Next week: how a rowdy band of dungeon crawlers took over a groundbreaking computer network that was supposed to be used purely for education.
You can play a 1980 Commodore 64 port of Super Star Trek online; it has some major differences from the original, like sounds and color, but is the closest version I can find playable online. You might instead try running the BASIC source code yourself in Vintage BASIC. A detailed history of the game’s evolution by Maury Markowitz is accessible thanks to the Internet Archive. I also did a much messier source code dive last year if you’re into that sort of thing.
This is a truly remarkable blog, Aaron, and I'm enjoying every word of it! What I liked about your "Super Star Trek" entry is that you actually linked the game mechanics to specific episodes rather than simply stating that it was based on that TV series ("you know, the one everyone knows and loves...") the way it is usually done. It's quite interesting to note that most of the episodes wouldn't translate to video games that easily, and I'd never thought about it that way.
After a previous mention, I downloaded the listing for Super Star Trek and started to identify and rename variables. It isn't easy! That old code is really messy and obscure. The notes above will be a big help.
My eventual goal is to rewrite the game in Python, as a coding exercise. As I think I mentioned in another post, I Python-ized "DEEP SPACE," a game that appeared in Creative Computing in the mid 70s.