Slashdot Mirror


How do TV-Based Video Game Guns Work?

mark juncosa asks: "It is a mystery to me how Nintendo's Duck Hunt gun works. I have thought about it for a long time and have not been able to come up with any kind of good solution." Come to think of it, I wouldn't mind knowing this one myself. On a guess, I'd say that the system is entirely active and all the work being done by the gun and the TV remaining the display device that it always has been. Am I close? Or completely off base?

5 of 21 comments (clear)

  1. Like a light pen, I believe by The+Famous+Brett+Wat · · Score: 2
    I'm not in a position to give an authoritative answer, since I've never fiddled with the electronics of such a device or seen a specification, but since nobody else seems to have replied yet, here's my two cents worth.

    Duck Hunt is actually one of the simpler variations on the theme. The arcade games (Virtua Cop, The Lost World, etc) have a more impressive system. In Duck Hunt, when you pull the trigger, the targets (ducks) are replaced with solid white squares and a black background. (This is assuming you mean the original Duck Hunt and not some more recent release of which I'm unaware.) The gun then acts as a light detector, and the game measures the light input on the gun at that instant and judges whether you hit or not. If the game is particularly clever, it will have a full frame of black before and/or after the frame with the white squares to measure the difference between the two. This reduces the chance of false triggering.

    The smarter guns are probably rather more sensitive and well focused. It's possible to detect which part of the screen the gun is pointing at by causing the gun to trigger a latch on a raster beam counter when it reaches a certain light threshold. At the end of frame, read the value out of the raster beam counter register, and that provides your gun coordinates. If the gun is not pointing at the screen, then the register will not have latched, and the value will be some unreasonably high value. Alternatively, if the gun is pointing at some bright object other than the screen, then the latch will trigger immediately, and you will get a zero result in your register.

    This second "precise" mode means that you must output a minimum level of light at all points on your screen that you wish to be able to target. If the light output at any point on the screen falls below your trigger threshold, then the register will not be latched when the gun is pointing at that part of the screen, and it will look as though the gun is not pointing at the screen at all.

    I suppose I should take a little side-track into television theory here, just in case. Your screen is painted by an electron beam in a left to right and top to bottom manner, like the way English text is written. When the electron beam hits the phosphorous coating inside the glass, the phosphorous glows momentarily, emitting a characteristic spectrum of light (primarily red, green, or blue in the case of a colour monitor). This glow is actually quite brief, and if you saw the light output level of any particular point on the screen expressed as a graph, you'd wonder why the screen doesn't look like it's flashing. A trick of the eye and mind, known as Persistence of Vision, causes the image to look solid. In fact it is not solid, but flashing rapidly and unevenly, and this is what allows a light-sensor to be used to detect your aim. Other display technologies, such as LCD displays, may not be amenable to this kind of technique, depending on whether they use a measurable form of display refreshing.

    As a side note, the late lamented Amiga actually had the required hardware to support this behaviour for the purposes of using a light pen, so I'm not making this up entirely. The Amiga also had the necessary raster beam counter register and latching facility, of course, although it only resolved to the equivalent of "lo-res" pixels. I never saw an actual device that utilised this hardware, unfortunately.

    --
    proof, n. A demonstration that a conclusion is implied by certain premises and axioms.
  2. Not quite faster than the eye by stile · · Score: 2

    Well, first of all, you can see, if you shoot the gun, that the display flashes white squares where possible targets are. I haven't played for ages, maybe I should break out my nintendo. Now, the problem of detecting a hit is simple, based on the white-square-flash. It's a matter of contrasting colors.
    But that brings up a good point. I was thinking perhaps that the color of light might be used to detect which out of several possible targets was hit. But you have to think about this, they had to make the nintendo/gun to work on the widest range of technologies possible. I don't think they would have gone with the raster-timing method, for the simple reason of LCD screens. I don't know if lcd screens were OUT then, but they had to be thinking about possible technologies for which this wouldn't work.
    That brings up another point: You can easily change the colors on your television set. The set can be black/white or color, and especially if it's color, you could make that nice pearly "white" show up as greenish, bluish, or reddish. So it has to be done by contrasting colors.
    Ah, idea just occurred. You pull the trigger, the game flashes black, whites out _ONE_ location of an object, blacks that, lights the second, blacks that, etc. All the while reading input from the gun. If the gun can detect simple contrasting colors, this'll work. Furthermore, the chances of shooting at a light and hitting it at the right instant (think 60 hz bulbs, or different, people) makes it unlikely to register a hit. And if it does? So what. Easy win. D'oh. Play fair, dorks :)

  3. tracking the electron beam by inburito · · Score: 2
    I recall reading that all of the tv-based video game guns work essentially according to the same principles. You have a highly focused light detector attached to the end of the gun. It will track sudden changes in light intensity and report them back to the computer.

    In a normal tv-screen there is an electron beam sweeping the screen starting from the top left corner progressing to the right and after reaching the end of the line moving down to the next one. On a normal tv-screen this is done for every line on the screen exactly 50 times / second(60 if you live in us).

    Now, when the electron beam hits the phosphorous coating on the screen it flashes briefly. Having this done 50(60) times per second creates an illusion of a continuosly lighted surface.

    It is these brief flashes that your gun tracks and dutifully reports to the computer. Computer, responsible for drawing the picture, is always aware of the pixel it is currently drawing(at least most of the video game hardware is built with this feature) and can extract the location the electron beam is pointing when it receives a signal from the gun. And if you happen to be pressing the trigger then maybe something should happen at that location.

    This technology is rather limited though. For instance, it doesn't work on lcd's (maybe by varying the intensity of pixels thus simulating the effect of the electron beam lighting up individual pixels, don't know of anyone actually trying this though). I can also imagine this thing having a hard time with 100hz tv's that are getting more popular in europe. Then again, how many of us actually use a cheapo game console on a tv that doesn't comply to the normal requirements.

  4. Try a VCR by billh · · Score: 2

    For what is is worth, my brother and I used to cheat at Duck Hunt by taping the game, then hooking up another monitor and playing the tape back until we found where we had shot. Using freeze frame, you could then play the game on the original monitor and hit everytime.

    It has been a long time, but I seem to remember that when you shot, the screen would go black and the ducks would show up as white blocks. Anyone with a Nintendo, a VCR, and too much time on their hands could easily verify this...

  5. Comment removed by account_deleted · · Score: 2

    Comment removed based on user account deletion