RNG oddities (Generation III): Difference between revisions

Jump to navigation Jump to search
Content added Content deleted
>Sherkel
(Created page with "{{Misc Gen 3}} While luck manipulation can be considered a class of non-glitch exploits, there are aspects of RNG implementation in the Generation III ha...")
 
>Sherkel
mNo edit summary
Line 6: Line 6:


== VBlank RNG interrupt glitch ("Methods") ==
== VBlank RNG interrupt glitch ("Methods") ==
In all five games, there exist multiple sets of PIDs and IVs for a given Egg or encounter on any given frame. Even though the effects of this are mostly innocuous and potentially beneficial to the player, it is due to a programming oversight that this is the case.
In all five games, there exist multiple sets of PIDs and IVs for a given Egg or encounter on any given frame. Even though the effects of this are mostly innocuous and potentially beneficial to the player, these are due to a programming oversight.


The GBA's VBlank routine runs roughly once every 16.743 milliseconds. Stat generation is generally much faster than this, making four calls to the RNG returning a halfword each time, two each for the PID and IV spread. These can be predicted for any given current seed by running the LCG on it manually and looking at the upper 16 bits of each value. However, as VBlank is an interrupt and the LCG advances by one every time it's run, an additional call sometimes needs to be made to determine some of the IVs.
The GBA's VBlank routine runs roughly once every 16.743 milliseconds. Stat generation is generally much faster than this, making four calls to the RNG returning a halfword each time, two each for the PID and IV spread. These can be predicted for any given current seed by running the LCG on each result manually, noting the upper 16 bits of each value. However, VBlank is an interrupt and the LCG advances by one sequential state every time it's run, so to generate the needed four values, an additional call sometimes needs to be made.


These unintended orders have been referred to as "methods" by various sources. Three have been confirmed to occur on official hardware. Each has a counterpart that includes the random encounter nature hunt routine ("Methods H-1, H-2, and H-4"). Method H-1 almost never occurs, as the slowness of the nature hunt almost always causes VBlank to interrupt the four main RNG calls. Method 4 has frequently occurred in [[bp:Pokémon Box Ruby & Sapphire|Pokémon Box Ruby & Sapphire]], and H-1 has been occasionally witnessed in {{RS}}.
These unintended orders have been referred to as "methods" by various sources. Three have been confirmed to occur on official hardware. Each has a counterpart that includes the random encounter nature hunt routine ("Methods H-1, H-2, and H-4"). Method H-1 almost never occurs, as the slowness of the nature hunt almost always causes VBlank to interrupt the four main RNG calls. Method 4 has frequently occurred in [[bp:Pokémon Box Ruby & Sapphire|Pokémon Box Ruby & Sapphire]], and H-1 has been occasionally witnessed in {{RS}}.