Most Generation PRNG Help / Information

I'm still having problems with the RNG Reporter because of the IV's don't have a ton of Rare Candies so I don't get ranges when calculating IV's
 
OMG this is amazing!

I'm now resetting on my favorite shiny.

Thetorsoboy, thank you for the great guide but I have a suggestion. In you guide you suggested looking for a delay of about 650 or under. I got fed up looking for a spread in that range so I just picked a high number. This high number provided me with a shiny that was only about 300 clicks away. So it doesn't seem to matter if the delay if high or not.

P.S. This is frakking awesome.
Oh, sorry. Was a bit unclear there. Meant 500-900. D:
 

mingot

free agent
is a Site Content Manager Alumnusis a Battle Simulator Admin Alumnusis a Top Researcher Alumnusis a Contributor Alumnusis a Smogon Media Contributor Alumnusis an Administrator Alumnus
Mingot: You could add a function for inserting Trainer/Secret-ID for all of the editions someone owns - and then tell in the list which edition to hatch it on. This could greatly decrease the needed frame advancements if someone is willing to use more editions.
At some point I will probably do this.

Also I'm still not certain whether all this only applies to Platinum. I found the
PID = PID*0x6c078965+1
in D/P as well and I'm suspecting that RNG-rollback could be possible on D/P, too.
I _really_ have to tris this in-game instead of just reeding about it.

TCC

PS: peeking into Diamond
0201BB6C contains the magic number 9D2C5680
0201BB2C loads it. Breakpointing the load does nothing for some time, but when switching to happiness viewer, it is called 12 times (I have 6 Pokemon in party).

