Today I found out how the gun on the original Duck Hunt game worked.

If you’ve ever played Duck Hunt or any of the other NES games that used the NES Zapper gun, you probably at one point or another wondered how the game actually knows where on the TV you are aiming the gun when you pulled the trigger. It turns out, the method for accomplishing this is incredibly simple, as is the gun itself.

This gun primarily just consists of a button (the trigger) and a photodiode (light sensor). When you pull the trigger, this causes the game to make the TV screen go completely black for one frame. At this point, the game uses the light sensor to sample the black color it’s reading from your TV to give it a reference point; this is essential given that the ambient light in a particular room and other things of this nature can vary greatly. In the next frame, the game causes the target area to turn white, with the rest remaining black. If the game detects a shift from black to white from the gun’s photodiode in that split second, it knows you were aiming correctly at the target and so doesn’t specifically need to know anything about where on the screen the target is.

For games with multiple targets at any given time, the same type of method is used except multiple target frames are shown. So the game will flash the black reference screen; then will flash one of the targets, leaving the rest of the screen black; then flashes the next target, again leaving the rest of the screen black; and so on. The game knows which target is hit, if any, by which frame is currently being shown when a light shift is detected.

If you liked this article, you might also enjoy our new popular podcast, The BrainFood Show (iTunes, Spotify, Google Play Music, Feed), as well as:

Bonus Facts:

Early models of the NES Zapper gun could be tricked into thinking the target was always hit by simply pointing the gun at a bright light source and pulling the trigger.

Interestingly, if you read over the patent for the NES Zapper Gun, one of the main features they point out which separates their gun from previously patented light detecting guns is that in the “preferred embodiment” of their system, it has the ability to distinguish between multiple targets in one frame. However, that’s not actually what they did in the NES system; rather, they used multiple frames, one per target, as described above. In a “one frame” system, it uses a signal from the TV itself. This signal is in the form of pulses which signify the start of the horizontal and vertical retracing. The computer hooked up to the TV can use these pulses to more or less tell what area is currently being traced on the TV; it can then time this with a shift in light detected by the photodiode. Thus, with precise enough timing, it is able to detect which target is being hit in just one frame. With this method, the flash can happen fast enough that it’s nearly imperceptible to most people, unlike in the actual NES system where when multiple targets are shown, most people can perceive the flash. The NES system did use the vertical retrace signal to be able to detect the start of each frame though, but didn’t use it to detect anything about the position of the target as in the “preferred embodiment” described in the patent.

Although not initially very popular or critically acclaimed in any way, Duck Hunt has become something of a cult classic and was recently rated the 77th best NES game of all time by IGN.

The NES Zapper was first released to the masses in 1985 when the NES first began being sold in the United States, being bundled with the system and Duck Hunt.

Expand for References: