science fact magazine
Vol. LXXXVII, No. 5,
July 1971; pp. 67-79
Fletcher sat warily at his controls as the glowing blips approached each other in the battle display. His thoughts were divided; half his mind was thinking of the duel, and the other half was integrating out approach vectors. Trajectories meeting at forty-five degrees—Tatge would reach the point of intersection first, barely—the other ship was rotating into firing position ... NOW! He punched down the firing button and shot off a full salvo of four torpedoes. QUICK! He slammed his controls left and forwards into an escape curve, cursing all the while. So much computing power available, and all wasted computing orbits instead of going into the fire-control loop! Well, those were the rules, and a duel wouldn’t mean much if it were between his computer and Tatge’s...
On the screen his second torpedo merged with Tatge’s ship, and the blip spread into an expanding circle of sparkles. Tatge had got off only one torpedo, and it was going to miss. He was beginning to sigh premature relief as his inertia carried him forwardjnto the explosion. His rockets weren’t strong enough to turn him in time—he’d fired when he was too close. As the outer fringes of the debris touched Fletcher’s ship, another fiery circle blossomed. Deadlock.
He turned to Tatge. “I’m getting sick of this; that’s the third time in a row. Let’s have the score, I want to see how we’re doing.”
Tatge punched several buttons on the computer console, and the printout chattered briefly. “You’re still ahead, Ken, 35 to 29, but there are 43 ties now. You’re shooting too close.”
”I know, I know. Start ’er up again, I want to try something new.”
Two ships appeared on the display and began jockeying into Solar orbit ...
Analog science fiction? Nope—digital science fact. That little scene has been repeated many times over during the last decade, with different players and varying rules of war. The two were playing a computerized battle game called “Spacewar,” a game which has been implemented in many computer centers and which some of you may have seen on television on “The 21st Century.” It’s a fascinating game, perhaps the first true game of the space age, and its biggest drawback is that even the most minimal versions need something like twenty kilobucks worth of computer and associated equipment. Very few individuals have that much computer handy, so Spacewar is usually played “bootleg” in the dead of night when whatever computer is available is not busy doing its official and useful tasks.
There have been very real battle casualties among the players of Spacewar: people who played late into the night, then fell asleep in class or on the job the next day; people who were caught by some dour and humorless guardian of the computer, who’d rather see it idle than engaged in frivolity.
The playing of the game is simplicity in itself. The computer is merely the “board” upon which the game progresses, and does not intrude any programming complexities upon the players. A simulated radar display of two spaceships is generated upon a CRT display terminal, and each player has a control panel which “flies” one of the spaceships. Pushing the rocket control forward fires the tail rockets; pulling it back fires the retros in the nose. Pushing the gyro control to the right makes the ship rotate clockwise; to the left, counterclockwise. And pressing the little red button will fire torpedoes at your opponent’s ship. If you hit him, he’ll blow up. If he hits you, you’ll blow up. (That’s where the strategy starts coming in.) Those are the essentials of Spacewar.
Besides the two spaceships, most games have a background of sun and stars upon the screen. The stars have very little effect upon the game; they provide a fine “atmosphere” to put the players in the proper mood and serve as motionless reference points useful in judging ship velocity, but have no other effects. The sun, in the center of the screen, is quite another matter. It has it gravitational field so the ships can orbit around it; and it is dangerous. Get too close, and pfftt—no more ship. Just a pretty sparkly explosion which doesn’t last long and looks good only to your opponent.
The sun is the major factor in the game, only slightly less important than your opponent. It destroys more neophytes than enemy torpedoes. Dozens of times I’ve seen a really good beginner make a perfect shot and destroy his opponent—only to find that while he was lining up the shot he had got so deep into the sun’s gravity well that his rockets couldn’t save him. No matter how many games you’ve played, you’re a beginner until you’ve learned to keep the sun constantly in your calculations. And when you’ve learned to use it, you are well on the way to being a master. For the sun is far more than a lurking trap for the unwary—it can be a definite aid. Due to the peculiar mathematics of orbital mechanics, some maneuvers can be far more effective when performed deep within a gravitational well. And fighting from close orbit has several advantages, not the least being that your ship is traveling in an ellipse rather than a straight line, and is consequently harder to hit.
Of course, few games are really as much fun when stripped to bare essentials, and Spacewar is no exception. Chess would be less interesting without “castling” and the peculiar behavior of pawns. Poker players have wild cards to use when they want added spice. And in Spacewar—imagine the possibilities, with a computer to keep track of all the odd things that might happen!
In every version of Spacewar I’ve run across, there has been an operative Panic Button for players to use when they find the enemy bearing down upon them and no escape in sight. And all of these panic buttons have been two-edged affairs with a built-in tendency to bite the finger that pushes them. After all, making escape dangerous is really the only way of getting the players to keep their fingers away from the Panic Button long enough for somebody to be shot down. And programmers have responded to the challenge with fiendish ingenuity!
In MIT Spacewar—the original version from which all others are taken—the panic button activates hyperspace generators. Your ship disappears, and after a while reappears elsewhere. Just where you reappear is determined by a random-number generator hidden away somewhere in the computer programming; and there is no assurance that you will like this new position at all. You might appear in the center of the sun, or close enough to it so you’ll end up there. That’s bad, but it’s not likely enough to be really frightening, so: the hyperspace generators were made unreliable. The first time you activate them, there is one chance in eight of your ship exploding. The second time, there are two chances in eight; the third time, three chances in eight. Nobody pushes the button the eighth time.
While programming Minnesota Spacewar, I opted for a panic button involving skill rather than luck. The Minnesota Panic Button makes your ship invisible. Your enemy can’t see you—but neither can you yourself. The advantage lies with the player who is better at mentally predicting trajectories—which is made simpler because the rocket flames are not invisible: any course alterations will immediately pinpoint ship position. Long periods of invisibility are dangerous unless your ship is in stable orbit; the sun may get you.
Another of the odd things that happen in Spacewar is best called “toroidal space.” The ships are capable of building up quite a substantial velocity—it’s necessary for a fastpaced game. But at these high speeds they are able to cross the entire CRT in a time on the order of ten seconds. And when a ship reaches the end of known space, what to do? Should it disappear, or explode, or fall off the edge of the Universe?
Programmers have found the answer to this problem in the old science-fictional idea of curved space—go far enough in one direction, and your ship will come back to the place it started from. When a ship reaches the right edge of the CRT, it reappears at the left edge. When it goes out the top, it comes back in the bottom. (I suspect the effect is much less distressing to players than to readers; it is harder to explain than to learn to love.) This is easy to program, for it is something digital computers will do automatically because of the way they handle positive and negative numbers. It’s quite possible that the original programmers of Spacewar were as surprised by the effect as anybody is upon seeing the game for the first time—but if they were, they realized they had a good thing going, and kept it. With the relatively small display terminals usually available, this little trick is the only thing that keeps the game from getting cramped.
Each version of Spacewar has its own minor details and limitations, depending upon the whims of the programmer(s) and the structure of the computer used. Fuel and torpedoes are often limited in the interests of realism, just as they would be for real spaceships: For example, in Minnesota Spacewar each ship has two minutes of fuel and twenty torpedoes. The torpedoes are fired at one-second intervals in salvoes of four or less, and have a lifetime of fifteen seconds. Each ship can have at most four torpedoes in action at one time. These limitations prevent space from becoming filled with torpedoes that long ago missed their targets but still are menaces. (Remember how live torpedoes and mines washed up on various shores for years after WorId War II was over? That sort of weapon is ungentlemanly.) Since fuel is consumed only when the rockets are fired, each ship has much more than two minutes of normal powered flight. I’m thinking of cutting the fuel supply in half, because in practice ships almost never last long enough to run out of fuel and a limit that is never approached doesn’t count.
THE PLAYING OF THE GAME
Spacewar is rather like chess or checkers, in that the game goes through certain phases in which the optimum strategies are quite different. In analogy with chess these phases can be called the opening, the midgame, and the endgame. The opening starts with both ships motionless on opposite sides of the sun, continues as they make orbit and jockey for position, and ends after the ships make their first firing pass at each other. If both ships survive this first pass the players then enter the midgame, in which considerations of tactics dominate —rather than orbitmaking, as in the opening. And the endgame limps in as one or both ships begin to run low on fuel and ammunition. Here a certain conservatism is necessary to winning: shots are placed more carefully, fuel use is minimized, and both players must be alert for kamikaze attacks by their opponent.
Since the ships start quite close to the sun, the first necessity of the opening game is to avoid getting trapped and destroyed by it—and even a second’s hesitation can be fatal. There are half-a-dozen opening gambits to choose from during these first hurried moments, and the effectiveness of each gambit depends strongly upon the one chosen by the enemy. This calls for split-second decisions; the wrong response can be suicide. It helps to know your opponent’s strengths and weaknesses—he’s going to avoid his weaknesses, so out of simple justice you should avoid his strengths.
The spin-and-drift opening gambit is perhaps the best example of the need to know your opponent. It stations your ship close to most of your opponent’s possible trajectories, and makes it almost impossible for him to shoot you without either falling into the sun or being destroyed in the explosion of your ship. If your enemy hates ties, well and good! He’ll try to evade you, and you’ll have a fair shot at him. But if he doesn’t mind ties nearly as much as losing, he can take you with him every time and you might as well try something else.
Actually, spin-and-drift is not a good maneuver for winning—except with a very few opponents. It’s dangerous, your foe can easily make it unprofitable, and it requires so much attention to piloting that there’s little time to aim and shoot. The main virtue of this maneuver is something else altogether: it is superb for grandstanding. If you fly it well and pot your opponent truly, any audience you can find will be sure to applaud—and it’s almost impossible to play Spacewar without gathering an audience. Winning isn’t everything.
Unlike spin-and-drift, the three variations on the standard trajectory are extremely easy to fly. The “left” variation is a straightforward, damn the-torpedoes sort of attack, and is the maneuver you’re most likely to use, and encounter. With it, your opponent has the maximum amount of time to prepare; the minute your ship starts to rotate counterclockwise he knows what you’re up to, and can choose any orbit but spin-and-drift to counter your attack. But in effect his choice will be more limited than that; all he can really decide is whether he will close with you and slug it out, or evade. Victory goes to the best shot, and subtlety is difficult. The only real options available to a player flying this variation are the firing time and pattern, and the evasive maneuvers immediately following firing.
Because of the high torpedo and ship velocities built up while swinging far into the sun’s gravitational well, there is little time for evasion and a good pattern of torpedoes is capable of bracketing most escape trajectories. With two good players persistently flying the left variation, Spacewar is reduced to the level of a sophisticated game of ticktacktoe: mutual frustration is far easier than a win for either side.
The “right” variation of the standard trajectory is ideal for declining engagement. In effect, it cuts out the opening game and gets on into the midgame without the formality of the first firing pass.
The center variation is seldom used in its pure form, because it ends up with the ship traveling along a diagonal of the screen. This forces the pilot to predict his trajectory a great distance past the “corner of the Universe” to avoid flying into the sun. Piloting then becomes more important than fighting—an excellent way to lose. Therefore, the usual pattern with this opening involves flying out to the corner of the screen and altering course.
The best things about the standard patterns is that they are so easy to fly that even a beginner can concentrate on wiping out the other guy rather than worry about piloting. Some expert players will even fly them invisibly—normally a difficult thing to do—and still have a good enough idea of ship position and velocity to fire accurately. Unfortunately, this trick doesn’t wear well, for it depends primarily upon shock value for its effectiveness. If the invisible attacker sticks to the standard patterns his enemy can quickly learn where to shoot; and if he leaves these well-worn paths he himself can’t keep track of his ship.
My own personal and favorite opening maneuver is the rocket-assisted fractional orbit. Properly used, it can be fiendish. Basically, you get into a very close orbit and use your rockets to assist the sun’s gravitation. That whips you around the sun twice as fast as a normal orbit, and if you time everything properly you’ll go flying up your opponent’s tailpipe as if you were shot from a sling. He’ll be destroyed before he can even turn around and shoot at you. The natural counter-pattern for this gambit seems to be spin-and-drift; and since your opponent must commit himself to spin-and-drift well before you commit yourself to a fractional orbit, it won’t be pulled on you unless you become too predictable.
Orbiting the sun is a useful maneuver at the beginning and the end of a game. In the beginning, it’s the purest form of fighting; for once a stable orbit is attained, you need pay no attention whatsoever to flying the ship. All your attention can be concentrated upon your enemy. In addition, your orbital velocity is added to the torpedo ejection velocity—and close to the sun, orbital velocity is considerable. But this orbital velocity is only useful when you’re in a portion of your orbit where your ship is headed roughly towards your opponent. The result is firing “windows” very similar to the launch windows for Moonshots or planetary probes. It’s quite possible to miss an otherwise easy shot because your ship is in the wrong portion of its orbit. However; your opponent is at a compensating disadvantage; for your ship is moving rapidly along a curved path, and can be a most difficult target for all but the most experienced players.
In the endgame, when you are running low on torpedoes and fuel and your opponent has the edge, a distant orbit is the safest hiding place you can find. Get into a large orbit, go invisible, and what the devil can he do? He can blunder around until he collides with you, shoot off all his torpedoes in the small hope of hitting you by accident or guesswork—or resign, and give you a tie. (And if he should shoot off all his torpedoes in a vain attempt to hit you, you can then reappear and stalk him with your one remaining shot!)
WHERE THE REAL FUN IS
The perversity of the various “panic button” provisions should serve as a warning: Spacewar can be a most peculiar game. Although it uses a computer to handle orbital mechanics, physicists and mathematicians have no great playing advantage—John Campbell’s seventeen-year-old daughter beat her MIT student-instructor on her third try—and thereafter—while the most promising player I’ve seen was a theology student. Good reflexes and an eye for motion seem to be far more important than training in the concepts involved. And most perverse of all, the fun part of the game isn’t really playing it—it’s writing the program.
Now, I’m not knocking the actual playing of the game. I like it, and when my win ratio starts dropping as it has lately, I am unhappy. (The other players are simply getting too much experience; I had best rewrite the game and change it around.) But I’ve reached a bullfighting sort of attitude towards winning: the point isn’t just to kill the bull, it’s to do it with dash and style. I’ll go for both ears and the tail every time.
The one thing that’s more fun than playing is to go for both ears and the tail while writing the program. I’ve done three versions of Spacewar so far, and each of them has been more elegant than the preceding version.
Version I was a crude, get-it-working sort of thing that was fun to play, but really only served to define the programming problems.
Version II was slightly faster and had a few more features.
Version III has bells and whistles: it keeps score—which none of the earlier versions did—and the two ships are no longer identical—which helps in playing the game, but makes the programming harder. But I’m proudest of things that don’t show, things buried deep in the programming. Version III is a bit faster than the earlier versions, even though it’s more versatile. The torpedoes are handled in a much more compact and elegant manner. The display programming is more streamlined and requires less memory and many fewer instructions.
These are little things, but I’ve learned a lot of programming by doing them. Few things are more enjoyable than tackling a hard bit of thinking and problem-solving, just for fun. It’s rather like working out crossword puzzles or mathematical brain teasers, and the best part of it is that you’re learning some very useful things even as you enjoy yourself.
This way of looking at Spacewar seems to be widespread. The history of the MIT Spacewar game—a much older game than the Minnesota version—shows a definite progression from the early days when much programming was yet to be done, into the-well-stagnant period after the game was refined and polished.
The first few years of Spacewar at MIT were the best. The game was in a rough state, students were working their hearts out improving it, and the faculty was nodding benignly and smiling as they watched the students learning computer theory faster and more painlessly than they’d ever seen before. It was an education for all concerned. The students were doing creative and difficult program design and debugging, and the only problems in sight were the few students who neglected their other studies to concentrate on Spacewar. After all, it looked so much like the things they came to school to study that it had to be good for them! And a background of real-time interactive programming was being built up that anybody in the school could draw upon; one of the largest problems in the development of the game was learning how to talk to a computer program, and have it answer back. Knowledge of this sort is useful whenever interaction with a computer is desirable, and many of the faculty were starting to put it to use.
But the problems were eventually solved. All the rough edges had been trimmed from the programming. The CRT display looked as realistic as possible. The only real program development going on was done by a couple of students trying to introduce a computer-piloted flying saucer to occasionally zoom through the game as a kind of “wild variable.” To the best of my knowledge, they never got it working. Students were still playing Spacewar, but with all the problems solved it was rapidly degenerating into pure recreation—and even gambling. Nobody was learning anything—except orbital dynamics—but they were taking up valuable computer time. The faculty became less benign; they wanted to use the computer. And Spacewar at MIT drifted off into the sunset.
Spacewar drifted off into the sunset, and so did a lot of the players. It is in the nature of MIT graduates to wind up at installations with computers; and with a new computer, the fun can start all over again! For each computer installation is different, requiring different programming, and there’s a whole new bunch of people to make appropriately reverent and excited noises when they first see two little spaceships on a computer display.