Main Restorations Software Audio/Jukebox/MP3 Everything Else Buy/Sell/Trade
Project Announcements Monitor/Video GroovyMAME Merit/JVL Touchscreen Meet Up Retail Vendors
Driving & Racing Woodworking Software Support Forums Consoles Project Arcade Reviews
Automated Projects Artwork Frontend Support Forums Pinball Forum Discussion Old Boards
Raspberry Pi & Dev Board controls.dat Linux Miscellaneous Arcade Wiki Discussion Old Archives
Lightguns Arcade1Up Try the site in https mode Site News

Unread posts | New Replies | Recent posts | Rules | Chatroom | Wiki | File Repository | RSS | Submit news

  

Author Topic: How does a Light Gun Work?  (Read 945 times)

0 Members and 1 Guest are viewing this topic.

Jabba

  • D-Hutt
  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 1643
  • Last login:November 16, 2020, 02:17:20 pm
  • I find your lack of faith...disturbing...
How does a Light Gun Work?
« on: March 12, 2004, 05:16:26 pm »
I just bought a control panel from a Night Stocker game:

http://www.klov.com/game_detail.php?letter=N&game_id=8870

Paid $25. It came with the Steering Wheel and the LightGun. For the life of me, I can't figure out how the light gun works. I get the trigger is most likely a switch, but how does the light gun know where you are shooting? Does it need a special screen or something? Can I set this thing up oin MAME?

Thanks for the help.
« Last Edit: March 12, 2004, 05:18:02 pm by jabba »
Vids:  Home built MAME machine, Crystal Castles. Arkanoid
Pins:   Williams Aztec (working). Stern Nugent (not working...yet), Williams Phoenix (major not working, missing parts.... )

Always on the lookout for buying 90's game with Ramps that need work...

NoOne=NBA=

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 2718
  • Last login:July 23, 2011, 08:59:16 am
  • Just Say No To Taito! -Nichibutsu
Re:How does a Light Gun Work?
« Reply #1 on: March 12, 2004, 05:59:28 pm »
I don't know whether you can get that one to work, or not.
My guess would be probably not.

How they work is pretty simple.
Actually, the EXACT way they work is pretty complicated, but here's the major points of the process.

You have the lens in the gun that focuses light on a sensor farther back in the gun.
When you fire, the other hardware (the box between the gun and your monitor, in the case of the PC guns) creates a screen flash.
This flash will either be a solid white, or a pattern.
Either way, the sensor looks at the "picture" it sees when the fire command was given, and sends data based on where the screen flash was at that moment.

In the case of the Act-Labs guns, the other hardware processes the data read by the sensor, and then tells the computer to move the cursor to that point, and process a fire signal.

The arcade guns (like what you bought) have their own hardware to process that signal.
That is why the PC guns are having trouble processing the off-screen "reload" shots on some games.
When the arcade guns don't see ANY of the screenflash, the hardware for them sends a "he missed the screen entirely, do a reload" message.
The Act-labs gun sends a "shoot at the last place he shot because THIS shot missed" signal.

SirPoonga

  • Puck'em Up
  • Global Moderator
  • Trade Count: (+1)
  • Full Member
  • *****
  • Offline Offline
  • Posts: 8190
  • Last login:August 14, 2025, 10:34:47 pm
  • The Bears Still Suck!
Re:How does a Light Gun Work?
« Reply #2 on: March 12, 2004, 06:07:12 pm »
actually, there are several different methods, but what NoOne mentioned is the popular method.

Most guns go by flash the screen method.  The NES lightgun blanked the screen black and had a white bounding box around the targets.

The DC is different, not sure exactly how it works, BUT you can point the gun in some game during clibration and crosshairs follow where the gun is pointing.

NoOne=NBA=

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 2718
  • Last login:July 23, 2011, 08:59:16 am
  • Just Say No To Taito! -Nichibutsu
Re:How does a Light Gun Work?
« Reply #3 on: March 12, 2004, 06:37:32 pm »
My guess would be that the DC hardware is set to poll the lightgun, much like the computer does with a mouse or tablet.

That would let it do a "live-track" like described.

It would basically be the same as the way a computer tracks the pen, even when it is above the tablet, but sends a click when the pen touches the tablet.

SirPoonga

  • Puck'em Up
  • Global Moderator
  • Trade Count: (+1)
  • Full Member
  • *****
  • Offline Offline
  • Posts: 8190
  • Last login:August 14, 2025, 10:34:47 pm
  • The Bears Still Suck!
Re:How does a Light Gun Work?
« Reply #4 on: March 12, 2004, 06:50:32 pm »
Obviously it is polling the lightgun, but how does it know where it is pointing?

NoOne=NBA=

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 2718
  • Last login:July 23, 2011, 08:59:16 am
  • Just Say No To Taito! -Nichibutsu
Re:How does a Light Gun Work?
« Reply #5 on: March 12, 2004, 07:33:51 pm »
I haven't actually seen it done, but my guess would be that you have to move the gun to the edges of the screen during calibration.

I'm not sure if there is a calibration screen, or not, during that time.
If there is, it would be a simple matter of the gun following the calibration pattern, and showing the cursor movement at a specified interval.

It may also track the cursor USING the cursor, and keep trying to "recenter" the cursor to the sensor in the gun until it bumps the edge of the screen.
At that point, the cursor wouldn't move any farther, but the gun would continue to register it as off-center, showing the gun where the edge of the screen is.

JustMichael

  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 1438
  • Last login:September 27, 2015, 01:19:40 am
  • Mmmmm!! Cheesecake!!
Re:How does a Light Gun Work?
« Reply #6 on: March 12, 2004, 09:02:56 pm »
A lightgun works by seeing light from the screen.  Let me explain how the screen is drawn then how the computer figures out where the gun is pointing.  The screen starts out blank.  The scanning beam then draws a single line from the top left corner to the top right corner of the screen.  The beam then shuts off and drops down 1 line and goes back to the left.  It then turns on and draws the new line (which is right below the first line).  This pattern is repeated until the whole screen is drawn.  Once the whole screen is drawn, the scanning beam shuts off and goes back to the top left corner to draw the screen again.  The computer can figure out where the lightgun is pointing by taking the difference in time from when the screen started drawing to when the lightgun saw the light.  I hope this makes it clearer.
« Last Edit: March 12, 2004, 09:06:11 pm by JustMichael »

lokki

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 647
  • Last login:May 05, 2025, 06:18:51 pm
Re:How does a Light Gun Work?
« Reply #7 on: March 12, 2004, 11:16:40 pm »
« Last Edit: March 12, 2004, 11:19:34 pm by lokki »