Tricking Duck Hunt To See A Modern LCD TV As CRT

A must-have peripheral for games consoles of the 1980s and 1990s was the light gun. A lens and photo cell mounted in a gun-like plastic case, the console could calculate where on the screen it was pointing when its trigger was pressed by flashing the screen white and sensing the timing at which the on-screen flying spot triggered the photo cell.

Unfortunately light gun games hail from the era of CRT TVs, they do not work with modern LCDs as my colleague [Will Sweatman] eloquently illustrated late last year. Whereas a CRT displayed the dot on its screen in perfect synchronization with the console output, an LCD captures a whole frame, processes it and displays it in one go. All timing is lost, and the console can no longer sense position.

[Charlie] has attacked this problem with some more recent technology and a bit of lateral thinking, and has successfully brought light gun games back to life. He senses where the gun is pointing using a Wiimote with its sensor bar on top of the TV through a Raspberry Pi, and feeds the positional information to an Arduino. He then takes the video signal from the console and strips out its sync pulses which also go to the Arduino. Knowing both position and timing, the Arduino can then flash a white LED stuck to the end of the light gun barrel at the exact moment that part of the CRT would have been lit up, and as far as the game is concerned it has received the input it is expecting.

He explains the timing problem and his solution in the video below the break. He then shows us gameplay on a wide variety of consoles from the era using the device. More information and his code can be found on his GitHub repository.

We’ve featured [Charlie]’s work in the retro gaming field before, with his HDMI mod for a Neo Geo MVS. Console light guns have made a lot of appearances on these pages, a recent one was this video synthesiser but it’s this burning laser mod that most children of the 1980s would have given anything to own.

