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 version by Norbert Landsteiner, www.masswerk.at, 2012, updated 2013.
Added enhanced, CRT-like graphics, support for variable output sizes, a splash-screen with near to authentic graphics, and embedding artwork. This version also features minor changes to the original emulation code for a bit of speed.

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

New: Touch-Controls — With touch devices use landscape orientation. Use the ship icons to move the controls to a convinient location.
Use the special offline version to add "Spacewar!" to your home screen (so you may play even without an active network connection).

Don't miss the fullscreen version of Spacewar! (best with presentation/fullscreen mode and browser zooming, or a high-res display).

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

*     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

      L ... TURN RIGHT

      K ... THRUST

      I ... FIRE

 

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

 

 

SIGNED

HEAD OF THE COMPUTER DEPARTMENT

Notes & Credits

• Notes on the Emulation:

A printed version of original code (aprox. 40 pages long) was 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 assembler written in Perl. The code is extremely faithful to the original, only the spaceships have been made bigger to account for the smaller display size.
For this version the source code has been re-compiled again, with the collision radius doubled to compensate the bigger size of the spaceships. (N.L.)

The resulting code is then executed in a PDP-1 emulated in JavaScript (written by Barry Silverman, Brian Silverman, and Vadim Gerasimov based on an earlier Java-code by the same authors). The original JS emulation code has been enhanced to support the hardware multiply/divide option of later PDP-1s (we may support later versions of Spacewar! in the future), also some of the low-precision code for the shift-operations (SFT) has been re-implemented for execution speed. (N.L. 2013)

• Notes on the CRT-Emulation:

The original PDP-1 Type 30 display was a point-plotting display, plotting randomly accessible points onto a 1024 x 1024 raster area of 9 3/8 inches by 9 3/8 inches size. It featured two layers of phosphor, a bright blue one of quite fast decay, and a second, dim yellowish-green "P7" phosphor layer of long persistence. The CRT-emulation attempts to remodel these special characteristics, 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 addressable by the PDP-1 (with one control bit reserved for the Type 31 "Precision CRT Display" for use as a photomultiplier device). According to the source code, 4 different levels of brightness are actually used by the game, especially for the background starfield.
Please mind that the original Type 30 "Visual CRT Display" featured twice the resolution of the emulated display. (You may want to check the fullscreen version for the original resolution – big display and presentation mode recommended.)

The emulated PDP-1 code is executed faithfully frame by frame. In order to reduce flicker, you may disable frame-by-frame-mode in the "Sense Switches / Setup" dialog. (The emulation will still be executed frame by frame, but even and odd frames will be stacked, resulting in only odd frames to be actually displayed.)

• Notes on 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"). The ships, each to be controlled by a human player, are subject to a gravity wedge in the center (also known as "the Star"). 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 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 code run in the emulation is tagged "spacewar 3.1 24 sep 62".

You may select a version of Spacewar! from the "versions menu" at the top left of the emulated screen. Currently there's version 3.1, both in its original state and in a modified version featuring bigger space ships to accommodate to the smaller size of the emulated display.

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 …

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

• Further Reading:

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

(On: low, Off: high)

(On: low, Off: high)

???

???

(On: none, Off: starfield)

(On: kills, Off: teleports)

(On: big star off, Off: big star on)

Emulation:

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

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