6

Spacewar!

 3 years ago
source link: https://www.masswerk.at/spacewar/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
Spacewar!
Version:

This is a virtual DEC PDP-1 emulated in HTML5/JavaScript running the original code of "Spacewar!", the earliest known digital video 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–2016.
Based on emulation code by Barry Silverman, Brian Silverman, and Vadim Gerasimov. The emulation code was extended to support some additional instructions and auxilary hardware. Especially the shift/rotate instructions and the arithmetics were rewritten and now include an emulation of the automatic hardware multiply/divide option. Further, cycle counts were added for accurate timing and frame rates. Some importance was put in the recreation of the appearance of the original CRT display and the unique experience conveyed by it. Moreover, a splash-screen was added, and there are multiple versions of the original code ready to play. See below for details.
For some other interactive programs running on this emulator, see www.masswerk.at/minskytron.

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

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

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

   [ALTERNATIVELY USE 'Q' (PLAYER 1) AND 'U' (PLAYER 2).]

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

HIT TAB ON KEYBOARD TO SWAP CONTROL BOXES AND SHIPS.

SIGNED

HEAD OF THE COMPUTER DEPARTMENT

(You may disable the original LEFT+RIGHT hyperspace action in favor for using single-key commands only by selecting "Hyperspace Lock" in the options menu options menu icon at the top right of the page. Single-key actions may also be useful for custom joystick mappings.)

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.

gamepad-icon.pngGamepads / Joysticks:
The game will show a message on the splash-screen, if it dedects support for gamepads by your browser. Some gamepads may require special connection modes like switching them to "direct mode" or having a connection button pressed, when plugging in.
For a close to original experience use the analog sticks: the left one turns (left/right) the right one is used for thrust (down) and hyperspace (up). Digital sticks and D-pads are supported as well. Any major button should work as fire. Left shoulder buttons are hyperspace, right shoulder is fire.
Hit the tab-key of the keyboard to swap the assignment of pads and ships.
Click here for an illustration of gamepad mappings.

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

Notes & Descriptions

Program Versions & Sources

The emulation is running various versions of the original game, both from binaries copies of the original paper tapes and newly assembled from authentic code listings. The programs are loaded as virtual paper tapes (RIM-mode: Read In Memory) into the memory of the emulated DEC PDP-1.

Spaceships (stylized) according to the Hingham Institute Study Group on Space Warfare

Spacewar! 3.1, the final version of Spacewar! as left by the original programmers (Steve Russell and the other members of the Hingham Institute Study Group on Space Warfare), is presented here once in its original form and in a modified version showing scaled up graphics and effects for the benefit of small screen sizes. Further, there are both earlier and later versions, as Spacewar! 2B (the program described in "The Origin of Spacewar" by J. M. Graetz) and some examples of version 4 (adding minor features and compatibility to an upgraded hardware). Finally, there is a special version of Spacewar 3.1, demonstrating the "Winds of Space" effect.

(Please mind that the title screens are generated by the emulator and are not part of the original games.)

