• 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 IX
  3. Random battle formula?

User Info: etony33

etony33
2 years ago#1
Does anybody know what formula the game uses to determine whether or not you get into a random battle? I'd assume that each area is different, and it randomly generates a number between 1 and x to determine how many steps you can take until you get into a random battle (at which point, I would think, the game determines which enemy you fight).

Any help would be greatly appreciated.

User Info: MysterPixel

MysterPixel
2 years ago#2
Look at this old thread:

https://www.gamefaqs.com/boards/197338-final-fantasy-ix/55527744

However whether it is correct I can't say - it does make sense but then there are things like the stop-start movement method to encounter Ragtime Mouse, which means there is more going on than just an internal incremented counter checked against a RNG each interval.

User Info: Vir27

Vir27
2 years ago#3
@Tirlititi is likely to know something about it, if he'd be so good as to stop by.

User Info: Tirlititi

Tirlititi
2 years ago#4
SoftReset's post is quite accurate. The Steam's source code runs this kind of code at every frame:

if (sMoveKey && !IsNearlyZero(DistanceFromLastFramePos)) {
. . sEncountTimer += DistanceFromLastFramePos * FieldWorldMapFactor;
. . if (!Cheat.IsNoEncounter && usercontrol != 0 && sEncountTimer > 960) {
. . . . sEncountTimer = 0f;
. . . . sEncountBase += encratio;
. . . . if (random8() < sEncountBase/8) {
. . . . . . sEncountBase = 0;
. . . . . . TriggerRandomBattle();
. . . . }
. . }
}


It's the same code for both fields and world maps, but "FieldWorldMapFactor = 1" in fields while "FieldWorldMapFactor = 256" in World Maps.
The character usually walks at a speed of 30units/frame and runs at 60units/frame. On the World Maps, it is lower (I don't know the exact value, but it seems to be either 2, 4 or 6). So the stutter stepping trick seems to take advantage of the "IsNearlyZero" check.

"encratio" is the number that changes from field to field. It's around 12-16 on the World Maps (depends on the area).

The encounter rate is notoriously lower on Steam. I would think that this 960 value is lower on PSX, but 960 is rather consistant with the "half second of directional movement" SoftReset talked about. On Steam, the check is thus performed every 17 frames when running and the game is at 30fps.
A small difference there could have some noticeable impact mathematically because of the cumulative method: it may be a check performed every 15 frames on PSX instead (or even transform the strict '>' into a large '>=') and make a significant difference.

The Ragtime Mouse encounters are different. See this:
https://steamcommunity.com/app/377840/discussions/0/357285398694899362/

User Info: Vir27

Vir27
2 years ago#5
Thanks, Tirlititi!

User Info: Tirlititi

Tirlititi
2 years ago#6
No problem Vir !
*Flies away*

User Info: MysterPixel

MysterPixel
2 years ago#7
Tirlititi posted...
The Ragtime Mouse encounters are different. See this:
https://steamcommunity.com/app/377840/discussions/0/357285398694899362/



Thank you so much for this!

if (FF9StateSystem.Settings.IsNoEncounter)
{
return 0;
}
long num3 = (long)Comn.random8();
long num4 = (long)Comn.random8();
long num5 = num3 << 8 | num4;
long num6 = num5 % (long)(ff9.w_frameEventBattleProb + 1);
int num = 0;
if (ff9.w_frameEncountEnable && ff9.w_moveCHRControl_Move && ff9.m_GetIDTopograph(iDALL) >= 36 && ff9.m_GetIDTopograph(iDALL) <= 38 && ff9.w_frameCounter > 400 && num6 == 1L)
{
num = 1;
}
return num;


If ff9.w_frameEventBattleProb always equals 231 then this essentially gives you a 1 in 232 chance of encountering Ragtime Mouse for every frame you are moving in a forest, or am I missing something?

User Info: Tirlititi

Tirlititi
2 years ago#8
Yep, seems so. It can also happen only after some time spent on the world map (a battle resets the w_frameCounter, that's why I previously had the impression that we couldn't find him twice in the same forest consecutively).

User Info: MysterPixel

MysterPixel
2 years ago#9
Very interesting thank you!

User Info: wpot

wpot
2 years ago#10
Soooo..."IsNearlyZero" would appear to be the exploitable bit there for an EXIIPG, if anything. What do we know about that? Can we infer that the "stop/start" method works if you take (very?) small steps? Do the steps need to be consistent and without fail (I.e. once the counter starts it doesn't stop)...or not? I'm having some trouble interpreting. Any info on how small? Any idea how quickly this resets after letting the 'joystick' return to vertical?
Pronounced "Whup-pot". Say it. Use it.
  1. Boards
  2. Final Fantasy IX
  3. Random battle formula?
  • Topic Archived