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

redmagejoe

#240
I'm fairly confident that weapon and spell exp works properly as according to the formulas. The RNG is definitely something I'll ask if abw can look at, since I haven't the foggiest how the algorithm is working or how it relates to amount of processing time needed to avoid bumping into VRAM time. I've just finished looking over the evasion cap fix, and it seems like a pretty simple change. Essentially we've eliminated the unnecessary math on the second byte that was causing problems, and this new code should have no unintended side effects, yes?

For instance, on pre-fix stable, I have 85% with no shields on, yet post, it's 68%. At the very least, the fix does cap evasion at 99% with two shields, but I'm curious if the math is being done properly. Is the 85% an unintended boost as a result of the old evasion calculation, and 68% is indeed correct, or is there a side effect taking place? I'd have to track down the exact formula for evasion.

Quote
Evasion: A number of factors go into calculating evasion. Each character has a base evasion percentage equal to their agility score. From there, you add the evasion bonus from the items held in each hand by the appropriate skill level for that hand plus one. So if you have a sword with an evasion bonus of 1 at level 2, you gain (2 + 1) × 1, or 3 evasion from it. Similarly, if you have a shield with an evasion bonus of 5 at level 3, you gain (3 + 1) × 5, or 20 evasion. Finally, subtract the weight of each piece of armor worn from your evasion.

Disregard, I forgot weapons have an evasion bonus, and I still had Ripper equipped. Sure enough, both versions are at 68% with Firion completely unarmed. This looks like a pretty clean fix abw, and I'm ready to commit it to stable if you feel confident in it. I just spent several passes through debugger stepping through and watching values, and I don't see anything that raises any red flags. :)




The more I test buff spells, the more I realize how ridiculous they are at Level 16 when they actually work properly. Blink can raise a single party members number of evade chances well past the 16 it maxes at for their stat, with Firion having gotten up to $25 evade chances from three or four turns of having Blink cast on him. Assuming he has 99% evade rate, he's essentially untouchable. It's too bad so many of them didn't work before we got to them.

abw

Quote from: redmagejoe on February 26, 2020, 11:33:08 AM
Are you saying that Heal Staff was NOT actually healing undead before, or that you've FIXED it to not heal them? Also, is it doing its family damage and bonus damage to Undead either pre- or post- fix?
The original code for the Heal Staff effect used against Undead does not inflict special effect damage. Like Ripper, only the base damage (including the +20 family bonus) is subtracted from the target's current HP; the special effect damage is only added to the displayed number.

Quote from: redmagejoe on February 26, 2020, 11:33:08 AM
Work is being very distracting, so apologies if it's slow progress.
No worries, I'm actually in a similar boat myself, so expect slow/no progress from me for the next little while :(.

Quote from: redmagejoe on February 26, 2020, 03:12:09 PM
I, for one, am okay with the intention behind INT/SPR penalties. Given that they were removed in remakes, however, and it's a controversial change, I don't see why we can't work on an optional patch so people can choose whether they want to play "the original", an NES version of the remake, or an "enhanced original", since we've got a Mysidian Tower Orbs buff and consideration for a weapon-switching experience tracking feature, among other things.
This should be a simple change: just set the spell power penalty for each piece of equipment to 0. The equipment data starts at $0C:$8000, and spell power penalty is the 3rd byte for armour and 5th byte for weapons/shields.

Quote from: Leviathan Mist on February 26, 2020, 06:06:41 PM
1. RNG seems to still favor the middle two characters for enemy targeting. Firion's HP is much lower than Maria's and Guy's.
Assuming you continue to use their starting equipment, Firion is definitely the best protected member of the party, which means that even with (non-random) perfectly balanced enemy targetting, he tends to take the least amount of damage and thus is less likely to gain HP, so having lower max HP is still expected. That said, the RNG isn't great to start with, and while I've addressed one of its problems, that might not be enough.

Rabite890

Quote from: abw on February 27, 2020, 09:11:58 AM

This should be a simple change: just set the spell power penalty for each piece of equipment to 0. The equipment data starts at $0C:$8000, and spell power penalty is the 3rd byte for armour and 5th byte for weapons/shields.


Alternatively, lower the INT/Spirit penalty on the armor with low evade penalties, knives, etc. Maybe give staves a bonus to INT/Spirit that are more focused on being spell caster equipment.

Looking at the stats, it almost looks like what I was saying is already in place. Though I would like to see the staves thing happen. If you're using magic why not be able to have a staff equipped for the power boost?

redmagejoe