There are two display resolutions to select from:

  • Low resolution, plotting at 512 x 512 px, 50% of the original display.
    Special subpixel rendering is employed in order to boost the visible resolution beyond the physical resolution provided by the display element in the browser.
    The result corresponds closely (if not being even a bit better) to the visual resolution of the original display: While the display featured a resolution of 1024 x 1024 plotting locations, only approximately 512 points on each axis were "resolvable to the unaided eye" (DP-35-2 / PDP-1 Instruction Manual / Part 3; DEC 1971; p. 5).
    Compare these contemporary photos: [1] [2] [3].
  • High resolution, plotting at the original 1024 x 1024 px, with the display element scaled to 50%.

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

  • Spacewar! 3.1 (24 Sep 1962)
    This could be regarded as the "standard version" of Spacewar!. The program is dated "24 sep 62" and is loaded from an authentic binary paper-tape image (spacewar3.1_24-sep-62.bin) provided by Steve Russell via bitsavers.org.
  • Spacewar! 3.1, scaled ships (low resolution only)
    Scaled up graphics and effects to show the game in greater detail on a small display. (Colission radii and turning pivots of the ships have been adjusted accordingly.) This is quite similar to the presentation seen in other emulations. Please mind that the changes have minor effects on the gameplay.
    The code is based on the original PDP-1 assembler sources by Steve Russell as available at bitsavers.org and was modified and newly assembled in 2014. (N. Landsteiner, 2014; this is not an authentic version!)
  • Spacewar! 2B (2 Apr 1962)
    This is the first complete version version of the game as presented at MIT's annual Science Open House in May 1962. Notably this is also the very version the background starfield (Peter Samson's Expensive Planetarium) was designed for, as this is annotated in the source code by "stars by prs for s/w 2b" and dated "3/13/62, prs". The program features the pre-particle-system "Crock Explosion" [4] and optionally a faster movement of the starfield (sense switch 4), torpedoes are single shot only (no salvoes). Some of the differences are more cosmetical: The ships' exhaust flames are half the size of later versions, also the display of the starfield hasn't found its final form yet (starting at an other position as compared to later versions). Moreover, the original starfield routine, found here, is modulating the varying brightnesses of the stars by how often the individual stars are drawn, whereas later versions are using the built-in intensity levels of the Type 30 CRT display instead.
    For more on the making-of of Spacewar! see "The Origin of Spacewar" by J. M. Graetz.
    The code is run from a binary paper tape image (RIM) labeled "spaceWar_SA-5.bin". This has been proven to be identical to loading the two paper tapes "spacewar2B_2apr62.bin" and "stars.bin", both to be found at bitsavers.org.
    ("SA-5" is not a version string, but indicates the program's start address being 5, which would start the program in a setup for reading the input from the console test switches rather than from MIT's special control boxes, as would be the case with the default start address. The label suggests that this was a tape sent from MIT to an other facility.)
    Spacewar! 2B is known with a date as early as 25 March 1962. This earlier version shows minor differences regarding the polarity of the sense switch settings.
    Spacewar! — The Hyperspace Minskytron signature The program is presented here with two patches applied, namely the hyperspace-patch to include Martin Graetz's original hyperspace routine, the "Minskytron hyperspace" [5] and its "warp-induced photonic stress emission", and the auto-restart patch for seemless playing. (There are exactly three jumps to hyperspace per player.)
    This represents the the game as described and depicted in J.M. Graetz's seminal article "The Origin of Spacewar" and as presented at the MIT Science Open House in May 1962. (It still lacks a scorer-patch, which seems to be lost.) The patches are provided by the paper tape images "hyperspace85.bin" (Hyperspace VIci, 2 May 1962) and "spaceWarRstrt.bin" — an other tape provides the same patch as "spacewAutoRestartPatch.bin". (The auto-restart patch was to be applied to the hyperspace-patch and is by this officially a patch to a patch. Thus, loading the full program had become a fairly complex affair then, involving up to 6 tapes.)
    Listings of Spacewar! 2B and the patches may be found here.
    Please mind that this is still the game early in development. The restart-patch is missing an edge case (pun in­tend­ed), where the ships would collide at the "antipode" in the corners of the display. The game requires a manual restart in this situation.
  • Spacewar! 4.1f (20 Feb 1963; mod. for CHM 2005 – 2008)
    This is the version apparently running at the Computer History Museum (CHM).
    This is Spacewar! 4.1 modified by Peter Samson in 2005–2008 to include the scorer routine of Spacewar! 4.8. Moreover, version 4.1f features modified brightness settings for the background starfield (for use at the CHM), which are here remapped to usual values by the emulator. (Otherwise most of the stars would remain invisible.) Like other version of Spacewar! 4.x it requires the hardware multiply/divide option and features the single shot switch for torpedoes. The source code is dated "spacewar 4.1 2/20/63 dfw" and annotated "mod for CHM, 2005-06-01 - 2005-11-28 --prs", and "changed delay in score display, 2008-08-22 --prs.". The code is run from a binary paper tape image (sw41f.rim) provided by Peter Samson via bitsavers.org.
  • Spacewar! 4.2a (4.1/4.2 dfw) (22 Feb 1963 ?)
    This is an authentic representative of the 4.x-generation of Spacewar! (probably by "dfw", like version 4.1 above), requiring the hardware multiply/divide option of the PDP-1. Additionaly to some internal modifications it features, like all versions 4, a working single shot mode for torpedoes (sense switch 3). The code is run from a binary paper tape image (spacewar4.2a_sa4.bin) provided by Steve Russell via bitsavers.org.
    A visually distinctive detail of versions 4.x (4.1 and later) is the "Sun" (heavy star), now drawn by a dashed line like the rocket blasts, thus separating it visually a bit more from the starships (see the high-res/full-scale version for a close-up view.) Also, two ships colliding in free fall in the center will explode at the "antipode" rather than at the center as with earlier versions of the game.
  • Spacewar! 4.3 (17 May 1963)
    This is a version by Monty Preonas (signing "ddp"), who also provided the adaptations for the automatic hardware multiply/divide option and the new gravity computations used by all flavors of Spacewar! 4 in his version 4.0 (2 Feb 1962) earlier.
    Spacewar! 4.3 features, like Monty Preonas' flavor of version 4.2 and version 4.4 (also signed "ddp", but presumably by Joe Morris), a special on-screen score display, very much like the one of the 4.8-scorer-patch (see the note on scores below). Like all versions by Monty Preonas, it usues an implementation of the background starfield alike the one of Spacewar! 2B.
    The game features a special Twin Star mode to be engaged by sense-switch 2 (accessible by the options menu options menu icon at the top right corner of the screen). This visually distorted mode puts the Needle in the center of the screen in between a doubled sun and draws any other objects relatively to this ship. Moreover, some items are drawn at a double offset and torpedoes are displaced for real, resulting in a quite vexing game play. This mode was probably initially intended as an ego view from the Needle's perspective and left as-is as an amazing novelty. (Compare "Spacewar! 2015" below.)
    The program, dated "5/17/63", was newly assembled from source code provided in the assorted listings available at CHM catalog no. 102664173 (which apparently came from Joe Morris, compare Joe Morris, alt.sys.pdp10, Jannuary 6, 2005).
  • Spacewar! 4.8 (24 Jul 1963)
    Apparently the final version of MIT-Spacewar!, dated "7/24/63" and signed "dfw". A patch for a special on-screen scorer is available for this version (see the note on scoring below).
    The game was newly assembled including the dedicated scorer patch. Sources ("spacewar4.8part1_engl.txt", "spacewar4.8part2_engl.txt", and "spacewar4.8_scorer.txt") are available at textfiles.com and bitsavers.org.
  • Spacewar! 4.1 Holloman Air Force Base Version
    This is a reconstruction of a version of PDP-1 Spacewar! as seen at the Holloman Air Force Base (New Mexico) and described by John W. Andrews in December 1966 for "The Gamesman" (The Gamesman, Issue 4, Dec 1967, pp 30-32). Altered starting positions are probably the most interesting feature of this version. (Controls have been swapped accordingly to accommodate for this.)
    Starting positions in Holloman Air Force Base Spacewar.These are the changes as applied according to the description provided by John W. Andrews:
    • Altered setup position width spaceships facing the central star,
    • The length of exhaust flames indicates the amount fuel left,
    • Ships collide with background stars on re-entry from hyperspace,
    • A collision with the gravitational star kills in the default setting,
    • 36 torpedoes per ship (instead of the standard supply of 32).
    (Reconstruction by me, N.L., Sep. 2019.)
  • Spacewar! 2015 (21 Mar 2015)
    "The Return of the Minskytron Signature" — Fresh code for the PDP-1 from 2015!
    My own tour de force on Spacewar!: Based on Spacewar! 4.1 (dfw) — like the CHM-version — it features hyperspace with the Minskytron signature (like Spacewar! 2B, slightly modified), a modified version of the 4.8-scorer-patch (including a scanning divider line, like Spacewar! 4.2), and last, but not least, a working Needle's Ego View. This Ptolemaic View (sense switch 2, see the options menu options menu icon) shows the Twin-Star mode of Spacewar! 4.3 (ddp) as presumably at first intended: Sense switch 2 enables a transposed view relative to the Needle's position, just like it would be seen on a radar scope inside the Needle's cockpit. Think of Ptolemaic space travel with the Wedge orbiting in epicycles. (For the changes applied and related deliberations compare the discussion here.)
    Spacewar! 2015 is meant as a potpourri of features that were previously lost or widely unknown.
    Please mind that this is not an authentic program!
  • Bonus track 1: Spacewar! 3.1 "Winds of Space"
    This is an attempt to demonstrate the formerly popular "Winds of Space" effect.
    A clue to this is provided in Steven Levy's "Hackers – Heroes of the Computer Revolution": "Or, as the night grew later and people be­came locked into interstellar mode, someone might shout, 'Let's turn on the Winds of Space!' and someone would hack up a warping factor which would force players to make adjustments every time they moved."
    Another clue is provided by the following quote by Steve Russell: "[T]he reason that all the parameters got accumulated in the first page of the listing, which says you can put that first page of the listing o[n] the console, and anyone who wanted to try a different set of parameters could." (Oral history interwiev with Al Kossow; CHM 2008. p. 14)
    Putting things together, "Winds of Space" was effected by tuning one of the values of the parameters table. And, in deed, there is a val­ue for the "amount of torpedo space warpage" at memory location 021. This is a scaling factor, therefor, the lower this value, the more the trajectories of the torpedoes will be modulated by what resembles a sine-like curve. The effect varies with speed and position. To demonstrate the effect, this value has been set to the lowest value (0), with the default value being the maximum amount of 9 bitwise right-shifts (effecting in straight trajectories). — It should be noted that this hasn't been "officially" confirmed yet.
    This module uses the original code of "Spacewar! 3.1", which is first loaded from a virtual paper-tape and then patched for the "hacked" parameter. (Additionally, the torpedo life-time is set to be a bit higher value, to emphasize the effect.)
    For hacking parameters or game constants in general, see the options menu options menu icon at the top right of the screen.
  • Bonus track 2: Snowflake
    This is another famous visual PDP-1 program from the 1960s, an early example of computer animations. Snowflake produces sequencies of a starlike, kaleidoscopic pattern by aligning a series of dots, which are bound to 4 attractors and then displayed 12 times by a rotation by 30°. (An alternative 8-dots display mode is available by operating sense switch 2, see the options menu options menu icon.) While there is not much information to be found on this program, you may read some about it here.
    The program is run from an authentic paper tape image "snowflake_sa-100.bin" to be found at bitsavers.org.
  • Bonus track 3: Snowflake (@CHM)
    Another (shortened) version of Snowflake as seen at the CHM, differing a little by its setup.
    The program is run from a paper tape image "dpys5.rim" (titled "pdp-1 display hacks") to be found at bitsavers.org.

Note on Scoring

In the original game, the game halts at the end of a match (which may be set up for a spefic number of games by console switches not implemented in this emulation) and scores are displayed in binary using the console lights for the accumulator and the IO-register. For these games the emulation tries to detect the scoring code and displays the AC and IO lights (along with scores presented as decimal numbers) below the virtual scope.
Some later versions of the game, like 4.1f, 4.3, and 4.8 feature a special on-screen score display. Here, scores are displayed at the end of each game. In order to activate the score display, either click the score indicator at the lower left of the emulated scope, or hit "B" to toggle the score board on/off. (Alternatively, you may access the scoring option by the options menu options menu icon.) If scoring is deactivated, when leaving the score display, scores are reset to zero.

Some research has been invested in order to identify various versions and paper tapes, some of these versions are here 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. Versions marked "[rim]" were newly assembled for this emulation from historic source listings. Modules marked "[mod]" are modified versions based on genuine listings.
You might want to play in classic setup with the "Sun" killing on contact by activating sense switch 5 (see the options menu options menu icon at the top right of the screen).

The Emulator

The code is executed in a DEC PDP-1 emulated in JavaScript (based on code by Barry Silverman, Brian Silverman, and Vadim Gerasimov, who did also a Java-implementation in 1997, which serves as a basis for any PDP-1 emulator around). The JS emulation code was partly rewritten and 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 the shift/rotate-operations, the logic for arithmetics, switches, flags, or I/O operations) has been re-implemented. Realtime time-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) of the games (see the tools menu accessible by the options menu options menu icon at the top right of the screen). (N.L. 2012-2015)

The DEC PDP-1 was introduced in 1959 as one of the first commercial machines using core memory and transitors only. It featured a clock rate of 0.2 MHz (100,000 additions per second) and operated at 18-bit words. The standard memory was 4 K of 18-bit words (expandable). The over all performance is roughly comparable to the one of an Apple II micro computer from the late 1970s (wider words and less CPU cycles per instruction make up for a slower clock rate).

Some importance has been put in reconstructing the visual impression of the original CRT display:

DECUS icon

Notes on the CRT-Emulation

The PDP-1 was one of the first computers to come with an (optional) CRT display. The DEC Type 30 Visual CRT Display featured a round tube in a distinctive, hexagonal housing in a concentric layout. The make of the tube was originally intended for radar scopes and employed a dual P7 coating with two layers of phosphor, a bright, light-blue one displaying freeshly activated blips, and a dimmer, greenish-yellowish one displaying the decaying blips in a fading afterglow. These characteris are also responsible for the iconic trails drawn by any moving object on the screen.

The Type 30 CRT was essentially a point plotting device (also known as XY display), meaning that there was no memory or repetitive scan, but plotting locations were addressed randomly by individual display commands. Refreshing the screen was entirely left to the program, which had to redraw any blips that were to stay on the screen. If not refreshed, the blips would fade away in the afterglow of the P7 phosphor. The scope provided a technical resolution of 1024 by 1024 plotting locations on an area of 9 3/8 inches square. The spot size of an activated location increased with its intensity (the display featured 8 distinctive brightnesses), the blips — we cannot speak of pixels here — thus slightly overlapped and mended on the screen, effecting in a visible resolution of approximately 512 by 512 display locations.

