Final Fantasy by TheAxeMan

  • ROM: Final Fantasy (U)
  • Abuses glitches
  • Manipulates luck (a lot)
  • Uses power cycles
After much hard work I proudly present this highly optimized run through the US version of the original Final Fantasy. This run beats the current record by exactly 9800 frames. That's 2 minutes, 43 1/3 seconds.
The overall plan is about the same as before. However this time I analyzed the game's internal algorithms. I used this information to create and use an extensive amount of optimization scripting. There are also a few other odds and ends, but most of the improvement comes from the optimization scripts. I also used ffhackster and the fceu memory watch feature a lot, so many thanks to everyone who contributed to those. Maximus' tas editor was useful early on but failed me later as it doesn't support power cycles.
I wrote three different scripts to optimize different aspects of the run. The most important was an overall pathfinding script that would tell me what enemy groups I would encounter given a route through the game. The next most useful was a run analyzer that figured out the optimal manipulation for running from a series of battles. I also had a battle analyzer to optimize battles, but this was only used in the first few battles. The algorithm controlling which battles come up is pretty much separate from the battle randomization for hits, damage, running, etc. so it made sense to analyze these separately.
The pathfinding script used a little runset that listed how many steps I would take through each area. It could take some regression options, analyze all the permutations then report the best result according to a cost function. The cost function took into account the time taken to walk around, run from battles and fight if necessary. Of course the most useful aspect of this was to avoid fights with the dreaded "can't run" flag. The secondary benefit was fewer fights in general. Finally, extra pacing steps are almost completely eliminated. In order to use this, I needed to analyze and plan out every step through every area ahead of time. But the results were well worth it: I eliminated all "can't run" fights except for two in the final dungeon. Additionally, the total number of random battles is reduced from 184 to 173. So basically most of the improvement comes from this.
The run script figured out how to manipulate running from each battle. The highlights of this are controlling the number of enemies that show up; fewer enemies are easier to manipulate and there is an extra frame of loading for each enemy. You might notice throughout the run that the enemy groups are a little smaller than you normally see throughout the game. Another big factor is preemptive battles. It seems that the little "preemptive attack" message comes up quickly, but it actually causes 29 frames of delay. Sometimes it's worthwhile, but often it's just a waste. Generally, it's more useful early on when it increases the probability of running from very low to 100%. The last preemptive is in Ice Cave. These running issues might seem like a pretty minor thing, but it adds up to about 15-20 seconds over the course of the run.
The battle analyzer was really just useful on Garland and the pirates. I also ran it on the wizards, but it just confirmed that my old method was optimal. Once down to one guy it was easy to do the battles by hand.
I did some extra research to find situations where I could walk without triggering an increment of the encounter mechanism. FFHackster was very useful here. In fact, I used it to create a hacked rom that identified these "free" squares for me. In particular, this showed me which squares around Coneria were free. This is why you see me walk a bit out of the way. Other free steps are the first step into or out of the canoe or ship. To take advantage of this, I get in and out of the canoe as much as I can. Of course, the ship docks are all free spaces. Interestingly, the shadow of Mirage tower and the spaces next to the Temple of Fiends are also free. Finally, in dungeons, the squares around doors and the south wall of rooms are usually free. I also used my knowledge to create another hacked rom with no random encounters that was very useful for testing. This was nice as I needed to analyze everything ahead of time to set up the pathfinding script. I actually created this run with the mark-up hack and then hexed the checksum in. Here's a screenshot. The white marks show free squares.
The main way I manipulate which battles I run into is by saving my game and cycling the power. Of course in this game I can only do it in the outer world and I need to obtain tents, cabins and houses (all three are used!). The main purpose of the pathfinding script was to tell me where to use these. But I needed to coordinate this plan with obtaining the items. In the end, it worked out very well; I cycle power five times to manipulate encounters compared to just once in the old run. Luckily, I'm able to pick up the items I need from chests until I get to Gaia where I walk right by item shop on my way to the fairy's spring.
Since there are essentially only 256 different outcomes for a given set of battle commands, I was able to plan the battles in the TOF in the planning phase. So the healing items used beforehand was planned for earlier.
It's well known that Final Fantasy has a number of glitches. However, none of them really break the game to allow for a really crazy TAS. In fact most of them are generally more harmful than good. There are two that come into play here. First, dark status actually has no effect. Second, it's only possible to get one levelup per battle. This first affects me after beating Astos. Since I got rid of the "can't run" battles, I actually have a heldover levelup through most of the game. You might think this is a disadvantage because the extra stats would be nice to have. But it ends up being a blessing by allowing me to use the bane sword against phantom and also manipulate two zombie Ds in the following battle. This is the case because a levelup pulls some random numbers out to determine stats. The phantom only gives 1 exp, so it's sort of unlikely to get a levelup here any other way. This is why I had to slug it out with him in the old run.

