Spacewar! is a space combat video game developed in 1962 by Steve Russell in collaboration with Martin Graetz, Wayne Wiitanen, Bob Saunders, Steve Piner, and others. It was written for the newly installed DEC PDP-1 minicomputer at the Massachusetts Institute of Technology. It was later expanded by other students and employees of universities in the area, including by Dan Edwards and Peter Samson. It also spread to many of the few dozen installations of PDP-1s, making it the first video game to be played at multiple computer installations.
The game features two spaceships, "the needle" and "the wedge", engaged in a dogfight while maneuvering in the gravity well of a star. Both ships are controlled by human players. Each ship has limited ammunition and fuel for maneuvering, and the ships remain in motion even when the player is not accelerating. Flying near the star to provide a gravity assist is a common tactic. Ships are destroyed when they collide with a torpedo, the star, or each other. At any time, the player can engage a hyperspace feature to jump to a new and random location on the screen, though in some versions each use has an increasing chance of destroying the ship instead. The game was initially controlled with console switches on the PDP-1, though Bob Saunders soon built an early gamepad to make it easier to play.
Spacewar! is one of the most important and influential games in the early history of video games. It was extremely popular in the small programming community in the 1960s and the public domain code was widely ported to and recreated on other computer systems at the time, especially after computer systems with monitors became more widespread towards the end of the decade. It has also been recreated in more modern programming languages for PDP-1 emulators. It directly inspired many other video games, such as the first commercial arcade video games, Galaxy Game and Computer Space (both from 1971), and later games such as Asteroids (1979). In 2007, Spacewar! was named to a list of the ten most important video games in history, which formed the start of the game canon at the Library of Congress, and in 2018 it was inducted into the World Video Game Hall of Fame by The Strong and the International Center for the History of Electronic Games.
Background
During the 1950s, various computer games were created in the context of academic computer and programming research and for demonstrations of computing power, especially after the introduction later in the decade of smaller and faster computers on which programs could be created and run in real time as opposed to being executed on a schedule. A few programs, however, were intended both to showcase the power of the computer they ran on and as entertainment products; these were generally created by undergraduate and graduate students and university employees, such as at the Massachusetts Institute of Technology (MIT), where staff and students were allowed on occasion to develop programs for the TX-0 experimental computer. These interactive graphical games were created by a community of programmers, many of them students and university employees affiliated with the Tech Model Railroad Club (TMRC), led by Alan Kotok, Peter Samson, and Bob Saunders. The games included Tic-Tac-Toe, which used a light pen to play a simple game of noughts and crosses against the computer, and Mouse in the Maze, which used a light pen to set up a maze of walls for a virtual mouse to traverse.
In September 1961, a Digital Equipment Corporation (DEC) PDP-1 minicomputer was installed in the "kludge room" on the 2nd floor of Building 26, the location of the MIT Electrical Engineering Department. The PDP-1 was to complement the older TX-0, and like it had a punched tape reader and writer, and additionally accepted input from a panel of switches and could output to a cathode-ray tube (CRT) display. Over the summer before its arrival a group of students and university employees had been pondering ideas for programs that would demonstrate the new computer's capabilities in a compelling way. Three of them—Steve Russell, then an employee at Harvard University and a former research assistant at MIT; Martin Graetz, a research assistant and former student at MIT; and Wayne Wiitanen, a research assistant at Harvard and former employee and student at MIT—came up with the idea for Spacewar!. They referred to their collaboration as the "Hingham Institute" as Graetz and Wiitanen were living in a tenement building on Hingham Street in Cambridge, Massachusetts. "We had this brand new PDP-1", Russell told Rolling Stone in a 1972 interview. "Somebody [Marvin Minsky] had built some little pattern-generating programs which made interesting patterns like a kaleidoscope. Not a very good demonstration. Here was this display that could do all sorts of good things! So we started talking about it, figuring what would be interesting displays. We decided that probably you could make a two-dimensional maneuvering sort of thing, and decided that naturally the obvious thing to do was spaceships."
Gameplay
The gameplay of Spacewar! involves two monochrome spaceships called "the needle" and "the wedge", each controlled by a player, attempting to shoot one another while maneuvering on a two-dimensional plane in the gravity well of a star, set against the backdrop of a starfield. The ships fire torpedoes, which are not affected by the gravitational pull of the star. The ships have a limited number of torpedoes and supply of fuel, which is used when the player fires the ship's thrusters. Torpedoes are fired one at a time by flipping a toggle switch on the computer or pressing a button on the control pad, and there is a cooldown period between launches. The ships remain in motion even when the player is not accelerating, and rotating the ships does not change the direction of their motion, though the ships can rotate at a constant rate without inertia.
Each player controls one of the ships and must attempt to shoot down the other ship while avoiding a collision with the star or the opposing ship. Flying near the star can provide a gravity assist to the player at the risk of misjudging the trajectory and falling into the star. If a ship moves past one edge of the screen, it reappears on the other side in a wraparound effect. A hyperspace feature, or "panic button", can be used as a last-ditch means to evade enemy torpedoes by moving the player's ship to another location on the screen after it disappears for a few seconds, but the reentry from hyperspace occurs at a random location, and in some versions there is an increasing probability of the ship exploding with each use.
Player controls include clockwise and counterclockwise rotation, forward thrust, firing torpedoes, and hyperspace. Initially, these were controlled using the front-panel test switches on the PDP-1 minicomputer, with four switches for each player, but these proved to be awkward to use and wore out quickly under normal gameplay, as well as causing players to accidentally flip the computer's control and power switches. The location of the switches also left one player off to one side of the CRT display due to the limited space in front of the computer, which left them at a disadvantage. To alleviate these problems, Saunders created a detached control device, essentially an early gamepad. The gamepad had a switch for turning left or right, another for forward thrust or hyperspace, and a torpedo launch button. The button was silent so that the opposing player would not have a warning that the player was attempting to fire a torpedo during a cooldown period.
Development Russell, Graetz and Wiitanen developed the basic Spacewar! concept in the summer of 1961, in anticipation of the PDP-1 being installed. Russell had recently finished reading the Lensman series by E. E. "Doc" Smith and thought the stories would make a good basis for the program. "His heroes had a strong tendency to get pursued by the villain across the galaxy and have to invent their way out of their problem while they were being pursued. That sort of action was the thing that suggested Spacewar!. He had some very glowing descriptions of spaceship encounters and space fleet maneuvers." Other influences cited by fellow programmer Martin Graetz include E. E. Smith's Skylark novels and Japanese pulp fiction tokusatsu films.
For the first few months after its installation, the PDP-1 programming community at MIT focused on simpler programs to work out how to create software for the computer. During this period, Russell visited his old friends in the community frequently and described the Spacewar! concept to them. Russell hoped someone would implement the game, but had no plans to do so himself. Other members of the community felt he was the logical choice to create the game, however, and began pressuring him to program it. In response, Russell began providing various excuses as to why he could not do so. One of these was the lack of a trigonometric function routine needed to calculate the trajectories of the spacecraft. This prompted Alan Kotok of the TMRC to call DEC, who informed him that they had such a routine already written. Kotok drove to DEC to pick up a tape containing the code, slammed it down in front of Russell, and asked what other excuses he had. Russell, later explaining that "I looked around and I didn't find an excuse, so I had to settle down and do some figuring", started writing the code around the time that the PDP-1's display was installed at the end of December 1961. The game was developed to meet three precepts Russell, Graetz, and Wiitanen had developed for creating a program that functioned equally well as an entertainment experience for the players and as a demonstration for spectators: to use as much of the computer's resources as possible, to be consistently interesting and therefore have every run be different, and to be entertaining and therefore a game. It took Russell, with assistance from the other programmers—including Bob Saunders and Steve Piner (but not Wiitanen, who had been called up by the United States Army Reserve)—about 200 total hours to write the first version of Spacewar!, or around six weeks to develop the basic game. It was written in the PDP-1's assembly language.
Russell had a program with a movable dot before the end of January 1962, and an early operational game with rotatable spaceships by February. The two spaceships were designed to evoke the curvy spaceship from Buck Rogers stories and the PGM-11 Redstone rocket. That early version also contained a randomly generated background star field, initially added by Russell because a blank background made it difficult to tell the relative motion of the two spaceships at slow speeds. The programming community in the area, including the Hingham Institute and the TMRC, had developed what was later termed the "hacker ethic", whereby all programs were freely shared and modified by other programmers in a collaborative environment without concern for ownership or copyright, which led to a group effort to elaborate on Russell's initial Spacewar! game. Consequently, since the inaccuracy and lack of realism in the starfield annoyed TMRC member Peter Samson, he wrote a program based on real star charts that scrolled slowly through the night sky, including every star in a band between 22.5° N and 22.5° S down to the fifth magnitude, displayed at their relative brightness. The program was called "Expensive Planetarium"—referring to the high price of the PDP-1 computer compared to an analog planetarium, as part of the series of "expensive" programs like Piner's Expensive Typewriter—and was quickly incorporated into the game in March by Russell, who served as the collator of the primary version of the game.