Spacewar

 

Hello everyone! This is the 13th post on this blog. We have crossed the Rubicon, there is no turning back! With 12 posts left this year, I feel so happy that we got this far. Your response to this blog keeps me overwhelmed. This week we will look at the very first arcade game! It is with a great sense of nostalgia that I publish this post.

It is amazing the hacker ethic that got the computing industry to this point is nearly lost. Personally, I look back to a time where you could go to sleep with a fellow programmer in the room. Sadly those days are gone! Now with venture funding entering into the scene, the days of hackerdom are over. Non Disclosure Agreements (NDAs) and Non Compete Agreements (NCAs) are the norm these days. In the years to come, I know that I will have to get a lawyer on my team. But enough talk. Let’s get to this week’s post…

In the annals of hacking history, there are many great computing machines however; none would change the history of computing as much as the (Programmed Data Processor-1) PDP-1. Designed by Digital Equipment Corporation (DEC), it was donated to the MIT labs. The PDP-1 replaced the TX-0. The TX-0 was the world’s first personal computer. Costing $3 million in the late fifties, it would trigger the formation of a dedicated community of hackers around it.

The PDP-1 however would go on to make history. First produced in 1960, it would be on this computer that music would first be created via a computer program and the first computer game would be created.

When the PDP-1 was delivered to MIT, it came with a simple collection of systems software, which the TX-0 hackers considered completely inadequate. The TX-0 hackers had become accustomed to the most advanced interactive software anywhere, a dazzling set of systems programs, written by hackers themselves and implicitly tailored to their relentless demands for control of the machine.

Alan Kotok already an accomplished TX-0 hacker designed a debugger for the PDP-1 called the DDT. It was him and a dedicated team of hackers that would write their own assembler over a weekend. They accomplished this feat by reworking code from the TX-0 and not sleeping!

During the summer of 1961, a plan for the most elaborate hack yet was devised. Steve Russell and his friends came up with a plan to create an elaborate display hack on the PDP-1 using the CRT screen. They collectively agreed that the most effective demonstration of the computer’s magic would be a visually striking game. Given their collective background in science fiction, the team decided to build a game that would feature space warfare.

Steve Russell delayed starting work on the project for several months. When pressure mounted from other hackers, he muttered that he had not started the project because he had not figured out how to write the elaborate sine-cosine routines necessary to plot the spaceships. Given the spirit of hackerdom, a library was found for the trigonometric functions and work could start.

At that point, Steve Russell had no excuse. So he spent his off-hours writing this fantasy PDP-1 game, the likes of which no one had seen before. He began in December 1961 and when the calendar wrapped around to 1962, he was still hacking. By that time, Russell could produce a dot on the screen that you could manipulate: by flicking some of the tiny toggle switches on the control panel, you could make the dots accelerate and change direction.

He then set about making the shapes of the two rocket ships: both were classic cartoon rockets, pointed at the top and blessed with a set of fins at the bottom. To distinguish them from each other, he made one chubby and cigar-shaped with a bulge in the middle, while the second he shaped like a thin tube. Russell used the sine and cosine routines to figure out how to move those shapes in different directions. Then he wrote a subroutine to shoot a “torpedo” (a dot) from the rocket nose with a switch on the computer. The computer would scan the position of the torpedo and the enemy ship; if both occupied the same area, the program would call up a subroutine that replaced the unhappy ship with a random splatter of dots representing an explosion. (That process was called “collision detection.”)

In the later stages of programming, Bob Saunders helped Steve Russell out, and they hacked a few intense six-to-eight-hour sessions. Sometime in February, Russell unveiled the basic game. There were the two ships, each with thirty-one torpedoes. There were a few random dots on the screen representing stars in this celestial battlefield. You could manoeuvre the ships by flicking four switches on the console of the PDP-1, representing clockwise turn, counter clockwise turn, accelerate, and fire torpedo.

Once a rough version of the game once shown to the community of hackers, there was no going back! Since the code was open-source, modifications beyond the original design were made to it.

Peter Samson for instance loved the idea of Spacewar, but could not abide the randomly generated dots that passed themselves off as the sky. Real space had stars in specific places. “We’ll have the real thing,” Samson vowed. He obtained a thick atlas of the universe, and set about entering data into a routine he wrote that would generate the actual constellations visible to someone standing on the equator on a clear night. All stars down to the fifth magnitude were represented; Samson duplicated their relative brightness by controlling how often the computer lit the dot on the screen which represented the star.

Another programmer, named Dan Edwards was dissatisfied with the unanchored movement of the two duelling ships. He felt it made the game merely a test of motor skills. He figured that adding a gravity factor would give the game a strategic component. So he programmed a central star-a sun in the middle of the screen.

The variations made to the game where endless. Spacewar was played a lot of times. So much so that Russell eventually wrote a subroutine that would keep scores (High Scores Screen). In the course of playing Spacewar, the tedium involved in working the switches on the console of the PDP-1 led to the invention of the first computer joysticks! The first computer joysticks had their control boxes made of wood with Masonite tops. They had switches for rotation and thrust as well as a button for hyperspace.

Like the hackers’ assemblers and other programs, Spacewar was never sold. It was placed in the drawer for anyone to access, look at, and rewrite as they saw fit. Gradually the popularity of the program would spread and DEC engineers would use it as a final diagnostic program on PDP-1s before they rolled them out the door.

Sources

Hackers Heroes of the Computer Revolution by Steven Levy

Wikipedia en.wikipedia.org

You can get a copy of the presentation here. Sorry that this week’s post read like a thesis 🙂 Sometimes we have to look back in order to move forward. Will be back in the new quarter to do my 12 posts and go home. I made this promise before and I make it again: “As long as you keep coming, I will continue posting”.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s