Spacewar!

Select Version:

This is a virtual DEC PDP-1 emulated in HTML5/JavaScript running the original code of "Spacewar!", the earliest known digital screen game.

Spacewar! was conceived in 1961 by Martin Graetz, Stephen Russell, and Wayne Wiitanen. It was first realized on the PDP-1 in 1962 by Stephen Russell, Peter Samson, Dan Edwards, and Martin Graetz, together with Alan Kotok, Steve Piner, and Robert A Saunders. – Spacewar! is in the public domain, but this credit paragraph must accompany all distributed versions of the program.

This implementation by Norbert Landsteiner, www.masswerk.at, 2012-2014.
Based on emulation code by Barry Silverman, Brian Silverman, and Vadim Gerasimov. Added enhanced, CRT-like graphics, support for variable output sizes, a splash-screen with near to authentic graphics, and embedding artwork. The original emulation code was modified to include some additional instructions and to support additional emulated hardware.
Also, there are multiple versions of the original code ready to play. See below for details.

The original PDP-1 emulation in HTML5/JavaScript running Spacewar! by Barry Silverman, Brian Silverman, and Vadim Gerasimov is to be found at: http://spacewar.oversigma.com/html5/.

Touch-Controls: Special controls featuring arcade-style buttons are displayed for touch-enabled devices (use landscape orientation; drag the controls by their ship icons to move them to a convenient screen location).
Use the special offline version to add "Spacewar!" to your home screen (so you may play even without an active network connection).

******************

*     M E M O    *

******************

 

 

ONCE AGAIN:

PLAYING "SPACEWAR!" DURING REGULAR OPERATIONS IS POSITIVELY PROHIBITED!

AS YOU ALL PRETTY WELL KNOW, REGULAR OPERATION HOURS ARE FROM 0 AM TO 12 PM ("24/7")!

 

 

INSTRUCTIONS FOR PLAYING "SPACEWAR!":

 

   PLAYER 1:

      A ... TURN LEFT

      D ... TURN RIGHT

      S ... THRUST

      W ... FIRE

 

   PLAYER 2:

      J ... TURN LEFT      OR 4 (NUMBER-PAD)

      L ... TURN RIGHT     OR 6

      K ... THRUST         OR 5

      I ... FIRE           OR 8

 

   PRESS 'LEFT' AND 'RIGHT' TOGETHER FOR CLOAK/HYPERSPACE.

 

 

SIGNED

HEAD OF THE COMPUTER DEPARTMENT

(Visit the "Sense Switches / Setup" dialog to select a national or non-standard keyboard layout.)

Notes & Credits

• Notes on the Emulation:

The Source:
The emulation is running various versions of the original game, both from newly assembled authentic code listings and from binary copies of original paper-tapes for the PDP-1 being loaded by an emulated paper-tape reader.

The first version is "spacewar 3.1  24 sep 62", based on a listing of the original code (aprox. 40 pages long) provided by Martin Graetz to Barry Silverman, Brian Silverman, and Vadim Gerasimov, who typed it in again and re-assembled it with a PDP-1 Macro assembler written in Perl. The code is extremely faithful to the original and has been the only known source listing of this games for some years. See here for the original readme file and the related sources. (Notably, this was the only source available then.)
Version 3.1 is also provided from an alternate source, a binary paper tape-image or "Read In Memory" (RIM), provided by Steve Russell to bitsavers.org. (This version might show minor differences in some values like random number generator factors.)
Further, there are some later versions of Spacewar! (version 4.x), also loaded from binary paper-tape images. These were adding minor features to the game and were dedicated to an upgraded hardware. Some of these versions were also featuring a visual score board.
Finally there is the obligatory making-of as a "bonus track", an early version of Spacewar! in the making (two sources).
(Please mind that the title screen shown on the emulated screen is not part of the game, but generated by the emulator.)

There are two display resolutions to select from (for most of these versions):

Versions available (by the "versions menu" at the top left of the emulated display):

Some of these versions are here playable for the first time in decades.
Versions marked "[bin]" are loaded as-is from binary paper-tape images as they are found in the archives. These should be 100% authentic.
Versions marked "[rim]" are also loaded from virtual paper-tapes, but were newly assembled for this emulation from historic source listings.
Untagged versions are loaded as memory dumps, just as would be the case, if they happened to be already in the core memory of the real machine. (Usually the extensions "rim" and "bin" are used synonymously, the distinction made here is specific to this site.)

