Jump to content
  • Advertisement
Sign in to follow this  
invictus

Programming against those good old laser gun input devices

This topic is 4478 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi I was wondering if anyone has any information about how to program against those good old laser gun input devices we know from consoles and computers? I really would like to try it out sometime. Thanks in advance :)

Share this post


Link to post
Share on other sites
Advertisement
I was thinking of designing a light gun a while ago. The problem I faced was that I needed to know which scanline the CRT is tracing. I think there is a function in DirectX that tells you the current scan line but it may be device dependent.

If you have an TFT LCD monitor then forget about using a light gun.

I think they work by starting a ramp generator everytime a new scanline is traced out and when you press that trigger button**, the scanline count (The gun keeps track of this with an internal counter that is refreshed on the vertical blanking pulse) and the analog value of the ramp which is then converted to a digital code and this is passed to the computer as an x,y pair.

** There is a little magnifying glass before the photodiode sensor (You can see this if you stare down the barrel of a light gun) This is to magnify the screen so much so that all that photodiode sees is 1 pixel

I am not sure if this is how they really do it but this seems most logical. (And it is they way I would do it)

Maybe someone out there can either confirm it or know of how they do it. :)

Share this post


Link to post
Share on other sites
it depends on the light gun type, doesn't it? The old nintendo one had that thing you put on the tv that measured the x and y offset...but i remember seeing one fairly recently for the ps2 that just plugged in as a controller and was useable without one of those x-y things (although it had terrible accuracy)

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Nah, the old nintendo one doesn't need anything extra, just plug it in and you're off playing duck hunt.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Or maybe you are talking about the SNES gun.

Share this post


Link to post
Share on other sites
The old NES light-gun was only used for duck hunt, I think.

The way it worked was as follows:

Whenever the trigger was pulled, a white square was briefly, for one frame, flashed at the duck's current position, while the rest of the screen was black. This was quick enough that the user only noticed a "flash," as if his gun had fired in reality.

Then the lightgun simply checked to see if it was seeing white or black. If it saw white, it triggered a "hit." If not, it was a miss.

You could fool around and cheat by using a flashlight to simulate the square, triggering a "hit" every time.

Edit: The following wikipedia article has perhaps a better explanation: http://en.wikipedia.org/wiki/NES_Zapper

Share this post


Link to post
Share on other sites

The link below describes a couple of methods. I was almost right as method 2 explains :)

This probably explains why you also had to plug those GCON light guns for the PS2 into the video in port on your TV/VCR

http://en.wikipedia.org/wiki/Light_gun

Share this post


Link to post
Share on other sites
I had never understood how that thing worked. I learned something new. :)

As I recall, there were more games than just Duck Hunt that used it. Weren't there some where you shot gophers and other things like that?

Share this post


Link to post
Share on other sites
Quote:
Original post by helix
I had never understood how that thing worked. I learned something new. :)

As I recall, there were more games than just Duck Hunt that used it. Weren't there some where you shot gophers and other things like that?


Yes, by looking at the Wikipedia there is apparently more games than I thought would be supported by the gun.


Quote:
Quote from Wikipedia Article

Games



The Adventures of Bayou Billy
Baby Boomer
Barker Bill's Trick Shooting
Chiller
Duck Hunt
Freedom Force
Gotcha!
Gumshoe
Hogan's Alley
Laser Invasion
The Lone Ranger
Mechanized Attack
Operation Wolf
Shooting Range
To the Earth
Track & Field II
Wild Gunman



Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!