Author Topic: (FF7 PSX) Impossible to win all item drops from multiple enemies?  (Read 20228 times)

antd

  • *
  • Posts: 49
    • View Profile
It seems it is impossible to win all item drops from multiple enemies.

Example:
Fighting two soldiers (shinra HQ) will not allow you to win 2x grenade (1 is max)
Fighting three soldiers will not allow you to win 3x grenade (2 is max)
Fighting three sneaky steps will not allow you to win 3x m-tentacles (2 is max)

Am I wrong about this? Anything known about the mechanics?

I've never seen 100% item drops from multiple enemies. Although it could be that the full drop is quite rare...

NxK

  • *
  • Posts: 130
  • In AI I Trust
    • View Profile
    • YT
It seems it is impossible to win all item drops from multiple enemies.

Example:
Fighting two soldiers (shinra HQ) will not allow you to win 2x grenade (1 is max)
Fighting three soldiers will not allow you to win 3x grenade (2 is max)
Fighting three sneaky steps will not allow you to win 3x m-tentacles (2 is max)

Am I wrong about this? Anything known about the mechanics?

I've never seen 100% item drops from multiple enemies. Although it could be that the full drop is quite rare...

What is known about the mechanics is that an enemy will never yield more than 1 item. This means that if one were to steal an item from an enemy, that enemy could not drop another item at the same time. So, did you actually steal while doing these drop rate tests?
Apart from that, I would suggest that you calculate the expected probability of all enemies dropping an item. As it probably will not be so low in the cases you are mentioning, you could easily do enough test runs to come across statistically significant deviations from your calculations in case it were in fact impossible for all enemies to drop an item.
What I also find remarkable is that you are referring exclusively to instances of multiple enemies of only one type. Perhaps the peculiarity concerning the drop rate you seem to be experiencing only applies to these cases as well.

nfitc1

  • *
  • Posts: 3011
  • I just don't know what went wrong.
    • View Profile
    • WM/PrC Blog
The RNG table in the KERNEL.BIN comes into full force in this one. Those values determine what is capable of dropping. There are slots in RAM for a max of at least four items (might be more) being dropped at the end of a battle, but the RNG values usually don't allow that. The (pseudo)code to determine if an item drops or not is as follows:

Code: [Select]
ItemDrop ( EnemyData, isDrop, AllowRandom, ChanceMultiplier)
{
   WORD dropped_item = -1; //no item
   for ( int i = 0; i < 4; i++ ) //loop through the enemies' held item data
   {
      if ( ( EnemyData(136 + i) ) AND C0h ) == isDrop )  //if isDrop is a 0 then we're looking for drop items instead of steal items
      {
         DropChance = AllowRandom ? 256 : ChanceMultiplier * ( ( EnemyData(136 + i) ) AND 3Fh ) / 256; //special battles (like bosses or WEAPONS) have guaranteed drop rates, otherwise we'll use chance)
/*
 *  The multiplier is usually worked like this:
 *
 *  ( ( Thiefs_Level + 40 - Targets_Level ) << 9 ) / 100
 *
 * If Targets_Level = Thiefs_Level it turns out to be 204, but the multiplier won't go higher than 200%
 */
         if ( ( RandomRNGByte AND 63h ) <= DropChance )
         {
            dropped_item = EnemyData(140 + i * 2);
         }
      }
   }
   return dropped_item;
}

Basically, in a normal battle, if the random byte AND 63h is less or equal to the item's drop chance * multiplier (which is signed, so you need to be at no fewer than 39 levels below your target enemy to even have a chance) then the item drops. An Eagle Gun (lvl 46) will never drop an X-Potion (rate of 63) if killed by a character at level 7 or below, but a Master Tonberry (Lvl 77) will have a 1:6.452 chance of dropping a Megalixer (rate of 8) for a level 99 character. A few conditions to this:

The first item an enemy holds that drops, drops.
ex.
The Special Combatant enemy from Reactor 5 has two items to drop. He can drop an Antidote at a rate of 8 and a Grenade at a rate of 2. If the Antidote doesn't drop, the game goes for the Grenade. So there's a 0.8:8, or 1:10, chance that an Antidote will drop. If it doesn't, there is another .8:32, or 1:40, chance that the Grenade will drop. There doesn't seem to be anything else that influences drop rates. I don't see where the game doesn't allow all enemies to drop things.

Like NxK said, the enemy won't drop anything if it has been stolen from.

Back to the issue, this is handled as the enemy dies. So if they don't all die at once the RNG is going to keep moving around. Getting it to cooperate, let alone knowing where the pointer is, is nigh impossible in most cases, but this is relatively easy. Since it just requests a byte the Random Number Set isn't incremented. So you're looking for a certain pattern in the RNGLUT. You need to find a chain of them that all meet that criteria. I'm not certain there are any that do. The RNGLUT may have been constructed in such a way that situations like that are difficult.

