zapper

This is an archive of a topic from NESdev BBS, taken in mid-October 2019 before a server upgrade.
View original topic
zapper
by on (#24785)
is it possible to have 2 zappers connected and in use at the same time. i don't see why not, but i don't have a dev-cart to mess around with.

by on (#24787)
I am not certain, but I think that the zapper has to be in controller port 2. I could be wrong though. If not, I think it could be possible, I just don't think you could shoot 2 places at once, because there is one place for it to be read.

by on (#24788)
It can work in either port, the only game that uses both at once is Chiller. I've played it like that before, many years ago.

by on (#24791)
Quote:
It can work in either port, the only game that uses both at once is Chiller. I've played it like that before, many years ago.


never heard of that one before, i'm gonna have to look into it. thanks.

now the wiki says to blank the screen and only place white where the object is. now is this done with name tables or sprites, or does it not matter?

im tinkering with the idea of a 2 player shooter similar to area 51 where the player is on a set track and enemies just kinda pop up. im just trying to make sure that the basic concept it possible before i throw together a tech demo

by on (#24792)
never-obsolete wrote:
now the wiki says to blank the screen and only place white where the object is. now is this done with name tables or sprites, or does it not matter?

It doesn't matter, whatever is easier for you to code. The only thing the light gun does is detect the presence or absence of light.

A good tip is to show a completely black screen before placing a white sprite at the place you are testing for a hit, and confirm that the gun detected black for that frame. If you don't, a player can just point the gun to a lightbulb and every shot will be considered a hit. So I heard.

I think that the idea of a 2-player lightgun game is great!

by on (#24794)
Yeah, I always thought it was only one at a time... Oh well! That's cool that you can do that.

I think it would also be cool to have a 2 player light gun game. But I think it would be really cool to have a game where you use the controller most of the time, but then there'll be a part where you can use two light guns. It would be cool if there was a 3Dish game where you were on a space ship, while the computer was piloting, you could be the gunner. That would be cool.

by on (#24795)
tokumaru wrote:
If you don't, a player can just point the gun to a lightbulb and every shot will be considered a hit. So I heard.


It's not true. It detects light at the frequency of the television's horizontal refresh (15khz I think). It won't work on higher-freq stuff like PC monitors or some newer types of TVs.

This also means you need to continually poll the controller port, at least once per scanline. While you're at it, if you want to, you can time & count the blank polls and know which scanline the gun was pointed at. :)

I never wrote my zapper game, just a little zapper test.

by on (#24796)
i was playing call of duty 3 on the wii and i got to thinking i could use the joypad/zapper combo a lot like the wiimote/nunchuck. i couldn't really come up with a good idea for that other than a fps, so a 2 player shoot-em up seemed more practical. though with a 4-score, 2 joypads, and 2 zappers i might be able come up with something cool. i definately would need a dev-cart for that so i could constantly test it on the hardware.

by on (#24801)
For my raycaster that I'll make some day (I need to get a few more things together), I was thinking that the player would move with the controller, and shoot with the gun. All you would really do with the controller is move, so you could hold that in one hand, and hold the gun in the other. I think it would be cool if it could be pulled off correctly. It would be somewhat of a programming nightmare to have to count scanlines along with the raycasting.

by on (#24802)
Quote:
It's not true.

Not true for incandescent, tho I do have a flourescent light that will trigger the Zapper. No idea how fast the light is supposed to be switching but it works fairly consistently.

Quote:
couldn't really come up with a good idea for that other than a fps

Doesn't Gotcha! (paintball game) use Zapper and controller? It was like dpad to pan left/right and Zapper to shoot the people and items.

For detection without scanline counting you might be able to do something like a binary search tree of the screen. Start with half screen white, then each frame cut the amount of white in half. Depending on the accuracy you want it should take ~4-6 frames. Might be too much of a distraction or it might look really cool having the white area zoom to your target.

by on (#24803)
Celius wrote:
It would be somewhat of a programming nightmare to have to count scanlines along with the raycasting.

You can easily stop the raycasting for a while to check for hits, no problem with that. Why'd you want to keep raycasting if all you are displaying is white boxes on black backgrounds? =) You may want keep processing input and movement though, so that motion does not look "choppy", but raycasting is a graphical process, unnecessary if you are not showing the graphics.

BTW, I also thought that a similar controlling method could be used in a raycaster... but I promissed myself I'll only get back to my raycaster when I finish (or get really close to) my Sonic engine.

by on (#24804)
Do you need to display white boxes on black backgrounds? Why can't you just turn the sprites completely white for the moment of the shot? The player will probably go "Oh, that's just supposed to be the flash of the gun or something." So it wouldn't look so bad. I wouldn't keep raycasting, I'd just stop for a frame, and use that frame to check for a hit.

And would it be bad to just check if the trigger is pulled at the beggining of a frame rather than for every scanline while raycasting? I doubt someone will pull the trigger mid-frame, and let go before the beggining of the next frame. And when I say check at the beggining of a frame, I mean check to see whether or not you are going to dedicate that frame to checking for zapper hits. I think it would be good.

It would be better to have the gun, because in games like Doom, where the enemy was on a different elevation than you, you couldn't aim up or down, you could just aim left and right, which I think is very limited. I don't know if you are planning to have more a more 3D variation on raycasting that allows for stairs or anything like that, but if you are, the gun would be a good way to go.

by on (#24825)
Celius wrote:
Why can't you just turn the sprites completely white for the moment of the shot?

I've never programmed for the lightgun, but you are probably right... just turing the sprites that compose a target all white might do the trick...

Quote:
It would be better to have the gun, because in games like Doom, where the enemy was on a different elevation than you, you couldn't aim up or down, you could just aim left and right, which I think is very limited.

That always annoyed me too. I guess that moving with the keypad while shooting with the gun would make it all very dynamic... but there is a problem. Lightgun games check if you hit a target, and register that hit immediately, while in games like Doom, they usually simulate a projectile actually moving through the level until it hits something. Of course, one can always ignore that and go with the lightgun method, which is much simpler even, instead of having to handle one more object withing the level. But then there'd be no support for playing without the gun, I guess.

Quote:
I don't know if you are planning to have more a more 3D variation on raycasting that allows for stairs or anything like that

Man, I wish. But doing the math with paper and pencil (just a figure of speech, of course I used the PC for that! :) ) I came to the conclusion that only the basic method with fixed-height walls is doable within the avaliable time. But if I have some really good idea on how to do the more 3D version until the time I start working on this thing again, of course I'll try it.

by on (#24920)
I've always wondered how they did it in "Gumshoe". There are tons of objects on the screen at once, is it just all a very timed CPU-loop?

by on (#24926)
Cycle-timed Y position detection (white screen, timing from sprite 0 to the hit) allows the search to be narrowed down to plus or minus about 15 scanlines. Then a binary (as opposed to linear) search reduces the number of frames needed to narrow down which object was hit.