#243
Oh yes, I forgot that Firion starts with a shield and a sword, which I believe gives him at least a 6% evasion advantage over his allies? Double checking, Firion actually starts with 14% Evasion, Maria with 10%, and Guy with 1%. I have to check the stream again to see what Leviathan was running. With his starting equips, Firion has 14%, Maria has 20%, and Guy has 9%. So Guy is mathematically most likely to have the most HP (he did), Firion higher than Maria (though he starts with 10 more HP than Maria), and Maria with the lowest. By the end of the stream, Firion had 41 HP, Maria 56, and Guy 90. While Guy's seems fine given the lack of evasion and the starting HP being 30, 20, and 40 (Guy gained 50 HP, Maria gained 36 HP, and Firion gained 11 HP), how much their HP increases can't alone be used to determine whether the RNG for targeting is working or not. We also have to consider how finicky the Stamina and HP up RNG is. Because the exact same conditions must be met for Stamina or HP to go up, but they're STILL determined by separate rolls, it's possible to get 3 Stamina ups in a row with no HP ups, and vis versa.

At the end of the day, I'm willing to bet that the new RNG is giving a better outcome with the current systems than previously, where Guy and Maria would no doubt be much further away from Firion under the same conditions. A better test would see all characters with the same Evasion %, which means gear tailored to their different starting Agility. EDIT: So I got all three characters to have 9% Evasion through various equipment swapping shenanigans, and then I began my journey outside the first town. I can tell you right away that the enemies had an affinity for Firion, but there was still a few misses. In the end though, he still ended up neck and neck with Guy on max HP, though Maria got a lucky streak of HP ups while Guy got deprived a few he should have gotten, in my opinion, and Firion was my highest HP party member after only about 20 minutes of grinding.

The only concern I really have about the RNG right now is the fact that it's still causing the VRAM bugs on stat ups.

Leviathan Mist

Quick question about modifying the counter overflow fix: Does the counter apply to every counter combined, or individually? E.g., if I were to change the overflow value from 200 to, say, 8, would I then be able to only accrue 8 attacks + 8 enemy targets/evasion points in a single battle, or would it combine both of them and only allow 4 attacks + 4 enemy targets, or some other combination that adds up to 8? Also, does it combine weapon attacks and spell casts into the same counter?

redmagejoe

Each type of action (white magic casts, black magic casts, each individual spells slot use per character, attacks, being hit by spells, being hit by attacks) has its own counter. Though given the action cancel exploit, because of the way the counters are tallied the moment an action is issued, it's actually attempts, attempts, attempts, attempts, enemy targets you with spells, enemy targets you with attacks. But they are all individual, and thus the overflow protection is placed on each one. So while highly unlikely to ever happen in a single battle, your counter for any of those actions will not go above 200 each. No combination whatsoever. Yes, you could in theory set it much lower, though I'm not sure why you would want to.

