Friday, August 30, 2013

How The NES Zapper Works

I have professed my undying love for the light gun peripheral elsewhere on this blog. To me, it remains one of the most natural and immersive ways to interact with a video game, despite its decline in popularity. Though nearly every game console from the mid 80s to the mid 90s had one, the NES Zapper is probably the one most gamers are familiar with.

Nintendo's involvement with light gun games actually predates the NES by over a decade. In 1973, Nintendo turned several old Japanese bowling alleys into light gun-based skeet shooting parlors.  A year later, Nintendo introduced its first arcade game, Wild Gunman. The purely electro-mechanical Wild Gunman used a couple of 16mm film projectors to show footage of various Old West bad guys ready to draw and fire on you, the player. Your goal was to wait until their eyes 'flashed', then draw your own pistol & shoot. If you were quick enough, "YOU WON" would be projected on the screen over a shot of the bad guy clutching his chest & crumpling, Sergio Leone-style, to the ground. 

The NES wasn't the first home console to sport a light gun, (that honor belongs to the Odyssey) but it was the first to couple one with complex games, and it has by far the largest library of supported titles. The Zapper is based on the Famicom's light gun, a very convincing-looking black revolver which was itself modeled after the one featured in Wild Gunman. Fearing a potential rise in cases of police-perforated eight-year-olds, Nintendo of America redesigned the Zapper to look more futuristic, and less lethal. The earliest Zappers have a dark gray body, light gray accents, and a red trigger, mimicking the NES' color scheme. Later models have a bright orange body, light gray accents and a black trigger, again in an attempt to make them look even less like real firearms. 

Opening up a Zapper reveals that there's not much to it. A small lens in the barrel focuses light from the TV screen onto a photodiode, a device which generates a small electrical current when exposed to light. An amplifier boosts the current and sends it to the NES console to be processed as input for the game. As simple as it is, the Zapper can't tell if the light it detected came from a TV screen or another source, like a light bulb, so it's up to the NES game to make that determination. The more well-written games use a multi-step process to determine which target on screen has been hit:

Here, we have two Duck Hunt ducks flying around:

When the Zapper's trigger is pulled, the NES blanks the entire screen for one frame of video, or roughly 1/30th of a second. This establishes a baseline that the NES uses to make sure the player's not just aiming the Zapper at a lamp. 

Next, the NES draws a white box around the first duck on the screen for one frame:

The first box is then removed and another one is drawn over the second duck:

Finally, the NES resumes drawing the game's normal graphics. If the Zapper picked up light from one box or the other, the NES registers a hit and the game murders the targeted duck accordingly.

This entire process takes a fraction of a second to complete, and is nearly imperceptible to the human eye. You can watch the whole process unfold in this slow-motion footage from Hogan's Alley:

When the trigger is pulled for the first time, the NES blanks the screen and puts a white box in place of the cop first, the professor second and the bad guy third. The NES registers a hit with the bad guy, so he is removes from play. When the trigger is pulled for the second time, only the cop and the professor are left as valid targets, and the NES replaces just those two characters with white boxes.

It's a simple and effective technique, but it's not fool-proof. The television has to be adjusted so that the image is not too bright or too dark, as either will screw up the baseline or keep the Zapper from picking any light up at all. The targets have to be large enough so their white box can be picked up by the Zapper, and the number of targets on screen are limited to no more than three or four to keep the TV screen from going black too long. The process is also extremely time-sensitive; if there's any significant delay between the time the NES sends the image to the television, and the time that image appears on-screen, the NES won't correctly register hits. This isn't a problem for old-school analog CRT televisions, as they respond pretty much instantaneously. However, digital HDTVs spend a lot of time (relatively speaking) converting the analog signal from the NES into a digital image, and then rendering it on screen, causing a phenomenon known as input lag. In some HDTVs, this lag can be as bad a 1/10th of a second, which is much longer than the 1/30th the NES is expecting to wait. As a result, Zapper games work only spottily with the handful of tube-based HDTVs in existence, and they won't work at all with LCDs, plasmas or projectors. All the more reason to hang on to your old Radiation King, in my opinion.

Friday, August 9, 2013

SolarStriker for Game Boy

I own three copies of SolarStriker. I've actually run across this game in stores, purchased it for dirt-cheap, taken it home & realized I already owned a copy twice. It's not that I have Mel Gibson's Consipracy Theory OCD; it's that this game is so forgettable, it keeps falling out of my brain.

Another Game Boy launch title, SolarStriker is a vertical spaceship shooter with a standard boilerplate of a plot: You and your super-advanced prototype fighter are Earth's last defense against the overwhelming forces of an invading alien race. You fight your way through waves of enemies until you encounter the level's boss. Once you defeat it, you move on to the next level in the game. In standard shmup fashion, you have no control over how fast the screen scrolls, but you can move up and down in addition to left & right, and the screen scrolls slightly left or right to reveal more of the play field than will fit on-screen at once. You have only one weapon in this game (A & B buttons both fire it.) which can be upgraded from a single shot to twin, triple, and ultimately the high-powered Super Shot by shooting space-crates & collecting the 'P's enclosed within. There are no other types of weapons or power-ups at all in SolarStriker

It's an uncomplicated game to be sure, but it's not easy. You start with only three lives and no continues. Scoring 50,000 points earns you a bonus life, but unless you're really good at dodging enemy fire, that won't be enough to sustain you through all six of its levels. Dodging itself is a problem because, while you can move in any direction, you don't do so very quickly, and you can't outrun enemies at all. The SolarStriker is one pokey little spaceship, but then again the play field is so tiny, there are times when you can't avoid getting hit no matter how fast you move. Maddeningly, you can only shoot straight ahead, while most of your enemies can shoot in any direction. You're usually screwed if you let too many enemies get behind you, because there's no way you can take them out. Oh, how I yearned for a Super Zapper or something when this happened! Fortunately, the game is not so cruel as to actually spawn enemies behind you. It's not a thumb-busting button masher either, as you just have to hold A or B down to keep firing. Come to think of it, this may be the first shmup I've played to actually sport that feature.

The graphics in SolarStriker are basic but clean, and nicely high-contrast. It's very playable on the original Game Boy's notoriously smear-happy screen because nothing moves very quickly. I'm glad the developers chose dim, unobtrusive backgrounds, even if black stars on a white background do look a bit odd. (Nintendo corrected this on the Game Boy Color, Advance & Player.) The sound effects never rise above Atari-style beeps & bloops, but the background music isn't bad. If nothing else, SolarStriker demonstrates the Game Boy's potential to produce some very good chiptunes in subsequent games.

It's unfair to be too critical of a launch title like this, as developers almost always have a tight schedule & limited budget to work with. SolarStriker certainly feels like a rush job, but there's a germ of a good game here. If it just had a little more variety in its design, a little more balance in its gameplay, and a little more reason to keep the player coming back for more, it wouldn't be so forgettable today. And I wouldn't own three copies of it.