30

Modern motion detection video game systems (Wii/Wii U, Xbox Kinect, PS Move, etc.) need sensors to read for motion and user input. However, when you play Duck Hunt (and some other games) on the NES, the light gun has no sensor. How does the game know where you are aiming, and if it doesn't need a sensor to track motion, why do modern game systems need them?

3

2 Answers 2

32

The Zapper worked by receiving light through the photodiode at the front of the gun in the barrel.

mental_floss has a really great description of what happens:

When you point at a duck and pull the trigger, the computer in the NES blacks out the screen and the Zapper diode begins reception. Then, the computer flashes a solid white block around the targets you’re supposed to be shooting at. The photodiode in the Zapper detects the change in light intensity and tells the computer that it’s pointed at a lit target block — in others words, you should get a point because you hit a target. In the event of multiple targets, a white block is drawn around each potential target one at a time. The diode’s reception of light combined with the sequence of the drawing of the targets lets the computer know that you hit a target and which one it was. Of course, when you’re playing the game, you don’t notice the blackout and the targets flashing because it all happens in a fraction of a second.

Here's an image from Nintendo's Video target control and sensing circuit for photosensitive gun patent on how the hardware works:

Zapper Patent Page 1

More images on the entire process flow are also available in that patent link.

This is why if you pointed the Zapper at a white light you would automatically hit any target with perfect accuracy, at least in Duck Hunt.

6
  • 5
    Here's a great video explaining it as well.
    – BruceWayne
    Aug 13, 2016 at 2:37
  • 2
    To your last comment, I remember reading that later games would blank the entire screen first, and make sure the photodiode reads low, then put a white box on the screen. It delayed the process by 1 frame, but defeated the cheat of pointing at a bright light.
    – Cort Ammon
    Aug 13, 2016 at 4:45
  • @CortAmmon Indeed, agent86's answer on Arquade linked by angussidney describes that exact technique.
    – user
    Aug 13, 2016 at 12:50
  • 1
    I actually find the second part of the OP's question, which wasn't addressed here, more interesting: Why there was a general switch from video feedback to motion tracking technology.
    – Jason C
    Aug 13, 2016 at 21:27
  • The quote's description of "the computer in the NES" doing things is a bit misleading, since it sounds like this is some kind of hardware feature that happens automatically. In reality it's a software thing, where the game checks if the Zapper's trigger has been pulled, and if so, temporarily sets the background to a dark color while drawing a bright shape in place of each target sprite one at a time and checking if a hit is registered for that target.
    – Michael
    Aug 23, 2016 at 8:30
10

Quality light guns rely upon the fact that television sets not only used to draw the picture top to bottom, left to right, but they did so with timing controlled by the video source. On black and white television sets, the electron beam would switch on and off almost instantly in response to changes in the input video signal; color sets needed to add a little delay for color processing, but depending upon the color encoding used (which varies between PAL, NTSC, SECAM, and other video formats) the delay would either be less than 1/100 of a scan line, very close to one scan line exactly, or very close to two scan lines exactly. A quality light gun which saw a pulse of light could infer that the beam must have just passed the spot upon which the gun was focused; since it knew where the beam was at any moment, that would tell it where the gun was pointed.

A limitation of this approach is that it only works well for parts of the screen that are fairly bright; the light gun won't be able to see parts of the screen that are dark. Games with a light gun must ensure that any portion of the screen for which the gun needs to register a position will be bright enough to be detected. Some games flash the entire screen white for that purpose; I'm not positive whether the NES flashes the ducks (versus the whole screen) because flashing a smaller area is less annoying than flashing a large one, or because it can't sense timing well enough to determine beam position and is simply looking for a bright flash, but some other light guns were capable of sensing where on the screen the gun was pointed.

7
  • 4
    While quality light guns work that way, the video linked to in BruceWayne's comment explains how the NES light gun works and demonstrates that the NES light gun doesn't work that way at all. In particular, the video explains why it's not possible to just aim the gun at a bright light to always score a hit -- the screen blacks out completely first before showing the squares that represent the targets. If the black screen isn't detected first, the gun won't register a hit. youtu.be/c3tBk-LYyzo?t=9m23s
    – Johnny
    Aug 13, 2016 at 4:55
  • 2
    I figured that the question asked about the NES in particular, it would likely be read by people wondering how any kind of vintage light gun worked. Interestingly, the Atari 2600 was intended to use the "high-quality" approach to reading a light gun even though it would be unable to show anything on the screen while it was watching for a light-gun trigger; I think one game was actually written for the 2600 light gun (Crossbow) , and it shows a gray screen for a frame when the trigger is pulled. I wonder if the light gun might have been more popular if the inputs could have...
    – supercat
    Aug 13, 2016 at 16:50
  • 1
    ...reset the missile locations (so software could figure out where the light gun hit was registered by using collision registers to detect the locations of the missiles afterward, rather than having to use a loop that could only check for a light-gun hit once every 15 pixels).
    – supercat
    Aug 13, 2016 at 16:52
  • 2
    I know this is old, but I wanted to clear up a very common misconception about the NES Zapper. supercat's answer is right on target. NES programs must poll the Zapper at least every couple of scanlines, or it will not detect the light. It is possible to make the entire screen white, and precisely detect which scanline the Zapper is pointed at by counting the elapsed CPU cycles. Problem is, everyone looks at Duck Hunt and assumes that's just how the Zapper works. Duck Hunt is polling the Zapper, but isn't counting scanlines. But the capability is there, I'm sure some later games do.
    – Memblers
    Mar 28, 2018 at 5:59
  • 2
    I'm familiar with this because I've coded for the NES w/Zapper and have done this vertical position detection myself. Horizontal detection doesn't really work, but vertically (per scanline) it is 100% precise. For some good example programs, look up Zap-Ruder and ZapPing by Damian Yerrick.
    – Memblers
    Mar 28, 2018 at 6:07

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .