Thread: RNG Research
View Single Post
Old Dec 30th, 2011, 1:19:58 AM   #870
Kaphotics
Remodeling Kitchens
is a Pokémon Researcheris a Contributor to Smogon
 
Kaphotics's Avatar
 
Join Date: Apr 2009
Posts: 758
Berkeley, CA
Default

WORK IN PROGRESS

just so we can see what happens and make sense of any debugging if needed

Calls following an Activated PokéRadar

First we must chain something. If we don't have a chain, we can't have any shiny patches.

By noting the current seed BEFORE and AFTER activating the PokéRadar, we can find out how many calls happen if we activate it. If we try it a few times with different seed, we can see that the current seed after activating is 12 frames after the initial. So, 12 random numbers are used to calculate how the PokéRadar gives patches.

We know that each patch requires 2 calls (for ESV and Shiny). That leaves us with 4 position calls, and 4x2 calls for ESV/Shiny. Perfect!

Upon further observation (first 4 call debugging courtesy of Bond697), we see that the game calculates position with 4 different divisions - 0x20, x18, 0x10, 0x8. After the 4 positions, slot and shiny are determined. But how does the game position?

Code:
Div values the game uses to determine position: 
High16/(position div)
0x20, 0x18, 0x10, 0x8     -> 

Possible Range: 
0x20	0x0000-0x07FF
0x18	0x0000-0x0AAB
0x10	0x0000-0x0FFF
0x8	0x0000-0x1FFF

Bit ranges of the max result

7FF	0000011111111111
AAA	0000101010101010
FFF	0000111111111111
1FFF	0001111111111111
	   12345xxxxyyyy --- ???


Grid Position with Player at Origin

444444444
433333334
432222234
432111234
432101234
432111234
432222234
433333334
444444444

9x9, 7x7, 5x5, 3x3, [1x1 (center)]
4    3    2    1    0
9x9 perimiter = 32 (5 bits)
7x7 perimiter = 24 (5 bits)
5x5 perimiter = 16 (4 bits)
3x3 perimiter = 8 (3 bits)

Code:
0    - Initial
1    - Position1
2    - Position2
3    - Position3
4    - Position4

56   - ESV1/Shiny1
78   - ESV2/Shiny2
910  - ESV3/Shiny3
1112 - ESV4/Shiny4

However, we can't assume that it will allow for shiny-notchain Pokemon.
The game doesn't allow for shiny patches with a non-started chain (c=0)

Quote:
The patch farther away gives you a better chance of seeing the same kind of Pokemon in a row. That's the feeling I get, anyways.
editing in, more of a scratchy post

Last edited by Kaphotics; Dec 30th, 2011 at 3:11:59 AM.
Kaphotics is offline   Reply With Quote