A Final Fantasy X lightning strike dodging aimbot

Since I bought the Final Fantasy X HD remaster, I’ve been (re)playing through the game (75 hours now!). I’m currently playing through a lot of the side quests.

Now, some of you Final Fantasy players may remember the 200 lightning bolt challenge. If you don’t, let me explain briefly.

There is a mini-game in FFX where you can dodge lightning strikes. How it works is the player walks through an area where the screen flashes at random intervals signalling a lightning strike. If you don’t hit X quickly enough to dodge it, your character gets hit by a bolt of lightning. If you do hit it quickly enough, your player jumps out of the way before it can hit him.

One of the side quests involves being able to dodge 200 of these lightning bolts in a row without being hit in between, leaving the area or saving. It’s said to be one of the hardest and most frustrating side quests in the game.

Naturally, since I’m a lazy, dirty cheat and didn’t want to go through the trouble of practicing, I thought of other, more automated ways to do it with a microcontroller (I really had to complete this side quest).

I needed two things to build a successful aimbot:

  1. A way to tell when a lightning bolt was about to strike
  2. A way to respond to it

The area where the lightning strikes is generally pretty dark and a lightning bolt causes the screen to flash brightly. That’s a fairly big contrast in terms of brightness. I simply used a photo-resistor taped to the screen and covered it with a black cloth (to prevent light from the room from affecting the readings).

Wiring the photo-resistor was also pretty simple. I just wired it straight from the pin to ground and enabled the internal pull-up to create a voltage divider. From there, it was trivial to get readings by using analogRead.

Calibration was pretty easy too. I ran an Arduino program to continuously print readings to serial. I waited around in the area of the game, waited for a lightning flash then went back to look at the readings.

I expected to had to graph the readings but I was actually able to tell straightaway by inspection. Before lightning struck, I was getting readings from the photo-resistor that ranged from 680-720. During the flash, I was getting readings from around 150-210. In the code, I simply regarded lightning has struck as any reading below 250.

I double checked my findings by having the micro-controller blink an LED every time lightning struck. As far as I could observe, there weren’t any false positives or false negatives. We had a 100% success rate.

As an aside, keep in mind that the median human reaction time is somewhere around 215ms. I’m guessing the designers of the game would be aware of this fact so the time window for a successful dodge should be around that. That’s a good benchmark for working out an appropriate button press debounce time and the maximum amount of time your code should take to react.

Now that we know how to detect a lightning bolt, the question of responding to it remains.

I was originally going to try and tie a servo onto the PS3 controller to press the button but owing to the weird, rounded shape of the controller, I wasn’t able to secure the servo onto it. That led me to look up ways to emulate a PS3 controller on a micro-controller to directly feed input to the PS3.

Turns out, there was a great project written for the Teensy that emulates a PS3 controller.

I took the code, hacked in an analogRead function, deleted everything I didn’t need and fixed a few compilation errors I had. I had the firmware make the character run around in circles and send a “pressed X” event every time it detected a lightning strike.

A quick test showed that my quick, hacked up mess actually worked! The LEDs blinked at the right times and my character dodged the lightning strikes perfectly every time. The timing was impeccable!

As a final touch up, I wired a second Arduino (hey, I was lazy) to count the number of times the Teensy blinked its LED and display the count on an LCD screen. From there, I just left it until the counter showed 200.

Finally, if you decide to use this, I recommend placing your character in a weird secluded corner to prevent him edging too close to a lightning tower (where you’ll just waste time since lightning doesn’t hit there).

Source code on Github

Leave a Reply

Your email address will not be published.