Also I should clarify what I said earlier about the nature of stat increases. Stamina, HP, M.Power, and MP are all very finicky compared to Strength, Spirit, and Intellect, because while the last 3 have a threshold over which they are GUARANTEED to increase (56 attacks, 16 white magic casts, 25 black magic casts, all within a single battle of course), the former 4 are not guaranteed even if you go from 100% HP to 1 HP. Because it's calculated based on proportion of max HP lost, the only way to guarantee it would be to end at 0 HP. Of course, if you're at 0 HP... you're dead and so you can't get the stat increase. Having said that, you COULD guarantee an M.Power and MP gain (I think, if the formula isn't still stupid) by going from your max MP to 0. Agility is also not guaranteed since evasion can only go to 99, and the chance is rolled 0-255. So even if your evasion % is 99, you still only have a 99/255 chance of gaining Agility at the end of battle.

Leviathan Mist

Quote from: redmagejoe on February 27, 2020, 08:34:06 PM
Each type of action (white magic casts, black magic casts, each individual spells slot use per character, attacks, being hit by spells, being hit by attacks) has its own counter. Though given the action cancel exploit, because of the way the counters are tallied the moment an action is issued, it's actually attempts, attempts, attempts, attempts, enemy targets you with spells, enemy targets you with attacks. But they are all individual, and thus the overflow protection is placed on each one. So while highly unlikely to every happen in a single battle, your counter for any of those actions is 200 each. No combination whatsoever. Yes, you could in theory set it much lower, though I'm not sure why you would want to.

Also I should clarify what I said earlier about the nature of stat increases. Stamina, HP, M.Power, and MP are all very finicky compared to Strength, Spirit, and Intellect, because while the last 3 have a threshold over which they are GUARANTEED to increase (56 attacks, 16 white magic casts, 25 black magic casts, all within a single battle of course), the former 4 are not guaranteed even if you go from 100% HP to 1 HP. Because it's calculated based on proportion of max HP lost, the only way to guarantee it would be to end at 0 HP. Of course, if you're at 0 HP... you're dead and so you can't get the stat increase. Having said that, you COULD guarantee an M.Power and MP gain (I think, if the formula isn't still stupid) by going from your max MP to 0. Agility is also not guaranteed since evasion can only go to 99, and the chance is rolled 0-255. So even if your evasion % is 99, you still only have a 99/255 chance of gaining Agility at the end of battle.

Thanks for the info. My idea would be to set it so low that it's impossible to max out certain stats (like weapon level) on rank 1 enemies by repeating the same action over and over. Ideally the only way to reach level 16 would be by fighting rank 7 enemies. I'm sure there's probably a better way to make that happen though, but it's an idea that could help discourage it. Another thing I've toyed with is removing the ability to target allies with damage attacks/spells, to prevent the whole "beat up on yourself to gain stats" mechanic. This certainly wouldn't fix every problem, and might actually introduce some new ones (can't remove sleep or confusion on an ally without Basuna, for example) but it would take away another cheap leveling tactic. It wouldn't prevent people from wasting turns in battle for the sake of stat gains. Not sure how feasible it would be to reprogram the game so that attacks on dead/escaped enemies are redirected and don't just hit air, that's another cheesy way to prolong a battle and get more commands in, but not too worried about that one. There will always be ways to game the system, but some of them are more exploitable than others.

By the way, I have been doing a bit of off-stream grinding on my file, and I found that my biggest issue with his lack of HP growth was that I unequipped all my armor, so my evasion on Firion is now too high for him to be hit by most enemies I'm fighting. I'll have to unequip shields later so I can naturally train his HP a bit more.

redmagejoe

#247
Mind you, the counters are for a single battle and don't carry over, and if we were to fix the current behavior of counters to happen after, rather than the current before, actions are carried out, it won't be a problem anyway. There will be no action cancel exploit, and actually making a battle last long enough to grind that much experience for a stat/spell/weapon will be significantly less feasible. A more effective way to achieve what you're suggesting that carries over multiple battles is to increase the malus from battle rank. As to your desire to lower Firion's evasion, weapons and shields both raise evasion, while armor always reduces it of varying degrees. If you wish to train Firion's HP without beating him up with your other party members, I'd suggest making him unarmed and wear the heaviest armors you can find.

Anyway, I'm not sure I'm really willing to put the energy into patches of that nature even as optional after all the things on the to-do list are tackled, but I would encourage any other romhackers who might want to take on such a rebalancing project to use this project and the disassembly that abw has been so kind to maintain to lay the groundwork.

Leviathan Mist

It seems like you're getting the wrong impression from my discussion. I'm not asking you to do anything. Nor am I asking you to include my ideas in your patch. I sense a tone of annoyance in your wording, so I will simply bow out. These ideas are solely for my own personal modification.

redmagejoe

#249
If I conveyed that, it was not my intention. I have been told I can come off as curt, so I apologize. I received a few other PMs asking about my intentions to include some of the proposed ideas and simply wished to clarify in this thread, rather than shut your ideas down wholesale. I don't think the ideas themselves should be too hard to achieve though, even checking the source of an action and its target in the case of friendly fire. The issue will most likely be clever use of space more than anything.

As for preventing self-targeting with spells and attacks, preventing the cursor from moving beyond a certain point in certain scenarios doesn't sound itself like a foreign concept for NES game interface behavior, though I don't think this game itself has any restrictions on who you can select with what. No doubt you'd have to write that routine from scratch. Redirecting attacks to remove the ineffective hits could be easy enough to program, though one would have to look at FF3 to see how it's handled since that was the first in the series to do away with attacking air, I believe. I'm sure someone in this community who's more savvy than I could figure out just by giving it a few moments thought how to achieve it as well, but I can't even begin to think with my limited ASM experience how to go about it.




Just to add, after seeing the graphics bugs in Leviathan's stream, I went and tested on our current stable myself with the RNG fix, and it does indeed throw the graphics bug before each character's stat ups without fail.

abw

Quote from: Rabite890 on February 27, 2020, 11:48:49 AM
Alternatively, lower the INT/Spirit penalty on the armor with low evade penalties, knives, etc. Maybe give staves a bonus to INT/Spirit that are more focused on being spell caster equipment.
Yup, each piece of equipment's spell power penalty can be individually adjusted to anything in the range [0..255], 0 was just an example. Currently only armour can boost core stats, so adding that to weapons would take a bit of work; if you wanted to go down that path, I'd be tempted to add varying boost amounts instead of everything being +10, and maybe even let one item affect multiple stats.

Quote from: redmagejoe on February 27, 2020, 12:07:25 PM
Because the exact same conditions must be met for Stamina or HP to go up, but they're STILL determined by separate rolls, it's possible to get 3 Stamina ups in a row with no HP ups, and vis versa.
Actually, you have a slightly better chance to gain Stamina/Magic Power than HP/MP - Stamina/Magic Power requires at least a 1/9 loss ratio, but HP/MP requires at least a 1/8 loss ratio.

Quote from: redmagejoe on February 27, 2020, 08:34:06 PM
Stamina, HP, M.Power, and MP are all very finicky [...] [they] are not guaranteed even if you go from 100% HP to 1 HP. Because it's calculated based on proportion of max HP lost, the only way to guarantee it would be to end at 0 HP. Of course, if you're at 0 HP... you're dead and so you can't get the stat increase. Having said that, you COULD guarantee an M.Power and MP gain (I think, if the formula isn't still stupid) by going from your max MP to 0.
Even that wouldn't be enough - a 100% loss ratio is 1, so if you roll a 0, you still don't get an increase :(.

Quote from: redmagejoe on February 27, 2020, 08:34:06 PM
Agility is also not guaranteed since evasion can only go to 99, and the chance is rolled 0-255. So even if your evasion % is 99, you still only have a 99/255 chance of gaining Agility at the end of battle.
It's actually Evasion Success % >> 2, so with 99%, you only have a 24/256 chance to gain Agility.

Quote from: Leviathan Mist on February 27, 2020, 08:45:08 PM
My idea would be to set it so low that it's impossible to max out certain stats (like weapon level) on rank 1 enemies by repeating the same action over and over. [+ more ideas about making grinding less profitable]
Coming at this problem from a different angle, one idea I've been toying around with is removing the minimum of 1 action in order to have a chance at growth. Particularly for spells, I always find myself stuck with level 1 spells when I really need level 6 spells; removing the casting requirement for growth would allow your spells to slowly gain experience up to a limit determined by the battle rank. You could apply the same idea to weapons, which would encourage people to explore the full range of options instead of refusing to switch weapon types because they don't want to go back to a maximum of 1 hit attempt, especially against enemies with decent evasion.

Quote from: redmagejoe on February 28, 2020, 01:26:07 AM
Anyway, I'm not sure I'm really willing to put the energy into patches of that nature even as optional after all the things on the to-do list are tackled, but I would encourage any other romhackers who might want to take on such a rebalancing project to use this project and the disassembly that abw has been so kind to maintain to lay the groundwork.
Yeah, there's enough work to do with the bugfixes at the moment, but if anyone else wants to work on other changes, they should feel free to use any of the resources linked to in the first post; either way, it can be fun to talk about ideas for improvements :).

redmagejoe

Work is still being oppressive, but I'd like to see if I can't poke my nose around the special effects weapon code and see if I can't help narrow down the battle poses and such. But I also wish there was some way I could contribute to the RNG timing issue leading to the graphics bug, I'm just completely unlearned in the concept. I'm assuming the issue is that the code has to work within a specific number of CPU cycles to not elbow in on VRAM time, and thus one has to know how many CPU cycles the currently updated RNG is taking. Is the reason the old RNG was so poorly optimized because it was taking inherently less time?

Grimoire LD

Quote from: abw on February 29, 2020, 06:43:35 PM
Coming at this problem from a different angle, one idea I've been toying around with is removing the minimum of 1 action in order to have a chance at growth. Particularly for spells, I always find myself stuck with level 1 spells when I really need level 6 spells; removing the casting requirement for growth would allow your spells to slowly gain experience up to a limit determined by the battle rank. You could apply the same idea to weapons, which would encourage people to explore the full range of options instead of refusing to switch weapon types because they don't want to go back to a maximum of 1 hit attempt, especially against enemies with decent evasion.

This is one of the best ideas I've seen for the game and something the remakes never addressed. The tedium of leveling up spells and weapons is enormous and Battle Rank seems to mean next to nothing. I think Battle Rank bonus/malus should be applied across the board for any action taken so that you can't successfully grind off of Battle Rank 1 to get 9999 HP, but that you aren't still leveling up Flare to Level 4 in Pandemonium.

It would take a bit of a rewrite and a lot of checks to the Battle Rank but I would love to see a hack which addressed these flaws. It would change the flow of the game completely, yes, but it might also cut down on the tedium of grinding endlessly.

(Also I wouldn't mind changing some of the spells into combat moves as a reward for leveling up weapon types. (I mean Sap, Swap? What were they even thinking with Swap other than a way to abuse their poor mechanical setup?) get rid of Toad, Mini, and Frog, the game does not need three more instant death spells... Wall is weird in the first place. Apparently it blocks a singular magical attack... sometimes. I do know that there are some enemy only spells as well which could be used for that.

Leviathan Mist

Quote from: Rabite890 on February 27, 2020, 11:48:49 AM
Alternatively, lower the INT/Spirit penalty on the armor with low evade penalties, knives, etc. Maybe give staves a bonus to INT/Spirit that are more focused on being spell caster equipment.

Looking at the stats, it almost looks like what I was saying is already in place. Though I would like to see the staves thing happen. If you're using magic why not be able to have a staff equipped for the power boost?

Not sure what redmagejoe has planned for the int/spr penalties, but I did create a patch that addresses this. You can find it here, though I have not done any testing with it since I'm still working on beta testing the Restored project by itself.

redmagejoe

#254
I think what I've settled on is simply fixing the bugs and leaving things like the INT/SPR penalties alone. I'm going to trust the rest of the community to come up with rebalancing patches, and since Leviathan already has a patch that acts as a guide for where to change data in order to affect the INT/SPR penalties, the work doesn't need to be done on our end to locate the necessary bytes. I am hoping work settles down soon so that abw and I can move towards the finish line on this project and provide a good foundation for romhackers to give Final Fantasy II the love it deserves. :)

Chicken Knife

@redmagejoe

I think that is absolutely the right approach. Provide a perfect bugfree base and let others (or maybe you down the road) create and compile the rebalances. I'm extremely excited about this and will be playing the hell out of it.

redmagejoe

#256
For the v2.0 of Chaos Rush translation, I'm wondering if it would be easier to simply extend the display box for spells by one more character rather than trying to redo the graphics used for the 5-character long spell names. This box extension would be specific to the translation patch, not the Restored patch.

Actually, looking at it, the game already creates 3 spaces after the spell name, so that the level is always right-aligned, and there's 2 spaces for a <10 level spell, and 1 for a 10+ spell. It would probably be easier to simply remove one of the spaces in the Chaos Rush translation. This would probably result in the alignment looking odd on the few spells that still use 4 characters instead of 5 (|Cure 1 | -> |Cure15 |) but at least the spell levels would fit into the box for all spells (currently |Thunder  | -> |Thunder 1|, want to change it to |Thunder 1| -> |Thunder15|).

This was a simple fix. I simply changed the INX below to a NOP, with the INX seeming to be what moves the horizontal position forward by one, creating a space.


0x032D2A|$0C:$AD1A:E8      INX


This is the easiest fix currently, even if it's not the cleanest looking.

Leviathan Mist

So I've been focusing on leveling evasion, and I noticed that my evasion level is going up, but it's not showing that it went up in battle. I know vanilla had a delayed level-up message where it wouldn't appear on the battle it went up, but at the end of the next battle. In this case, it's not appearing at all. In fact, I don't recall ever seeing a message for it, and my evasion level is 4 on all 4 characters, so I should have seen it quite a few times by now.

redmagejoe

#258
The reason that Evasion and Magic Resist "got away" with the sneaky level up difference from others is that they don't actually show a message. So it initializing when the following battle starts, or when equipment was switched, worked out because it was harder for the end user to notice. The only way you'd know if it did or didn't go up at a particular time is if you're watching the value in RAM, which was how I determined that it was being set at the start of the proceeding battle (and it was obvious with equipment switching since you can see it change right in the stat window).

Assuming that it was only the messages you were worried about, it's working as intended, since there's no "Evasion/Magic Resist up!" messages programmed even in vanilla. Let me know though if you've noticed the value not appropriately adjusting when watched in RAM, as I was pretty sure I'd tested that, but did not extensively test to see if there were any strange outlier scenarios. If we had more room in ROM, I might consider having messages for those leveling up, but since it didn't do that in the remakes (I think, would have to test this on PSP version), and it may become involved, I'll put that at the end of the Possible Improvements list. I think it's a worthwhile improvement, I just don't know how feasible it is to implement with limited space, but the groundwork to implement it is definitely there.

Leviathan Mist

Ah okay. I thought it showed a message in vanilla, that's all I was posting about. I'll continue to update if I see any more weird behavior though.