Light Guns and LCDs

Light Gun LCD

56 replies to this topic

#1 Thomas JentzschOFFLINE

Thomas Jentzsch

Thrust, Jammed, SWOOPS!, Boulder Dash, THREE·S, Star Castle

• 23,940 posts
• Always left from right here!
• Location:Düsseldorf, Germany, Europe, Earth

Posted Thu Feb 2, 2017 12:07 PM

Before I get my light gun, I started wondering about the problems with LCDs and how to overcome them. Unlike a CRT, modern LCD have lags and delays.

A simple light gun detection for a CRT works like this:

• When you pull the trigger a black frame will be displayed and detected
• Then a frame with a white square instead of each target will be displayed and detected
• Finally the game returns to the normal display of the game

So display and detection are simultaneously for a CRT. For a LCD this is not the case. Here the reaction to a signal change is not immediate, so display and detection are not in sync. But the method with the white square should be working for a LCD too.

The LCD display logic would be like this:

• When you pull the trigger a number (b) of black frames will be displayed. b depends on the maximum time the LCD needs to switch from any brightness to black (or something detected as black).
• Then a number (w) of white frames are displayed. w depends on the time the LCD needs to switch from black to white (or something detected as white).
• Finally the game returns to the normal display of the game

The detection logic is decoupled:

• When you pull the trigger, the game logic waits for l + b frames and then tries to detect black l is the display lag of the LCD.
• w frames later, the game tries to detect the white square.

The picture below shows how the display types react to signal changes.

• At 0.5 (example brightness value) the normal game screen is displayed.
• When at the beginning of frame 0 the light gun trigger is pulled, the CRT reacts immediately and displays black (0.0) in frame 0. The LCD continues to display 0.5 for two frames and then needs another two frames to finally reach 0.0.
• The CRT displays the white square (1.0) in frame 1. The LCD needs some frames to switch from 0.0 to 1.0 and reaches 1.0 in frame 8.
• Then CRT (immediately) and LCD (slower) switch back to the game screen (0.5).

The example LCD values in the picture are:

• l = 2
• b = 2
• w = 3
• g = 2 (time required to switch from white on black to game display)

Here the whole process requires 11 frames (instead of 2 for a CRT), for 9 frames the LCD screen is flickering. The flicker will become much more noticeable, especially on slow LCDs. And it extends by one frame (CRT and LCD) for additional targets detection. The LCD values vary between LCDs and even for one LCD depending on its settings and mode. To identify the values, a calibration is essential.

So these are my thoughts. Please correct me where I am wrong or missed something.

#2 KeatahOFFLINE

Keatah

Missile Commander

• 21,848 posts

Posted Thu Feb 2, 2017 12:35 PM

The way I understand a lightgun to work is when the white screen is being drawn, T (timer) is set to 0. It then counts up. And by the time the white screen is finished being drawn. T= 0.016sec [1/60 msec per frame]

Now when the lightgun photo cell is triggered mid-frame. T has only had time to count to 0.008, so the game knows you shot the middle of the screen. If the counter made it to 0.016 then you shot the bottom of the screen.

Make sense?

#3 Thomas JentzschOFFLINE

Thomas Jentzsch

Thrust, Jammed, SWOOPS!, Boulder Dash, THREE·S, Star Castle

• Topic Starter
• 23,940 posts
• Always left from right here!
• Location:Düsseldorf, Germany, Europe, Earth

Posted Thu Feb 2, 2017 12:50 PM

That's the method the two existing Atari light gun games use. In theory it is very precise and flexible, in practice it doesn't work very well.

Anyway, this doesn't work for LCDs, because there is no beam. Instead I plan to use the NES Duck Hunt method, where a white square on a black screen is displayed instead of a target.

Here is a video explaining that:

#4 RevEngONLINE

RevEng

Bit Player

• 5,107 posts
• Location:bottom of the stack

Posted Thu Feb 2, 2017 1:13 PM

