News:

11 March 2016 - Forum Rules

Main Menu

Final Fantasy II Restored

Started by redmagejoe, December 10, 2019, 03:09:14 AM

Previous topic - Next topic

Vanya

Quick question.
Have you guys looked into the spell targeting routines at all?
I'm curious about it for the FF1 project.

redmagejoe

I feel confident that abw's thorough commenting has narrowed down the spell targeting code, but I haven't looked yet personally. When I have a bit of free time I'll see if I can't pinpoint it.

abw

After an enemy decides what attack it's going to use, the code for taking the targeting byte and ending up with an actual target starts at $0C:$A571 and is at least somewhat documented in my disassembly, though not to the level you'll be used to from Disch's FF1 disassembly. From the player's side, the code for loading up the magic menu, picking a spell, and picking its target(s) starts at $0C:$9D44, but I haven't yet had a reason to care about it, so the documentation there is still pretty sparse.

Vanya

Cool. Thanks for pointing me in the right direction!

abw

Time for an update: I've tweaked the key item usage code to delete 8 useless key items from your inventory after their last known use. I suppose I ought to dig deeper and go through the data for what key terms and items a given NPC has text for, not just the code for doing non-text stuff; work, work, work :P. The new code seems okay in the few spots I've tested, but it'll probably require a complete playthrough for full confidence. I've roughed out a bunch of NPC and event flag stuff, mostly in bank E; if we ever need large amounts of space in banks 3 or E, those banks each have a pair of 256-byte lookup tables (for a total of 1024 bytes) to map 8-bit bit indexes to the corresponding byte and bit (e.g. to map flag #$5A to bit 1 of byte #$0B) that could be replaced by about 20 bytes of code (which might already exist somewhere!).

The Mythril and Wyvern Egg were already removed once you were done with them; now the Pass, Goddess's Bell, Egil's Torch, Sunfire, Pendant, White Mask, Black Mask, and Crystal Rod are also removed, leaving you with only the Ring, Canoe, Snowcraft, and Wyvern summon. If you decide to fight your way into the Dreadnought, the Pass now gets removed from your inventory and the chest containing the pass gets marked as open (whether you actually opened it to not) in order to prevent picking up the Pass after the window for getting it out of your inventory closes. The Wyvern summon is a potentially useful battle item (and you can decide to have Ricard take it with him when he goes), so it can stay, but for the others, the game only checks the list of obtained key items to determine whether their abilities apply on the world map, so if we wanted to we could basically convert the Canoe and Snowcraft to non-inventory items. The Ring could be removed from your inventory after you show it to Hilda, but that would be at odds with her dialogue where she explicitly tells you to keep it; I'm tempted to suggest some light script revision there, either to have Hilda take the Ring or maybe just have one of the characters wear it. I found myself having to throw out useful items quite often during the mid-to-end game, so freeing up 11 of your 32 inventory spaces would be pretty awesome. However, I'm not sure whether this should be considered a bugfix or an improvement.

In other news, how would you feel about re-ordering the naming screens to match the character order, i.e. Firion/Maria/Guy/Leon instead of Firion/Leon/Maria/Guy?

Heaven Piercing Man

The naming order not matching the battle order has been one of my major pet peeves with the NES version. Doo Eet!

abw

And the good news is it only requires changing 4 bytes (2 to swap the display order, 2 more to swap the duplicate name checks)!

redmagejoe

Sorry I fell off the radar. Work work.

I think that leaving the Canoe, Snowcraft, and Ring as is would be fine. I fully agree with the naming order change, however, as it throws me off every single time I start a new game. I think it should be kept as a separate Improvement patch like the Mysidian Tower Orbs Buff lest we risk being at odds with the purists.

Shall I update the first post to address the inventory clean up WIP being complete?

Heaven Piercing Man

Are there purists that care about the naming order?

redmagejoe

Quote from: Heaven Piercing Man on April 25, 2020, 07:42:12 PM
Are there purists that care about the naming order?

I don't know, but I did set out on this project after myself making comments on liberties that were taken with Final Fantasy Restored (item shop edits, removal of Peninsula of Power), and I even released a patch that reverted those creative liberties. I'm simply trying to avoid being hypocritical and change things that don't really NEED to be changed. The naming order is neat, but really only addresses some mild OCD and a one-time momentary nuisance, rather than fulfilling a need, so the argument for why anyone should be bothered by it changing can just as easily be leveled toward why we should bother to change it and then push it as part of the base patch.

tl;dr I don't feel strongly one way or the other, it's just a matter of perspective. That said due to circumstances and differences in experience and skillset, this has really become more abw's project than my own, but I would like to try to maintain certain philosophies for the finished product if that isn't presumptuous of me.

abw

Quote from: redmagejoe on April 24, 2020, 05:18:37 AM
Shall I update the first post to address the inventory clean up WIP being complete?
It seems to be okay so far, but playtesting continues. This time through, I'm also collecting more data such as NPC IDs and treasure chest IDs, am making some progress on identifying the function of game event flags, and have a list of breakpoints set up for RAM addresses I'm curious about. I implemented passive skill experience gains, so I'm testing that out simultaneously; I'd like to combine that with testing per-character running totals of HP/MP damage, but it turns out that most of the unknown bytes in the character skill data are used for various things not related to that character, so finding RAM space for that will take some more work.

I've uploaded my updated disassembly (and the re-assemblable version!) and bugfix patch as well as a new bugfix + improvement patch (remove most useless key items, naming order change, passive skill exp) and just the naming order change.

redmagejoe

The HP/MP running totals and passive skill exp gain will be a part of the Restored (post Bug Fix Only) patch, I assume. I forgot that we were doing a bug fix base patch for other modders, and then Restored, so I guess the name order thing really isn't an issue so long as people can still get the bug fixes without the enhancement/re-imagining that's being done.

redmagejoe

#312
Does the Bug Fixes + Improvement patch include the B Button Dash optional patch that came with an older version of the Chaos Rush patch? I can't seem to find the file for that patch any more.

Reverse-engineered it from a version of the game I had with the patch. It seems that the changed code is as follows:


0x03D4F3 => 85 32 85 34 --> 20 50 F7 EA
0x03F760: 85 32 85 34 A5 20 29 40 F0 02 E6 34 60
[code]

Seems to be a JSR down to this extended code in our free space in fixed bank. May need to recreate this patch given I managed to lose it in my update to Chaos Rush... Or maybe you know of a more elegant way to accomplish this patch.


As I'm cleaning up the first post, may I also ask what improvements are in the + Improvements patch distinct from the Bug Fix Only patch? If I can list them separately in the first post that would be helpful for changelogging. Any chance could get the "improved key items" and "passive skill growth" in separate patches?




I'm happy to see that it's possible to do early grinding without the cheese strat being a temptation/issue any more. However, I also noticed that attacking a Battle Rank 1 enemy 1 time with a Level 1 weapon only yielded 1 point of weapon experience. It should be 2, following the formula (Rank + Attacks − Level + 1), using the bug_fixes.ips. Did something get changed during the merge of the patches to cause this incorrect behavior? Similarly, I cast Cure 1 a single time and gained 6 points where I should have only gained 4 (Rank + Times Cast − Level + 3). These formulas should be maintained for the Bug Fix Only patch.

abw

Quote from: redmagejoe on May 04, 2020, 10:15:26 PM
Does the Bug Fixes + Improvement patch include the B Button Dash optional patch that came with an older version of the Chaos Rush patch? I can't seem to find the file for that patch any more.
Nope, but now that you've found it, we can definitely work it in!

Quote from: redmagejoe on May 04, 2020, 10:15:26 PM
I'm happy to see that it's possible to do early grinding without the cheese strat being a temptation/issue any more. However, I also noticed that attacking a Battle Rank 1 enemy 1 time with a Level 1 weapon only yielded 1 point of weapon experience. It should be 2, following the formula (Rank + Attacks − Level + 1), using the bug_fixes.ips. Did something get changed during the merge of the patches to cause this incorrect behavior? Similarly, I cast Cure 1 a single time and gained 6 points where I should have only gained 4 (Rank + Times Cast − Level + 3). These formulas should be maintained for the Bug Fix Only patch.
I've updated the patch links with a few fixes that should include both of those issues.

The bugfix patch was updated to make Ultima's damage somewhat reasonable instead of being completely OP; it should top out at around 9000 damage now instead of 46000 (for comparison, fully buffed physical attacks against 0 defense/evasion top out at around 24000), and I was getting around 1600 damage in Pandaemonium, which felt pretty good. I also fixed one problem with the attack counters where multi-target spells were running through the incrementing logic once for each target and another where enemies casting multi-target spells on themselves were not incrementing nothing like they should.

The bugfix + improvements patch got the same fixes plus a couple others, and I've also updated it to include full-party stat buffs from the Mysidian Tower orbs.

I think I'm pretty happy with the weapon auto-levelling - my alternate weapon levels were usually 1-2 levels behind my primary weapon level, which basically eliminated the desire to grind without eliminating the benefits of focussing on one weapon type. It also meant that switching to a better weapon of a different type wasn't so painful and I actually used most types at some point. Spell auto-levelling was just plain awesome. I did notice a difference in evasion growth from the vanilla game; between the balanced RNG not concentrating enemy attacks on Maria/Guy and nobody getting credit for attacks that didn't happen, overcoming the evasion growth barrier was much harder, and I didn't get my first evasion level up until Deist. Magic resist growth was affected by the same factors, but the fix to magic resist credit for enemy multi-target spells tended to balance it out. I had just barely enough inventory space for the longer dungeons, so that was definitely an improvement, but I'm still considering ditching the Canoe and Snowcraft. The fixed Ripper is also phenomenal against high-defense enemies such as all those annoying slimes.

Quote from: redmagejoe on May 04, 2020, 10:15:26 PM
As I'm cleaning up the first post, may I also ask what improvements are in the + Improvements patch distinct from the Bug Fix Only patch?
Like I said above, the bugfix + improvements patch includes removing most key items after their last required use, switching the naming order to match the party order, passive skill experience gain, but it now also includes the Mysidian Tower orbs granting stat increases to all party members.

Quote from: redmagejoe on May 04, 2020, 10:15:26 PM
Any chance could get the "improved key items" and "passive skill growth" in separate patches?
Maybe. Separating the improvements out from the bugfixes is one thing, but making individual patches to apply against the base ROM would be more annoying.

redmagejoe

#314
First post has been updated, removed the links to Mysidian Tower Orbs buff and B Button Dash (but still have them kept in case they're wanted to be uploaded as separate patches for those who might not want to use Restored) as they've been added to the Improvements patch. For ease of communication, I've dubbed our versions Bug Fix and Restored respectively.

I figured that the key items improvement at least might be a nice QoL standalone patch, though the passive skill growth does seem like it should be one of the defining traits of the Restored patch.




While fixing a little mistake in my revision of the Chaos Rush translation, I noticed a place where our patches don't play nicely.


0x032D27|$0C:$AD17:AE BF 7C LDX $7CBF  ; index into string buffer at $7D47
0x032D2A|$0C:$AD1A:E8      INX


As I had replaced the E8 with an EA to address Chaos Rush's spell names pushing characters out of the battle window, this seemed ducky. Your bug fix patch, however, seems to move this code down to 0x032D4B. A very minor issue, but one I'm trying to think how might be resolved. A simple one-byte compatibility patch, maybe? Seems silly, but the simplest solution to change that E8 to an EA. I know it's a janky fix I used in the first place, but without trying to rewrite/rearrange that space to have it specifically check number of characters used and do a conditional E8 or not (so only 5-character spell names would result in "Thunder16" while "Cure 16" would still display properly) which I don't have the confidence in myself to do, it's my best bet.




I just happened to wonder if it was indeed Chaos Rush translation that was causing the slightly buggy appearance of shop NPCs (or anything along that horizontal axis) when text boxes are opening, which also lead to the weird "orange" pixels on icons, most noticeable in the first magic shop's fourth tome on a translated version. As it turns out, a completely unpatched JP ROM has this same bug, so it can be added to the list as a minor graphical bug.

Quote
  • Stat refresh needed after Mysidian Tower Orb

Is it safe to assume that this would just require the 3 bytes for the JSR to our stat refresh? I feel like there were multiple JSRs... Sorry, I've been out of the loop on this for so long I'm starting to forget some of the methods we used to achieve some basic fixes...  :(

Special

I'm confused with the latest patch on this site, it was updated apparently but still says 2.0 as what I had before, it says "Minor bug in Enemy Names bank" was one thing fixed, but also that you re-added the B Button Dash patch, so do I need to patch B Button Dash after the fist patch, does the first patch now not have the B Button Dash baked into it?

redmagejoe

Quote from: Special on May 06, 2020, 02:06:02 PM
I'm confused with the latest patch on this site, it was updated apparently but still says 2.0 as what I had before, it says "Minor bug in Enemy Names bank" was one thing fixed, but also that you re-added the B Button Dash patch, so do I need to patch B Button Dash after the fist patch, does the first patch now not have the B Button Dash baked into it?

The B Button Dash was never baked in, but rather a separate IPS included in Chaos Rush's old archive (7z, RAR, ZIP, etc) that I had forgotten to include. I have reincluded it as a separate IPS, the same IPS available in the first post of this page. No matter how you acquire it, the B Button Dash can be safely patched on top of any ROM. The only patch with it baked in is the Restored WIP on the first post of this thread.

Special

Ah, thanks for clarifying, I only wondered because my "old version" is labeled as "Refurbished v2.0 + B-Button Dash" but I honestly don't remember patching B-Button Dash (but it's been a while), then your description made me wonder about things.

redmagejoe

#318
@abw: It seems like Guy, the only 1 of 2 front row characters (the other being Firion) is getting a disproportionate amount of enemy focus. Did something happen with the enemy targetting? I thought we'd fixed that, but I just had Guy exclusively focused by a Soldier, and then a Land Turtle (two different battles) 8 times in a row. Maybe it was just really bad RNG, since I've been locked in a standstill with 2 Ogres and an Ogre Mage, and they're regularly targetting Firion and Guy pretty fairly. I doubt that an entry this early in the series has monster AI that focuses specific targets (like lowest HP or highest HP, etc).

Also I believe I may have found an interesting new bug. I believe the monster encounter is determined one tile before it happens, rather than on the tile where it happens. I am beyond certain that I mapped out the corner of the overworld encounter tiles, and yet I've noticed that if I would be entering a different tile of this grid as I encountered a battle, it would use enemies from the grid tile I'd just left.

Also still getting spells cast on me by Ogre Mages that I SEEMINGLY successfully landed Minwu's Fog (Amnesia, permanent mute) on. EDIT: It's only happening on the same turn where the spell is cast, but according to online descriptions, a successful Mute/Amnesia should cause the spell to fail if the monster has already issued the order. That doesn't appear to be happening. Is this also a vanilla bug? I should probably add that to the list if it is.

Jiggers

Quote from: redmagejoe on May 06, 2020, 05:12:06 PM
Also I believe I may have found an interesting new bug. I believe the monster encounter is determined one tile before it happens, rather than on the tile where it happens. I am beyond certain that I mapped out the corner of the overworld encounter tiles, and yet I've noticed that if I would be entering a different tile of this grid as I encountered a battle, it would use enemies from the grid tile I'd just left.

That's in FF1 too I think? I don't remember what the fix is, but it might just be re-loading tile properties or whatnot during battle set up to make sure its gonna load enemies from the new grid.

You guys have come so far! I couldn't keep up. But it sounds like its fun to play again, so good job!
I know exactly what I'm doing. I just don't know what effect it's going to have.

I wrote some NES music! Its a legal ROM file. - I got a Ko-Fi page too.