Jump to content
IGNORED

Light Guns and LCDs


Recommended Posts

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.

post-45-0-65170300-1486057813_thumb.png

  • Like 2
Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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:

  • Like 2
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.
Link to comment
Share on other sites

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
  • Like 2
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

  • Like 2
Link to comment
Share on other sites

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. icon_smile.gif

Link to comment
Share on other sites

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"

Link to comment
Share on other sites

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
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

TestLG_1.bin

Link to comment
Share on other sites

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
Link to comment
Share on other sites

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.
Link to comment
Share on other sites

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
Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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. icon_ponder.gif

Link to comment
Share on other sites

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. icon_ponder.gif

 

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?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...