Moral is: it CAN produce drops from all enemies (or you wouldn't get drops from single enemy battles like Adamantaimai), but you haven't hit the right string of numbers yet. It would take at least 256 attempts to try all the patterns in the RNGLUT.

antd

  • *
  • Posts: 49
    • View Profile
Back to the issue, this is handled as the enemy dies. So if they don't all die at once the RNG is going to keep moving around. Getting it to cooperate, let alone knowing where the pointer is, is nigh impossible in most cases, but this is relatively easy. Since it just requests a byte the Random Number Set isn't incremented. So you're looking for a certain pattern in the RNGLUT. You need to find a chain of them that all meet that criteria. I'm not certain there are any that do. The RNGLUT may have been constructed in such a way that situations like that are difficult.

Moral is: it CAN produce drops from all enemies (or you wouldn't get drops from single enemy battles like Adamantaimai), but you haven't hit the right string of numbers yet. It would take at least 256 attempts to try all the patterns in the RNGLUT.
I think this is the point I was missing! I thought ending the battle by a different frame would yield the full range of results. But this is wrong; it is when individual enemies die.

In this case, I will throw a right arm at 3 enemies of the same type. This will ensure all enemies die at the same time, right?

I've set up my script to kill all enemies delaying +1 frame each time, so it should hit each all possible RNG values.

It's tried 1000 attempts already and it has never hit 3 * T/S bomb drops from 3 * Flapbeats.
The most it has dropped is 2 * T/S bomb.

If this runs for over 65536 attempts, will this show that getting all item drops from multiple of the same enemy is impossible?
« Last Edit: 2011-12-28 17:25:12 by antd »

nfitc1

  • *
  • Posts: 3011
  • I just don't know what went wrong.
    • View Profile
    • WM/PrC Blog

If this runs for over 65536 attempts, will this show that getting all item drops from multiple of the same enemy is impossible?

Statistically I'd say yes. 256 attempts would be enough given there are only 256 values in the RNGLUT. However, there are eight pointers to it at any given time and I don't know for certain what each of them are for and when the game cycles though them nor at what rate. So 2048 (256 * 8 ) would be enough if you knew where the pointer started and what value was next in the RNGLUT. I'm not convinced that the RNG is shuffled every frame like other RPG games do.
That would only work for consecutive values, however. If you knew what value made an item drop and got the RNGLUT pointer back to that value for every enemy then you could likely get all the items from enemy drops. There is room in the data for four unique items although the quantity is variable. This point is moot because an enemy will only drop one item (if any) and there can only be three enemy types in a battle.

Vgr

  • Global moderator
  • *
  • Posts: 2163
  • If it quacks like a duck, it must be a duck
    • View Profile
A neat way to find out would be to find out which offsets points to the Random Number Generator Look-Up Table then try each value.

antd

  • *
  • Posts: 49
    • View Profile
Quote
A neat way to find out would be to find out which offsets points to the Random Number Generator Look-Up Table then try each value.
Yep, a good idea. But beyond my skills at the moment. I may try this when I have enough spare time to find the relevant memory addresses!

Statistically I'd say yes. 256 attempts would be enough given there are only 256 values in the RNGLUT. However, there are eight pointers to it at any given time and I don't know for certain what each of them are for and when the game cycles though them nor at what rate. So 2048 (256 * 8 ) would be enough if you knew where the pointer started and what value was next in the RNGLUT. I'm not convinced that the RNG is shuffled every frame like other RPG games do.
That would only work for consecutive values, however. If you knew what value made an item drop and got the RNGLUT pointer back to that value for every enemy then you could likely get all the items from enemy drops. There is room in the data for four unique items although the quantity is variable. This point is moot because an enemy will only drop one item (if any) and there can only be three enemy types in a battle.
Interesting info!

Currently at 44,000 attempts and no maximum item drops. Only, 0, 1, and 2 drops. Not 3.
I'll let this script run until it crashes or until it reaches 1 million attempts. On average, it is currently testing 140,000 attempts per day. So should hit 1 million in just over 1 week.

Surely if it reaches 1 million consecutive attempts it would have tried pretty much all variations of RNG position?
« Last Edit: 2011-12-29 15:42:26 by antd »

Vgr

  • Global moderator
  • *
  • Posts: 2163
  • If it quacks like a duck, it must be a duck
    • View Profile
I can do it for you if you want, given you already do a lot of work to do. I'll do it through Cheat Engine and pSX, but I think you'd probably prefer through psxjin given that's what you use for your TAS. Shouldn't be too hard. I don't know how to manipulate it *in* the game though.

antd

  • *
  • Posts: 49
    • View Profile
I can do it for you if you want, given you already do a lot of work to do. I'll do it through Cheat Engine and pSX, but I think you'd probably prefer through psxjin given that's what you use for your TAS. Shouldn't be too hard. I don't know how to manipulate it *in* the game though.
oh nice! you can get the relevant memory addresses?
i can write a lua script (psxjin) that automatically changes the values in game and reports the item drop


also: 58,000 consecutive attempts so far and no 3*T/S bomb drop from 3*Flapbeats!

Vgr

  • Global moderator
  • *
  • Posts: 2163
  • If it quacks like a duck, it must be a duck
    • View Profile
Wait, to automatically change might work, but will it work if someone uses the file to replicate the run? Because AFAIK if you want to post it on TASvideos you need replayability (I had read their rules...) so unless the lua script gets along with the emulator movie file, I think there has to be some way around.

Livesey

  • *
  • Posts: 148
    • View Profile
Please correct me if I'm being dumb but could you not change the drop values of a certain enemy to 255% in ProudClod and then test an enemy formation to see if the can get a 3x grenade drop?

antd

  • *
  • Posts: 49
    • View Profile
Wait, to automatically change might work, but will it work if someone uses the file to replicate the run? Because AFAIK if you want to post it on TASvideos you need replayability (I had read their rules...) so unless the lua script gets along with the emulator movie file, I think there has to be some way around.
Well I'm just doing this for my own knowledge. This part of the run will not be submitted to TASvideos.
It's purely to find out if maximum item drops are possible on enemies of the same type.

So, I just need to know which memory addresses are related to item drops.

Btw, 100,000 attempts and no 3*T/S bomb drop + the emulator crashed :D

Erzfreund

  • *
  • Posts: 26
    • View Profile
I can guarantee that it is possible to get all items as long as there are multiple win slots. For example Garuda at Dao Chao (Far right hand is the best spot for that).
I’ve also won three Eye Drops from six Battery Caps.


Quote
[…]but a Master Tonberry (Lvl 77) will have a 1:6.452 chance of dropping a Megalixer (rate of 8) for a level 99 character[…]

Hard to believe. Megalixer drops are quite common.

antd

  • *
  • Posts: 49
    • View Profile

I’ve also won three Eye Drops from six Battery Caps.
That's not actually what I'm suggesting. In your example, you will not win an item from all enemies.
I've only seen evidence of winning all items from a single enemy.
I'm suggesting that you cannot win 3 eye drops from 3 battery caps. That's unless 1 battery cap can drop more than 1 eye drop.

Quote
as long as there are multiple win slots
When does this change? Will there be 3 win slots when facing 3 enemies of the same type?

Anyone that can provide a screenshot or video of winning all items from all enemies of the same kind? I don't think it can be done without cheat codes.

Erzfreund

  • *
  • Posts: 26
    • View Profile
Ah, no I meant, that it could be possible, that the maximum drop for items is two, which is not the case. I believe, that you are right about the general impossibility of winning all items.


Garuda:
(Full List) Win: [ 8] Ice Crystal, [ 8] Bolt Plume, [ 8] Light Curtain,
                 [ 8] Mute Mask

http://youtu.be/heWRsQG8Vv8

nfitc1

  • *
  • Posts: 3011
  • I just don't know what went wrong.
    • View Profile
    • WM/PrC Blog
Please correct me if I'm being dumb but could you not change the drop values of a certain enemy to 255% in ProudClod and then test an enemy formation to see if the can get a 3x grenade drop?

This should be done before any more in-game testing as a proof of concept at least. If it's impossible then this would show it (although it would need to be set to 63 as 255 is a guaranteed stealable).

Vgr

  • Global moderator
  • *
  • Posts: 2163
  • If it quacks like a duck, it must be a duck
    • View Profile
Heck, why did nobody thought of that before? I feel so dumb now :P

NxK

  • *
  • Posts: 130
  • In AI I Trust
    • View Profile
    • YT
I have tried out the 3 Sneaky Steps battle and easily won 3 M-Tentacles after having adjusted the drop rate to 63.

Erzfreund

  • *
  • Posts: 26
    • View Profile
Ah, that's nice, but not really surprising (regarding the Turk battle at Gongaga).

What happens if the drop rate is set to 62? Especially when fighting Battery Caps. I think five of six Eye Drops is the best one can get.

NxK

  • *
  • Posts: 130
  • In AI I Trust
    • View Profile
    • YT
Even at a drop rate of 62, I got 6 Eye Drops in the 6 Battery Caps battle on my first attempt.

nfitc1

  • *
  • Posts: 3011
  • I just don't know what went wrong.
    • View Profile
    • WM/PrC Blog
Try getting three different items from a battle with three types of enemies. I think that's possible too.
...(regarding the Turk battle at Gongaga)...

I think bosses have some kind of 'always drop item' flag to ensure drop. I think even a rate of 63 is less than 100% or can somehow be prevented by certain attacks like Remove of whatever.

Livesey

  • *
  • Posts: 148
    • View Profile
Isn't 62 over 100%?

NxK

  • *
  • Posts: 130
  • In AI I Trust
    • View Profile
    • YT
Isn't 62 over 100%?

According to TFergusson the probability is (Chance + 1)/64, which means that 63 would be equivalent to 100% and 62 would definitely be less than 100%.


Livesey

  • *
  • Posts: 148
    • View Profile
Ahh, alright I must have been getting confused with the 255 thing.

Bosola

  • Fire hazard!
  • *
  • Posts: 1752
    • View Profile
    • My YouTube Channel
The scope of the variable is 6 bits rather than a whole byte. I don't know what those other two bits signify - maybe they're flags for 'always drop' and 'null'?