News: 11 March 2016 - Forum Rules
Current Moderators - DarkSol, KingMike, MathOnNapkins, Azkadellia, Danke

Poll

Restored: ROM space allowing, should attacks be tallied for each weapon type used in combat? (support multiple weapon EXP for weapon swapping)

No. Restored already has passive growth, only end-of-combat weapon should receive bonus.
Yes. All weapons used in combat should receive this bonus credit.

Author Topic: Final Fantasy II Restored  (Read 124929 times)

Rabite890

  • Jr. Member
  • **
  • Posts: 30
    • View Profile
Re: Final Fantasy II Restored
« Reply #340 on: May 15, 2020, 10:28:04 pm »
Is there a list of all the things you've fixed so far? I know there's been a ton of work put in and I'm really only waiting for Ultima and dual wielding to be fixed. The rest are obviously still important, but those two are huge for me.

I've said this earlier in this thread, but thanks again for all the work you've put in.

redmagejoe

  • Sr. Member
  • ****
  • Posts: 298
    • View Profile
Re: Final Fantasy II Restored
« Reply #341 on: May 15, 2020, 10:45:41 pm »
We've been maintaining an internal list of bug fixes since the first post was getting crowded beyond the character limit. I would like to still have a list of the fixes though, so I may put a link to that up, unless abw is maintaining the one I gave him, in which case I'll ask him about it. As of this posting, however...

Quote
  • The Ripper Knife was meant to do +20 non-reducible damage per hit to the target on top of its normal attack damage. While the game displayed this bonus damage, it was not actually being dealt. This has been fixed so that Rippers do inflict their bonus damage.
  • The Heal Staff is a weapon that was meant to do 0 damage to non-Undead targets and heal them by +30-60 HP per hit, while doing its normal attack damage to Undead targets and +30-60 non-reducible bonus damage per hit. Both effects were bugged: (1) When used against non-Undead targets, the Heal Staff would first deal its normal damage and then heal its normal damage + heal amount; if the normal damage killed the target, the net effect was that the target would be healed by the heal amount + any excess normal damage. This has been fixed so that now only the heal amount is applied. (2) When used against Undead targets, the Heal Staff suffered from the same bug as the Ripper Knife, displaying the sum of its normal and bonus damage but only dealing its normal damage. This has been fixed so that now the bonus damage is also applied.
  • Drain/Osmose effects on physical attacks, such as from the Blood Sword, could drain more than the target's current HP/MP. This has been fixed so that the drain amount is capped at the target's current HP/MP.
  • If a monster was killed by the drain bonus damage from a Blood Sword (not by its normal damage), the monster simply disappeared without displaying its usual death message. This has been fixed so that monsters killed by bonus damage also display their usual death messages.
  • Equipment that grants a bonus to some stat would allow that stat to exceed 99, in which case the stat's tens digit would be displayed as "A" in menus, e.g. "A9" instead of "109". This was obviously a bug and a cap has been imposed in this patch.
  • Equipment that granted bonuses to the same stat were supposed to stack, but the code was improperly written in a way that would not allow for more than one bonus per stat, resulting in only one bonus being applied to the same stat from multiple equipment pieces. This patch changes the behavior to allow stacking bonuses, making it possible to wear multiple pieces to gain a +10/20/30 bonus to Strength or Agility.
  • The Evasion success % calculation was capable of overflowing but only the low byte was used and capped at 99%, resulting in characters with between 256% and 354% Evasion recieving 0% to 98% instead of 99%.
  • There was no overflow protection on the counters in combat for keeping track of actions taken by and performed against you in combat that are used for determining stat level ups at the end of battle. Though extremely unlikely to occur in normal game play, it was possible for these values to overflow back to 0 in a particularly long battle, robbing characters of deserved stat increases. All counters were capped at 128, far higher than is necessary.
  • Overflowing a character's black magic usage counter also incremented that character's white magic usage counter.
  • Due to an addressing oversight, enemy casters who targetted the entire party would add credit to Firion's White Magic counter (for increasing Spirit at the end of battle), rather than to each party member's "hit by magic" counter for raising Magic Defense. All characters were robbed of Magic Defense experience because of this. This patch corrects the addressing error, so that target-all spells hitting the party now properly give each of them Magic Defense experience.
  • The combat action counters were incremented as soon as a target was selected and were not decremented if that action was cancelled, leading to the infamous "target/cancel" bug where a player could artifically inflate the physical, white, black, and per-spell usage counters for all but the last party member. The same logic also leads to the less famous "get credit for stuff that never happened" bug where party members' physical and/or magical defense counters were artificially inflated by including attacks from monsters that were killed before they could act. These closely related bugs have all been fixed by moving the incrementing of combat action counters from when a target is selected to when an action is performed.
  • The original RNG uses a "multiply and round" algorithm that produces non-uniform results, causing the lowest and highest possible values to be only half as likely to be selected as other values. In the case of enemy target selection, this results in the middle 2 characters receiving a disproportionate amount of the enemy's attacks compared to characters 1 and 4. This patch substitutes a "multiply and truncate" algorithm that produces a significantly more uniform random distribution. However, the chance to lose Intellect/Stamina/Strength when gaining Strength/Intellect/Spirit has had its value adjusted to maintain the original game's 1/10 chance instead of the intended 1/6 chance.
  • The logic for determining whether a monster will run or not suffered from multiple overflow errors and has since been brought significantly closer to working as intended. (see first post for the remaining WIP note)
  • There was an approximately 1% chance for "non-breakable" items (e.g. equippable items that can be used as items in battle to cast spells) to be destroyed anyway when used in battle, including unique and valuable items such as the Masmune. "Non-breakable" items are now truly non-breakable.
  • While Square attempted to cap Gil at 9,999,999 when gaining Gil from selling items, their branching code was done incorrectly, resulting in Gil being set to 9,999,999 ($98967F) as soon as it reached 9,961,472 ($980000). Likewise, it could overflow beyond the $FFFFFF byte maximum, wrapping back around to 0 Gil. Square did not even attempt to cap Gil when gaining Gil from battle. Gil is now properly capped at 9,999,999 in all scenarios.