Specific changes:

  • The fight with Garland is about the same length as before, but I manipulate luck from the levelup. This adds some extra time here (about 2 seconds), but it's an investment that pays off quickly in manipulating running from battles throughout the game. The battle plan was generated by my battle analyzer script.
  • The pirate fight was improved by several seconds using the battle analysis script.
  • Walking carefully around Coneria and on the Elfland dock helps me avoid the extra sailing that I did in the old run and cuts down the number of fights.
  • Instead of buying a silver sword I pick up the dragon sword from the Dwarf Cave treasure room. This is convenient because there are a couple savegame items that I need from there. It was actually a pretty close decision between coral sword and dragon sword, but after a lot of analysis I am pretty sure the dragon sword was the right choice. Anyway, not getting the silver sword lets me walk around Elfland town and I also don't need to fight a battle to get enough gold. The dragon sword isn't quite as powerful as silver sword. The only place it really makes a difference against Lich, where I need 5 rounds instead of 4.
  • On the way to Melmond I do some extra sailing. This cuts out a fight later on due to how the encounter mechanics work. This is the only time I add extra steps for this reason. Other times I use slack steps to save time. For example, walking around elfland or sailing all the way into the dock.
  • The first power cycle happens right before entering Earth Cave the second time. This lets me avoid the nonrunnable wizard battles. The old run dealt with two of these.
  • The second power cycle happens on the way to Crescent Lake.
  • After getting the canoe, I use it to reduce my step count by getting in and out of it as I walk back to the ship.
  • In Ice Cave I pick up a tent in addition to the gold. The tent gets used right after exiting for the third power cycle. Since I was walking right by that chest it was better to get this and do my shopping in Gaia rather than Crescent Lake.
  • In Gaia I buy one house and three cabins. Some of these will be used for luck manipulation. The rest go to restoring some hp for battle in the final dungeon.
  • Once again it seemed to be a better deal to do the Sea Shrine before the waterfall. This time I can run from every battle, saving time over the last run where I needed to take out a couple ghosts.
  • Despite being on a lower level, Kraken still takes 10 rounds. This time it happens that he successfully gets me with his ink and I can demonstrate the dark status glitch.
  • In the waterfall robot room I avoid the forced battle square altogether by getting the robot to walk onto it. I didn't think it was possible before.
  • The fourth power cycle happens after the waterfall, almost at the same spot as the only one used in the old run. This gets rid of the zombull no-run fights near Lefein.
  • I also get luckier on Dr. Unne, making him walk to toward me a bit more than last time.
  • The fifth and final power cycle happens right before entering Mirage Tower. Compared to the old run this leads to fewer fights here on out, especially in Sky Palace. But I end up getting two two-enemy fights in the final dungeon instead of one 2-enemy fight and one with 1 enemy.
  • Unfortunately I don't run into WarMech on Sky Palace 5F. Interestingly though, Sky Palace 5F has a much higher encounter rate than anywhere else in the game. It's 24/256 vs 10/256 in the outer world, 3/256 for the ship and 8/256 for all dungeons except the last floors of the final dungeon.
  • This time through Gurgu I take extra steps on lava to cut down the number of encounters.
  • In the final dungeon I beat two Gas Ds, one of the toughest enemies in the game. This time I'm able to use bane on the phantom and still get two zombie Ds afterwards by cashing in my heldover levelup. The rest of the game goes just about the same. Unfortunately, there's not much I can do to manipulate the bane sword to work faster. The only way to change luck is to wait while the randomization seed cyles at a rate of one seed every two frames. There is only a 3/256 chance that bane works. However, several of the fiends will kill me for sure if they attack first. In that case I only have a 1/256 chance of going first and successfully killing them. That means I may have to wait up to 510 frames to make things line up.