(Note: The Type 30 CRT was neither an oscilloscope nor a vector display. It lacked any memory, but it was a serious piece of hardware that came at a destinctive price tag. Point plotting CRTs with P7 phosphor are also known as "animated display" or "painted display" for their sponge-like display characteristics.)

These characteristics are quite important for the game, since its drawing mechanism heavily depends on the afterglow of the display, which provides the required stability for the screen image. Moreover, since the built-in brightnesses didn't scale that well, perceivable brightnesses are also modulated by distinctive refresh rates. (E.g, the background starfield is refreshed only every second frame in order to separate it from the foreground objects a little more.)

The emulation recreates the distinctive characteristics and their effects, like the dual layers of phosphor, the variable intensities and spot sizes, and the overall perceptible resolution. In low-resolution mode a special virutal subpixel mapping is employed to boost the display resolution, providing smooth movements and a similar degree of visible detail like the original device. Thanks to the faithful recreation of the display, the programs can be run and displayed at the original frame rate by the emulator. (There's also an option in the settings dialog to opt out of true frame-by-frame rendering for a more stable, flicker-free display.)

(While the low-resolution mode corresponds closely to the visual impression of the original display, users provided with a large screen or a high density ["retina"] display, may want to also check the full-scale version of the emulator.)

Spacewar!

The Game

Spacewar! features the epic battle of two spaceships, the Needle and the Wedge, each of them to be controlled by a human player. The two ships navigating in outer space are subject to the gravity excerted by a central star, closely simulating the laws of Newtonian physics. Photon torpedoes of limited supply (not affected by gravity themselves for the limited resources of the PDP-1) may be fired in order to destroy the opponent. A game ends when any of the ships would explode in pixel dust or when both of the vessels would manage to run out of torpedoes. Hyperspace offers a means of last resort to any player in trouble, but of an unreliable sort: The "Mark I hyperfield generators" are likely to explode on re-entry, with an increasing probability with each successive jump. (And a ship will certainly explode at the eighth attempt, if you would get ever that far.)

The ships are drawn against the background of a realistically depicted starfield, Peter Samson's Expensive Planetarium, which draws a 45° segement the "stars of the heavens" (the stars of the first four magnitudes between 22½° N and 22½° S as listed in the American Ephemeris and Nautical Almanac) in a gradually shifting motion.

The game features a scoring facility including managed matchplay with tie-resolving (up to 31 games, to be set up on the switches of the operator's console). The machine would halt at the end of a game or a match and display the score at the console lights (in binary, player 1 by the contents of the accumulator, player 2 by the lights of the I/O-register). Some of the later versions featured a graphical on-screen display for even increased delights.

A variety of settings could be accessed by the sense switches at the operator's console, like the kind of turning action (inertial rotation for angular momentum, simulating rocket-driven movement in space, or Bergenholm rotation, simulating the more convenient action of gyros), single shot or continuous fire operation, the presence of a central star and the extent of its gravity, controls for the background-starfield, and last but not least, if ships colliding with the central stars would explode or rather be warped to the "antipode" at the corners of the screen.

Initially intended as an entertaining demonstration object for the real-time capabilities of the DEC PDP-1, then newly donated to MIT, Spacewar! was to become the first of what we now know as digital video games. A group of MIT students and employees, the Hingham Institute Study Group on Space Warfare (named after Steve Russell's lodging), conceived the game in summer 1961 and progressed to implementation over the fall of the same year under the lead of Steve Russell, programmer-in-chief. A first version (without gravity or the background starfield) was operational soon thereafter (fall/late 1961) and the game was basically ready in February 1962. Version 2B saw the addition of a background display featuring the slowly moving stars of the heavens (Peter Samson's Expensive Planetarium, March 1962) and was announced in the first issue of Decuscope (the DEC users' information) in April 1962. The program, complemented by a few patches, was presented to the public at the MIT Science Open House in May 1962. Finally, the program was refactored into its final form (final as far as the original group of authors was concerned), Spacewar! 3.1, in September 1962. Later, other programmers took over to adapt the game for the upgraded hardware and to add minor features, namely Monty Preonas (ddp) and the coder known as dfw.

For more on how the program came into being, see "The Origin of Spacewar" by J. M. Graetz (in: Creative Computing; Volume 7, Number 8; August 1981; also published in: The Computer Museum Report, Fall 1983; Malboro, MA, 1983).

A variety of special input devices, so called "control boxes", including even a repurposed joystick from a missile control console of USAF surplus supplies, were developed for use with the game and attached to the PDP-1. Facilities outside of MIT that were not so lucky to have their own control boxes had to rely on the testword switches on the operator's console for input. (The game is known to have been temporarily banned at BBN and other locations for the wear of console switches excerted by heavy gaming.) The kind of control input to be processed by the game could be selected by the start address of the program.

The game was written in assembler code for MIT's Macro assembler (ported from a previous implementation for the TX-0 computer). Special contributions were, aside from Peter Samson's Expensive Planetarium that could have well served as a stand-alone program, the addition of the gravity computations by Dan Edward and his ingenious outline-compiler which allowed only the inclusion of gravity. Even with the extensive JIT-code produced by the outline-compiler the memory condition were not tense, allowing for ample space for patches and even the parallel use of the online-debugger ddt. (Stories of swapping in and out values of shared storage locations for terse memory are urban myths and do not withstand an inspection of the source code.) Resources were not so much restricted by the amount of memory available or the particular execution time, but by the requirements of refreshing the screen at a steady frame rate and the delay caused by the display's response to any plotting commands. (While an internal instruction completed in 5 microseconds, the display required 50 microseconds to respond with a completion pulse. This was caused by some cooling circuits in the display, which prevented the beam from oscillating or "ringing" while jumping at high speeds from one plotting location to the next.) Therefore, the real expensive article was a dot on the display.

While the game was for some years, with a few exceptions, available on DEC machines only, it saw its spreading by frequent ports to other platforms in the 1970s and provided a popular entertainment to the happy few who had access to a computer with a suitable screen.

PDP-1 sense switches

Sense Switches

Some settings to modify the game's behavior could be adjusted by flipping one of the sense switches, an array of 6 switches dedicated to user interaction on the PDP-1's console. You may set these in the "Sense Switches / Setup" dialog, or, more conveniently, using the options menu options menu icon at the top right of the screen. The menu items always reflect the options available with the particular program. You may also use the keyboard to toggle sense switches by pressing the SHIFT key and the appropriate number key (1..6).
(There are some more options in the "Sense Switches / Setup" dialog, like the emulation speed or keyboard settings.)

Hacking Parameters

Most versions of Spacewar! (but the very earliest) started with a section commented "interesting and often changed constants" — probably the first cheats in electronic gaming history.
Steve Russell: "It was quite interesting to fiddle with the parameters, which of course I had to do to get it to be a really good game. By changing the parameters you could change it anywhere from essentially just random, where it was pure luck, to something where skill and experience counted above everything else. The normal choice is somewhere be­tween those two." (quoted in "Spacewar – Fanatic Life and Symbolic Death Among the Computer Bums" by Stewart Brand.)

These "often changed constants" could be altered either by manipulating individual bits by the means of the operator's console or, more likely, by the use of the online-debugger ddt. The emulator provides access to most of these "constants" by a special parameters dialog, accessible by the options menu options menu icon. The parameters are bounded to sane values (e.g. value parts or bit-wise shift-steps are extracted and handled internally) — 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 proper 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

A well established way to set up a game of Spacewar! was dubbed the "CBS Opening" (named for its remarkable similarity to the network company's logo, see this image): Both players would turn their ships orthogonally to an imaginary axis 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.

Players are encouraged to use gravity as a friend rather than engaging in a quite hopeless attempt to fight against it.

Usage / UX-Notes

  • Special touch controls are automatically injected for touch devices. You can force them to show or hide by the use of the options menu options menu icon.
  • 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.)

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 handwritten labels only.
    "Space War" was also the name of an arcade game by Vectorbeam, based on the original game. 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 for the title screen, using the algorithm and data of the original program.
  • "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 paper tape: See CHM, catalog no. 102631997, probably produced by this source code (p. 11).
  • 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+)
  • Jason Scott (of JSMESS/archive.org and textfiles.com fame, via Twitter): "JSMESS can handle 500k+programs on 1000+ platforms. But when someone does work on just one program, it's amazing."
  • "I really like the format of 'curated source code' this person takes.", Dag Spicer (Senior Curator, Computer History Museum, Mountain View, CA; Editorial Board, IEEE Annals of the History of Computing) on the code analysis related to this project. "Your effort is really first-rate. (…) If there could be 10 efforts such as yours, I would consider that a victory."
  • This page is now linked as the online Spacewar!-emulation by the Computer History Museum's PDP-1 site.
    Makes it somewhat "official" … (May 2015)
  • The page has been on interactive display at the "The World of Video Games" exhibition by the Sai-no-Kuni Visual Plaza / Visual Museum (SKIPシティ, Saitama Prefecture, Japan) from 2015/10/3 to 2016/2/28.

Lost and Found:

The following features were either identified or rediscoverd while researching for this project:

  • The "Minskytron Hyperspace" as described and depicted in the article "The Origin of Spacewar" by J. M. Graetz (see below) has been identified as the patch "hyperspace85.bin", actually "Hyperspace VIci, 2 May 1962", retyped by Martin Graetz in 1985. Read the story of its discoverey here.
    The version of Spacewar! described in J. M. Graetz article has been identified as Spacewar! 2B with all patches applied (hyperspace, auo-restart, scorer).
    The original Minskytron can be seen here in an in-browser emulation:
    The Minskytron and Other Early Graphics Demos at the PDP-1.
  • The source codes of Spacewar! 2B and the hyperspace patch (see above) have shown up and have been identified.
    A transcription of the sources can be found here.
    Compare also the The Spacewar 2B Preservation Project and the documentation of this project.
  • "Winds of Space": This special mode is immortalized in Steven Levy's "Hackers" by the quote, "Or, as the night grew later and people became locked into interstellar mode, someone might shout, 'Let's turn on the Winds of Space!' and someone would hack up a warping factor which would force players to make adjustments every time they moved." From this we may conclude that "Winds of Space" was effected by hacking the value in memory location 021 ("amount of torpedo space warpage") of the setup table at the start of the program. The lower the value, the more extreme will be the effect. Compare version 3.1 with "Winds of Space" provided here.
    Please mind that this hasn't been officially confirmed yet.
  • "Hydraulic Spacewar": This is again from Steven Levy's "Hackers": "By switching a few parameters you could turn the game into 'hydraulic Spacewar,' in which torpedoes flow out in ejaculatory streams instead of one by one."
    "Hydraulic Spacewar" would be achieved by setting the value of paramter "rlt" (torpedo reload time) close to zero. See the item "Hack Parameters..." in the options menu options menu icon to experiment with it.
  • "Twin Star Mode": This is a visually distorted mode found in Spacewar! 4.3 (ddp). This mode, activated by sense switch 2, provides a vexing view on the usual game: The Needle is fixed to the center inbetween a doubled star, the Wedge is falling from the very lower left corner towards the center and any torpedoes or exhaust blasts show up at a transposed location. Moreover, the background starfield is moving quite erratically.
    On closer inspection, we find that the Needle is rather pushing the whole universe, than moving itself on the screen. This was probably intended as a Needle's Ego View, but, as some of the objects happened to be subjected to a translation twice, turned out as described. Compare the version 4.3 provided here.
    A detailed analysis of the code can be found here.
    An actual Needle's Ego View may be explored in Spacewar! 2015 with sense switch 2 deployed.
  • Spacewar! 4.4 proves to be the earliest known attempt at a multiplayer first-person shooter, or rather, what I would call a "Planar FPS", since it conveys a view relative to the players as it would be seen on an onboard radar display of the respective spaceships. Spacewar! 4.4 is based on Spacewar! 4.3 and signed "ddp" while probably by Joe Morris.
    See the game in emulation along with a description: Spacewar! 4.4 emulated in HTML5/Javascript.
  • "Wedges only": Setting the constant "ddd" (020) to zero (or any positive value) will setup the outline compiler to draw both spaceships as Wedges. This was meant to provide extra space in memory for the online-debugger.
  • Fuel consumption (fun fact):
    Fuel consumption in Spacewar! is not a function of time, but of the length of the exhaust flames drawn. A longer flame burns more fuel (while resulting in the same acceleration, regardless of its length).
  • Crashing Spacewar! (fun fact):
    It's actually possible to crash Spacewar! 3.1 by "hacking" an insane combination of some game constants (paramaters): When setting the torpedo reload time ('rlt') to a rather small value and the torpedo lifetime ('tlf') to a rather long one and fiering constantantly from both ships, the game will eventually run out of objects and enter an infinite loop of halt instructions. (It is impossible for this to happen with default values or values rather close to them.) While Spacewar! 2B didn't feature the constants table, Spacewar! 4.x handles this situation more gracefully.

There are still some facts missing:

  • Versions 4.5, 4.6, and 4.7 are missing. At least one of these provided two distinctive speeds of acceleration/thrust (as can be guessed by a left-over comment in the source code of version 4.8).
  • The identity of author "dfw" remains — inspite of her/his merrits — unknown.
  • The scorer patch for Spacewar! 2B seems to be lost.

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. (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.
  • Special thanks to Lyle Bickley and Ken Sumrall for utilizing themselves as my personal bridgeheads to the CHM's PDP-1 Restoration Team.
  • Thanks to Gary A. Messenbrink, Bob Supnik, Phil Budne for the recreation of the original Macro assembler in C (macro1.c), thus prividing an invaluable tool for any practical PDP-1 research.

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

Research

Further Reading

Related Games

▶ Play Spacewar! Fleet Action, a new old-style game based on the original 1962 Spacewar! game and inspired by a quote by Steve Russell.

▶ Play Minnesota Spacewar, a reconstruction of a Albert W. Kuhfeld's flavor of Spacewar!, featuring "Minnosota Hyperspace". (This application is actually up for a re-write.)

▶ Play Space War for the Atari VCS (Atari 2600 console), Atari, Inc, 1978.

© 2012 – 2016 Norbert Landsteiner,
mass:werk – media environments, www.masswerk.at.

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK