Author Topic: FF7 Drop Rates  (Read 6967 times)

NxK

  • *
  • Posts: 130
  • In AI I Trust
    • View Profile
    • YT
FF7 Drop Rates
« on: 2014-07-13 00:21:21 »
Hello.

So, after reading some  threads on in-battle and post-battle randomness, I wonder if there is a way to manipulate (in a non-TAS setting for the PC version) drop rates.
I do know that drops are determined after the battle using the RNLUT found in the kernel.bin.

Here is what I am asking myself and have not been able to find answers to:

1) How is the seed for the RNLUT drop check derived? Is the kernel.bin RNLUT also used for in-batte checks?
Imagine that, after killing 3 enemies, I knew the drop rate RNLUT check pointer started at the first number in that table (63h), which means that the first three numbers in the table (63h, 06h and F0h, respectively) would be used for the drop rate check. Would running away from any encounter after that battle before eventually killing 3 more enemies allow me to get the RNLUT entries just after the first three ones used in the previous drop rate check, so 23h, F8h and E5h for the next drop rate check?

2) Imagine I kill 3 enemies in a battle (say 2 Mirage and 1 Dorky Face for a Mirror drop in the Nibelheim Shinra Mansion). Is the order in which I kill the enemies relevant in the drop rate check? I assume not as I find it unlikely the game even tracks the order of killing.

Thanks in advance and feel free to point out anything I might not have yet considered.

nfitc1

  • *
  • Posts: 3011
  • I just don't know what went wrong.
    • View Profile
    • WM/PrC Blog
Re: FF7 Drop Rates
« Reply #1 on: 2014-07-13 01:29:59 »
1) All in-battle RNG calls query the RNLUT and that's all it's for. This excludes animation randomizations such as which direction the sparkes from Ultima take, etc. Anything that does damage or chooses a target will advance the RNLUT. Advancing it yourself isn't easy as it requires a command of some sort and that will advance it a number of times depending on the action.

2) No. Order of kills does not matter as drops are determined at the end of the battle. That almost ensures that you won't get two rare drops in the same battle.

NxK

  • *
  • Posts: 130
  • In AI I Trust
    • View Profile
    • YT
Re: FF7 Drop Rates
« Reply #2 on: 2014-07-13 02:12:26 »
About 1):
Does the RNLUT advance if nothing happens at all (imagine there is only one enemy that is in the state of being manipulated)?
Also, does it advance in a "simple fashion" or is it changing too fast or erratically?

Tenko Kuugen

  • Public Enemy
  • *
  • Posts: 1416
    • View Profile
    • Twitter
Re: FF7 Drop Rates
« Reply #3 on: 2014-07-13 04:05:27 »
Slight hijack:
Are drop rates values even accurate? From what Sega said it checks against rnd(0,63) but how does that translate to 0-100%?

It would be one thing if this were a hex check(as 63 hex is 99) but no editor is capable of using hex values for item drops and steals. I only have some bizarre theories on the matter but I observed that the vanilla game uses very specific ranges for item drops, almost as if there were specific ranges of dec numbers the game is designed to handle in this hex-range check.

Basically, a drop rate of 40/63 would be 64%
There is no way to create a 60% drop as that would be 3C in hex and obviously using 60 as the drop value results in an actual drop chance of 96.
Since there are six values per dec ten string (A-B-C-D-E-F per string of 00-0F) that's 36 drop values being impossible to arrive at.

NxK

  • *
  • Posts: 130
  • In AI I Trust
    • View Profile
    • YT
Re: FF7 Drop Rates
« Reply #4 on: 2014-07-13 04:34:29 »
From what I have read, the drop rates (0 to 63) represent drop chances as (0+1)/64 to (63+1)/64.
 

nfitc1

  • *
  • Posts: 3011
  • I just don't know what went wrong.
    • View Profile
    • WM/PrC Blog
Re: FF7 Drop Rates
« Reply #5 on: 2014-07-13 11:35:08 »
Drop rates are what NxK said. It's not 0-63 in hex, it's 0-63 in decimal. 63 is considered always drop and 0 is never drop. What happens is (and I don't have this in front of me, but I'm acting out of memory) the RNGLUT is asked for a number and if that number AND 63 (&3F) is LESS THAN OR EQUAL TO the drop rate of the item then it will drop. This all happens sequentially (for every item) at the end of battle. I did a little searching through the RNLUT and found that at most you can get two of six 8/63 items in a battle.
EDIT:
So this DOES equate to increments of 64 (32 would be 33:64 chance because 0-32 values would cause the drop/steal to succeed), but there's not a 1:64 chance. A value of 1 is actually a 1:32 chance since both a 0 value and a 1 will cause it to drop. The game's programmed to consider 0 as a no drop/steal. In practice, this consideration is ridiculous. Also, if an enemy has been stolen from it will not drop an item.

About 1):
Does the RNLUT advance if nothing happens at all (imagine there is only one enemy that is in the state of being manipulated)?
Also, does it advance in a "simple fashion" or is it changing too fast or erratically?

No. It only advances when actions are taken and as far as I know there's no "advance just once" kind of thing. It's pretty complicated.
« Last Edit: 2014-07-13 13:46:20 by NFITC1 »

NxK

  • *
  • Posts: 130
  • In AI I Trust
    • View Profile
    • YT
Re: FF7 Drop Rates
« Reply #6 on: 2014-07-13 20:20:32 »
So, if the RNLUT does not advance as long as there is only one enemy in the battle that is being manipulated and no ally or enemy acts, it should be possible to determine its state by doing the following:

Make the enemy attack itself and note the damage sustained. The only randomness in that should be (as the attack, provided it is a physical or magical attack that only deals damage, cannot miss in this scenario due to the enemy being manipulated) the random variation of the damage.
If one calculates the upper and lower bound of the damage the attack can deal, one can then conclude what random number was used in the random variation calculation: Damage := [Damage * (3841 + Rnd(0..255)) / 4096]

Of course, one can only tell what RNLUT number was used if the damage was >=4096. If it deals less than that, one might end up with more than 1 possible value.
Still, if one repeats this procedure often enough, one can conclude which random numbers were used in the random variation damage calculation and thereby draw conclusions on how the RNLUT advances.

Is that correct?
« Last Edit: 2014-07-13 21:31:08 by NxK »

nfitc1

  • *
  • Posts: 3011
  • I just don't know what went wrong.
    • View Profile
    • WM/PrC Blog
Re: FF7 Drop Rates
« Reply #7 on: 2014-07-14 13:53:54 »
I take it back (some of it anyway). I just did a trace and it seems like it's being called at least twice every frame during battle for every actor even when nothing was happening. Also, it's less predictable than that because there are eight pointers to the RNGLUT that it's constantly cycling through.

So in conclusion there's no real-time way to track it. It's pretty erratic even for TASing purposes.

NxK

  • *
  • Posts: 130
  • In AI I Trust
    • View Profile
    • YT
Re: FF7 Drop Rates
« Reply #8 on: 2014-07-14 15:10:55 »
I guess this is the end to possible non-TAS drop rate manipulation then. :/