I've always felt a sequential targets type light gun might work with LCD, if the frame delay and white level is calibrated. The main concern is that each white box is displayed for only 1 frame, or you wont be able to have more than 1 target on the screen.

If the TV treats 240p as 480i, then you have this complication.

#5 Thomas JentzschOFFLINE

Thomas Jentzsch

Thrust, Jammed, SWOOPS!, Boulder Dash, THREE·S, Star Castle

• Topic Starter
• 23,940 posts
• Always left from right here!
• Location:Düsseldorf, Germany, Europe, Earth

Posted Thu Feb 2, 2017 1:17 PM

I've always felt a sequential targets type light gun might work with LCD, if the frame delay and white level is calibrated. The main concern is that each white box is displayed for only 1 frame, or you wont be able to have more than 1 target on the screen.

True. But for multiple targets you should at least be able to do a binary-search-like target selection. Then you need less frames.

If the TV treats 240p as 480i, then you have this complication.

Good point, probably you need an extra all black frame then.

#6 KeatahOFFLINE

Keatah

Missile Commander

• 21,848 posts

Posted Thu Feb 2, 2017 2:24 PM

Would it be possible to have two intensities to allow even more targets (2 per frame) to be detected?

#7 Thomas JentzschOFFLINE

Thomas Jentzsch

Thrust, Jammed, SWOOPS!, Boulder Dash, THREE·S, Star Castle

• Topic Starter
• 23,940 posts
• Always left from right here!
• Location:Düsseldorf, Germany, Europe, Earth

Posted Thu Feb 2, 2017 2:31 PM

No, its either on or off. But for detecting e.g. 4 targets, you only need 2-3 white rectangle frames.

• First display rectangles 1+2
• If there is a hit
• display 1
• If there is a hit, it is 1 else 2
• If there is no hit
• display 3+4
• if there is a hit
• display 3
• If there is a hit, it is 3 else 4
• If there is no hit, nothing is hit

You can detect n targets in log(n+1)/log(2) white rectangle frames.

Edited by Thomas Jentzsch, Thu Feb 2, 2017 2:35 PM.

#8 RevEngONLINE

RevEng

Bit Player

• 5,107 posts
• Location:bottom of the stack

Posted Thu Feb 2, 2017 2:33 PM

True. But for multiple targets you should at least be able to do a binary-search-like target selection.

Yeah, that's standard for sequential targets. But I'm thinking that some LCDs might not adhere to displaying 1 frame per source frame, either by 480i display or motion interpolation or whatever. This would smear the different white box frames together.

Might not be an issue, but any light gun code would need to be tested on various LCD TVs.

#9 Thomas JentzschOFFLINE

Thomas Jentzsch

Thrust, Jammed, SWOOPS!, Boulder Dash, THREE·S, Star Castle

• Topic Starter
• 23,940 posts
• Always left from right here!
• Location:Düsseldorf, Germany, Europe, Earth

Posted Thu Feb 2, 2017 2:43 PM

Yeah, that's standard for sequential targets. But I'm thinking that some LCDs might not adhere to displaying 1 frame per source frame, either by 480i display or motion interpolation or whatever. This would smear the different white box frames together.

Yup, that's another problem to overcome too.

Might not be an issue, but any light gun code would need to be tested on various LCD TVs.

Definitely! There are a lot of variables that have to be tested. Modern LCDs do quite a lot to ancient video signals.

I hope I find enough people with light guns and consoles attached to LCDs who can test thoroughly enough.

#10 CrispyOFFLINE

Crispy

Star Raider

• 65 posts

Posted Thu Feb 2, 2017 4:05 PM

There's always the option of adapting the Wii sensor bar and Wiimote to work with the 2600. Maybe even refit a light gun with the PixArt image sensor so that it uses the Wii sensor bar to detect position.

Edited by Crispy, Thu Feb 2, 2017 5:04 PM.

#11 KeatahOFFLINE

