Want to read Slashdot from your mobile device? Point it at m.slashdot.org and keep reading!

 



Forgot your password?
typodupeerror
×
Games Entertainment

How do TV-Based Video Game Guns Work? 21

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?
This discussion has been archived. No new comments can be posted.

How do TV-Based Video Game Guns Work?

Comments Filter:
  • It was explained to me like this:

    The stuff on the screen flash faster than the eye can pick up, and in a unique patern per section of a grid on a screen. When you pull the trigger, it registers the flash patern of the part of the screen that the gun is aimed at. The gun then sends the info about which section of the screen it "hit" back to the console system, which then reflects said "hit" on the screen.

    This explanation made sense to me... I'm sure there's a whitepaper somewhere explaining it much better than I can.
  • 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.

  • 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 :)
  • That's a good point. Perhaps we should look at hogan's alley, and other shooting games, see if they do the same. One thing though.
    Shooting away from the screen is how you select the game, and shooting the screen is how you start it. How's it going to tell the difference? Now, my guess has to be that it just gets a brightish color. Someone should try with weird colorization on their TV, see what the game does. Furthermore, think from a design point of view, specifically from the view of "What can the user do to screw this up?" Once it's calibrated, they could easily just change the colors. Especially if it had to be a different color for their favorite TV show, but they decided that reddish brown hills didn't look good for clay pigeon shooting. So, though I had thought briefly of the fact that it could calibrate, I think it doesn't.

    BTW, note that the gun itself has a little lens in it. I think it looks at a VERY narrow part of the screen in doing its calculations.
  • No, I don't think that's how it works. Remember, Nintendo has to be able to make their product REALLY SUPER compatible with everything out there; you can't patch a cartridged game. I don't even think it has to do with rastering, because lcd's might be used, and quite definitely, EVERY different brand/make of TV has different synchronization rates (I think? I mean, this sounds quite logical to me.) Furthermore, tv sets can be different. I doubt it has to do with the rendering of pixels and the time it takes to get to a certain one.
  • Actually, it seems I already had my nintendo out to play dr. mario, you know, when you get nostalgic for the old 8bit days ;) So, I dug up my gun and gave it a try. I saw that yes, the white squares do flash. I tried fiddling with my controls to no avail, I can't confuse it. I guess my tv set's not fancy enough ;) And by the way, you CAN select which game you want with the first-player controller and your gun in the second controller slot. So it's not calibrating.
    I couldn't fool it with average incandescent lights (and by the way, I was wrong, incandescents are the ones that don't blink, fluorescents do, but I imagine it has to do with the color.)
    So, I set out to scientifically (?) test the theory that it flashes each target in succession. I figured that if I blinked fast enough, I could catch it when just one was lit and the other wasn't, and that would prove my theory that the target hit is decided by lighting each seperately. If I _COULDN'T_ see only one square, though, that wouldn't mean I was wrong, it would mean I hadn't proven the hypothesis.
    It took several tries, but I _DID_ manage to have my eyes open at one point just long enough to see only one square. Only once, mind you, but I think that that, coupled with the fact that this is the simplest and "most portable" solution, means I'm probably right. Ideas? How many of you are going to go try this now? ;)
  • 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.


  • Actually, the video game gun dates far further back than the Nintendo -- pong systems had them in the late 70s, so the technology used must be very simple.
    --
  • The Commodore 64 had a light pen too and I used several programs that used it. Primarily cad software, but also had some games for the kids that used it too.
  • The Duck Hunt system is fairly different from others.. for example, with Sega's Menacer gun or many arcade guns, there's a cursor on screen that constantly shows where you're aiming, so the gun has to be able to get a reading all the time without a flashing screen.
  • Alright, I was attempting to cover both bases by saying that either it won't work on lights, or it would but it'd be boring. That's interesting that it CAN be fooled like that.
  • Every different brand/make, as long as they are used for the same standard(pal/secam/ntsc) actually have exactly same synchronization rates. Only exceptions I'm aware of are the 100hz tv's, which tend to redraw their picture twice as many times per second as regular pal, and those new widescreen tv's(although these probably when used in the 'compatibility'-mode will have standard synchronization rates). For every computer monitor the synchronization rates do differ but even in that case you could probably somehow extract the information from the graphics card.

    Reason for this is the way video signals are encoded. There are synchronization signals inserted into the picture information to keep the picture from "running" - horizontal and vertical (line and frame). The hardware that generates the video signals has to insert the correct sync signals so that the device used to display the information can do it correctly. Now, when the tv-set starts to decode the signal sent to it it has to use this synchronization signals to lock on to the picture and it is restricted to the synchronization rates that it is provided with - which for obvious reasons have to be standardized (for a certain set of standardized synchronization rates you get a tv-standard, such as ntsc or pal - of course there is other stuff involved too).

    Several years ago, when amiga 500 was a new computer and C64's where still widely used, I recall reading from a computer hardware magazine instructions on how to make your own gun. It worked by tracking the electron beam and it did so very easily. I recall that it was for C64 and used very few lines of code to determine the position it was pointed at.

    If you start to think about nintendos. There have been guns from the very beginning of the original nintendo. When that thing came out about 99.999% of the tv's used were regular cathode ray tube tv's. Now the percentage of regular tv's may have shrinked to 99.9% but that is still certainly enough to keep the good old way of doing things still adequate. Most likely this feature is hardcoded into the actual console so that the game makers don't have to worry about different tv-standards. Console itself knows which standard it is displaying on and can read the correct values accordingly.

    Yes this thing doesn't work on lcd's or projectors or (maybe) on widescreens, but how big a percentage of the people using nintendos would actually use an lcd or projector to play their shoot them up games? Probably not big enough to worry about. Maybe someone has one of these and a nintendo with a gun at their disposal and could actually check whether or not it works. It'd also be interesting to know what'll happen if you point at a different tv-set than the one you're playing the game with. I don't have my playstation anymore(used to have a gun for that thing).

  • 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...
  • Years ago I dissasembled a tandy colour computer game that had a light gun. I stole the routines that got the gun x,y and made my own game.

    I know I could get the gun x,y, but I had to flash the whole screen white, then call this code. There was also some variation between samples. (about 5 pixels in both axis)

    I think the code did some stuff with the vertical retrace flag. I also believe the code did the vertical by counting from the vertical retrace, and the hardware did the horizontal, maybe with a phased locked loop watching the raster. If I still had all that stuff, I'd get a hardware dude at work to analyse it with a cro etc.

    BTW It was a Sega 'light phaser' with some custom box the game company (diecom) made. A very cool looking gun!

  • Comment removed based on user account deletion

It's a naive, domestic operating system without any breeding, but I think you'll be amused by its presumption.

Working...