Video game light gunThe light gun is a fondly recalled (though often financially unprofitable for the makers) control device for arcade games and console video games. The device is modeled after some sort of weapon, usually a pistol or bazooka, and is used for targeting characters on the screen. The most popular example of this would be Nintendo's Zapper gun for the Nintendo Entertainment System, though there are light guns for Sony PlayStation, Sega Dreamcast, Magnavox Odyssey and undoubtedly several other console and arcade systems. It is similar in principle to the Light pen.
The "light gun" is so named as it uses light as its method of detecting where on screen you are targeting. The name leads one to believe that the gun itself emits a beam of light, but in fact all light guns actually receive light through a photoreceptor diode in the gun barrel. The diode uses light reception to do its targeting, in conjunction with a timed mechanism between the trigger of the gun and some rather smart graphics programming. There are two versions of this technique that are used commonly, but the concept is the same. When you pull the trigger of the gun, the screen is blanked out to black, and the diode begins reception. All or part of the screen is painted white in a way that allows the computer to judge where the gun is pointing based on when the diode detects light.
The first detection method, used by the Zapper, involves drawing each target sequentially in white light after the screen blacks out. The computer knows that if the diode detects light as it is drawing a square (or after the screen refreshes), that is the target the gun is pointed at. Essentially the diode tells the computer whether or not you hit something, and for n objects, the sequence of the drawing of the targets tell the computer which target you hit after 1 + ceil(log2(n)) refreshes (one to determine if any target at all was hit and ceil(log2(n)) to do a binary search for the object that was hit). An interesting side effect of this is that on poorly designed games, often a player can point the gun at a light bulb, pull the trigger and hit the first target every time. Better games account for this by not using the first target for anything.
The second method, used by the Super Nintendo Entertainment System's Super Scope and the EGA's light pen, is more elaborate but more accurate. The trick to this method relies on the nature of the cathode ray tube inside the video monitor; it does not work with LCD projectors. The screen is drawn by a scanning electron beam that essentially travels across the screen starting at the top until it hits the end, and then moves down to update the next line. This is done repeatedly until the entire screen is drawn, and appears instantaneous to the human eye as it is done very quickly. When the player pulls the trigger, the game brightens the entire screen for a split second, and the computer (often assisted by the display circuitry) times how long it takes the electron beam to excite the phosphor at the location the gun is pointed at, and calculates the targeted position based on the monitor's horizontal refresh rate (the fixed amount of time it takes the beam to get from the left to right side of the screen). Once the computer knows where the gun is pointed at, it can tell if it coincides with the target or not. However, many guns of this type (including the Super Scope) ignore red light, as red phosphors have a much slower rate of decay than green or blue phosphors.
A game that uses more than one gun reads both triggers continuously and then, when one player pulls a gun's trigger, the game poll that gun's diode until it knows which object was hit.
As stated before, people love the light gun. It is very popular for arcade games, but has never caught on in the home video game console market. This is most likely because it was often a peripheral that had to be purchased separately. Consumers rarely ever buy more than one extra controller for their system, let alone a special-purpose and often pricey device, and so games centered around the gun were often found to be unprofitable and later re-tooled to use a standard joypad or especially a computer mouse. Ironically, the lack of games is a significant factor as well in people deciding not to buy the peripheral.
UK December 2001 a Ballistic Light Gun and Pedal plus the Playstation game Time Crisis was selling for about £35 making the light gun a much more attractive proposition.