Keatah

Missile Commander

• 21,848 posts

Posted Fri Feb 3, 2017 3:06 AM

I agree. There's gotta be a lot of new technologies for making lightguns since the 1970's.

#12 Thomas JentzschOFFLINE

Thomas Jentzsch

Thrust, Jammed, SWOOPS!, Boulder Dash, THREE·S, Star Castle

• Topic Starter
• 23,940 posts
• Always left from right here!
• Location:Düsseldorf, Germany, Europe, Earth

Posted Fri Feb 3, 2017 3:08 AM

There's always the option of adapting the Wii sensor bar and Wiimote to work with the 2600. Maybe even refit a light gun with the PixArt image sensor so that it uses the Wii sensor bar to detect position.

Sure, there are hardware solutions. But a product which requires modified hardware reduces the already small user base even more.

Also I am no hardware guy, I try to find solutions by software only.

#13 grafixbmpOFFLINE

grafixbmp

Dragonstomper

• 683 posts
• Location:South Central US

Posted Sat Feb 4, 2017 2:20 PM

Could it be possible to devise a delay test built in to the game that has to be done before gameplay? Test is ran by pulling the trigger which starts a timmer and from that it continualy checks the screen for a response. When the gun gets screen feedback it stops the timmer and saves the value for gameplay. That way any and every tv will work with asort of "auto calibration screen sync"

#14 Thomas JentzschOFFLINE

Thomas Jentzsch

Thrust, Jammed, SWOOPS!, Boulder Dash, THREE·S, Star Castle

• Topic Starter
• 23,940 posts
• Always left from right here!
• Location:Düsseldorf, Germany, Europe, Earth

Posted Sat Feb 4, 2017 2:52 PM

Yes, that's my plan. But this has to be tested with many TVs before we can rely on it.

The algorithm I have in my mind looks about like this:

1. b = w = 1
2. display 10 white frames
3. display b black frames
4. display w white frames
5. display black frames
6. in parallel starting from step 2 the code does:
• i = x = y = 0
• while (light gun == on) && (i <= 10) i++
• if (i < 10) ERROR! (white frames not detected)
• while (light gun == on) && (x < 10) x++
• if (x == 10) b++; goto step 2 (we need more black frames)
• while (light gun == off) && (y < 10) y++
• if (y == 10) w++; goto step 2 (we need more white frames)
• lag = x + 1 - b;

Now lets verify those:

1. display 10 white frames
2. display b black frames
3. display w white frames
4. display black frames
5. in parallel starting from step 2 the code does:
• if (b > 1) at frame 10 + lag + b - 1: if (light gun = off) ERROR! (calibration failed, lag or b too high)
• at frame 10 + lag + b: if (light gun = on) ERROR! (calibration failed; b too low)
• if (w > 1) at frame 10 + lag + b + w - 1: if (light gun = on) ERROR! (calibration failed, w too high)
• at frame 10 + lag + b + w: if (light gun = off) ERROR! (calibration failed, w too low)
6. if (b > 1) b--; lag++; goto step 1 (this calibrates lag value to maximum to minimize black frames b)
7. calibration done successfully

This is only a preliminary algorithm, but for a start it should work. If it should fail regularly, I have to find a better way.

Edited by Thomas Jentzsch, Sun Feb 5, 2017 12:27 PM.

#15 Thomas JentzschOFFLINE

Thomas Jentzsch

Thrust, Jammed, SWOOPS!, Boulder Dash, THREE·S, Star Castle

• Topic Starter
• 23,940 posts
• Always left from right here!
• Location:Düsseldorf, Germany, Europe, Earth

Posted Wed Feb 8, 2017 3:54 AM

Quick update:

I bought myself a Sega Light Phaser and AA member Tigerduck kindly provided my with an adapter to use it on an Atari 2600. So I will start testing and programming very soon.

#16 Kosmic StardustOFFLINE

Kosmic Stardust

