Ok, starting a pure research thread for PRNG abuse. As items in the help thread get moved over to the site and articlized technical information will be moved here about other games. Rules Only one, and you will be infracted if you break it. - This is currently a pure research thread, not a help thread. Use the sticky for that. DON'T ask questions here that can be answered by any knowledgeable abuser. Information Black & White Assorted 5th Generation RNG Information 64 Bit Seed Formula and Reverse Formula Mersenne Twister Determination of IVs MTRNG Table Updating Advancing the MTRNG: Walking, Withdrawing, and Battling C-Gear Seeds Entralink Offsetting Turning it on at the continue has an offset that's not constant, we turn it on in game. Passive advancement with C-Gear on (We keep it off, or turn it off asap) Initial (Non C-Gear) Seeding via SHA-1 Encryption Time and Date Keypress States Advancement: Stepping/Turning on Wild Tiles (Not Constant), Chatot, and Saving 5th Gen Ability Calculation Encounter Slots: Land Encounter Slots: Water 0x80000000 XOR Decision Rain Frame Advancement Breeding Basic Structure With(out) Ditto and/or Internationally, with(out) Everstones Other Areas of Abuse Entralink IVs and Natures ID/SID for Shiny PIDs Calculations that the Game Uses (Move your mouse to reveal the content) Calculations that the Game Uses (open) Calculations that the Game Uses (close) Code: Definitions: FullSeed = Entire 64 Bit Seed u32 = Upper 32 bits of the 64 Bit Seed L32 = Lower 32 bits of the 64 Bit Seed Lowest Bit = Lowest Bit of the (64 Bit) Seed FullSeed>>63 == 1 Pass Sync FullSeed %4 == 0 give Pokemon else give Item FullSeed %5 == 0 give 'Not even a nibble...' else give Pokemon U32 ^ XOR = PID U32*6>>32 IV Passed U32>>31 Parent Passing IV U32*100>>32 Encounter Slot Value Translate to Slot for Land/Water U32*25>>32 Nature Calculation ([URL="http://www.smogon.com/forums/showpost.php?p=3229521&postcount=608"]Use Table[/URL]) ===== Code: PID = Undecided Generated PID PID = Decided Generated PID HB = Highest Bit of PID LB = Lowest Bit of PID LTSh = Highest Bits XOR'd: L16(PID), TID, SID === Decision for 80000000 XOR PID = U32^0x10000 if (HB+LB)%2 == (LTSh)%2 PID == PID^0x80000000 else PID == PID Compilation of all the 0x(8)0010000 Encounters and Structures (Move your mouse to reveal the content) Compilation of all the 0x(8)0010000 Encounters and Structures (open) Compilation of all the 0x(8)0010000 Encounters and Structures (close) Wild / Surf Code: 0 Initial 1 Sync 2 ESV - Land / Surf 3 Held Item 4 PID 5 Nature Water Spots (Fish / Surf) Code: 0 Initial 1 Sync 2 ESV - Water 3 Held Item 4 PID 5 Nature For surfing, you have to surf into it, with frame advancement. Surfing onto it uses the ESV for surfing spot, fishing it uses the fishing spot. Fishing (No Spot) Code: 0 Initial 1 Sync 2 (No) Fish 3 ESV - Water 4 Level Calc 5 Held Item 6 PID 7 Nature Fishing (No Spot, Suction Cups in lead) Code: 0 Initial 1 (No) Fish - does not matter as Suction Cups guarantees a catch 2 ESV - Water 3 Level Calc 4 Held Item 5 PID 6 Nature Shaking Spots (Grass) Code: 0 Initial 1 Sync 2 ----- 3 ESV - Land 4 Held Item 5 PID 6 Nature Shaking Spots (Cave / Bridge) Code: 0 Initial 1 Sync 2 Item or Pokemon Calc 3 ESV - Land 4 PID 5 Nature Cute Charm Code: 0 Initial 1 Cute Charm 2 ESV - Land / Surf 3 Held Item 4 PID 5 PID modification \ Nature (failed CC) 6 Nature (successful CC) Compilation of all the 0x10000 Encounters and Structures (Move your mouse to reveal the content) Compilation of all the 0x10000 Encounters and Structures (open) Compilation of all the 0x10000 Encounters and Structures (close) Zekrom/Reshiram Code: 0 Initial 1 Sync 2 PID 3 Nature Gifts / Fossils / Starters Code: 0 Initial 1 PID 2 Nature High Link, some of the time. Zoroark has a weird way of PID generation, which we aren't completely certain how it works. It's really unnecessary to completely document, just like Zoroark because these buggers cannot be shiny. Zoroark / Zorua cannot shine. Wonder Cards Code: 0 Initial 22 HP IV 23 Atk IV 24 Def IV 25 SpA IV 26 SpD IV 27 Spe IV 30 PID 32 Nature There is something that can change the PID to make it give the opposite nature. Not sure, but it's noted here. Best bet is in between Compilation of Egg Generation and Structure (Move your mouse to reveal the content) Compilation of Egg Generation and Structure (open) Compilation of Egg Generation and Structure (close) Code: Frame 0 n-1 Initial Seed [Start] Frame 1 n nothing Frame 2 n+1 nothing Frame 3 n+2 Nature (r[n+1]*0x19) >>32, nature value --- if Everstone, becomes Frame 4 [n+3] and all calls are shifted +1 Frame 4 n+3 DW (r[n+2] * 5) >>32 > 1, inherit DW --- if Ditto parent, becomes Frame 5 [n+4] and all calls are shifted +1. Not sure what is done here. Frame 5 n+4 m IV1-Place r[m]*6>>64, return 0-5 for what IV (HABCDS) Frame 6 n+5 m+1 IV1-Parent r[m+1]>>63, return 0/1 for what parent (A=1, B=0) Frame 7 n+6+2r m+2 IV2-Place r[m+2]*6>>64, return 0-5 for what IV (HABCDS) ...r=rejected frames for 2nd iteration, each rejection is +1 to r value Frame 8 n+7+2r m+3 IV2-Parent r[m+3]>>64, return 0/1 for what parent (A=1, B=0) Frame 9 n+8+2r+2s m+4 IV3-Place r[m+4]*6>>63, return 0-5 for what IV (HABCDS) ...s=rejected frames for 3rd iteration, each rejection is +1 to s value [U]Frame 10 n+9+2r+2s m+5 IV3-Parent[/U] r[m+5]>>64, return 0/1 for what parent (A=1, B=0) Frame 11 n+10+2r+2s PID Generated r[n+10+2r+2s] - 1 = PID Frame 12 n+11+2r+2s Pokemon placed in party. [End] For >>32, assume using upper32 For >>6*, assume using full seed "Rejected": 0-5 value calculated matches one from a previous iteration. Discard and repeat calc until it does not match a previous 0-5, thus advancing 2 frames. Please refer to the other Breeding resources that are in the list at the top of this post. Compilation of all the unXOR'd Encounters and Structures (Move your mouse to reveal the content) Compilation of all the unXOR'd Encounters and Structures (open) Compilation of all the unXOR'd Encounters and Structures (close) Roaming Pokemon Code: 0 Initial 1 PID 2 Nature SID / ID Code: Seed from Are you ready to enter the world of Pokemon XXXXYYYY XXXX = SID YYYY = ID HGSS Seeding Seeing is either exactly the same or extremely close, with the exception of the delay which can be much lower. Some more samples here would be welcome, but it seems like "normal" is probably somewhere around 490. RNG Reporter 7.01 has been released and has a checkbox to lower the minimum search delay on the seed finder to 400. RNG Advancing Walking in areas where there are no wild Pokemon is the same as in DPP. +1 for each Pokemon in the party per 128 steps. PID Generation for Wild Pokémon For the most part, PID generation is handled in the same manner described by X-Act in his article, but the process of getting the initial PID has changed in the 4th generation. In the 3rd generation, without a synchronizer present, the next two or three numbers from the RNG were taken and used directly to form a PID. In the 4th generation games this procedure has changed and there is an initial call to the RNG to get the nature and then the RNG is advanced until an appropriate PID (that is, one that has a matching nature) is found. Starting from s[n], which can be thought as your current seed, when entering a battle with a Pokémon (wild or Synchronizable legend), the first seed used to generate the Pokémon is s[n+1]. This number is used to determine the nature of the Pokémon as follows: s[n+1] mod 25 This operation will produce a number between 0 and 24, which is the target nature. Next is the PID generation. PID is [s[m]][s[m+1]] where m starts as m = n+2 and is incremented by 2 until a PID is found with the target nature. In the end the IVs, as usual, are formed with [s[m+2]][s[m+3]] <insert complete example with pid generation> Effect of Synchronize: The low bit of s[n+1] acts as a trigger. If it's 1, Synchronize has failed. In this case the method above is used, but s[n+1] is NOT recycled to determine nature. Instead another call is made to the RNG and that number is considered to be s[n+1]. If it's 0, the the target nature will be that of the first Pokémon in your party. Next step is the PID generation. PID is [s[m]][s[m+1]] where m starts as m = n+2 and is incremented by 2 until a PID is found with the target nature. In the end the IVs, as usual, are formed with [s[m+2]][s[m+3]] <insert complete example with pid generation> Professor Elm Responses (Move your mouse to reveal the content) Professor Elm Responses (open) Professor Elm Responses (close) We can use phone calls to Professor Elm to verify or determine our initial seed. When called he will give one of the following responses: "I expect there are some Pokémon in the Kanto region that I don't know. There are probably methods of evolution that I'm not familiar with yet. I should use that perspective and discover what I can." "There are so many different ways that Pokémon evolve, aren't there?! Some Pokémon don't even evolve until they meet certain conditions first!" "It seems that Pokémon that have been infected with Pokérus level up better. We're not quite sure why..." We will refer to these messages as K, E, and P. Each time the Elm is called the RNG is advanced by one. The result is processed as follows: result = seed % 3 0 = Evolution 1 = Kanto 2 = PKRS FRLG Information can be found in this thread.