• Topic Archived
You're browsing the GameFAQs Message Boards as a guest. Sign Up for free (or Log In if you already have an account) to be able to post messages, change how messages are displayed, and view media in posts.
  1. Boards
  2. Final Fantasy II
  3. Random discoveries

User Info: Alex Jackson

Alex Jackson
10 years ago#1
The frequencies of monster encounters on the world map are stored in RAM for some reason. Moreover, they're stored in a region of RAM that's saved as part of your savegame, so if you "somehow" modify them and then save your game, the modification will be permanent as far as that savegame is concerned.

RAM address 62B6: Encounter frequency on foot (world map only). Initially 11 (out of 256).
RAM address 62B7: Encounter frequency on chocobo. Initially 0.
RAM address 62B8: Encounter frequency on snowcraft. Initially 4.
RAM address 62B9: Encounter frequency on ship. Initially 2.

The canoe and airship appear to be hardcoded not to allow monster encounters, but if you modify address 62B7, you can have encounters while riding the chocobo!

It looks like Square hadn't decided at this point just how safe chocobos should be--they programmed the game to allow the possibility of only reducing encounters, rather than eliminating them altogether.

Also, on the US prototype the foot encounter rate is set very slightly higher--12/256 instead of 11/256.
Any sufficiently advanced incompetence is indistinguishable from malice.

User Info: DoraboChan

DoraboChan
10 years ago#2
Interesting discoveries, Alex Jackson. It's always cool to try and guess what the developers were intending while they were developing the game... If you increase the number to 256 for those RAM Addresses, would that mean you would get an enemy encounter every step you take?

User Info: silktail

silktail
10 years ago#3
If you increase the number to 256 for those RAM Addresses, would that mean you would get an enemy encounter every step you take?

I imaging that value would only go up to 255 (aka "FF" in hexadecimal). Which would be every step except for 1 in 256.

(Assuming that you are walking on squares with random encounters obviously.)
---

User Info: Alex Jackson

Alex Jackson
10 years ago#4
Apparently the "Plate" armors were originally going to be "Bracelets", as in FF1. The original review of FF2 in Famicom Tsuushin showed screenshots of the armor shop in Palm with a "Copper Bracelet" in place of the Copper Plate, and the armor shop in Bofsk with a "Silver Bracelet" in place of the Silver Plate. In FF1 (the NES version, at least) the armor equip screen doesn't explicitly indicate where items are equipped, so there's no problem having bracelets that take the place of armor or a cape that takes the place of a shield, but I guess Square decided it would be too weird to equip a "bracelet" in the "body" slot in FF2, so they changed the names late in development.

Source: http://kamakura.cool.ne.jp/kj/other/knowledge1.htm
Any sufficiently advanced incompetence is indistinguishable from malice.

User Info: Alex Jackson

Alex Jackson
10 years ago#5
Been mostly too busy either to hack or post lately.

I found the map data (both world map and town/dungeon) a while ago. The world map is stored exactly the same way as FF1's, with each horizontal row individually RLE encoded. Come to think of it, FF3 was the same too, only it had four world maps (floating continent, main world before "deflooding", main world after deflooding, and undersea).

The town/dungeon maps are like FF3's, 32x32 squares (FF1's are 64x64) and RLE encoded.
Any sufficiently advanced incompetence is indistinguishable from malice.

User Info: Alex Jackson

Alex Jackson
10 years ago#6
I've worked out the exact probabilities for gaining each stat after a battle. Unlike later games that use similar growth systems (i.e. the SaGa series from FFL2 onward), the probabilities in FF2 aren't affected by the strength of the enemies you're fighting (at least not directly), nor by the current value of your stats. It's just as hard to go from Strength 5 to 6 as it is to go from Strength 98 to 99.

All division operations are truncated to the next lower integer, e.g. 15 / 8 = 1.

The RNG FF2 uses in battle has a peculiarity: the values on the edges of the range are only half as likely as any other values. For example, random (0 to 3) has a 17% chance to yield 0, 33% chance to yield 1, 33% chance to yield 2, and 17% chance to yield 3. Incidentally, FF3 and FFL (but not FFL2) have the same quirk. I'm not quite sure whether it's intentional or not--there was at least one algorithm in FFL that seemed to be designed with this quirk in mind, but in all three games the quirk has the effect that the second and third characters in your lineup are more likely to be targeted by enemies than the first and fourth characters, which seems unlikely to be intentional.
Any sufficiently advanced incompetence is indistinguishable from malice.

User Info: Alex Jackson

Alex Jackson
10 years ago#7
HP and MP:
Damage_taken = max(CurHP_at_battle_start - CurHP_at_battle_end, 0)
if Damage_taken == 0, bail (no chance to gain HP)
else Damage_quotient = MaxHP / Damage_taken
if random(0 to 8) >= Damage_quotient, gain HP.

MP uses exactly the same algorithm

The upshot is you need to lose more than 1/9 of your maximum HP or MP to have any chance of gaining, but above that minimum, the probability quickly grows asymptotically towards 100%.

Strength:
if random(0 to 45) < times_Fight_selected, gain Strength