The entire level up routine code has been optimized and shifted to free up space for bug-fixing, and contains all of the below-listed fixes:
Quote
  • There was previously nothing preventing HP and MP from going above 9,999 and 999 or even overflowing beyond their 2 byte range, which eventually could result in an entire party permanently stuck with 0 max HP and MP. This patch properly caps HP at 9,999 and MP at 999.
  • There was no attempt made to prevent stats from attempting to increase at the end of battles when they were maxed (99). While the stats could never go above 99, the code still allowed the message to display saying they had increased, and this caused the code for determining the corresponding stat decreases to fire. This patch prevents any attempts to run stat increase/decrease code on a stat that is already at its cap.
  • Skill levels were capped at 16, but would continue to gain experience and, in the case of Weapons and Spells, erroneously display a message on "level up" at the end of battle. This patch prevents any experience growth (including experience for spells cast outside of battle) or level up messages from appearing on maxed skills.
  • The skill experience calculation suffered from an underflow bug when high-level skills were activated with low usage in low battle rank fights, resulting in enough experience gain to guarantee a level up at the end of battle. This patch corrects the logic to check for underflow and prevent experience gain when underflow occurs.
  • Increases to a character's base stats would not be reflected in their calculated stats until the start of the next battle or an attempt to change the character's equipment. Calculated stats are now automatically updated at the end every battle.

The entirety of the code for handling spell behaviors has been rewritten to make the code more concise/efficient, and fix a gross number of bugs including:
Quote
  • Levels 8+ of Aura and Barrier did not grant their 8th level benefit, due to a math error by the developers. This patch corrects that error, allowing Aura to grant bonus damage to Undead enemies and Barrier to grant Ice resistance as originally intended.
  • Aura, Barrier, and Dispel display messages announcing which effects they modified, but the messages were displayed in opposite order to the effects, i.e. the level 1 effect displayed the level 8 message, the level 2 effect displayed the level 7 message, etc. These spells' messages now correctly correspond to their effects.
  • When Basuna/Esuna cured multiple status ailments, only the message for the last-cured ailment was displayed. This patch converts the relevant code into a loop so that Basuna/Esuna now display messages for each Ailment that was cured.
  • Basuna would always clear the "Critical HP" ailment.
  • Casting Basuna on a target with only the "Critical HP" ailment would result in displaying the message for successfully casting Fear.
  • Basuna would always cure Poison, even with 0 successes.
  • If Basuna/Esuna failed to clear the highest-ranked ailment present on a character, they would display their failure message even if they did clear other ailments.
  • The bonus amounts from Berserk/Fear/Protect could overflow before being added to the target's associated stat, resulting in low or no effect.
  • Berserk/Blink/Fear/Protect/Shell displayed their failure message whenever the stat they increased became >= 255, even if it was < 255 before.
  • Berserk/Blink/Fear/Protect/Sap/Shell did not display a failure message when they failed to affect their associated stat.
  • Cyclone/Quake/Tsunami were fairly messed up. Their code has multiple nested bugs, so it's hard to be sure what their intended behaviour was. Based on their behavior in later remakes, they have been updated to deal double damage to certain monster families and be completely ineffective against certain other monster families.
  • Dispel failed to write the target's modified resistances back to RAM, resulting in the spell doing nothing.
  • As with weapon effects, the Drain/Osmose spells were capable of draining more than the target's current HP/MP; Osmose was even able to drain MP from creatures with 0 max MP.
  • Fear/Haste/Slow were slightly too powerful, not failing with 0 net successes like other spells.
  • Imbibe decreases the target's evasion % by 1, but there was no check for underflow, so after enough castings the target could end up going from 0% to 255% evasion.
  • After calculating how much HP to restore, Life only wrote the low byte of the value, which could result in the target being revived with 0 HP and immediately pronounced dead again.
  • Protect determined its effect multiplier by checking the target's spell power, but this value was only calculated for the caster when the spell was used. As such, each target other than the caster ended up with a multiplied by 0 bonus. This patch correctly checks the caster's stat rather than the target's so that all targets now benefit from Protect's defense bonus.
  • Sap only acted on the least significant byte rather than the whole of a target's MP.
  • Wall could be exploited by casting it on monsters to ensure that instant death spells would work on them.
  • As the story goes, Ultima was intentionally bugged. It did not scale with its own level like every other spell, it did not scale with the caster's other skill levels as in later remakes, it did not scale at all (aside from the boosts to success rate and power that are applied to all spells). Based on its behavior in later remakes, this patch makes Ultima scale with both its own level and the caster's other skill levels. (see first post for WIP note)
  • The code for using status-curing items in battle forgot to set a key variable before determining which message to display, which could result in incorrect messages being displayed (e.g. if a character suffered from both Amnesia and Curse, curing Curse in battle with a Cross would incorrectly display the message for curing Amnesia).
« Last Edit: May 15, 2020, 11:16:01 pm by redmagejoe »

Rabite890

  • Jr. Member
  • **
  • Posts: 30
    • View Profile
Re: Final Fantasy II Restored
« Reply #342 on: May 15, 2020, 11:02:20 pm »
We've been maintaining an internal list of bug fixes since the first post was getting crowded beyond the character limit. I would like to still have a list of the fixes though, so I may put a link to that up, unless abw is maintaining the one I gave him, in which case I'll ask him about it. As of this posting, however...