Princess Rescuer

• 18,391 posts
• Location:Milky Way Galaxy

Posted Wed Feb 8, 2017 5:19 AM

One potentially big issue here, is the dot when "racing the beam" on a CRT display is orders of magnitude brighter than and LCD technology. Reason is when the beam strikes the phosphor, there is a bright flash of light followed by a slow decay. Light guns are designed to detect this "bright flash of light" and not the after glow which can often persist for a few frames, ie "phosphor trails." So what the human eye sees is a steady glowing screen with LCD or CRT tech. What the lightgun sees as a hit is the intense output of the beam, often repeated at around 15kHz as the beam passes multiple scanlines. In fact the NES Zapper has a filter circuit to detect the 15kHz strobe. The Atari and Sega Phasor lightguns lack this filter, but all lightguns send out hit detection as digital pulses, either on or off. You are not likely to detect the presence of an LCD screen with any lightgun because they don't strobe. Plasma would be plausible but such displays are expensive and falling to cheaper LCD tech and OLED displays.

#17 Thomas JentzschOFFLINE

Thomas Jentzsch

Thrust, Jammed, SWOOPS!, Boulder Dash, THREE·S, Star Castle

• Topic Starter
• 23,940 posts
• Always left from right here!
• Location:Düsseldorf, Germany, Europe, Earth

Posted Wed Feb 8, 2017 6:57 AM

Could be. I hope they just detect enough white from the LCD to trigger.

Guess I will find out soon.

Edited by Thomas Jentzsch, Wed Feb 8, 2017 7:19 AM.

#18 Thomas JentzschOFFLINE

Thomas Jentzsch

Thrust, Jammed, SWOOPS!, Boulder Dash, THREE·S, Star Castle

• Topic Starter
• 23,940 posts
• Always left from right here!
• Location:Düsseldorf, Germany, Europe, Earth

Posted Thu Feb 9, 2017 1:16 PM

I started experimenting with my new light gun today. First I played a few rounds of Sentinel and Shooting Arcade on my CRT. Everything worked fine.

Then I started experimenting with white squares and also with an all white screen (still on my CRT). There I noticed something very weird: Only when pointing at something white in a small area at about the right quarter of the screen, and only in a limited vertical area there, my light gun would trigger. Weird, isn't it?

I have no idea why, maybe someone can help me explaining?

And maybe some people can try my little test program on their CRTs and tell me their results? Initially you will only see a white screen. When the light gun triggers, you will see a black line at the left, starting from the vertical detection position and three colored squares. Does that trigger for you also only on the very right?

BTW: You don't have to press any button.

#19 TigerduckOFFLINE

Tigerduck

Star Raider

• 71 posts
• Location:Germany

Posted Thu Feb 9, 2017 3:25 PM

Hmm, with the SEGA Lightgun I experienced the same effect. Additionally there is one vertical line close to the left edgde of the screen witch triggers the gun.

With the original XG1 if have only the line on the left mentioned above. It's much harder to follow the line to keep the trigger with the XG1 than the SEGA.

I don't have an explanation for this behavior.

But to start the little testprogramm with my Harmony, first I have to select and activate the Programm with a joystick then unplug it and change to the lightgun.

Maybe this procedure could lead to a strange behavior.

I experienced wrong input interpretation in the Harmony menu when i plugged in the joystick after starting the console...

Edited by Tigerduck, Thu Feb 9, 2017 3:26 PM.

#20 Thomas JentzschOFFLINE

Thomas Jentzsch

Thrust, Jammed, SWOOPS!, Boulder Dash, THREE·S, Star Castle

• Topic Starter
• 23,940 posts
• Always left from right here!
• Location:Düsseldorf, Germany, Europe, Earth

Posted Thu Feb 9, 2017 3:30 PM

Hmm, with the SEGA Lightgun I experienced the same effect. Additionally there is one vertical line close to the left edgde of the screen witch triggers the gun.