The counter for the number of times the character selected Fight is the same one used for gaining weapon skills, so the select-cancel trick works.

Intellect:
if random(0 to 25) < times_Black_Magic_selected, gain Intellect

Spirit:
if random(0 to 15) < times_White_Magic_selected, gain Spirit

It's easier to gain Spirit than Intellect, perhaps to compensate for the fact that white magic spells are often cast out of battle. Either that or black magic is just supposed to be "harder" than white magic in the world of FF2.

Losing Intellect/Vitality/Strength:
When you gain Strength, Intellect or Spirit, you have a chance to lose Intellect, Vitality or Strength respectively:

if random(0 to 5) == 0, lose the corresponding stat

This check is done immediately after the gain check. Theoretically, the chance of losing a point is only ~10% (considering the abovementioned RNG quirk) but in practice it's much higher. This is because in FF2's RNG table, the numbers between 0 and 25 mostly occur immediately after other low numbers. Since the game only checks for losing a point after you've successfully gained one, and since gaining a stat requires drawing a low number from the RNG, the check for losing a point is more likely to draw another low number and succeed than the algorithm suggests.

Incidentally, unlike FF1, FF2's battle RNG table isn't located anywhere in the ROM. It's generated algorithmically (which is why it's so biased--the algorithm is really crude) and stored in RAM at the start of each battle. Presumably they did it this way to save ROM space, but it's a bit silly, since the ROM already contains a RNG table that's used for random encounters and out-of-battle healing. Why didn't they just use that table for battle results as well? FFL uses an algorithmically-generated RNG table for everything, and the reason clearly is to save ROM space, as the FFL ROM is completely packed.

Agility:
if (Evasion / 4) > 0 and random(0 to 255) <= (Evasion / 4), gain Agility
The chance of gaining Agility isn't just affected by Evasion, it's directly proportional to Evasion. A rather dubious algorithm, given that Evasion is based on Agility. The more Agility you have, the easier it is to gain more!

Vitality and Magic:
Reuses the "damage quotients" that were calculated for HP/MP.
if random(0 to 9) > HP_damage_quotient, gain Vitality
if random(0 to 9) > MP_damage_quotient, gain Magic

The minimum amount of HP or MP you have to lose is the same as for gaining HP/MP, but the chance of gaining is slightly lower--it starts at 1/18 and goes up by 1/9ths, rather than starting at 1/16 and going up by 1/8ths.
Any sufficiently advanced incompetence is indistinguishable from malice.

User Info: silktail

silktail
10 years ago#8
It's easier to gain Spirit than Intellect, perhaps to compensate for the fact that white magic spells are often cast out of battle. Either that or black magic is just supposed to be "harder" than white magic in the world of FF2.

Well less White magic are offensive, so they were probably thinking that they would get used less in typical random encounters.
.....

The chance of gaining Agility isn't just affected by Evasion, it's directly proportional to Evasion.

That did seem to be the case, but the chance didn't seem to be the exact percentage.

Note: The chance to flee was also guessed to be directly related. But I don't know if it would fit the percentage chance of a 256 range of random numbers like this.
....

A rather dubious algorithm, given that Evasion is based on Agility. The more Agility you have, the easier it is to gain more!

True. But then equipment (especially shields,) do make a bigger difference to your Evasion%
---

User Info: Alex Jackson

Alex Jackson
10 years ago#9
I worked out how escaping works for both party members and enemies.

This may be almost common knowledge, but the chance for a party member to successfully run away is simply equal to their Evasion percentage. It's nice to have confirmed it by looking at the code, though.

For enemies, the algorithm is slightly more interesting. First, if you're fighting a formation that you can't run from, then enemies will never try to run away either. Otherwise, add up the total current HP of all party members that aren't dead or stone, and subtract the total current HP of all enemies that aren't dead or stone. If the result is negative (i.e. total enemy HP > total party HP) then set it to zero. Divide by 32. Add the "cowardice factor" of the current monster (a hidden stat each monster has that ranges from 0 to 180; casting FEAR on a monster increases this stat) and subtract 170. The result is the chance out of 100 that the enemy will run away.

Note that if a monster's cowardice factor is greater than 170 then it always has a chance of running away, regardless of anyone's HP. Also note that everything in the algorithm after "divide by 32" is done using a one-byte variable, so the chance of running wraps around above 256. Do the math and you'll see this happens when total_party_HP - total_enemy_HP is 8192 or greater.
Any sufficiently advanced incompetence is indistinguishable from malice.

User Info: x_loto

x_loto
10 years ago#10
Cool! Is there any indication of the chance for Evasion Count or Mag.Defense Count to increase? I've read that it's based on the number of times you are targeted in battle. I'm curious about the Mag.Defence Rate as well...I don't seem to be able to find what affects that offhand.... (It's always fun to wander into a board and find Alex with some freshly chopped numbers! :-P)

Oh, hi Dorabo-chan! ^_^
This is a signature. You might think that there is something to it...but in fact it is just an ordinary signature.
  1. Boards
  2. Final Fantasy II
  3. Random discoveries
  • Topic Archived

GameFAQs Q&A