Skip to content

Shooting from a moving ship

Why a shot can travel somewhere other than where the launcher points.

Your ship is moving upwards. A target is straight ahead to the right. Point right, fire, and the shot goes up and right.

Why? Because the torpedo carries your ship’s motion with it. In Spacewar!, launch velocity is added to the ship’s existing velocity. The barrel points one way; the resulting shot can travel another. Graetz describes that rule in the 1962 technical paper. Graetz, p. 37

We can work out a shot using the coordinates and movement ideas in Maths for Games. We’ll begin with a small local example: no gravity, no screen edges and a target that holds still. These are teaching units and chosen speeds, not measured Spacewar values.

Give each movement two numbers

Use X for right and Y for up. Our ship begins at (0, 0), travelling at (0, 30) units per second. The target is at (100, 0). A torpedo launches at 50 units per second relative to the ship.

Fire directly right and its launch velocity is (50, 0). Add the ship’s velocity:

Code
Ship velocity:       ( 0, 30)
Launch velocity:     (50,  0)
Torpedo velocity:    (50, 30)

After two seconds, the torpedo reaches (100, 60). The target is still at (100, 0). Our shot passed 60 units above it at that moment. Aiming the nose at the target didn’t cancel the upward motion.

Aim down to make the shot travel right

The launch needs a downward component of 30 to cancel the ship’s upward 30. How much rightward velocity is left if the launch speed must remain 50?

The horizontal and vertical amounts form a right triangle. Pythagoras gives us:

Code
Rightward amount² + 30² = 50²
Rightward amount² = 2,500 − 900 = 1,600
Rightward amount = 40

So use launch velocity (40, −30). Its speed is still 50: the square root of 40² + 30². Now add the ship’s motion:

Code
Ship velocity:       ( 0,  30)
Launch velocity:     (40, −30)
Torpedo velocity:    (40,   0)

The torpedo travels right at 40 units per second and reaches the target after 100 / 40 = 2.5 seconds. Our ship keeps moving upwards while the shot travels. We don’t have to follow it.

The launch angle is about 36.87° below the rightward direction. That’s the launch direction before adding the ship’s velocity, not the direction of the resulting world-space shot. The triangle and angle-to-target lessons explain the geometry behind those numbers.

Now let the target move

Suppose the target travels upwards at 10 units per second. The torpedo’s world-space upward velocity must also be 10 if they’re to meet, because both begin at Y = 0.

The ship already contributes upward 30, so the launch must contribute downward 20. With launch speed 50, its rightward component is the square root of 50² − 20²: about 45.826. The resulting torpedo velocity is about (45.826, 10).

It reaches X = 100 after about 2.182 seconds. In that time both the target and the torpedo reach Y ≈ 21.822. The target has moved; the shot was aimed to meet it there.

For other arrangements, subtract the ship’s velocity from the target’s velocity to get their relative velocity. That tells us how the target moves from the travelling launcher’s point of view. We still need an interception time and a launch direction that meet the target at that time. Some situations have no solution at the available launch speed.

What changes in the game?

Spacewar! makes the problem livelier. Gravity changes the ships’ velocities. A human opponent can thrust or turn, so a prediction based on a steady course can become wrong. A torpedo has a limited life, and a screen edge can change which route matters. The worked examples isolate one part of aiming; they don’t promise a guaranteed hit in the game.

That’s still useful. When a shot misses, we can ask a better question than whether we pointed accurately. Did we account for our own movement? Did the opponent change course? Did we fire too early or too late?

Return to the Spacewar! study and look at the exchange of shots with those questions in mind.

This study has not yet been fact-checked. Sources and capture conditions are included so you can follow the evidence.

Game captures: Spacewar!, MIT contributors, 1962, PDP-1; captured in Norbert Landsteiner's emulator. Full credits and capture conditions. Original illustration is separate from the historical game imagery.

Study sources and research notes · More game studies