The entire level up routine code has been optimized and shifted to free up space for bug-fixing, and contains all of the below-listed fixes:
The entirety of the code for handling spell behaviors has been rewritten to make the code more concise/efficient, and fix a gross number of bugs including:

Holy crap... I had no idea you had fixed that much stuff!

redmagejoe

  • Sr. Member
  • ****
  • Posts: 298
    • View Profile
Re: Final Fantasy II Restored
« Reply #343 on: May 16, 2020, 02:45:59 pm »
abw is the one who deserves all the credit for the project being as far along as it is, and I've just been doing anything I can to try to help.

Updated the first post after some testing with Life on dead enemies, and added a few more items. I'm not sure if the poison/venom monster KO bug is different than what I described, or if the sprites are still there and able to attack, etc etc.
« Last Edit: May 16, 2020, 02:57:25 pm by redmagejoe »

abw

  • Hero Member
  • *****
  • Posts: 528
    • View Profile
Re: Final Fantasy II Restored
« Reply #344 on: May 17, 2020, 03:30:36 pm »
Having scanned through the disASM and found where battle messages are stored ($05:$B5A9) and knowing that I'm either looking for any references to $05:$B5A9 with an offset of $13 (Preemeptive Strike) or $15 (Ambushed), or specifically calls to those messages which I doubt will be a thing given the deliberately vague and relative nature of instructions in place of specific conditions, I've eliminated the first 7/17 instances of $05:$B5A9 being relevant.
The battle message pointer table starts at $05:$B295, and if you're looking for Preemptive Strike/Ambushed!, those are #$09 and #$0A respectively and are referenced around $0C:$A313.

Fun new bug discovered. First of all, I wasn't aware that undead enemies would actually run away... You know, being undead and thus supposedly fearless... But apparently if you try to cast Life on a space where an enemy has fled, it will still succeed, said that enemy "fell", "Collapsed!" (is this supposed to come after "fell" for instant death spells?) and play the death sound. No items or gil or anything like that as if you actually killed it, but it is still worth noting, I think.
Huh, that is a fun bug. With non-Undead, you get similar behaviour, but with Life's revival message instead of the message for instant death spells. When a monster flees, its persistent ailments are set to KO and Stone, and the code for checking valid spell targets only looks at ailments, not whether the monster is still in combat. Life and Esuna are the only spells you're allowed to cast on dead targets, but Esuna doesn't check its target's family, so you could actually revive an Undead monster with Esuna. Furthermore, Esuna doesn't change your HP when cast in battle, so the target would get revived at 0 HP and then be marked as dead again. There's another bug to add to the list!

Updated the first post after some testing with Life on dead enemies, and added a few more items. I'm not sure if the poison/venom monster KO bug is different than what I described, or if the sprites are still there and able to attack, etc etc.
This is definitely different from the bug where monsters killed by Poison/Venom aren't removed from battle; Poison/Venom damage is inflicted at the end of a round, but this Life/Esuna bug is only exploitable in the time between when an enemy flees and the end of that round.

Another minor, interesting one I've been testing, and thought was another translation bug at first. It seems any enemy formation that has both DualHeads and DualDeads also displays in the "enemy names" window that only appears at the start of a battle Stalagmites as well, even if there aren't any Stalagmites present. I'm guessing this is a pointer issue.
I don't recall seeing that myself, but the enemy names window does go by pretty quickly if you're playing at high speed, so I may have just missed it.

Holy crap... I had no idea you had fixed that much stuff!
As far as I know, we've got all the most important actual bugs fixed at this point, but there are plenty of lower-priority bugs and improvements left. Here are some more to add to the list (I went trawling through the gamefaqs FF2 board at some point, so some of these come from there):
  • Casting Esuna in battle on a dead target with enough successes to clear the KO ailment revives the target with 0 HP, resulting in them staying dead.
  • You are able to continue interacting with NPCs that have been removed until you exit the conversation (e.g. you can keep talking to Scott over and over again even after he dies).
  • The NPC Ask/Learn/Item UI is displayed even for NPCs that will never respond to any key terms or items.
  • The Mysidia Cave B4 treasure room uses an incorrect battle background.
  • Parts of Palamecia Castle 7F do not block teleport spells.
  • Killer Fish use the wrong palette depending on their companions.
  • Damage values over 999 prevent the DMG text from being displayed.
  • Characters affected by Toad or Mini always get 0 spell successes in combat, including for the "spells" that power items, which makes the Maiden's Kiss and Mallet items ineffective in combat.
  • A weapon's family or element bonus can push its base damage over 1 byte, but the part of the damage algorithm that calculates a random number between 0 and base damage only uses the low byte of base damage, resulting in significantly reduced damage output in this case.
Technically this is also a bug, but the bug fixes we've already applied prevent it from being exploitable, so I'm not going to worry about it:
  • The Inn cost uses a 16-bit calculation which is subject to many overflow errors when maximum HP/MP are able to use their full 16-bit ranges; this can no longer be exploited since maximum HP and MP are now capped at 9999 and 999 respectively.