If unsure, which version to select, choose a version with a scorer like "Spacewar! 4.8" or "Spacewar! 4.1f".
You might want to play in classic setup with the "Sun" killing on contact by activating sense switche 5, or by just following one of these links to start the game in this setup: Spacewar! 4.8 or Spacewar! 4.1f with a deadly sun.

The Emulator:
The code is executed in a PDP-1 emulated in JavaScript (originally written by Barry Silverman, Brian Silverman, and Vadim Gerasimov, based on an earlier Java-code by the same authors). For this implementation the JS emulation code has been enhanced to support additional hardware like a paper-tape reader or the multiply/divide option of later PDP-1s, also a few additional instrcuctions have been added to the emulation and some of the low-precision code for the shift-operations (SFT) has been re-implemented for execution speed.
Some importance has been put in reconstructing the visual impression of the original CRT-display. (N.L. 2012-2014)

• Notes on the CRT-Emulation:

The PDP-1's original Type 30 display was a point-plotting display, plotting randomly accessible points onto a 1024 x 1024 area of 9 3/8 inches by 9 3/8 inches size. A point plotting display differs from other random-scan display devices in not storing the plotted screen locations for refresh as would be the case with vector displays, also there is no provision for drawing lines or vectors by the display's hardware. Thus a point plotting display activates discrete plotting locations individually, with the activated spots often being bigger than the underlying grid of randomly addressable plotting locations — as was the case with the Type 30 CRT, where only half of the technical resolution was actually perceivable. Notably a point plotting display is an 'animated' display, meaning that any activated locations would not be refreshed, but just fade back to black again, if not refreshed by the CPU by sending the display instruction again in the course of the program's cycle.
Moreover, the Type 30 CRT featured a "P7" phosphor with dual chracteristics: A bright blue short sustain (suitable to provide exact positions for the light pen attached to the front of the display) and a dim, yellowish-green long persistence which provided a fading remembrance of the previously plotted locations. The display emulation attempts to remodel these special characteristics, which are owed to the screen's original purpose of use with mechanical scan radar.

Also emulated are the display's varying levels of intensity: While the Type 30 display featured technically a range of 8 levels of intensity, only 7 were actually visible to the human eye. According to the source code, 4 different levels of brightness are actually used by the game, especially for the background starfield.

Additionally to the Type 30 CRT's built-in levels of intensity, the Spacewar!-code introduces another level of display modulation by not refreshing the background starfield in every cycle (odd cycles only), helped by the P7 phosphor's dim afterglow. Normally, the emulation is executed faithfully frame by frame, but in order to reduce any extensive flicker caused by a slow browser, you may disable frame-by-frame-mode in the "Sense Switches / Setup" dialog. (The emulation will still execute every single frame, but the output of even and odd frames will be stacked, resulting in only odd frames to be actually displayed. This provides a stable display, but might have effects on the sensitivity of the player controls.)

Please mind that the original Type 30 "Visual CRT Display" featured twice the resolution of the emulated display, but neighboring plotting locations would actually overlap, when activated. (This is also, why we cant speak of "pixels" here.) You may want to use a scaled view of the original resolution of 1024 x 1024 by selecting a "Hi-Res" version from the "versions menu" in order to get a more detailed impression of the figures actually drawn by the program. Consider this option while using a high-resolution ("retina") display. (You may also want to check the full-scale version for an unscaled view of the original resolution — a big display and/or presentation mode is highly recommended.)

• The Game:

"Spacewar!" features two ships — called the "needle" and the "wedge" — in deep space against the backdrop of a realisticly moving starfield (Peter Samson's "Expensive Planetarium" which displays the night sky as it would be seen from M.I.T.'s roof). The ships, each to be controlled by a human player, are subject to a gravity vortex in the center (also known as "the Star" or "Sun"). Ships may propel according to Newtonian laws and fire torpedoes (also called missiles, or photons) at each other in order to win the space duel. Unlike the ships, the torpedoes are unaffected by gravity, allowing some rather unexpected maneuvers. Both fuel and torpedoes are of limitted supply. A jump to hyperspace (triggered by issuing "left" and "right" at once) may be used as an unstable mean of last resort.

While the game was essentially complete in late April 1962, later versions would add even more features like a more complex (i.e. unreliable) hyperspace, a hyperspace animation, or scoring. (The best known version is tagged "spacewar 3.1 24 sep 62".) For more on the game's history and a detailed account how Spacewar came into being, read "The origin of Spacewar" by J. M. Graetz.

