Recommended Posts

Similarities with GameBoy Color Infra-Red Mystery Gifts

The logic is the mostly the same between Pokemon Stadium 2 and Mystery Gift between GameBoy Color using infra-red system.

The game chooses a random item and decoration separately. The game first tries to give the decoration but you already have that decoration, you will get the item instead.

Choosing a specific item or decoration gift to send occurs in two stages. First, the game selects a set from which the gift will come. Then, it uses a part of the player's Trainer ID number to determine which gift from that set to send. (Below, bit 0 refers to the least significant bit of the Trainer ID and bit 15 refers to the most significant bit. Given the Trainer ID 32768, which translates to 1000000000000000 in binary, bit 15 is 1 and bit 0 is 0.)

The logic for determining the item given is the same as the logic for Mystery Gift between GameBoy Color using infra-red system.

Decoration Logic

The logic for determining decoration is different however.

Random number.   Range     . Gift set                                          . Overall rate
1st 36-255 Common 223/256
0-35 N/A (pick a 2nd number)
2nd 72-255 Uncommon 25/256
0-71 N/A (pick a 3rd number)
3rd 72-255 Rare 7/256
0-71 N/A (pick a 4th number)
4th 154-255 Very Rare 1/256
77-153 Tentacool Doll 0/256
0-76 Tentacool Doll or Pikachu Bed 0/256

Common, Uncommon, Rare and Very Rare follows a similar logic as GameBoy Color Infra-Red Mystery Gifts (using Trainer ID). The exact bit used for each item and decoration is slightly different. Check https://bulbapedia.bulbagarden.net/wiki/Mystery_Gift for the detailed list.

Upon reaching the 4th roll with 0-76, Tentacool Doll is given if Round 2 has not been unlocked and Pikachu Bed is given if Round 2 has been unlocked.

No code exists to return Unown Doll (internal decoration ID 35).

Why Tentacool Doll and Pikachu Bed are unobtainable
You may have noticed that Overall rate for Tentacool Doll and Pikachu Bed is 0/256. Here's why:

To obtain Tentacool Doll, the game must roll 0-35, 0-71, 0-71, 0-153 (assuming Round 2 hasn't been unlocked).
To obtain Pikachu Bed, the game must roll 0-35, 0-71, 0-71, 0-76 (assuming Round 2 has been unlocked).

Those sequences of numbers are not possible.

The game uses a 32-bit linear congruential generator: result = (seed * 0x19660D) + 0x3C6EF35F;

Mystery Gift logic only uses the last 8 bits of the generated random number.

The last 8 bits of the generator follows a cyclic pattern:
0,95,50,233,52,3,134,45,168,231,26,177,92,11,238,117,80,111,2,121,132,19,86,189,248,247,234,65,172,27,190,5,160,127,210,9,212,35,38,77,72,7,186,209,252,43,142,149,240,143,162,153,36,51,246,221,152,23,138,97,76,59,94,37,64,159,114,41,116,67,198,109,232,39,90,241,156,75,46,181,144,175,66,185,196,83,150,253,56,55,42,129,236,91,254,69,224,191,18,73,20,99,102,141,136,71,250,17,60,107,206,213,48,207,226,217,100,115,54,29,216,87,202,161,140,123,158,101,128,223,178,105,180,131,6,173,40,103,154,49,220,139,110,245,208,239,130,249,4,147,214,61,120,119,106,193,44,155,62,133,32,255,82,137,84,163,166,205,200,135,58,81,124,171,14,21,112,15,34,25,164,179,118,93,24,151,10,225,204,187,222,165,192,31,242,169,244,195,70,237,104,167,218,113,28,203,174,53,16,47,194,57,68,211,22,125,184,183,170,1,108,219,126,197,96,63,146,201,148,227,230,13,8,199,122,145,188,235,78,85,176,79,98,89,228,243,182,157,88,215,74,33,12,251,30,229,0

The first random number is selected randomly in that list, then at every new roll, the next random number is the next one in the list.

The issue is that there are no 4 consecutive numbers that are 0-35, 0-71, 0-71, 0-153 respectively.
This means Tentacool Doll (and Pikachu Bed) can't be obtained.

The sequence to obtain a Very Rare decoration (0-35, 0-71, 0-71, 154-255) appears once (15,34,25,164).

In short, none of the Pokemon Stadium 2 exclusive decorations are actually obtainable.

Special thanks to Lincoln for providing the initial disassembly of Mystery Gift functions of Pokemon Stadium 2.

Edited by RainingChain
• 2
Share on other sites

By using hacks, it is possible to receive Pikachu Bed, Unown Doll, and Tentacool Doll.

In Pokemon Stadium 2 USA 1.0, place a breakpoint at command 0x801454F8 and alter the register V0 to 0x22 for Pikachu Bed, 0x23 for Unown Doll, or 0x24 for Tentacool Doll.

Note that the Unown Doll is displayed as "DECORATION".

Edited by RainingChain
• 2
Share on other sites

• RainingChain changed the title to Pokemon Stadium 2 Mystery Gift Mechanisms

From the sounds of it, this research was all conducted on English Pokémon Stadium 2. Is it feasible that it could have been possible to obtain the exclusive decorations on Japanese Pokémon Stadium GS? (e.g. If in the localization process, they tweaked the probabilities of Mystery Gift items, but inadvertently made them impossible to obtain.)

Share on other sites

On 9/10/2023 at 7:52 AM, SnorlaxMonster said:

From the sounds of it, this research was all conducted on English Pokémon Stadium 2. Is it feasible that it could have been possible to obtain the exclusive decorations on Japanese Pokémon Stadium GS? (e.g. If in the localization process, they tweaked the probabilities of Mystery Gift items, but inadvertently made them impossible to obtain.)

I just tested Mystery Gifts on Japanese version. The RNG function and the 4 consecutives check (< 36, < 72, < 72 < 77) are the same.

I confirm that the Tentacool Doll and Pikachu Bed decorations can't be obtained on Japanese Pokémon Stadium either.

Edited by RainingChain
• 2
Share on other sites

Really interesting info, I came here referenced via this document (leaving it here for other people, it is an easy to digest info about all gen 2 mistery gift mechanics)

Pretty happy to see this finally understood, that explains those 3 afternoons I spent years ago on emulator setup, advancing the clock (years even) without getting any new decoration from stadium.

Share on other sites

Not sure if this would work or not, but I remember hearing N64's keep bits of data stored in the RAM when a game is removed while running (I want to say Rare was going to use this in Banjo & Kazooie for bonus content) is it possible to use this to put in an RNG value that would generate the string of RNG necessary?  (I believe this is similarly used in a Paper Mario speedrun to manipulate the RAM values.)