And here are some other miscellaneous bugs/ideas/food for thought that aren't currently on the front page list (some of these have been brought up before; I'm just centralizing them here):
  • When dual-wielding two weapons of the same type (other than bare-handed), it is possible to gain 2 weapon levels in one battle by raising that character's attack counter high enough (does not apply to Restored).
  • Display all of the ailments affecting a character (e.g. by cycling through displaying them) instead of only the highest-priority ailment.
  • Only display key items in the NPC Item UI.
  • Restore the black backgrounds for character portraits on the status screen?
  • Re-order level up messages to match the order of stats as displayed in the status menu?
  • Preserve a character's row when they get revived outside of battle.
  • Add a row indicator on the main menu screen.
  • Update the status (/equip, but more work) menu screen to display magic penalty, armour resistances, attack elements/families, and weapon special effect.
  • Let multi-target Life/Esuna target dead characters.
  • Use different battle messages for Flee failure when the battle can't be escaped vs. when the character failed their success roll.
  • Display a message for inescapable battles at the beginning of combat.
  • Make Leila and Leon join at full HP?
  • Scale stats for new characters to average party stats?
  • Evasion/Magic Resist levels should probably have a low cap, as it is currently quite easy to become effectively immune to physical attacks and spell successes by casting Blink/Shell.
  • The Blood Sword is just too powerful, especially when you have two of them. Being able to kill the final boss in the first round with a low level party shouldn't be so easy.
  • Implement in-battle row switching (would need to re-run enemy command selection/validation)?
  • Make confused entities target a random entity instead of their own party?
  • Speed up battles by displaying spell animations and their text at the same time, or display animations for all targets simultaneously.
  • Deduct MP cost of spells before completing their effects so that Osmose/Swap can completely restore MP.

In other news, I've updated the Bug Fix patch to update calculated stats after each buff from the Tower of Magi orbs and condensed the corresponding code in the Restored patch; the key there was remembering that effective stats are also calculated stats so we don't need to update them separately before calling the code for updating calculated stats. For the orb buffs, that freed up 15 bytes, which was more than enough to add the call to update calculated stats; the same reasoning applied to the level up code in bank 5 freed up a further 80+ bytes there.

redmagejoe

  • Sr. Member
  • ****
  • Posts: 298
    • View Profile
Re: Final Fantasy II Restored
« Reply #345 on: May 17, 2020, 04:14:09 pm »
  • Casting Esuna in battle on a dead target with enough successes to clear the KO ailment revives the target with 0 HP, resulting in them staying dead.
  • You are able to continue interacting with NPCs that have been removed until you exit the conversation (e.g. you can keep talking to Scott over and over again even after he dies).
  • The NPC Ask/Learn/Item UI is displayed even for NPCs that will never respond to any key terms or items.
  • The Mysidia Cave B4 treasure room uses an incorrect battle background.
  • Parts of Palamecia Castle 7F do not block teleport spells.
  • Killer Fish use the wrong palette depending on their companions.
  • Damage values over 999 prevent the DMG text from being displayed.
  • Characters affected by Toad or Mini always get 0 spell successes in combat, including for the "spells" that power items, which makes the Maiden's Kiss and Mallet items ineffective in combat.
  • A weapon's family or element bonus can push its base damage over 1 byte, but the part of the damage algorithm that calculates a random number between 0 and base damage only uses the low byte of base damage, resulting in significantly reduced damage output in this case.

I'll go through these and update the first post.

And here are some other miscellaneous bugs/ideas/food for thought that aren't currently on the front page list (some of these have been brought up before; I'm just centralizing them here):
  • When dual-wielding two weapons of the same type (other than bare-handed), it is possible to gain 2 weapon levels in one battle by raising that character's attack counter high enough (does not apply to Restored).
  • Display all of the ailments affecting a character (e.g. by cycling through displaying them) instead of only the highest-priority ailment.
  • Only display key items in the NPC Item UI.
  • Restore the black backgrounds for character portraits on the status screen?
  • Re-order level up messages to match the order of stats as displayed in the status menu?
  • Preserve a character's row when they get revived outside of battle.
  • Add a row indicator on the main menu screen.
  • Update the status (/equip, but more work) menu screen to display magic penalty, armour resistances, attack elements/families, and weapon special effect.
  • Let multi-target Life/Esuna target dead characters.
  • Use different battle messages for Flee failure when the battle can't be escaped vs. when the character failed their success roll.
  • Display a message for inescapable battles at the beginning of combat.
  • Make Leila and Leon join at full HP?
  • Scale stats for new characters to average party stats?
  • Evasion/Magic Resist levels should probably have a low cap, as it is currently quite easy to become effectively immune to physical attacks and spell successes by casting Blink/Shell.
  • The Blood Sword is just too powerful, especially when you have two of them. Being able to kill the final boss in the first round with a low level party shouldn't be so easy.
  • Implement in-battle row switching (would need to re-run enemy command selection/validation)?
  • Make confused entities target a random entity instead of their own party?
  • Speed up battles by displaying spell animations and their text at the same time, or display animations for all targets simultaneously.
  • Deduct MP cost of spells before completing their effects so that Osmose/Swap can completely restore MP.

