Skip navigation
Welcome, Guest! Please Login or Join

Loading...

NES Light Gun: Where can I read up on it's functionality and how to homebrew for it?

Sep 28 at 1:59:51 PM
rlh (39)
avatar
( Potatoe!) < Lolo Lord >
Posts: 1675 - Joined: 09/06/2016
North Carolina
Profile
Ok, the question in the title stands and I do want to know the answer to it, secondary to my remaining questions and remarks.  Anyway, where can I find documentation on coding for the light gun?

I also have another question.  Is it at all, theoretically speaking, possible to code games that could work with modern HDTVs?  Here my logic.

My underlying assumptions might be incorrect, but it's my understand that the reason why the NES running through an HDTV can't work with the light gun basically boils down to the timing of specific frames and when the NES expects the light gun to register certain changes on the CRT.  CRTs could display data from the NES with near-zero latency while upscaling algorithms and analog-to-digital converters can't show the video content from the NES fast enough. Essentially, the frame used for the hit-test takes to long to show up on the screen.

So... if we have low-level control of the light gun/NES, could a time delay not be encoded into the trigger pull registry event and we delay the screen hit test by a specific number of milliseconds?  Additionally, you could change the screen update code to show the Black/White light gun screen for two frames rather than one, which could make it a little easier for the light gun to see the hit-test image.  This may be noticable to the gamer BUT it could allow for light gun games to be made for HDTVs.

I have only a moderate understanding of the problem and I also have no knowledge of the low-level light gone specifics, but it seems to me that with a bit of tricky-coding one could possibly make this work.  If this is still not possible, could one explain the reasons why that still wouldn't work?  What's the blocker?

-------------------------
[My FO/FT and WTTF NA Posts]
~ OR ~
[GameValueNow.com List: WTTF]

Sep 28 at 2:05:03 PM
Tulpa (2)
avatar
< Master Higgins >
Posts: 8079 - Joined: 12/24/2013
California
Profile



Sep 28 at 2:22:46 PM
rlh (39)
avatar
( Potatoe!) < Lolo Lord >
Posts: 1675 - Joined: 09/06/2016
North Carolina
Profile
That's getting close, but I'm thinking more along the line of homebrew titles. I mean, no one from 1984-94 would even think of making a delayed-check for the the light pixels because that wasn't even required. But we could do it today.

Again, if the gun is reading a single pixel off the screen, from within the white hit box, all you need to do is make sure the gun reads the pixels at the right time. If you can delay the read for, say, 100 milliseconds, and display the entire frame for 67 milliseconds (2 frames at 30 FPS) you should/might be able to use a light gun on an HDTV.

Ok, shoot holes in this theory. If not, I might actually try to homebrew a proof of concept just for kicks and grins... but to even try, I need documentation on developing for the light gun, which is why I asked in the first place.

-------------------------
[My FO/FT and WTTF NA Posts]
~ OR ~
[GameValueNow.com List: WTTF]

Sep 28 at 2:45:47 PM
Mega Mario Man (58)
avatar
(Tim ) < Kraid Killer >
Posts: 2322 - Joined: 02/13/2014
Nebraska
Profile
Documentation:
https://wiki.nesdev.com/w/index.p...

I think the issue is more than just delay. I'm not a hardware guy. If you search the Brewery, bunnyboy has some posts on the challenges.

-------------------------
Current Project
Isometric Survival Horror

Older Projects
Tailgate Party, Power Pad Demo, Happy Hour

Links
Store, Facebook, Twitter

Sep 28 at 2:46:25 PM
Tulpa (2)
avatar
< Master Higgins >
Posts: 8079 - Joined: 12/24/2013
California
Profile
Originally posted by: rlh
Again, if the gun is reading a single pixel off the screen, from within the white hit box, all you need to do is make sure the gun reads the pixels at the right time. If you can delay the read for, say, 100 milliseconds, and display the entire frame for 67 milliseconds (2 frames at 30 FPS) you should/might be able to use a light gun on an HDTV.
I'm wondering if the fact that modern HDTVs are fixed pixel displays (displaying all pixels in a frame at once) will make isolating the needed pixel impossible, as opposed to a CRT that draws each one.
 

Sep 28 at 2:56:17 PM
Mega Mario Man (58)
avatar
(Tim ) < Kraid Killer >
Posts: 2322 - Joined: 02/13/2014
Nebraska
Profile
I would say your best bet to make this work is to leave the white box on the screen for a few frames to give the light sensor enough time to see it. The challenge with that will be not registering more than 1 hit (since it checks every frame), but that may easily be coded to not allow that. I too have thought about ways to get around the issue with Homebrews so I'm interested to hear your findings.

-------------------------
Current Project
Isometric Survival Horror

Older Projects
Tailgate Party, Power Pad Demo, Happy Hour

Links
Store, Facebook, Twitter

Sep 28 at 3:08:16 PM
Mega Mario Man (58)
avatar
(Tim ) < Kraid Killer >
Posts: 2322 - Joined: 02/13/2014
Nebraska
Profile
One limitation that may make this not work is that it looks like you have approximately 100ms after the trigger has registered "pull" to find your target that was hit because of hardware in the gun. If the delay is longer than that, then the trigger is registered as released.

-------------------------
Current Project
Isometric Survival Horror

Older Projects
Tailgate Party, Power Pad Demo, Happy Hour

Links
Store, Facebook, Twitter

Sep 28 at 3:21:04 PM
rlh (39)
avatar
( Potatoe!) < Lolo Lord >
Posts: 1675 - Joined: 09/06/2016
North Carolina
Profile
Originally posted by: Mega Mario Man

One limitation that may make this not work is that it looks like you have approximately 100ms after the trigger has registered "pull" to find your target that was hit because of hardware in the gun. If the delay is longer than that, then the trigger is registered as released.
Yeah, that was my main question and why I wanted to find solid dev documentation on the light gun.  I didn't know if it was a little more simple where your software would hear "The trigger's been pulled" and then the game had an infinite amount of time to check a registry flag that is always reading whether a pixel is being hit, or not, over a specific threshold.

Anyway, I don't have much time for homebrewing a game, per se, but making a test ROM/app might be worth the effort. Now i just need to find the easiest/cheapest way to get a reflashable NES cart that can be used in an NES but, that's a personal exercise.

 

-------------------------
[My FO/FT and WTTF NA Posts]
~ OR ~
[GameValueNow.com List: WTTF]

Sep 28 at 3:32:49 PM
Mega Mario Man (58)
avatar
(Tim ) < Kraid Killer >
Posts: 2322 - Joined: 02/13/2014
Nebraska
Profile
Originally posted by: rlh
 
Originally posted by: Mega Mario Man

One limitation that may make this not work is that it looks like you have approximately 100ms after the trigger has registered "pull" to find your target that was hit because of hardware in the gun. If the delay is longer than that, then the trigger is registered as released.
Yeah, that was my main question and why I wanted to find solid dev documentation on the light gun.  I didn't know if it was a little more simple where your software would hear "The trigger's been pulled" and then the game had an infinite amount of time to check a registry flag that is always reading whether a pixel is being hit, or not, over a specific threshold.

Anyway, I don't have much time for homebrewing a game, per se, but making a test ROM/app might be worth the effort. Now i just need to find the easiest/cheapest way to get a reflashable NES cart that can be used in an NES but, that's a personal exercise.

 
The easiest and cheapest way is to get a Kazzo and one of their flashable boards. That's how I started. I got a 128kb UNROM flashable board and Kazoo with only the NES jack for around $35 plus shipping.

Fixed: Kazzo spelling error

-------------------------
Current Project
Isometric Survival Horror

Older Projects
Tailgate Party, Power Pad Demo, Happy Hour

Links
Store, Facebook, Twitter


Edited: 09/28/2017 at 03:37 PM by Mega Mario Man

Sep 29 at 1:17:04 AM
Memblers (3)
avatar
(Joey Parsell) < Eggplant Wizard >
Posts: 237 - Joined: 05/12/2008
Indiana
Profile
The short answer for Zapper on modern TVs is simply no, not possible.

The capabilities and limitations of the Zapper are widely misunderstood. Everyone looks at Duck Hunt and its white squares, but that's only part of the story. It doesn't just detect white, it also needs to match the horizontal refresh rate of the TV (which is 15khz). CRT VGA monitors for example are 30khz, the Zapper will not work with those either. LCD TVs do not have a horizontal refresh.

With the Zapper, you can fill the entire screen with white, and detect what vertical position on the screen the Zapper is pointing at. Duck Hunt doesn't do that, but I'm sure many other games do. You also can't just read the Zapper's light sensor once per frame like you would with a controller, you have to continually poll it.

-------------------------
 

Sep 29 at 9:22:46 AM
UKWildcats (5)
avatar
< Little Mac >
Posts: 85 - Joined: 02/10/2017
South Carolina
Profile
I have to think that we will eventually get the light gun to work. If we can clone a human being then surely we can figure out how to make a light gun work on modern televisions.

-------------------------
Licensed NES Games: 663/679
Unlicensed NES Games: 153/182
Licensed PAL NES Games: 6/34

Sep 29 at 9:25:22 AM
Tulpa (2)
avatar
< Master Higgins >
Posts: 8079 - Joined: 12/24/2013
California
Profile
Originally posted by: UKWildcats

I have to think that we will eventually get the light gun to work. If we can clone a human being then surely we can figure out how to make a light gun work on modern televisions.
We have light guns that work on modern TVs, but they require the sensor bar. If you watch the video, that is how it works.

 

Sep 29 at 9:59:14 AM
Mega Mario Man (58)
avatar
(Tim ) < Kraid Killer >
Posts: 2322 - Joined: 02/13/2014
Nebraska
Profile
Originally posted by: Memblers

The short answer for Zapper on modern TVs is simply no, not possible.

The capabilities and limitations of the Zapper are widely misunderstood. Everyone looks at Duck Hunt and its white squares, but that's only part of the story. It doesn't just detect white, it also needs to match the horizontal refresh rate of the TV (which is 15khz). CRT VGA monitors for example are 30khz, the Zapper will not work with those either. LCD TVs do not have a horizontal refresh.

With the Zapper, you can fill the entire screen with white, and detect what vertical position on the screen the Zapper is pointing at. Duck Hunt doesn't do that, but I'm sure many other games do. You also can't just read the Zapper's light sensor once per frame like you would with a controller, you have to continually poll it.
I knew there was more. I'm not a technical genius like Joe.  

 

-------------------------
Current Project
Isometric Survival Horror

Older Projects
Tailgate Party, Power Pad Demo, Happy Hour

Links
Store, Facebook, Twitter