Other notes

  • One suggestion I got was to transfer or drop something to get the bane sword in the first slot. However, the random seed cycles while moving the cursor so it's no problem to have the bane sword in a different slot.
  • As before, my solo fighter finishes at level 15. But despite fighting fewer battles, he gains more total experience due to the huge amount from the Gas Ds.
  • Since we don't see WarMech, this run should have a new screenshot. I propose the Gas D fight at 231249 or fighting Kraken while Dark at 171475.
  • I haven't analyzed Final Fantasy IV or VI encounter mechanics, but I bet you could use similar pathfinding techniques to improve those runs.

Improvements

  • I did luck manipulation for map-walking by hand. For example, the bats in Earth Cave. I got really lucky this time. If you could automate and tweak this you might get a few frames.
  • There's some other source of delay after the battle that my run analyzer doesn't pick up. It's small, but could add up given the number of battles.
  • Could combine all the scripting together and regress the whole thing. By checking fights, walking and running there might be some advantage to be had. While you're at it you might want to set it up to work on a supercomputer or large cloud computing cluster...

On a personal note...

I'm not saying that this will be my last TAS, but it will be the last one before some major changes in my life. In that respect it's sort of a masterpiece that I've been wanting to finish for quite a while. So I hope everyone enjoys this.
I've been a part of the TAS community for about four years now, though lately I've regressed pretty much back to lurker status. It's been really neat to interact with so many smart people and I'd like to really thank Bisqwit and everyone else on this site for a lot of great times.

Truncated: Accepting this movie.
Nice to see you back, Axe

Raiscan: Processing with MKV/Chapter treatment as I have the permission and information required from the author. Delayed due to hard resets not being converted when using FCEUX's fcm --> fm2 converter. I'd like to use FCEUX for capturing all new publications, so I'll wait for a hotfix on this one.
DeHackEd: <voice style="seagull">Mine! Mine!</voice>


