Miscellaneous Forums > Scripting and Reverse Engineering

[FF7] 3D Battler RNG

(1/2) > >>

I didn't see much online about the 3D Battler so I took a look at it.


Here's what I learned.

It does not matter what you pick, just when you pick it. It doesn't look at your input at all, whether you win or lose is based entirely on random.
However random is a single byte that increments at about 10-12 per second depending on your movement to the arena and is continually generated by movement of the background characters.
This random random value is at 095dc8 on PSX and FF7_EN.exe+8BF588 on PC
Damage is a counter that increments to 10 at 75e30/FF7_EN.exe+8C14DC (you) and 75e31/FF7_EN.exe+8C14DD (enemy)

Fighter 1: You have a 65.93% chance of winning
Fighter 2: You have a 51.17% chance of winning
Fighter 3: You have a 33.33% chance of winning
Fighter 4: You have a 25% chance of winning
Fighter 5: Is a ghost you cannot kill. Low is a Hit, but the value does not increment in memory. Mid is a Tie. High is a loss.

All considered and random being fair you have a 2.81% chance of getting to the ghost and winning 300gp.

I was thinking maybe it would be possible to find a starting seed that won with a turbo controller, but with how fast RNG increments, this would be very hard to get frame perfectly.
With a turbo controller this could likely be exploited by simply running the game for a while pressing O+X repeatedly as it won't stop until you run out of money or hit the ghost.
That said you are definitely better off doing chocobo races for GP, but it is nice knowing how this mechanic works.

Here are the charts for each fighter. Each seed value has a guaranteed result no matter what input you pick.
If you can see the random seed, you can use these charts to better time your inputs to increase your chances of success.

I’ve done lots of reversing with the 3D battler, actually. The fifth fighter is a programming mistake that happens because defeating the fourth battler doesn’t properly end the game. The last action you took during the fourth fight is what dictates the “active” move the game will react to. If you won with a low punch then the script will continue to cause Cloud to react as if a low punch is a scoring strike. Freezing Cloud’s hit counter will show there’s no way to break this cycle. Since the script that plays this game doesn’t update its reactions after the fourth battle it repeatedly reacts the same way. Oddly it doesn’t update its own hit counter either so it’s impossible to win. I documented this behavior on the ffwiki, but left out the technical details to make it readable to a wider audience.

You are correct that it doesn’t read your input and which punch you decide to throw is completely arbitrary, but it’s unlikely a turbo controller could win. 3DB uses the field’s RNGLUT to pull its random values from and for a single punch to be used to win would require watching that value in memory and pushing a button when that value was within a certain range of values. I bet that could be scripted with relative ease, though thats not something I have experience with.

I didn't know the last move on fighter 4 impacts fighter 5's move set. Good to know and I updated the ff7 wiki with the correct stats. I also made a video using my charts. I still think a turbo controller has a chance of winning on certain seeds, it's a simple test. Buy a controller and set O+X to turbo, set a book on it and leave the game running for a while, if it gets to the end we can. A human timing that is a different story.

One thing I didn't mention is the RNGLUT is really sporadic and time spent on certain frames depends a lot.

For example on PSX each cycle 0-256 of RNG will wait different amounts of frames before incrementing the RNG value

--- Code: ---RNG - Cycle1 - Cycle2
6 - 24 - 4
7 - 2  - 14
8 - 18 - 14
9 - 12 - 4
10 - 2 - 14
11 - 18 - 14
12 - 12 - 4
13 - 2 - 28
14 - 30 - 4
15 - 2 - 12
16 - 16 - 16

--- End code ---
Once you start the battler it is sped up even more.

--- Code: ---Frames before increment / Incremented value
8 - 1
8 - 2
8 - 2
4 - 1
4 - 1
8 - 2
8 - 1
8 - 2
8 - 1

--- End code ---

I haven't manually counted out all the frames in two cycles either, but there's doesn't seem to be a pattern it follows.

There are a few NPCs in the same field as the battler that cause the RNGLUT to progress. As they move they will change the next value. When the NPCs complete their random action they will pick a new RNG value. Since they both use the same RNGLUT they have a moderate influence on each other.
The field’s RNGLUT doesn’t increment by frame. There’s only one RNG value in the game that I know of that does and it’s in battle and only very rarely used.
There might be some initial condition and set up that will allow for a turbo controller to win, but it would take a lot of math to figure out the ideal condition.


[0] Message Index

[#] Next page

Go to full version