Shop OBEX P1 Docs P2 Docs Learn Events
About Light guns on the HYDRA — Parallax Forums

About Light guns on the HYDRA

GooL91GooL91 Posts: 7
edited 2009-10-13 18:39 in Propeller 1
Hi!
I'm going to try to make a game using a light gun.
My question is what kind of gun I should use.
I have psx one, a GunCon 1, and a Nintendo one, although I don't want to disassemble the Nintendo one(NES).
I have about six of the psx ones so I can open one up if you'dlike...
Maybe someone can give some tips on which gun to use.

Link to the psx one.
http://www.videospider.tv/Videos/Detail/696729719.aspx
76731022_1.jpg

Post Edited (GooL91) : 2/12/2009 8:24:49 PM GMT

Comments

  • Spork FrogSpork Frog Posts: 212
    edited 2009-02-13 03:37
    My recommendation would be to stick with the PSX controller. They use a serial data formant, which I believe there are a few objects available for already, so you would be at least able to run it more quickly in all likelihood.

    The NES lightguns as I've read use the "extra" pins in the connector, not shifting out of the shift register like the buttons. While this might be an interesting project to undertake, it would certainly be more complex.
  • mparkmpark Posts: 1,305
    edited 2009-02-13 07:53
    How do light guns work? My fuzzy understanding is that they send a signal when they "see" the flying dot on the TV screen, but that would require much tighter timing than serial data would allow...
  • GooL91GooL91 Posts: 7
    edited 2009-02-13 11:11

    Reply to "Spork Frog"
    Thank you for the answer. Is there any link that you could provide me with?

    As for the pins, well, if you compare the GunCons with the Nintendo lightgun the 2 extra pins seem to be video. As the GunCon uses the yellow "RCA" for video. But thats just my guess.

    Reply to "mpark"
    I'll try to describe my undertandig of how they work. To my help I'll use the popular game for the nes, DuckHunt.

    1. Objects appear on the screen, like ducks.

    2. The player presses the button and the console is told that the button is pressed.

    3. The whole screen becomes black.

    4. Duck nr(n) becomes a white box.

    5. The console checks if the gun sees a light.

    - Repeat step 4 and 5 for every object until the console is told that the gun sees a light, or run out of objects in which case the game tells you that you missed all objects.
    Funny, this technique is so slow that if you don't blink you'll see the black/white screen. Both on the nes and PSX.tongue.gif Although I'm not sure if it shows on the PS2...

    Was that right?

    I have another question. How does the console know where the gun points in menus? In some games you have a cursor in the menus or at the calibration screens.
    Is the screen blinking at an FPS higher than 11 so we wont see it? Or is it some other interesting way, maybe compasses and accelerometres. yeah.gif

    Post Edited (GooL91) : 2/13/2009 12:20:35 PM GMT
  • Spork FrogSpork Frog Posts: 212
    edited 2009-02-16 14:21
    You're right about the black/white screens on the more basic and older light gun games. Only problem was that one could theoretically point the gun at a light and still be considered a "hit", I think it might have actually looked to see if the spot you were aiming at turned from black to white to make sure you were pointing at the screen AND see if you hit something. The two extra pins were not for video (hardware wasn't that advanced at that time.) but instead just for something like a phototransistor.

    There's a psx controller object in the object exchange, I believe.

    Some light guns rely on the electron beam of a CRT to find its position, though this is considerably more tricky to do, and usually requires direct coupling with the video hardware. On the Hydra this might actually work: basically, the theory is that when the scanning beam of the CRT refreshes a pixel, it becomes very slightly brighter for a short time. When the gun sees a pixel become slightly brighter, it asks the video hardware what pixel it was drawing at that time, which is the position of the light gun. The GunCon appears to do a more accurate but more hardware-complex design. If the information I am finding is correct, it seems to use a CRT-scanning method but interfacing directly to the video and analyzing that instead of looking directly at a CRT display, which confuses me because I don't know how that is supposed to work.

    Accelerometers/gyros would work as well, with some careful calibration.
  • BaggersBaggers Posts: 3,019
    edited 2009-02-16 17:23
    Hi All,
    When I've coded for a Light gun, the reason the screen goes white is because to get the most accurate reading, you wait for the vblank, start a counter, some cause interrupts so you then read where the counter is, divide it by your counter value per line for your Y position, then the remainder is divided by the counter scaled for per pixel to get your X position. they use white.
    As we don't have interrupts, ( unless it puts the light trigger on a seperate pin that you can do a waitpeq/ne with ) you'll just have to poll the joypad, but as it's quite slow polling, cos you have to read ALL those bits, your X resolution is going to be pretty poor.

    Baggers.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    http://www.propgfx.co.uk/forum/·home of the PropGFX Lite

    ·
  • FredBlaisFredBlais Posts: 379
    edited 2009-09-14 23:18
    Baggers said...
    Hi All,
    When I've coded for a Light gun, the reason the screen goes white is because to get the most accurate reading, you wait for the vblank, start a counter, some cause interrupts so you then read where the counter is, divide it by your counter value per line for your Y position, then the remainder is divided by the counter scaled for per pixel to get your X position. they use white.
    As we don't have interrupts, ( unless it puts the light trigger on a seperate pin that you can do a waitpeq/ne with ) you'll just have to poll the joypad, but as it's quite slow polling, cos you have to read ALL those bits, your X resolution is going to be pretty poor.

    Baggers.

    Hey Baggers,
    Do you think you can get a pretty accurate x,y resolution with this method? I'd like to try it.
    I doubt we can get a pixel accurate resolution!
  • VIRANDVIRAND Posts: 656
    edited 2009-09-18 17:01
    The white square method is clever and probably still works now with new TVs. LCD's don't have flying dots, and LCD's don't
    flicker unless their backlight is powered by a low frequency inverter, which I've seen in cheap ones, even though it is easier
    to make a high frequency inverter >1000hz not 60hz.
  • BaggersBaggers Posts: 3,019
    edited 2009-09-18 17:52
    Fred, Sorry for missing your reply, I'm mad busy with preparing a demo for Tokyo Game Show, so if I can get back to you after Wednesday [noparse]:)[/noparse]
    Cheers,
    Jim.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    http://www.propgfx.co.uk/forum/·home of the PropGFX Lite

    ·
  • FredBlaisFredBlais Posts: 379
    edited 2009-09-19 15:04
    Monday I'll solder 2 wire from my 128k game cartridge to the NES socket with a connector in between, I'll be ready to start coding [noparse];)[/noparse]
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2009-10-09 05:22
    This may all be academic when it comes to LCD TVs. I've noticed from developing a video overlay object for the Prop that the flatscreen TV I've been using as an NTSC monitor delays its output by about 1/8 second! Presumably that's done for deinterlacing and scan line interpolation. But it means that it's storing several frames internally before outputing them to the screen. This would eliminate any consideration of "flying spot" timing and require a delay for "flashing box" detection.

    -Phil
  • potatoheadpotatohead Posts: 10,261
    edited 2009-10-13 18:39
    Exactly.

    There is some serious latency on newer TV's. Faster video processors help cut the numbers down some, but it won't ever be like a CRT was.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Propeller Wiki: Share the coolness!
    Chat in real time with other Propellerheads on IRC #propeller @ freenode.net
    Safety Tip: Life is as good as YOU think it is!
Sign In or Register to comment.