Post subject: Lufia & the Fortress of Doom
Player (215)
Joined: 2/12/2006
Posts: 373
Location: Oregon
I'm surprised that nobody's started a topic for this game yet. Would anybody else be interested in seeing a TAS for this game? I've been messing around with lua scripts to luck-manipulate battles, and also done some work reverse-engineering how attacks work, which I seem to have succeeded in doing for the Sinistral battles at the beginning. I've now got a C++ program that can calculate attacks based on some data fed to it via a lua script that runs until just before the actual calculations are done. Not too surprisingly, the random number system is pretty much identical to Lufia II. i.e., there's a location(7E149E) that can point to one of 55 values, and it increments in a certain pattern depending on the circumstances. Once it reaches 55, the values it can point at are XORed with each other in a certain pattern, then it's reset to 0.
Banned User
Joined: 12/5/2007
Posts: 742
Location: Gone
Okay, for the purpose of manipulating high rates of HP damage and critical hits, does this LUA script help? Or is this script different?!
Player (215)
Joined: 2/12/2006
Posts: 373
Location: Oregon
The lua script is, at least for now, just to test whether or not I'm calculating attack damage correctly. I've also figured out Artea's Dread spell. However, I do have two lua scripts which actually go through the Gades battle, and vary how long they wait before entering the battle since that affects the outcome. With the first one, I have each character do what I would consider a sane action. Maxim and Guy attack, Artea casts Dread at first, then Trick on Maxim or Guy or both (I can easily change it in the script), and Selan casts Thunder. The script keeps track of how long each battle took (taking wait time into consideration, of course) then reloads the savestate for the quickest one. That yields some good battle times, but it doesn't take into account that actions characters take affect later actions. So it might be possible, for example, that using Defend in the right places will cause more critical hits, thus actually yielding a faster time. But I'm not sure exactly how past actions affect future ones yet. So my other script has the characters take random actions (from a limited set for now) until they either win the battle or die. This is done many times for each possible amount of waiting. Actually, I kind of know how actions affect future actions since I can calculate how much 7E149E is incremented for some actions, but I don't know how the location for critical hits is affected, so I'll want to analyze that. If I manage to write a full battle simulator, that should be way faster than having a lua script try stuff out. Even if that doesn't work out, it's interesting to peek into how the battle system works :)
Player (215)
Joined: 2/12/2006
Posts: 373
Location: Oregon
No, I haven't been working on this, but I'm wondering: Is anybody else even interested in seeing a TAS of this game? That fact that there wasn't a thread until I made one is perhaps a bad sign...
Joined: 7/16/2009
Posts: 39
I'd be interested, but due to the nature and length of this game (nothing particularly special about the gameplay, plus it's kind of long), I have to wonder just how entertaining it would be. That's just my opinion, though.
Joined: 10/3/2005
Posts: 1332
Being a fan of Lufia II, I tried playing this game more than once, and also tried watching one or two realtime runs, but... my god, it's so boring. A TAS that can skip all the grinding, and make a mockery of the game in general might be very watchable, so I'll be interested to see any WIPs posted here.
Mastania
He/Him
Joined: 5/30/2009
Posts: 135
Location: Top of the pops
I'd be interested :O This game isn't exactly easy at low levels, so I'd enjoy seeing how you would go about manipulating fights etc.
Waddle Waggle Wattle
Banned User
Joined: 12/5/2007
Posts: 742
Location: Gone
<--- interested! :)
Joined: 8/13/2005
Posts: 356
Location: Canada
Mastania wrote:
This game isn't exactly easy at low levels, so I'd enjoy seeing how you would go about manipulating fights etc.
I agree with this. It could be quite interesting to see the low-level strategies (or, worst case, the levelling strategies). But then again I'm in the minority that like RPG runs.
Joined: 8/27/2006
Posts: 883
I'd watch it :P
Player (215)
Joined: 2/12/2006
Posts: 373
Location: Oregon
OK, so I've done some more RE'ing, but it'll probably be a while before I've pulled it together into something useful. Well, at least I sure hope it'll prove useful. If nothing else, I'll probably put up my findings on GameFAQs for the 12 people in the world who'd be interested. I know some people in that forum have looked at how monster's stats are stored, for example. People mentioned that they would enjoy seeing a run that manages to avoid the grinding usually seen in this game. That can probably be managed. First, it's possible to avoid random battles. Walk until a battle starts. Reload state and find out how many frames you have to wait before a battle doesn't start from walking onto that tile (it's usually only a few). Then you'll be able to walk for a little while longer. In that way, random battles can be avoided so that I'll only do them if necessary. The real-time run has to use a bunch of Smoke Balls to escape unwanted battles. Second, there are monsters that give a lot of EXP compared to other monsters around them. The caveat is that they're hard to kill since they have high DFP and love to run away. The current real-time run doesn't take advantage of these monsters due to how often they run away (although David might try to make a run with more segments in order to take advantage of those monsters), but of course that won't be an issue for a TAS. Third, a lot of bosses have spells or items that don't cause damage but instead do things like raise their stats. If I can manipulate them into doing nothing but those non-offensive actions, I might only have to worry about how to do a reasonable amount of damage. The only bosses I'm concerned about at the moment are the Goblins since I don't think they have any spells, and they're quite strong. I think I'll have to spend a little time fighting Kobolds in order to pick up Mid Arrows to dispatch those guys and probably gain a level or two in the process. The other thing is we'll have to see whether I really can manage to get these bosses to do nothing but their non-offensive actions. I should be able to, in combination with the other two factors, get away with very few random encounters. I hope you guys like lots of walking and cutscenes :).
Joined: 8/17/2007
Posts: 41
i wanna watch!
Player (215)
Joined: 2/12/2006
Posts: 373
Location: Oregon
I'm getting tired of trying to RE the battle system and I've been thinking that I ought to do a test run(s) to figure out basic strategy. So I've started a test run. There will be luck manipulation, but it will be far from exhaustive. So far, I'm up to the point where the hero can start moving around Alekia. For now, I'm using lua scripts that try waiting different amounts of time before fighting a boss, then pick from a very limited set of moves for each person (if the script even allows for more than one move for that person). It gives pretty decent results against the Sinistrals, certainly better than I would've gotten manually, but nevertheless it would be ideal to test a wider range of moves for each character, but that would take impractically long with lua, hence my efforts to RE the game. Here's my current WIP: http://dehacked.2y.net/microstorage.php/info/174976214/Lufia%20%26%20The%20Fortress%20of%20Doom%20%28USA%29%28test1%29.smv The reason for going into the menu at one point without even doing anything is to manipulate the RNG in order to avoid a battle (there are some places/times where waiting isn't enough to change the RNG).
Player (215)
Joined: 2/12/2006
Posts: 373
Location: Oregon
OK, now I've got a WIP that goes up to just after beating the blue demons. I managed to beat them without leveling up Hero and Lufia first, and without getting anybody killed, but the Lua script had to wait about four seconds to get an initial RNG state that wouldn't get anybody killed. I'm sure that with more thorough manipulation (e.g., trying to have characters defend in case it manipulates the RNG favorably in comparison to attacking) that could be less. As for equipment: I didn't skimp on armor, but I sold off not only their old equipment, but also Lufia's knife since she'll be using either arrows or spells. I got both Foul Waters in Sheran because I think they'll come in handy when leveling up, and also the Mid Arrow there. I also picked up some items that sell for a good amount since I'm avoiding random battles. You'll notice that I actually go to Treck immediately after visiting Sheran for the first time. The thought is that I then warp back to Alekia (I buy a Swing Wing in Treck), and when I finally need to go to Treck to do stuff there, I can just warp there using the Swing Wing in Alekia Castle without having to go through the Sheran Cave again etc. I'm thinking that next I'll get in a few fights with Kobolds in order to get 5 more Mid Arrows. I'll be using those against the Goblins, and hopefully that will be enough to beat them in spite of those 5 fights with Kobolds being the only random battles in the game so far. The WIP is here: http://dehacked.2y.net/microstorage.php/info/540345496/Lufia%20%26%20The%20Fortress%20of%20Doom%20%28USA%29%28test1%29.smv
Player (198)
Joined: 12/3/2006
Posts: 151
Nice WIP. It's refreshing to see this game played without the massive amounts of random encounters you'd normally get. I was wondering though, did you know you could achieve faster luck manipulation by spending some idle time in battle as well, instead of just before battle? Maybe you're deliberately not doing this since it's a test run, but I thought should mention just in case.
Player (215)
Joined: 2/12/2006
Posts: 373
Location: Oregon
Yes, I know about that. To be more specific, it's linked to the enemy's "wobbling". It seems that each time they move the RNG state changes. So when there are more enemies the RNG changes more quickly. This also means that with bosses that don't move, the RNG state only depends on what actions are performed in what order. I have some locations associated with the "wobbling" in my documentation. And yes, I deliberately avoided taking advantage of the randomness derived from wobbling. Trying to take advantage of that randomness would increase possibilities to try to the point where lua becomes impractical. Even with the non-moving bosses, the number of possibilities to brute force by checking a combination of reasonable actions and before-battle waiting times is huge. Hence my desire to eventually write a simulator like what you did with Lufia II in Java. I learned how to use Geiger's snes9x debugger and how to read SNES ASM to try to do so. I've actually implemented in C++ two of the ASM functions that help decide who goes when. Also got a fair bit of info on various subroutines and memory locations, though a lot of it's still speculation. A lot left to do before I can pull it together into something useful. BTW, could I see your notes for Lufia II? Perhaps there are some similarities under the surface. I noticed in your submission notes, for example, that the RNG in Lufia II and Lufia are the same. same number of pseudorandom numbers, increments counter whenever the game asks for a random number, both use XOR to "reset" the table.
Player (198)
Joined: 12/3/2006
Posts: 151
I realized I don't actually have any proper notes on Lufia II, so the next best thing I can provide is the code of two iterations of my Camu Simulator. I added the code in the relevant post. The first simulator aimed at simulating the entire fight without any simplifications and should contain most information on battle mechanics. The simplified simulator only predicts the outcome of the Boss AI, so it's probably less interesting to you.
Player (215)
Joined: 2/12/2006
Posts: 373
Location: Oregon
The test run is now up to leaving Grenoble to go to the Old Cave for the Fairy Kiss. http://dehacked.2y.net/microstorage.php/info/423642040/Lufia%20%26%20The%20Fortress%20of%20Doom%20%28USA%29%28test1%29%282%29.smv There are 5 random battles in this one in order to get mid arrows for the fight against the Goblins. The pauses there are to get good combinations of enemies, and getting the Kobolds to actually drop mid arrows. Thankfully, those mid arrows were enough to not only defeat the Goblins but defeat them fairly quickly. Hopefully the Apprentice and Phantasm will be fairly easy since they have non-damaging abilities I can try to manipulate them into using more often. EDIT: wrong SMV, changed that
Player (215)
Joined: 2/12/2006
Posts: 373
Location: Oregon
OK, here's the next WIP, up to entering Belgen: http://dehacked.2y.net/microstorage.php/info/852798252/Lufia%20%26%20The%20Fortress%20of%20Doom%20%28USA%29%28test1%29.smv Yes, I forgot to rest at the Inn before entering the Ghost Cave, and as a result there's more waiting during the fight with Phantasm than necessary, including a particularly long wait. Nevertheless, it demonstrates that my idea of spamming Mid Arrows and manipulating Phantasm into doing non-offensive stuff works. I've also done testing after that point (playing in realtime for the most part and with the RNG locked most of the time to prevent random battles, then unlocked during boss battles). For the next two bosses, when I did some tests, it seemed that spamming Big Arrows and manipulating them into doing non-offensive actions works. It's when I fight against the Guardian that I'll want to level up. Since the Guardian doesn't move during battle, I can't simply wait until he does something non-offensive. To manipulate luck I have to either change how much I wait before entering battle or what actions the characters do. Fighting the Red Cores doesn't seem to be doable at the levels I'll be at at that point. However, Mimicker can be done, though it's kind of a pain. Fighting the monsters around Frederia yields about the same amount of experience (in fact, they can yield somewhat more), and with the right groups of enemies they're very easy to kill using Ex arrows. For this first phase, I think I'll want to level up at least until Lufia has Stronger, possibly more. By the time you aren't getting at least one level-up per battle (somewhere around level 18-20?), roughly speaking, you can fight the Red cores without getting your butt kicked. In this case, I try to get an enemy combination with Red Core(s) and one other group of enemies (since I've never seen Red Cores appear by themselves). Kill the other group, probably with Ex Arrows, then manipulate it so that all but one Red Core run away, unless my characters are doing particularly well against Thor. Then get that one Red Core. Level up in that way at least until Lufia has Boost, since that spell is incredibly helpful. I'll have enough money that, combined with the Engage ring and selling items I've picked up, I can outfit my characters with far better equipment, especially since I skipped several generations of equipment for the most part. At some point, probably once I can fight the Green Cores, level up at least until Jerin gets Mirror. I have the memory locations that indicate how long it is until certain characters have their mirrors expire. That makes it easy to have Jerin keep mirrors on the characters all the time, so that all Sinistrals except for Gades are a piece of cake. So yes, there will be some grinding, but FAR less than the usual amount due to taking advantage of enemies that yield particularly high amounts of EXP that usually run away. Sort of the Lufia equivalent of Metal Slime. EDIT: Here's an SMV with the Follower defeated. Much easier battle since my HP was actually healed and I now can use Big Arrows. http://dehacked.2y.net/microstorage.php/info/522078640/Lufia%20%26%20The%20Fortress%20of%20Doom%20%28USA%29%28test1%29.smv
Mastania
He/Him
Joined: 5/30/2009
Posts: 135
Location: Top of the pops
You could maybe try manipulating a Scimitar from the sword enemies before Phantasm, it should pull more damage than a Mid Arrow and be useful for quite a while. Otherwise the WIP so far looks really good.
Waddle Waggle Wattle
Player (215)
Joined: 2/12/2006
Posts: 373
Location: Oregon
Yeah, I'll try doing that next time. I wonder if it will be of any benefit though: The ATP of Mid Arrow is 125 (or was it 120?). With Mid Arrows you can have your characters not wear weapons so that hopefully they'll be faster. With Scimitar your ATP is 90+your STR, with STR being rather low at the level I'm at when I reach Phantasm. Nevertheless, I'll test it out next time. The ATP of Big Arrows, however, is 250. Nevertheless the damage they do against Guardian is not very good. So I'm thinking I'll get Grand Blades (for STR +244), which combined with greater STR from leveling up does more damage. EDIT: I forgot to try using Power Gourds. So yeah, scimitars will probably end up being better, because the enhancement provided by Power gourd increases ATP of normal attacks, but not of arrow usage.
Player (215)
Joined: 2/12/2006
Posts: 373
Location: Oregon
Player (215)
Joined: 2/12/2006
Posts: 373
Location: Oregon
First test run complete: http://dehacked.2y.net/microstorage.php/info/393632804/Lufia%20%26%20The%20Fortress%20of%20Doom%20%28USA%29%28test1%29.smv Clocks in at 3:14 in-game time, compared to the real-time run's 5:27. There's a lot of room for improvement. For example, it looks like I could get away with opening a lot less chests than I actually did. EDIT: and in this test run the luck manipulation for all bosses after the Goblins are manual. The only part after the Goblins that's automated so far is luck manipulation for item drops.
Joined: 7/10/2007
Posts: 280
That last Gades fight looked ROUGH. Are you 'just barely' high enough level to make it work thanks to the Green Cores? Do Courage/Dread slowly lose effect? Seems like you could be casting Courage way earlier in that fight and saving a lot of healing. What level did Jerin get Mirror?
Player (215)
Joined: 2/12/2006
Posts: 373
Location: Oregon
Yes Courage and Dread slowly lose effect. And yeah, remembering to cast Courage earlier in the fight would be one improvement. I fought the Green Cores until Jerin had Mirror and no further (she gets Mirror at level 32). EDIT: Looks like I also forgot to try using Protect, which in my test run Lufia learned just after fighting the pirates. That spell could be helpful against both the Oil Dragon and Nazeby.