Responding to each item. Bug Fix implies Restored as well, while Restored means exclusive to Restored.
  • I guess the double level thing isn't an issue for our two patches.
  • Bug Fix(?): I definitely like the idea of cycling through all ailments. I don't see why this couldn't be in a non-Restored version, but that's up to you.
  • Restored: I VERY MUCH like this idea, freeing up a lot of scrolling if you're like me and keep your key items at the bottom of the menu. There's no interactions in the game that ask for a potion or anything, right?
  • Bug Fix: Not sure if this would accomplish anything other than "hey, neat". Not averse to it, but I always ask myself "what other things might I accidentally break by doing this, and is it worth it?". My first instinct is to leave it alone to avoid that possibility. :P
  • Restored: I think this would be a nice bit of polish.
  • Restored: Removing auto-backrowing for dead characters would be nice. I can't see any benefit to that and I've started so many battles with a front-row character I just revived in the back. It's arbitrary and cumbersome the way it is.
  • Restored: If you think this is feasible, I suppose it wouldn't hurt? Though may be effort that isn't necessary if the auto-backrow revive thing is removed.
  • Restored: Very ambitious but very much has my support. Some of these may get into the realm of using a different mapper, and could definitely benefit from having Jiggers be an active part of this project given her impressive work on the Final Fantasy MMC5.
  • Restored: Mixed feelings regarding balance vs convenience on this. I like the convenience, but should you be allowed the potential to res more than one character per round with a single character? Does the game's difficulty suffer from this? I'm inclined to say yes, so I'm conflicted about giving this idea my support.
  • Restored: I like this idea, though it demands what the criteria for "inescapable" means. Does it mean that the flag for bosses is set, or does it mean the math will never work out in your favor? Right now I find myself trapped in battles with two Chimeras for whatever reason, yet I can run away from them if they happen to be paired with 2 Death Flowers.
  • Restored: This seems like a good idea and is closely tied to the criteria in the item above.
  • Bug Fix: Wait, they don't? That's silly.
  • Restored: Ehhh, I've noticed that Leila and Ricard at least very quickly come into their own, and you get Gordon twice so he can scale further. I'm inclined to say not necessary.
  • Restored: Maybe I just have terrible luck even with spell successes, but I'm noticing no difference in damage on my character when I cast Wall 8 or Shell 8 on them even from level 7 spells. Not sure this would be necessary unless the mechanics of those spells is bugged. This should be discussed more probably, but with Evasion I definitely see where you're coming from. Not sure it's our place to try to rebalance the game though, just polish it.
  • Restored: I definitely agree it's too powerful, yet there's already a sort of universal "cheese" label on it that inclines some players to choose not to use it. I'm not sure it demands being tampered with, especially since how good it is depends entirely on your Swords level (or maybe Haste as well?). Inclined to say leave it alone, but I am definitely open to hearing ideas about it.
  • Restored: I don't dislike this idea, but I'm not married to it either. I say sure, why not.
  • Restored: This comes down to series convention I think. Confuse only actually has a chance to attack hostile units instead of just allies starting in Final Fantasy 8. I think we can leave it as it is to adhere to convention.
  • Restored: I like the idea of multi-target spells showing their animations all at once. I think the text showing up after the animation is fine. This would mean that it would cycle through the targets and damage in quick succession rather than animation, messages, animation, messages, etc.
  • Bug Fix(?): I like the idea of having the cost deducted at the start of the animation rather than after the first hit, since as you said, in single target cases you can never refill your MP with Osmose, and in multi-target cases it looks awkward for your MP to go down or stay the same after the first hit of Osmose.

In other news, I've updated the Bug Fix patch to update calculated stats after each buff from the Tower of Magi orbs and condensed the corresponding code in the Restored patch; the key there was remembering that effective stats are also calculated stats so we don't need to update them separately before calling the code for updating calculated stats. For the orb buffs, that freed up 15 bytes, which was more than enough to add the call to update calculated stats; the same reasoning applied to the level up code in bank 5 freed up a further 80+ bytes there.

Awesome! That's a lot of space to work with! And I completely overlooked that even though I had the sneaking suspicion that effective stats should have been taken care of without needing a separate increment. I guess this was done simply because they didn't call a stat refresh? Seems like they could have made a lot more space for themselves if they hadn't done things in such a rudimentary way.

Chaos Rush

  • Sr. Member
  • ****
  • Posts: 286
    • View Profile
Re: Final Fantasy II Restored
« Reply #346 on: May 18, 2020, 03:23:01 am »
Just posting to say, a user had contacted me to report that the FF2 version 2.1a patch doesn't work. They are patching to the Japanese ROM and according to them, it says patch successful but the game is still in Japanese.
« Last Edit: May 18, 2020, 08:12:04 am by Chaos Rush »
Creator of STARLIGHT LEGACY intended to be released on Steam.
Discord: https://discord.gg/fTS5Q78
Twitter: https://twitter.com/jmatz1995

redmagejoe

  • Sr. Member
  • ****
  • Posts: 298
    • View Profile
Re: Final Fantasy II Restored
« Reply #347 on: May 18, 2020, 08:30:12 am »
Just posting to say, a user had contacted me to report that the FF2 version 2.1a patch doesn't work. They are patching to the Japanese ROM and according to them, it says patch successful but the game is still in Japanese.
Hey Chaos. I'm assuming the user was TenJoker? It was some confusion on his end and we got it sorted out. I've since updated the page to inform people to PM me rather than you.

Chaos Rush

  • Sr. Member
  • ****
  • Posts: 286
    • View Profile
Re: Final Fantasy II Restored
« Reply #348 on: May 18, 2020, 08:36:22 am »
Hey Chaos. I'm assuming the user was TenJoker? It was some confusion on his end and we got it sorted out. I've since updated the page to inform people to PM me rather than you.
Yeah it was. Glad it's sorted out.

Thank you for continuing and maintaining FF2 by the way! I feel like FF2 was basically Square trying to do what they were doing with FF4, but they were limited by small cartridge space, and FF4 was when they finally got to make the type of story-heavy game that they wanted to with FF2. I still think it's amazing how much of a leap NES FF2 is from NES FF1 but sadly not many people can see it that way due to FF2's various gameplay issues.
Creator of STARLIGHT LEGACY intended to be released on Steam.
Discord: https://discord.gg/fTS5Q78
Twitter: https://twitter.com/jmatz1995

redmagejoe

  • Sr. Member
  • ****
  • Posts: 298
    • View Profile
Re: Final Fantasy II Restored
« Reply #349 on: May 18, 2020, 12:52:16 pm »
It's a pleasure to be a part of this project. I saw a great deal of promise in the game even if it's initial impression is less than ideal. It just needed a few... hundred bandages, that's all. ;D

Thank you for providing such a solid translation upon which to build.



@abw: How would you feel about, assuming it's possible and not simply tied to an inflexible room data table, to change the BGM of Fynn Castle post-liberation to the Rebellion Theme used in the hideout? It seems bizarre that it would still play the eerie castle dungeon theme even when it's occupied and the headquarters for your entire operation. The PSP version retained this, though it feels a strange stylistic choice.