still have to check whether it is called on boot-up and egg creation. Also init value of PRNG wasn't similar to my calculated datetime+delay but I'll have to check into this later.
Well first off I strongly suspect that all of this will work on D/P. You finding the PID adjustment code for international parents pretty much confirms the extra chance of a shiny there. There it is just a matter of finding the initial seed, which is a little different in that the delay can probably be pretty much anything. My Initial seed finder will only check delay values to 36,000 (which is WAY to high for Platinum and probably too low for D/P. At some point I'll mess around with adjusting that and see if I can find D/P seeds and see if the IRNG (what we call the egg RNG here) works in a similar manner. Seems like it does from your experiment with breakpointing in the call.

If you could verify a few things in the "Seed Advancement for Wild Pokemon" section of the first post that would be awesome. Specifically the open and close of the Pokedex. Does this advance the RNG? Really, though, code verification of anything there would be helpful.
 
Resetting for a good IV'd Shiny Modest Feebas, it was a pain to get a fast Modest spread, took me more than 1,5 hours (Using Int. Parents o.o)

Anyways, it took me 285 taps and 10 coin flips, I was scared I'd screw up but luckily, I didn't ^^

First egg:

16/20/9/20/10/30, not bad, but I want it to be better :3

Second:

27/20/31/20/10/7, another reset, I want at Sp. Att and Speed to be flawless, at least.

Third:

26/17/31/11/20/28, reset.
 
Just a quick sidenote on the PRNG: PRNG is crap.

I was trying to find out how many PRNG rolls were done in a battle.
Started rolling with seed 0xE914EC7D and was surprised:
0 Seed: E914EC7D
1790425565 Seed: E914EC7D rnd: E914

so seeding with E914EC7D can't have touched all seeds (2^32) - it didn't even touch half of them.

I originally did this to find the seed which appeared at the end of battle - but it seems it didn't even run there once. Looks like there are several "rings" of seeds which can't be left. I originally expected it to be one ring of 2^32 seeds.

I'm still hoping that there's a flaw in my program, because otherwise the game does things I can't explain yet.

I'll work more on eggRNG-breakpointing when I'm home. At the moment I'm kind of stuck to number crunching..

TCC
 

mingot

free agent
is a Site Content Manager Alumnusis a Battle Simulator Admin Alumnusis a Top Researcher Alumnusis a Contributor Alumnusis a Smogon Media Contributor Alumnusis an Administrator Alumnus
So it's not that it unwinds at all, just that it starts using another seed stored in a different location during the battle RNG calls? It DOES make more sense than rewinding. Save initial seed, start battle, when battle is over reseed with saved value.

When I see things like this it makes me wonder what they were thinking. I mean why go through the extra work to either rewind or save/restore a previous seed when you could have just kept going.
 
hi ..
im trying to do this but i cant first
when i put the nature in the program and the iv's and press find nothing apears
why ?
i dont know can anybody help is it from the ivs because i use the serebii iv check
or what please help me
 
asthegreat: Make sure you put the correct date in, if you did, then I'm sorry, I can't help you =(

I need some help aswell, still resetting on a good Shiny Modest Feebas, got these results:

16/20/9/20/10/30
27/20/31/20/10/7
26/17/31/11/20/28
29/20/8/11/31/10
22/11/9/20/20/28
31/25/2/9/28/18
14/18/10/6/11/28
27/2/18/11/23/30
28/15/31/11/28/28

Now I want to know, Sp. Att is 11 or 20 most of the times, is there any chance it'll be 30/31? If not, I might keep the last one.
 

Wild Eep

pet pet pet
is a Forum Moderatoris a Senior Staff Member Alumnusis a Researcher Alumnus
Moderator
asthegreat: Make sure you put the correct date in, if you did, then I'm sorry, I can't help you =(

I need some help aswell, still resetting on a good Shiny Modest Feebas, got these results:

16/20/9/20/10/30
27/20/31/20/10/7
26/17/31/11/20/28
29/20/8/11/31/10
22/11/9/20/20/28
31/25/2/9/28/18
14/18/10/6/11/28
27/2/18/11/23/30
28/15/31/11/28/28

Now I want to know, Sp. Att is 11 or 20 most of the times, is there any chance it'll be 30/31? If not, I might keep the last one.
Without knowing the IVs of the parents, I'd guess you have parents in the day care with the 11 and 20 IVs in SA. Without 31 SA from the parents, you have a small chance to land flawless SA (the same chance as landing that random 6 SA Feebas #7 has - about 1/64 eggs I think).
 
So it's not that it unwinds at all, just that it starts using another seed stored in a different location during the battle RNG calls? It DOES make more sense than rewinding. Save initial seed, start battle, when battle is over reseed with saved value.
We'd still have to figure out when the switch to the other seed is done. The numbers at the beginning of the battle still are generated with the old seed - so some seeds are used twice: at beginning of battle and after rewinding.
And I'd like to know when and where the game does get the new seed. I can imagine it being the PID of the wild pokemon or some xor between PIDs. If only I had some emu here..

When I see things like this it makes me wonder what they were thinking. I mean why go through the extra work to either rewind or save/restore a previous seed when you could have just kept going.
To be honest - at some points I guess, they weren't really thinking about it.
This "PRNG doesn't touch all seed"-issue looks more like some programmer thought "this might be a nice idea" without doing the math, first.

Right now, I'm having the "monster" cycle through the seeds. I want to know how many seed-rings there are with this PRNG and what's their period.

Concerning the "backup/restore-seed":

I can imagine a structure like this:
function battleWithPokemon(PokemonData){
(...)
}

and as a "real" function, the last thing before calling it would be
* Put "alive" values (like PRNG seed) onto a stack

and the first thing after returning from this function would be
* Restore "alive" values from stack.

Someone forgot that the PRNG seed doesn't need to be alive but is a global value for "everything" in the game.

Also, I personally believe that the "battleWithPokemon()"-function is very old - might even date back to blue/red and only was patched up to what the new editions offer and to the new prng when it was available.
Perhaps the function has always been a "seed the PRNG yourself"-function and whenever migrating the source to the next generation, no one wanted to change it.

TCC
 
Without knowing the IVs of the parents, I'd guess you have parents in the day care with the 11 and 20 IVs in SA. Without 31 SA from the parents, you have a small chance to land flawless SA (the same chance as landing that random 6 SA Feebas #7 has - about 1/64 eggs I think).
Just checked, and yes, Ditto has 20 and Milotic 11.
I like the other IVs of my current Feebas, but Sp. Att is one of it's most important stats. However, even if I get lucky getting 31 Sp. Att, chances are, the other IV's are crappy.

What would you do? Keep the last one?
I don't think I'll get much better spreads...
 

mingot

free agent
is a Site Content Manager Alumnusis a Battle Simulator Admin Alumnusis a Top Researcher Alumnusis a Contributor Alumnusis a Smogon Media Contributor Alumnusis an Administrator Alumnus
@ TCCPhreak - The period is 2^32, with no numbers repeated during the entire cycle.

And it would be strange for code to even know about the full seed as all it is returned/use are the high 16 bits of the actual seed and not the full 32 bits that are stored in the routine. Remember this all starts as C most likely and the RNG calls are probably black box call. Someone really had to go out of their way to do this I think.

@ Pokerealm - If you could, please ask these questions in DMP, you will get much better answers from there, I think.
 
@ TCCPhreak - The period is 2^32, with no numbers repeated during the entire cycle.

And it would be strange for code to even know about the full seed as all it is returned/use are the high 16 bits of the actual seed and not the full 32 bits that are stored in the routine. Remember this all starts as C most likely and the RNG calls are probably black box call. Someone really had to go out of their way to do this I think.

@ Pokerealm - If you could, please ask these questions in DMP, you will get much better answers from there, I think.
Thanks, I decided to keep it, and wait for Jonny's explaination on how to get flawless breeds =)
 
@ TCCPhreak - The period is 2^32, with no numbers repeated during the entire cycle.
This is what I've been trying to verify - and what seems to be wrong.

I took the E914EC7D-seed from the RNG while in battle and fed it into a PC program cycling through the seeds until a seed is found the second time.

Originally I simply let it cycle without stop condition. I expected the seeds to repeat after exactly 2^32 rolls but after a night of calculation, the seeds were repeating and some random numbers weren't created at all. I didn't believe this result at first, so I changed the program to stop as soon as one seed is touched twice.
(Thinking about it - it would _always_ have to be the initial seed - so building the 0,5gig bitvector was kind of stupid)

It stopped long before 2^32, so seed for roll (1790425565+1) will be the same seed as for roll 1. As long as the original seed is one of the 1790425565 reached from E914EC7D, the period will be less than 2^32.

0 Seed: E914EC7D
1790425565 Seed: E914EC7D rnd: E914

However, I'm still not denying that there could be something wrong with my program. I can post it or upload it somewhere for people to check.
Also, if someone else has done the PRNG on PC, he could seed it with E914EC7D and let it roll 1790425565 times and tell whether the numbers start repeating, then.

And it would be strange for code to even know about the full seed as all it is returned/use are the high 16 bits of the actual seed and not the full 32 bits that are stored in the routine. Remember this all starts as C most likely and the RNG calls are probably black box call. Someone really had to go out of their way to do this I think.
function PRNG(){
* load seed from a given (constant) point in memory
* load multiply value,
* do multiplication
* load add value
* do addition
* store new seed to the same point in memory
* cut the lower 16 bit away from new seed
* shift the upper 16 bit to become lower 16 bit
} // result is given in R0

so by peeking and poking the given (constant) point in memory, you can backup the seed or put in any value you like. Perhaps I should try to find out, what other program parts read and write there - except from the PRNG itself.


TCC
 

mingot

free agent
is a Site Content Manager Alumnusis a Battle Simulator Admin Alumnusis a Top Researcher Alumnusis a Contributor Alumnusis a Smogon Media Contributor Alumnusis an Administrator Alumnus
Just for you to verify:

seed = seed * 0x41C64E6D + 0x6073;

And to be honest I've never actually tested the 2^32, all numbers cycle, none repeat. It's just the nature of the Linear Congruent Generator.

Course the magic numbers could be bad.

And I always wondered where Nintendo got the "C" (the constant that is added) because it's not used in any of the standard implementations that I have seen.

Ah from Wiki for the full period range to be 2^32:

1.
and
are relatively prime,
2.
is divisible by all prime factors of
,
3.
is a multiple of 4 if
is a multiple of
4.[2]

Where c = 0x6073
Where a = 0x41C64E6D
Where m = 2^32

Maybe someone good at math could figure out if Nintendo used borked magic numbers.
 

Syberia

[custom user title]
is a Smogon Media Contributor Alumnus
When I see things like this it makes me wonder what they were thinking. I mean why go through the extra work to either rewind or save/restore a previous seed when you could have just kept going.
It's almost like they intended the RNG to be cracked at some point, considering that they went through so many seemingly needless steps to make it "convenient."

*cue Twilight Zone music*
 

mingot

free agent
is a Site Content Manager Alumnusis a Battle Simulator Admin Alumnusis a Top Researcher Alumnusis a Contributor Alumnusis a Smogon Media Contributor Alumnusis an Administrator Alumnus
Man, the code for the IRNG was anything but convenient to sort out. Honestly, I think with that the goal was to actually make it harder. Even emerald runs differently for eggs.
 
Thanks for the info, it took me a while to understand it tho, as I had 4 pokemon instead of 5 in my party for 1/2 of my time spent (stupid me, lol) ;)

Just hatched my first Shiny-egg using this method:
Yanma, Modest, Speed boost: 30/3/31/31/19/31, I think I'll keep this one :naughty:
 
Ah from Wiki for the full period range to be 2^32:

1.
and
are relatively prime,
2.
is divisible by all prime factors of
,
3.
is a multiple of 4 if
is a multiple of
4.[2]

Where c = 0x6073
Where a = 0x41C64E6D
Where m = 2^32

Maybe someone good at math could figure out if Nintendo used borked magic numbers.
As far as I can tell, those numbers satisfy the criteria. m's only prime factor is 2, while c (24691) is odd; a-1 (551757622) is divisible by 2 (the only prime factor of m); and a-1 (1103515244) is divisible by 4. So in theory, it should work; TCC appears to have made a mistake somewhere.
 

mingot

free agent
is a Site Content Manager Alumnusis a Battle Simulator Admin Alumnusis a Top Researcher Alumnusis a Contributor Alumnusis a Smogon Media Contributor Alumnusis an Administrator Alumnus
I think so, too. I just ran some simple code to keep a counter and cycle the RNG starting from zero (and E914EC7D since that number was mentioned) and to tell me how many iterations it ran before looping back to zero (or E914EC7D).

0xFFFFFFFF.

(Brute force to make up for my lack of math skills!)
 

Syberia

[custom user title]
is a Smogon Media Contributor Alumnus
Did you look through the entire list? The first one it gives you is not always your seed, especially if you wasted any time at all Sweet Scenting.
 

Users Who Are Viewing This Thread (Users: 1, Guests: 19)

Top