Spacewar!

Select a Version:

This is a virtual DEC PDP-1 emulated in HTML5/JavaScript running the original code of "Spacewar!", the earliest known digital screen game.
If available, use gamepads or joysticks (currently Chrome and Firefox only, see instructions-memo below) for authentic gameplay — the game was originally played using custom control boxes.

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. The arithmetic logic was re-implemented and a provision for timekeeping was added. 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.

 

 

OR USE CONTROL BOXES ("GAMEPADS"), HYPERSPACE IS UP.

HIT TAB ON KEYBOARD TO SWAP CONTROL BOXES AND SHIPS.

 

 

SIGNED

HEAD OF THE COMPUTER DEPARTMENT

Visit the "Sense Switches / Setup" dialog to select a national or non-standard keyboard layout.
Some keyboards may not read all keys at once, please resort to the alternate fire keys ("4" and "0") in this case.

Gamepads/Joysticks: The game will notify on the splash screen, when support for gamepads is available with your browser. This is still quite experimental technology, support may depend on the make of the OS, the browser, and the specific pad. Switching a pad to "direct mode" may help. Some pads require to have a connection button pressed, when plugged in. For a close to original experience use one of the analog sticks for turn (left/right) and the other for thrust (down) and hyperspace (up). Digital sticks are supported as well. Any major button should work for fire. Hit the tab-key of the keyboard to swap the assignment of pads and ships.

Notes & Credits

• Notes on the Emulation:

The Sources:
Spaceships according to the Hingham Institute Study Group on Space Warfare 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.

Spacewar 3.1, the earliest complete version, is presented here once in its original form, loaded from an authentic paper-tape image (RIM – Read In Memory), and once as a newly assembled modification showing scaled up graphics and effects for the benefit of small screen sizes.
Further, there are some later versions of Spacewar! (version 4.x), also loaded from binary paper-tape images. These were ad­ding 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 (once the bare program and once the same with some epoch-making patches applied).
Last but not least, there is a special version of Spacewar 3.1, demonstrating the "Winds of Space" effect.
(Please mind that the title screen shown on the emulated scope 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 provided here are playable for the first time in decades. The locations of the individual sources are linked in the descriptions above.
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 switch 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 hard­ware like a paper-tape reader, the multiply/divide option of later PDP-1s, or the test-word, also a few additional instructions have been added to the em­u­lation and some of the code (like some of the shift-operations, the logic for add/sub, switches, flags, or I/O operations) has been re-implemented. Realtime keeping was added for authentic emulation speed based on cycle counts. Aside the support of the PDP-1's sense switches to control some of the games' behavior, there's also a provision to extract and hack essential constants (setup parameters) from the progams loaded (see the tools menu accessible by the "hamburger" at the top right).
Some importance has been put in reconstructing the visual impression of the original CRT-display. (N.L. 2012-2014)

• Notes on the CRT-Emulation:

DECUS icon

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 vec­tor 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 acti­va­ted 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 re­fresh­ing 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 lo­ca­tions 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 ori­gi­nal 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 fig­ures 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!

"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 stars moving over the night sky as seen from Earth's equator — in an extent of a 45° segment — down to the just above the 5th magnitude). The ships, each to be con­trolled 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 torpe­does 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" (de­fault), 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 rou­tines 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 …

• Hacking Parameters:

Most versions of Spacewar! started with a section commented "interesting and often changed constants" — probably the first cheats in electronic gaming history. While these would have been altered by a procedure involving flipping bits on the control console of the original machine, you may access and change most of these parameters in a special dialog, accessible by the "hamburger"-icon (tools menu) at the top right of the screen. The parameters are bounded to sane values (e.g. value parts or bit-wise shift-steps are extracted and handled internally).
Not included are the constants controlling the duration of the various phases of hyperspace (since they have some dependency) the amount of fuel, and the colission radii. The setting for the number of hyperspace shots will only take effect, when the game is (re)started (see the tools menu again).
Please mind that, since these hacks are actually injected into the binary code of the program, they have to be set anew, when a different version of Spacewar! has been loaded.

Note: While called "constants" in the comments, the entries in this setup table weren't actually parameters, but entire instruction that could have even been replaced by jumps to subroutines that would return the value (this was even encouraged by the comments). The program wouldn't just look up these entries, it would actually execute the given instruction. Avoiding the perils of actual programming, the parameters dialog is sticking with the original instructions and allows the adjustment of their operands (in a somewhat user-friendly fashion).

Spacewar! - The CBS Opening

• 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 (for about 2 to 3 seconds) 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 / Usage:

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.)

You may export a sceenshot, either by hitting ALT+P (with a black background added), or a semi-transparent one (as displayed, just the illuminated pixels) by hitting SHIFT+ALT+P.
Please mind that the stars will be actually as the bright as in the frame you will happen to grab. (This migh be an odd frame showing them just by the dimm afterglow. You may want to retry in this case.)

Spacewar! — The Hyperspace Minskytron signature

A note on UX-history: Spacewar! might not only be the first digital video game, but also the first application of user experience (UX) considerations in computer history. In particular, hyperspace was a feature quite contested right from the beginning. In order to preserve an entertaining game-play from players just evading any risky situation by another jump to hyperspace, some essential limitations were applied in the first version: There were only three jumps available and the device was somewhat unreliable and unresponsive, not firing on every try. "It was something you could use, but not something you wanted to use" (Steve Russell, quoted in Origin of Spacewar). It was supposed to be an unreliable "Mark I" device, rushed to the fleet without thorough testing. And, in deed, the device would convey a destinctive "kludgy" feeling that would prohibit an overuse of this feature, even in the presence of the pretty effect of the "warp-induced photonic stress emission" of the "hyperspace Minskytron signature".

But, why would this neat visual feature have been dismissed in the final implementation of hyperspace, as to be seen in version 3.1 and later? Probably, the "kludgy" feeling conveyed by the Mark I generators had an effect on the all over experience. In deed, when the hyperspace routine was changed to fire more reponsively and reliably (but now with an increasing risk of breaking the ship), the game had a more complete feeling to it. But, with the generators now firing instantly on each try, there would have been the risk of the hyperspace signature ultimately ruining the game-play by players taking jumps to hyperspace just to see another bloom of the hyperspace signature — thus reducing the game to yet another Minskytron with spaceships in it. We may conclude that this might have been the reason for the eventual dismissal of the original hyperspace signature, instead of its visual appealing effect, and in the favor of a comprehensive game-play.
(Please mind that this is just musing and not confirmed by any of the authors of Spacewar!.)

• Gossip & Comments:

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 (in JavaScript) 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).

Jason Scott (of JSMESS/archive.org fame, via Twitter): "JSMESS can handle 500k+programs on 1000+ platforms. But when someone does work on just one program, it's amazing."

Bruce Baumgart (winner of the first "Intergalactic Spacewar Olympics", 19 Oct 1972 at Stanford University's Artificial Intelligence Laboratory, probably the first video game tournament in history): "Just like the PDP-1 Type-30 looked as it was in the 1960s." (via google+)

• Lost and Found:

The following features are known to have existed in Spacewar! and either were rediscoverd while researching for this emulation or do still remain a mystery:

I'm delighted to state that most of the items on my personal "lost" list are now in the "found" category.
In case you would happen to have additional informations, 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:

Play Minnesota Spacewar, a reconstruction of a Albert W. Kuhfeld's flavor of Spacewar!, featuring "Minnosota Hyperspace".
This application serves also as a test-bed to explore various options known for the game.

• Other (Research):

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)