Also a minor downside to the passive skill growth patch in Restored is that Warp loses some of its functionality much earlier, since it would only level through use before. I suppose if a player uses Warp to hop back a door enough times, it will invariably level to a point that it's slightly less precise. The patch makes it more unwieldy, but I don't know if you could have a single exclusion for Warp specifically without several instructions. It may be a good idea though for players who don't want Warp leveling up without their consent, but no other spell that I can think of suffers from having a downside to leveling on its own.

https://guides.gamercorner.net/ffii/maps/castle-fynn-treasure-rooms

Are there supposed to be encounters in these rooms even before you liberate the castle? You can only access 1 of the 2 before liberation any way, but there are NO encounters at all in this room. Is it that the encounters are pointed to by the room data, but the encounter rate is set to 0? Would that then be a bug? Perhaps it's only supposed to be set to 0 post liberation, and that check never got implemented? I think this is a potential bug. I tested this on even a base JP version, because I was scratching my head over why this guide spoke the way it did about these rooms and its encounters. I'm led to believe then that the guide was written based on referencing the ROM rather than actually playtesting (which means that someone had to have done some reverse-engineering at some point).
« Last Edit: May 18, 2020, 05:03:39 pm by redmagejoe »

abw

  • Hero Member
  • *****
  • Posts: 528
    • View Profile
Re: Final Fantasy II Restored
« Reply #350 on: May 18, 2020, 08:19:06 pm »
Heh, just spitballin' :p. Some of these are definitely out of scope for a bug fix project, but the lines can get a bit blurry sometimes especially with Restored. I haven't come across the code for most of these yet, so I can't say how feasible they are either. Some comments on specific items:
When dual-wielding two weapons of the same type (other than bare-handed), it is possible to gain 2 weapon levels in one battle by raising that character's attack counter high enough (does not apply to Restored).
Gaining 2 levels in the same battle is still possible in the Bug Fix patch since it levels up the primary weapon type and then the secondary weapon type. For Restored, I converted that section into a loop over each weapon type, so the same weapon type never has a chance to level twice.

Update the status (/equip, but more work) menu screen to display magic penalty, armour resistances, attack elements/families, and weapon special effect.
Most of the plumbing for displaying spell penalty is already there, but the others will need a little more code and probably some icons.

Let multi-target Life/Esuna target dead characters.
Another consideration is that multi-target Esuna works on targets with Blind/Venom/Curse/Amnesia/Toad, but skips over targets with Stone/KO, which is a bit inconsistent.

Use different battle messages for Flee failure when the battle can't be escaped vs. when the character failed their success roll.
This would be based on the flag for whether a battle is escapable or not. I haven't gone looking to find out what sets it, but I think I've seen it set for more than just boss battles. Assuming the battle is escapable, the only way for fleeing to be guaranteed to fail is for characters with 0% evasion.

Scale stats for new characters to average party stats?
I was also thinking about Leila and Gordon; they rejoin in almost the same condition they were in when they left, except with their ailments cleared (leading to the bug where they can be alive with 0 HP) and being set to the back row.

Evasion/Magic Resist levels should probably have a low cap, as it is currently quite easy to become effectively immune to physical attacks and spell successes by casting Blink/Shell.
Damage spells are one thing; immunity to spell successes won't do more than halve the damage, which still seems fair. One good Shell cast can also render your party immune to negative status effects (other than KO, of course). But yeah, high evasion levels are more of an issue in terms of balance.

@abw: How would you feel about, assuming it's possible and not simply tied to an inflexible room data table, to change the BGM of Fynn Castle post-liberation to the Rebellion Theme used in the hideout? It seems bizarre that it would still play the eerie castle dungeon theme even when it's occupied and the headquarters for your entire operation. The PSP version retained this, though it feels a strange stylistic choice.
Hmm, yeah, I guess that makes sense. Plus, is there anywhere else you can go post-cyclone that still plays the rebel theme? At least Deist still has the castle theme if you want to hear it some more.

Also a minor downside to the passive skill growth patch in Restored is that Warp loses some of its functionality much earlier, since it would only level through use before.
I agree that auto-levelling Warp is a mixed blessing. There's also a risk of levelling all of your spells so high that you can't cast any of them, but you can always buy a new spell at level 1 and cast it a few times to gain max MP, so I'm not really concerned about that.

Are there supposed to be encounters in these rooms even before you liberate the castle?
Maybe? I haven't looked at any of the map data myself and don't have much to say here!

So, it looks like reviving dead monsters is broken in several places. Assuming you succeed in reviving a monster, its graphic doesn't reappear, the number of remaining monsters isn't incremented, and it becomes untargetable at the end of the round (but you can still beat up on it some more until then). The Life spell restores a minimum of 1/16 of the target's maximum HP, but for mosters with less than 16 maximum HP, they get revived with 0 HP - you would need at least 10 successes to revive a Goblin with 1 HP! Given those issues, instead of fixing them directly I'm just going to make reviving monsters ineffective as part of the fix for trying to revive monsters that have fled.

redmagejoe

  • Sr. Member
  • ****
  • Posts: 298
    • View Profile
Re: Final Fantasy II Restored
« Reply #351 on: May 18, 2020, 08:38:04 pm »
Hmm, yeah, I guess that makes sense. Plus, is there anywhere else you can go post-cyclone that still plays the rebel theme? At least Deist still has the castle theme if you want to hear it some more.

Nope, once Altair is destroyed, you can never hear that iconic song again without making a New Game. :(
Don't forget about Kashuan Keep, too!

I decided to pick around the disASM for map data, and while I can see where the data is, it's not in any sort of readable form. I can however see that $11 is the Rebel Army Theme, and we want to narrow down the map IDs for Castle Fynn's 5(?) maps.

I agree that auto-levelling Warp is a mixed blessing. There's also a risk of levelling all of your spells so high that you can't cast any of them, but you can always buy a new spell at level 1 and cast it a few times to gain max MP, so I'm not really concerned about that.

I thought about the not enough MP issue when I was making my reply, but I had the same thought: If you haven't been raising your MP enough to cast an 8 MP spell, which is the highest a spell can get by the mid-point of a game from the passive growth, you shouldn't have put spells on them in the first place! Go level MP, you fools! :P But yeah, Warp seems like it might require some thought...

So, it looks like reviving dead monsters is broken in several places. Assuming you succeed in reviving a monster, its graphic doesn't reappear, the number of remaining monsters isn't incremented, and it becomes untargetable at the end of the round (but you can still beat up on it some more until then). The Life spell restores a minimum of 1/16 of the target's maximum HP, but for mosters with less than 16 maximum HP, they get revived with 0 HP - you would need at least 10 successes to revive a Goblin with 1 HP! Given those issues, instead of fixing them directly I'm just going to make reviving monsters ineffective as part of the fix for trying to revive monsters that have fled.

Yeah, if it's just made so Life fails on dead monsters, that seems like the easy way to address things. That was my thought at least, was to make it fail on any unit that isn't a party member and has the KO bit set.



Call this nitpicking, but would it make more sense to remove the Crystal Rod the first time the Mysidian Tower is accessed, rather than when you're swallowed by Leviathan? I panicked for a moment when I couldn't find my Crystal Rod after landing on the island.
« Last Edit: May 20, 2020, 10:21:25 pm by redmagejoe »

abw

  • Hero Member
  • *****
  • Posts: 528
    • View Profile
Re: Final Fantasy II Restored
« Reply #352 on: May 20, 2020, 10:08:53 pm »
Call this nitpicking, but would it make more sense to remove the Crystal Rod the first time the Mysidian Tower is accessed, rather than when you're swallowed by Leviathan? I panicked for a moment when I couldn't find my Crystal Rod after landing on the island.
It's actually removed after you use it to recruit Ricard, but yeah, I know what you mean. If at some point we track down the code for entering the Mysidian Tower (which probably wouldn't be too hard with that custom animation and all), then we can move the code for removing the Crystal Rod to there instead :P.

redmagejoe

  • Sr. Member
  • ****
  • Posts: 298
    • View Profile
Re: Final Fantasy II Restored
« Reply #353 on: May 21, 2020, 02:49:10 pm »
Something I noticed a number of times going between Paloom and Poft early on that I think should definitely qualify as a bug/oversight: If you don't use the 32 gil boat trip at the town which the boat is currently docked at, the boat is "locked" there. By this I mean, if the boat is docked at Paloom, and you go to Poft and talk to the NPC, he will offer you a trip from Paloom to Poft for 32 gil. So in other words, you need to go back to Paloom and then you can use the boat. Expected behavior would be to have the NPC in Poft specifically offer a Poft->Paloom trip, and vis versa, and have the boat's world map position relocated to the dock of whatever town you've paid for.

abw

  • Hero Member
  • *****
  • Posts: 528
    • View Profile
Re: Final Fantasy II Restored
« Reply #354 on: May 22, 2020, 09:20:27 am »
$0E:$8E00 is where that happens - the low bit of $600C is a toggle for which route the ferry will take and the second lowest bit indicates whether you've paid your fare or not; the game adds the route bit to message ID #$11 to select between the Poft -> Paloom or Paloom -> Poft dialogue. $600D/$600E control the ferry's X/Y position on the world map and would probably just have to be hardcoded - it looks like the ferry's initial position is set as part of the new game initialization data, and then after that it's determined by wherever the scripted motion for each ride dumps you off at. So I think the only piece we're missing in order to be able to fix this is knowing which town the player is in.

Cyneprepou4uk

  • Sr. Member
  • ****
  • Posts: 473
  • I am the baldest romhacker
    • View Profile
Re: Final Fantasy II Restored
« Reply #355 on: May 22, 2020, 09:47:12 pm »
@redmagejoe, back to original topic, was there ever a need for a compilable disassembly? Considering that by moving code back and forth it won't be compatible with translations and whatever other patches out there.

Or you just wanted to have a better view at the game code, basically what abw has done in his disassembly?
iromhacker.ru - NES ROM hacking tutorials for beginners. Please use Google Translate browser extension

redmagejoe

  • Sr. Member
  • ****
  • Posts: 298
    • View Profile
Re: Final Fantasy II Restored
« Reply #356 on: May 22, 2020, 10:05:46 pm »
Yeah, I was initially setting out to have something readable that I could use to glean knowledge and figure out how the game worked and where to begin working on bugs. Currently the project we have is compatible with, at least, the Chaos Rush translation as it doesn't touch any of the script. I had a much easier time of wrapping my head around what wasn't working and why when I could look at the disASM, and I think that abw even made a re-compilable disASM. :)

abw

  • Hero Member
  • *****
  • Posts: 528
    • View Profile
Re: Final Fantasy II Restored
« Reply #357 on: May 22, 2020, 11:03:43 pm »
@redmagejoe, back to original topic, was there ever a need for a compilable disassembly? Considering that by moving code back and forth it won't be compatible with translations and whatever other patches out there.

Or you just wanted to have a better view at the game code, basically what abw has done in his disassembly?
My non-compilable version includes ROM and RAM addresses and a copy of the hex bytes, so that's the one I use for investigating things, but for rewriting code at this scale, I am absolutely using the compilable version - if I had to manually recalculate every single branch/jump/pointer each time I made a change, nothing else would ever get done.