Joined: 4/25/2004
Posts: 615
Location: The Netherlands
TheAxeMan wrote:
Ok, here's an IPS for my hack: http://home.comcast.net/~f_amoroso/tas/FinalFantasyTAS.ips Making the hack was actually pretty easy to do with ffHackster. Anyway, if you play on this version you can see exactly where around Coneria there are no encounters.
I actually created a Lua script to do this for me :p Just trial and error, count the difference in the step counter and display it as a grid. That's how I figured you probably didn't know about that stuff in your previous run :p
qfox.nl
Active player (435)
Joined: 9/27/2004
Posts: 650
Location: Canada
Congratulations, Axeman. Now I know what I'll be doing with my day off. Watching some dude play Fnal Fantasy. Thanks ;) e: Very nice manipulation. My only idea would be to use the top fighter vs the Wizards to get the crown, so you don't have to swap the short sword, but it's probably just as likely that that would take longer because of the change in manipulation. Anyway, I'm a votin' yes.
Post subject: Movie published
TASVideoAgent
They/Them
Moderator
Joined: 8/3/2004
Posts: 15594
Location: 127.0.0.1
This movie has been published. The posts before this message apply to the submission, and posts after this message apply to the published movie. ---- [1187] NES Final Fantasy by TheAxeMan in 1:10:16.18
Joined: 7/7/2007
Posts: 161
TheAxeMan wrote:
When playing normally I take out Kary last too. Or at least a little later. There's nothing to stop you from going on and not much useful treasure in the Volcano either.
Yeah, given that getting the FLOATER is about as difficult as beating Kary yet yields substantially higher rewards, attempting the Volcano early makes little sense. Plus, though useful in a TAS, the Volcano's damage floors are just silly during a regular playthrough. Greatly appreciated update on one of my favorite TASes. Thanks for your effort, HectorSpriteMan!
Joined: 4/25/2004
Posts: 615
Location: The Netherlands
Why does this movie get "abuses programming errors in the game" ? I can't think of one (that you're not forced to use anyways, those can't be 'abused' ?)
qfox.nl
Joined: 3/11/2008
Posts: 583
Location: USA
Having the robot walk onto a forced-fight square in the Waterfall Cave so he can avoid the fight, perhaps.
Joined: 7/7/2007
Posts: 161
I don't quite understand the explanation, but, if I'm reading the submission text correctly, then a flaw in the level up counter allows TheAxeMan to use the Bane Sword successfully against PHANTOM.
Joined: 4/25/2004
Posts: 615
Location: The Netherlands
I don't think that constitutes that label... He's not actually abusing that flaw, he has no choice in the matter... He's just aware of the fact that this is the way it is. It's like saying running away gets that label because the game is bugged and it doesn't look at luck at all...
qfox.nl
Joined: 7/7/2007
Posts: 161
I don't think it's the strongest case, either, but the level up holdover is solidly in a different class than running, critical hits, etc. because it's not random manipulation. Instead, the level holdover is an unchecked border case, which could be construed as a programming flaw. Whether leveraging this situation qualifies as "absuse" is another matter. One can readily trigger this flaw in real play at the "Provoka Power Peninsula", if that means anything.
Player (121)
Joined: 2/11/2007
Posts: 1522
qFox wrote:
Why does this movie get "abuses programming errors in the game" ?
What about Dark status not working properly? Speaking of which, I was thinking of using a screenshot from the Kraken fight. The current one is from the old movie. WarMech is not in this run :(
I make a comic with no image files and you should read it. While there is a lower class, I am in it, and while there is a criminal element I am of it, and while there is a soul in prison, I am not free. -Eugene Debs
Joined: 3/11/2008
Posts: 583
Location: USA
"Tiamat used bane" might be a more amusing option than "Kraken used ink".
Ambassador, Experienced player (709)
Joined: 7/17/2004
Posts: 985
Location: The FLOATING CASTLE
I think it's generally considered a glitch that BANE works on everything. I've looked at the code that handles this. Internally, there's a flag that represents immunity. But rather than actually make it impossible to work, it sets a threshold to zero. So a roll of zero actually succeeds. There are three numbers in the randomization table that can make this work: two zeroes and a one that gets rounded to zero in some of the math. So that's how there's a 3/256 chance to succeed even when the monster is immune. Dark status is also glitched but it's not that big a deal. Some of the encounter-free step tricks might be arguable as glitches too.
Player (121)
Joined: 2/11/2007
Posts: 1522
Any other thoughts on screenshots? I was considering something from the first Garland fight as well.
I make a comic with no image files and you should read it. While there is a lower class, I am in it, and while there is a criminal element I am of it, and while there is a soul in prison, I am not free. -Eugene Debs
Joined: 5/30/2007
Posts: 324
I'm a little surprised none of the present ratings gave it a "10" in the Technical part. I thought the previous version was one of the most "perfect" movies on this site, made all the more impressive considering how many different internal algorithms the game uses, as well as it being an RPG over an hour in length. But this run is insane. Tremendous work, TheAxeMan.
Ambassador, Experienced player (709)
Joined: 7/17/2004
Posts: 985
Location: The FLOATING CASTLE
Say, after submitting my new run and looking at the times, it seems that the time is wrong on the description of this run. Is this an artifact of fcm translation or something? FCEU tells me it should be 1:10:09.25. Edit: Wait, after getting out a calculator and figuring 60 fps, this number is right and FCEUX is wrong.