I was playing Final Fantasy X, a game for the Playstation2, when I got to a particularly annoying segment. Basically, there's an area of the game where lightning strikes all the time. The screen flashes white, and you have about a quarter to a half second to hit the right button on the controller, or else you get hit. Nothing really bad happens when you get hit, but if you manage to dogde the lightning 200 times in a row, you get the Super Secret Prize.

As you can imagine, trying to do this is about as exciting as watching paint dry. My friend Greg and I tried to accomplish this feat several times, with no success. We could get up to about forty consistently, and once I even got up to 130, but nowhere near 200. Eventually, I got fed up and headed to Radio Shack for some parts with the goal of automating this stupid, stupid task.

I tried a couple of things, but the solution I settled on was the simplest. I just bought a spare PSX controller and wired it up so that the X button was controlled via the parallel port. I used a 74HC125 tri-state buffer IC with the button's voltage source on the input, its ground on the output, and a parallel port pin on the control, as well as another pair of pins for the chip's voltage and ground. When the control pin is high, the input and output lines are disconnected, when it is low, the output mirrors the input.
A failed attempt

I used the linux user-space parallel port device driver module (ppdev.o) to address the parallel port, and the small but handy libfg to grab frames from my Hauppauge bt848 video capture card and monitor the Playstation's screen. When the average intensity of the input image passed a certain threshold, my short program had the parallel port turn the controller button on for a tiny bit, and then turn it off. Running the capture card at its minimum resolution (48x32) made processing and image acquisition really fast.

With a little bit of debugging, the thing worked perfectly! FYI, dodging the lightning 2000 times doesn't get you anything special, and after a while, the lightning stops striking until you move again.

Jump, Tidus, Jump!


Mail me