47 thoughts on “Tricking Duck Hunt To See A Modern LCD TV As CRT

  1. Despite his confusing intro, he correctly says the NES dose not track the flying spot. It is not fast enough. Instead drawing a frame with white for a hit, black for a miss and testing which you where pointing at.

    1. At least one unlicensed NES game (Strike Wolf) watched the continuous output of the Zapper to extract the Y coordinate (and THEN uses bounding boxes to calculate the X coordinate). Damian Yerrick’s modern homebrew ZapRuder also does the same, and even lets you play pong with two Zappers.

      It’s not the speed of the NES that prevents polling from detecting the X coordinate, but rather the Zapper’s use of an infrared demodulator IC (i.e. from a remote control) that causes enough jitter such that the X coordinate can’t be usefully extracted.

      1. Wow, you know the details! Why did they use an IR IC when everyone else just used photodiodes?

        I thought the reason the NES couldn’t track a light gun was because it didn’t have the hardware. Generally systems that used them had a counter in the video chip that kept track of the flying spot’s current position, that you could freeze when light hit the light gun. Some home computers didn’t have the hardware, and had to use software instead, reading the light sensor in software as fast as they could, once the trigger is pressed, over and over til the screen is scanned.

  2. I’m really surprised, because always supposed that it couldn’t work in such a precise way, and what those games did was, when the user pulled the trigger, just put the screen black, illuminate each target sequentially, and detect when the gun detects light (so, it must be pointing to the target that is illuminated in that precise moment).

    1. Actually many games use a more complex process to perform “anti-cheating”

      There is a full frame that is black where the gun is sampled. Any light detected registers as a miss.
      Then there is one frame per target with the target as a white block, to detect which target the gun is pointing at, if any.
      Finally there is once more a full frame of black where any light detected registers as a miss.

      This keeps you from just pointing the gun at a light bulb and pulling the trigger. Detecting light before and after the frames showing light typically means cheating.

      This is also why the timing problem caused by LCDs is so difficult to work around, and why so much is involved to do it successfully – as you can see here.

  3. I’ve been thinking about this “problem” too lately.. as have, apparently, lots of other nerds. It seems to be a retro-hacker form of armchair quarterbacking :)

    I would have never thought of this solution — and proper kudos to using a Nintendo Wii-mote on an NES! — though here are my muddlings on the subject that I’ve never put in to practice. Other ideas welcome, we may as well make a clearing-house for future generations :)

    #1) Could you use an Arduino to watch for the trigger pull and then send the “select” button to pause the NES so the LCD would have time to catch up?

    Probably not, since the NES control deck has to poll the controllers and I would expect that the polling routine is suspended while the shots are calculated due to the fine-grained timing required.

    #2) Could you watch for the trigger pull and then send and an interrupt to the cart or expansion slot interrupt pin to momentarily slow down the NES, just enough for the LCD to catch up?

    I don’t know enough about the NES hardware interrupts to say, but it would probably require changing of the game code as well.

    #3) Could you watch for the trigger pull and then start to fiddle with the XTAL clock? A switch that could increase the resistance of the signal going to clock crystal so that it would slow down? Or cut the signal from XTAL to the CPU completely for just a moment?

    * watch for trigger pull
    * wait for blanking interval
    * slow down NES clock for a moment so the LCD can catch up
    * restore clock and let the NES draw the hit box
    * slow the clock down again for LCD to catch up
    * restore clock and let NES detect the hit box
    * profit?

    This sounds the most possible, but I have a feeling that the NES clock crystal doesn’t work the way I think it works.

    1. I’m sure you could patch the ROM to make Duck Hunt less fussy about timings. I did look at how many code you can change using a Game Genie but when I saw the answer was one byte, I gave up on that idea.

  4. This is the exact kind of solution I had considered for years but it seems like any time you tried to mention on gaming forums figuring out a way to make light guns work with non-CRT displays there was always a flurry of negativity and comments saying it can never be done. It was as if no one could get past “The zapper doesn’t work with LCDs, therefore it can’t be made to work with LCDs.” So thank you for this. I imagine it will only be a few years before we see this whole thing packaged and sold as a Universal Light Gun.

    1. Generally it’s because the raspberry pi running linux isn’t that well suited for timing critical real-time applications like this one since your user process will get interrupted by other system tasks and writing a kernel module to get around it is difficult. And the arduino isn’t well suited for interfacing with complex protocols like a bluetooth wii remote on its own but it’s cheap so it makes perfect sense to combine the two. They even sell single board computers now that has the arduino embedded on the board!

  5. I’d like to see a duck hunt “robot” that fools the light gun into registering a hit each time and auto-plays the game. Or one that would actually track each target and fire the gun properly…

    1. That could happen pretty easily, I think. When you pull the trigger, the NES first draws a blank screen and the zapper takes a light sample. If the NES register light then it knows you’re not pointing it at the screen, so it will not register a hit.

      Then, on the next frame, it draws the white “hit box” square, and checks that the zapper is pointed at that box by checking if it sees white.

      You could directly interface with the pins on the NES controller port that signal the trigger pull and light sensor value to the NES. Send the trigger pull to the trigger pin, put the light sensor pin low for a moment and then put it high and the NES would (I’m guessing) register a hit.

      1. I think it has to be in sync with the video, when it generates the dark frame it looks for corresponding dark input from the light sensor, and then looks for a flash when it draws the box around the target. IIRC it draws dark, then it flashes everywhere /but/ the target, and then it flashes around the target (in sequence for multiple targets).

        1. Yeah, that’s the detection mechanism I’ve seed detailed before, so I think you’ve got it right. You could do the same thing done in this post, using an arduino do watch for the blanking interval and send signals based on that, or you could just “wing it” and guess at the proper timing (since the NES doesn’t vary the signal time based on TV, it just expects the TV to handle it).

    1. really, I swear, my cousins-brothers-friends-nephew says if you pull the trigger exactly 18 times right after the last duck flies off the screen you can actually shoot the dog! Just like in the arcade game! I saw it! Well, I talked to someone who said they saw it…

  6. If you can draw onto the video, and you can get the position input anyway you like, why not make a mouse pointer :) Use a normal PS/2 Mouse and drop the whole Pi part.
    The arduino could put the pointer on screen and detect mouse movement. A click would be a shot.

    While this would be only “sorta” fun for gun games it suddenly turns all light pen software on old computers into a modern mouse interface :)

    1. The first version I had working was a cursor controlled via an analog stick (it’s what the white wire and connector going to the Arduino was for). As you said, it wasn’t much fun to play that way though. The light pen idea is interesting though, will need to crack out my BBC Micro and give that a go someday.

  7. To interject a bit of humor here…. Back in the early seventies “Duck Hunter” was a commercial video game. I worked as vending mechanic for an amusement company that installed a Duck Hunter machine in the clubhouse of a local gun club. But within three days I got a service call to come fix the machine… Quickly discovered the problem. The patrons would come in from the skeet range – where they perhaps couldn’t hit the broad side of a barn – and would take their frustration out on the Duck Hunter machine… Problem was machine was so full of quarters it couldn’t take anymore!

  8. Great video, it explains perfectly how it works and why it no longer works and then how it can be solved. I must acknowledge the confusion about the workings of duck hunt, but that’s just a minor detail.
    Thanks for posting.

    PS: I noticed that you have a C64 underneath your TV cabinet… not many lightgun games were made for that system. If there are people interested in more info about the C64 and lightguns then see this website:

    1. Yes, in hindsight I could have changed the video around a bit and made it less confusing. Thanks for the feedback.

      I never knew the C64 had any light gun games for it but I guess light pens were all the rage back then so maybe they had the hardware for it. Interesting, thanks for letting me know.

  9. Do the Sega Megadrive/Genesis light guns use the same system? I tried mine on a salvaged CRT, but it has some kind of “100Hz” processing that I’ve not been able to turn off that ruins lightguns.

    1. From what I understand the NES Zapper used timing of flashes on the screen to determine where the gun was pointed, and it will supposedly anyway work with SOME plasma TVs but not LCDs although I have yet to actually test it as I don’t have a plasma TV. The SNES light gun as well as the Sega light gun, used timing to determine what line of video was being drawn and where the gun was pointed (The article above explains it) but like the article says, due to the fact modern TVs draw the screen a whole frame at a time, this timing information isn’t present so the gun doesn’t work.

  10. 1. This solution is awesome, I’m not arguing that!

    2. The breakdown of why it no longer functions and how it used to work is pretty sweet, but…

    3. I think it’s hilarious he called it a “simple device” at the start of the video then shows a RasPi linked to an Arduino linked to a WiiMote linked to an LED jammed in the end of the zapper, all while doing analog video interception AND overlay. “Clever” is a much more apt single word to describe his contraption.

  11. Why does it seem to me that it would be less work to take a pic of the screen with a cam and if the target object is centered, award the shot. You’d have to train it for each game though, to recognize what you’re supposed to hit.

  12. Is anyone selling the guns that are being rebuilt to use on the newer t.v.’s? If so could someone please contact me
    I finally found the original system an some of my fav games
    . but of course duck hunt was my all time fav some one please help

  13. For mame, all guns are seen as a mouse so all this is pointless. A better solution is to use a positional gun which moves with pots. This is how a large number of arcade games worked anyway, so you could even use a real arcade gun. The few real light gun games are still playable in mame with a positional gun. It’s not ideal but no worse than any of these light gun replacement technologies for modern displays.

Leave a Reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.