The start of that line indicates when the Lightgun detects.

With the original XG1 if have only the line on the left mentioned above. It's much harder to follow the line to keep the trigger with the XG1 than the SEGA.

Not sure what you mean to say here. The left line is only an indicator.

But to start the little testprogramm with my Harmony, first I have to select and activate the Programm with a joystick then unplug it and change to the lightgun.
Maybe this procedure could lead to a strange behavior.
I experienced wrong input interpretation in the Harmony menu when i plugged in the joystick after starting the console...

That's OK. With the light gun, the autodetection detects (and locks!) a Driving Controller (no clue why). If you put the test ROM in the root directory, then you can select easily it with the console switches.

#21 alex_79OFFLINE

alex_79

Stargunner

• 1,195 posts
• Location:Italy

Posted Thu Feb 9, 2017 3:43 PM

Tried with XG-1 lightgun.

It only triggers on the left edge of the screen for me, at the same horizontal position of the black line and only at vertical positions corresponding to the top and bottom colored squares. Doesn't seem to trigger on any other region of the screen.

Edited by alex_79, Thu Feb 9, 2017 3:43 PM.

#22 Kosmic StardustOFFLINE

Kosmic Stardust

Princess Rescuer

• 18,391 posts
• Location:Milky Way Galaxy

Posted Thu Feb 9, 2017 3:48 PM

weird thing with the xe lightgun from best, the thing seems to fire a couple inches sideways of the target, even inches from the screen. My sega phasor (through a model 1 genesis w/ sms adapter) has pinpoint accuracy. Two crts tested. Could it be the av mod on my 7800 causing the propagation delay?

#23 Thomas JentzschOFFLINE

Thomas Jentzsch

Thrust, Jammed, SWOOPS!, Boulder Dash, THREE·S, Star Castle

• Topic Starter
• 23,940 posts
• Always left from right here!
• Location:Düsseldorf, Germany, Europe, Earth

Posted Thu Feb 9, 2017 3:52 PM

weird thing with the xe lightgun from best, the thing seems to fire a couple inches sideways of the target, even inches from the screen. My sega phasor (through a model 1 genesis w/ sms adapter) has pinpoint accuracy. Two crts tested. Could it be the av mod on my 7800 causing the propagation delay?

You tested with original Light Gun games, correct?

Depending on the sideways direction it either reacts faster or slower than expected by the developers.

#24 Thomas JentzschOFFLINE

Thomas Jentzsch

Thrust, Jammed, SWOOPS!, Boulder Dash, THREE·S, Star Castle

• Topic Starter
• 23,940 posts
• Always left from right here!
• Location:Düsseldorf, Germany, Europe, Earth

Posted Thu Feb 9, 2017 3:56 PM

Tried with XG-1 lightgun.

It only triggers on the left edge of the screen for me, at the same horizontal position of the black line and only at vertical positions corresponding to the top and bottom colored squares. Doesn't seem to trigger on any other region of the screen.

So it behaves like my light gun, just a the opposite side of the screen. Now I "only" need an explanation for this to understand the problem.

Tomorrow I will test with my Samsung LCD. But based on the negative experience with the CRT, I am pessimistic now. There seems to be some hidden logic which I miss so far.

#25 ShawnOFFLINE

Shawn

As Above

• 18,770 posts
• So Below

Posted Thu Feb 9, 2017 4:05 PM

So it behaves like my light gun, just a the opposite side of the screen. Now I "only" need an explanation for this to understand the problem.

Tomorrow I will test with my Samsung LCD. But based on the negative experience with the CRT, I am pessimistic now. There seems to be some hidden logic which I miss so far.

Kevin Horton tried to get an nes zapper to work with an LCD but failed\gave up. Maybe you could talk to him? Together you might be able to find a solution?

Also tagged with one or more of these keywords: Light Gun, LCD

0 user(s) are browsing this forum

0 members, 0 guests, 0 anonymous users