Keeping the addresses of each routine's entry point(s) the same is completely infeasible, so I'm not attempting to. Compatibility will suffer as a result, but there aren't that many pre-existing FF2 patches, so I'm not losing any sleep over that. That said, I have been taking certain pains to avoid moving the addresses of NMI handlers (as a convenience so that save states loaded with an old NMI address don't instantly crash) or the Chaos Rush translation patch.


A couple new things to add to our lists:
  • After exiting the Tower of Magi via magic (Warp/Teleport), you appear on top of the base of the tower; walking one square south activates the entrance animation and pulls you back into the tower; the tower entrance code should check to see which way you're walking before activating the entrance.
  • The Holy Lance currently uses the same effect as Holy tomes, which means it has a 100% chance to break when used as an item in combat. It should use a new Holy 8 effect with a 0% chance to break instead.
Also... The Toad Ailment: how badly and in what ways should it be considered broken? Some facts about Toad:
  • When used against monsters, it's an instant death ailment.
  • Characters afflicted with Toad have their Magic menu disabled inside battle.
  • Characters afflicted with Toad do not have their Magic menu disabled outside battle.
  • Characters afflicted with Toad automatically miss inside battle.
  • Characters afflicted with Toad automatically get 0 spell successes inside battle.
  • Characters afflicted with Toad do not automatically get 0 spell successes outside battle.
  • Characters afflicted with Toad can still use items inside battle (but status-curing items automatically fail since they require a spell success).
  • If the entire party is afflicted with Toad, you automatically lose the game at the end of the round.
I think the most severe issue here is the automatic Game Over for a full Toad party, since Toads are still capable of winning battles by using items or letting previously-inflicted Poison/Venom/Confuse ailments finish off the enemy, but I'm not sure which part of that is the broken part. Should the automatic Game Over be removed, consigning most parties to a slow, painful death, like a stun-locked solo Fighter losing 1 HP per hit from a screenful of 9 GEISTs in FF1, except with the eventual game over being completely unavoidable instead of only virtually certain? Should item use by Toads be disabled? If Toads can't cast spells in battle, why can they cast spells outside of battle, and with normal success rates on top of that?

Jiggers

  • Sr. Member
  • ****
  • Posts: 405
    • View Profile
    • My Ko-Fi Page
Re: Final Fantasy II Restored
« Reply #358 on: May 23, 2020, 02:47:28 pm »
Quote
After exiting the Tower of Magi via magic (Warp/Teleport), you appear on top of the base of the tower; walking one square south activates the entrance animation and pulls you back into the tower; the tower entrance code should check to see which way you're walking before activating the entrance.

Sounds like it would be simpler to move the exit teleport coordinates one tile down! If that's possible. But I also have no idea what the Tower of Magi is or how you enter it with an animation...
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.

redmagejoe

  • Sr. Member
  • ****
  • Posts: 298
    • View Profile
Re: Final Fantasy II Restored
« Reply #359 on: May 24, 2020, 02:47:54 pm »
Hmm, I hadn't tested that Mysidian Tower issue. Whether it's as easy as Jiggers suggests or not relies on how the game handles your position on the overworld. Is there a table of coordinates or bytes in map data that determines where the player's position on the overworld is after exiting? Or is your previous overworld position saved in memory and reloaded upon returning to the overworld? I'd be inclined to believe this latter, since it seems that you are universally deposited onto the tile upon which you stepped to enter the map, most notable with the 6 tiles that lead into Fynn, the two tiles leading into Poft, Mysidia, etc.

EDIT: Actually, on further research, it seems that when entering Fynn Castle, it ALWAYS spits you out on the right tile, even though it has 2 tiles you can enter through. So maybe there are specific coordinates in data rather than stored in RAM.

I would assume then this means that there is a universal routine that handles this upon entering any map from the overworld, which might make it more difficult as conditional branching would need to be used in the specific case of the Mysidian Tower. I did always find it awkward anyway that the tower would "freak out" every single time you entered, though, so the idea that it consumes the Crystal Rod (Restored only) and then never plays that animation again after the first time (Bug Fix & Restored) seems feasible.

As for Holy Lance, is it inherently different from Rune Axe (Fog), Masamune (Haste), or other items of that nature? Do those specifically call the routine for the spells, and then have some break chance (that you've since removed for Bug Fix, I'm assuming), while Holy Lance calls Holy Tome instead of Holy? The ideal scenario, of course, is that in Bug Fix & Restored, all equipment that casts spells should have a 0% chance to break. Tomes and reusable items, understandable if they break, but losing precious resources like that when they're hardly doing more than decent damage seems so very anti-player, and the 1% chance ones sounded like an oversight rather than intention. I'm assuming that Holy Lance was simply an oversight as well if it behaves inconsistently with the other casting weapons.

On that note, I'm curious: Do spells cast off of items affect the combat counters? I'm assuming not, and that they don't count as using White or Black Magic.

Toad... Hmm... It feels like Toad, coded with its animation on enemies, works exactly the way it should on enemies. Being unable to cast magic sounds explicitly deliberate as it has a separate message and everything. I think the out of combat magic enabled is essentially to make it a hindrance in battle, but not impossible to remove, like how there's +1 spell success on certain spells outside of battle (Esuna, Life, etc). These all seem intentional so far. Spell successes being set to 0 seems... well, so long as items are still self-cast, this seems broken, rendering Maiden's Kiss just as worthless as Phoenix Down and Gold Needle. In a Restored version with targeting on these items, it wouldn't be an issue. My only hangup is that items are enabled but you can't cure yourself, defeating the entire purpose of Maiden's Kiss inside battle. Considering magic is prevented, it might be safe to leave everything as it is, but consider removing the 0 spell success condition? This would allow someone equipped with Maiden's Kiss to cure themselves, or at the very least, a 3/4 toad party to use spell-casting items to magic their way to victory. Let's think carefully about that though.
« Last Edit: May 24, 2020, 04:21:06 pm by redmagejoe »