It might be notable that the game's code features a table of settings for adjusting essential constants like the extense of gravity, capture ranges, acceleration rates, the number of torpedoes in supply, their range, velocity, and spacing. Other settings were accessibly at runtime, to be controlled by an array of so-called "sense switches" (see below). These providing even two different modes of maneuvering: "gyros" (default), where rotation would be on as long as the button was pressed and off as soon as the button was off, and "thruster rockets", where pressing the button would add to (or substract from) the current angular momentum. The code running in the emulation are using default configurations, with the exception of the "big ships" version, which adjusts a setting value to the modified scaling of the ships.

In the beginning, M.I.T.'s PDP-1 didn't feature full hardware support for multiplications and divisions and programs had to use software routines for these operations. Later the machine was upgraded by a hardware multiply-divide option which added a bit of speed and freed some of the precious memory resources for other use. Since the hardware-enhanced arithmetical operations used the same instruction codes that operated the rudimentary multiply and divide steps provided by the machine without this "auto-multiply" option, the code of later versions (4.x) is incompatible with the code of prior versions. (Although there is a version 4 tagged "newSpacewar_4-30-60" to be run without the upgrade.)

• Sense Switches:

Some settings to modify the game's setup were adjustable by the PDP-1's sense switch controls. You may set these in the "Sense Switches / Setup" dialog, accessible by its button on top of the virtual display.
Also in this dialog there is a double-speed option for gamers spoiled by modern hardware …

• The "CBS Opening" Maneuver:

There was a well established way to set up a game of Spacewar! dubbed the "CBS Opening" (for a remarkable similarity to the network company's logo, see this image): Both players would turn their ships orthogonally to an imaginary axis pointing from the ship to the central star and would fire their thrusters to enter a stable orbit around the gravitational center. Orbits established, they would align their ships, ready to launch their torpedoes against the opponent.

• UX-Notes:

You may force the injection of touch controls by calling this page with the URL-parameter "?touch" (just to see, what it's like).

French users and users with non-standard keyboard layouts, please visit the "Sense Switches / Setup" dialog and select the fitting keybaord layout for the player controls.

There is a service screen available providing information on the emulation and the code modules loaded, accessible by the small button at the lower right corner of the display's bezel, just where the cable outlet of the light pen would have been. (This button also triggers a full reset of the emulation.)

• Gossip & Testimonials:

Is it "Spacewar!", "Spacewar", or even "Space War"?
The game is officially referred to as "Spacewar!", while original listings and labels use all three terms, occasionally also abriviations like "S/W" or "sw". Please mind that the character-set of the PDP-1 did not include an exclamation mark (while Steve Russell did put some importance in it), so this might be found on labels only.
"Space War" was also the name of an arcade game by Vectorbeam which was based on the original game of Spacewar! Also a video cartridge for the Atari 2600 system (1978) was called by this name.
"Space Wars" (mind the plural form) was the name of an arcade game by Vectrex/Cinematronics (1977 or '78), also based on the original game (which doesn't have a "s" at the end of its name).

True fact: This emulation includes an implementation of the "Expensive Planetarium" of its own, displaying the original starfield-data as a background to the splash-screen (intensities are purposely reduced).

"Congratulations! Your Spacewar! in its current version is the best Spacewar! on the web!
The keyboard controls work well and the speed is about right. The display looks very good and the simulation of the CRT decay to show trails is good." (Steve Russell, 2012-12-13)

"I've wanted to have one for a long time." (Steve Russell on the addition of the (unauthorized) splash-screen.)
Notably Spacewar! at least featured some kind of title screen, but this one was on the paper tape: See CHM, catalog no. 102631997, probably produced by this source code (p. 11).

• Lost and Found:

Some known features of Spacewar! are not represented in the various versions provided by this emulation:

In case you would happen to know any about these, please contact me.

• Special Thanks:

Thanks to Barry Silverman, Brian Silverman, and Vadim Gerasimov for granting permission to re-use their emulation code and their version of the Spacewar! source code. (Please visit their original site.)
Special thanks to Steve Russell for providing insight into the original PDP-1 Type 30 display and its special dual phosphor characteristics.

• Spacewar! – The Official Birth Announcement:

In April 1962 the following tongue-in-cheek style text was published in the very first issue of “Decuscope – Information for Digital Equipment Computer Users” (Vol. 1 No. 1, April 1962, pp 2 and 4; a copy is provided as a PDF-document at bitsavers.org):

PDP-1 PLAYS AT SPACEWAR!

         by D.J. Edwards, MIT
             J.M. Graetz, MIT

If, when walking down the halls of MIT, you should happen to hear cries of "No! No! Turn! Fire! ARRRGGGHHH!!," do not be alarmed. Another western is not being filmed — MIT students and others are merely participating in a new sport, SPACEWAR!

Planned and programmed by Stephen R. Russell under the auspices of the Hingham Institute Study Group on Space Warfare, SPACEWAR is an exciting game for two players, many kibitzers, and a PDP-1.

The game starts with each player in control of a spaceship (displayed on PDP's scope face) equipped with propulsion rockets, rotation gyros, and space torpedoes. The use of switches to control apparent motion of displayed objects amply demonstrates the real-time capabilities of the PDP-1.

Also displayed on the scope is a central sun which excerts a gravitational influence on the spaceships. The entire battle is conducted against a slowly moving background of stars of the equatorial sky. The object of the game is to destroy the opponent's ship with torpedos. The computer follows the targets and participants have an opportunity to develop tactics which would be employed in any future warfare in space.

Your editor visited the MIT Campus in Room 26265 and can verify an excellent performance. She learned that the best "Aces" had only a 50% chance of survival. Enthusiasm nevertheless ran high and the battle continued while young Mr. Russell trued to explain his program.

"The most important feature of the program," he said, "is that one can simulate a reasonably complicated physical system and actually see what is going on."

Mr. Russell also said that symbolic and binary tapes were available. Please contact Mr. Russell for additional information.

(You may note that there is no notion of hyperspace yet in this text, the version in question being apparently Spacewar! 2b.)

• Spacewar! as an Ambassador of the Programmed Data Processor-1 (PDP-1):

In 1963 (ca.) the Digital Equipment Corporation (DEC) related to "Spacewar"[sic] in a promotional brochure (“PDP-1 Computer and Spacewar”), which also provides some contemporary context, as follows:

SPACEWAR
The demonstration you are watching on the cathode ray tube is called Spacewar. At first look, Spacewar is a fascinating space-age game, in which two players maneuver rocket-armed spaceships in the near weightlessness of space until one is in position to fire the winning shot.

More important, Spacewar is typical of simulation techniques used in psychology laboratories to analyze the problems of man-machine relationships in complex or little-understood situations.

General-purpose computers and other digital equipment play a key role in many scientific studies. The PDP-1 computer used in Spacewar is performing calculations at speeds up to 100,000 per second as it interprets the operator's switch actions and sends positional information to the display at a rate of 20,000 points per second. To give some idea of the complexity of the computer's task, we might mention that in storing and plotting the relative positions and speeds of the spaceships, rockets, stars, and sun, PDP-1 is referring to Newton's laws of motion stored in its 4096-word core memory. Thus the operators must compensate for gravitational attraction when the spaceships come close to the sun.

[The following paragaraphs are not specially related to Spacewar!, but give a vivid picture of human-computer-interaction (HCI) as anticipated in the early 1960s, building on achievements like M.I.T.'s Whirlwind, the SAGE scope, the Charactron/MIV console, and Ivan Sutherland's Sketchpad on TX-2, which are all in PDP-1's pedigree. (C.f. this image and notes.)]

PDP-1 and its newer, lower priced companion PDP-4 can be installed in ordinary office space, require no special power, air conditioning, or floor reinforcement. They go to work almost immediately, since minimum costumer training is required. Ample controls and indicators provide easy and convenient operation and control.

The Precision CRT Display Type 30 demonstrated here is one of the family of computer-operated displays designed by Digital Equipment Corporation to extend greatly the usefulness of the computers. With the unique Light Pen Type 32, a completely untrained operator can communicate with the computer. For example, the Light Pen aimed at the scope face could signal the computer to modify an engineering drawing displayed at the scope. The modified drawing would be displayed instantaneously.

• Further Reading:

• Related Games:

PDP-1 Sense Switches

The PDP-1's control console provided an array of switches, the “sense switches”, which were used to control some of the game's behavior (“off” = default settings):

(unknown)

(unknown)

(unknown)

(unknown)

(unknown)

(unknown)

Emulation:

(On: display each frame, Off: double frames, no flicker)

(On: run at double speed, Off: original speed)