|
|||||||
![]() |
|
|
Thread Tools |
|
|
#1051 | |
|
Join Date: Apr 2008
Posts: 1,019
here...where I'm allowed everyThing AlL of the tIme
|
-TCCPhreak. Are you looking into the game code? If yes could you check how the ID and the Secret ID are created? maybe we can work out how to calculate the Secret ID from the ID and the game starting date...It would be awesome.
=J=
__________________
New Pearl Fc: 5456 1642 7916 Platinum Fc: 4597 2036 6232 My tradeable Pokemon http://www.doomdesire.it Quote:
|
|
|
|
|
|
|
#1052 | ||||||
|
Join Date: Mar 2009
Posts: 23
|
Hello,
first of all I'd like to report some success regarding "does it work on D/P, too?". * Caught the Seed after reset. * watched the IRNG (or what seems like it) while egg was created, * noted down the number it returned -> IRNG_return * took the egg and saved. Then peeked at the PID of the egg -> egg_PID * fed the Seed into PRNG-Generator and let it calculate the PIDs of the first egg -> Gen_PID Result: IRNG_return == egg_PID == Gen_PID. In other news, I'm trying to re-implement the EggRNG on PC. Unfortunately I don't completely understand everything Jonny has writte and would be grateful if someone could tell me whether I'm right with what I did so far. a table is an array of 624 numbers, called t[0..623], normally indexed with n Quote:
t_table createInitialTable(uint32_t seed); Quote:
Although they temporarily use values A,B and C, those are created by tableIndex. uint32_t k0(uint32_t tableIndex, t_table previousTable); uint32_t k1(uint32_t tableIndex, t_table previousTable); Quote:
When creating a new table, those have to refer to the elements of a previous table, right? For first created new table, this should be the 0th table, but later on the 0th table is not referred anymore... Only previous table is needed, although k0 and k1 are used, they are calculated with the iterator. t_table createNewTable(t_table previousTable); Quote:
Quote:
So the first random number is S(0) is t[0] of table 1? next random number is S(1) is t[1] of table 1 and random number 625 is S(624) is t[0] of table2? This would also mean that after creation of table1, table0 is not needed any more and when table1 has cycled and table2 was created, we can purge table1 as well. Quote:
k0, k1 and k2 are merely temporary variables here? To be honest, some of the pseudo-programming syntax more confused than clear things. You're writing arrays for simple temporary results; square braces as function parameters... Don't get me wrong. I'm very thankful that someone figured it out at all and decided to post it here. Still at some points is seemed rather confusing. Once my code works, is it okay to post it somewhere? Greetings, TCC |
||||||
|
|
|
|
|
#1053 |
|
free agent
![]() ![]()
Administrator
Join Date: Jun 2008
Posts: 3,045
|
Not to discourage you from writing your own code, but it's a Mersenne Twister and if you google that you can find sample code x 2 in every language you could imagine. Also google has pretty clear pseudo code for re-implementing.
And yeah if you want to post source for an implementation, that's useful.
__________________
Last edited by mingot; Apr 9th, 2009 at 9:21:32 AM. |
|
|
|
|
|
#1054 | |
|
Join Date: Apr 2008
Posts: 1,019
here...where I'm allowed everyThing AlL of the tIme
|
Sorry about the small mistakes, I simply translated it from a japanese article , when me and Mingot worked on it (via msn) we found several mistakes, and finally discovered that the algorithm was the well known Mersenn Twister...I thought it was pointless to edit that post ...eheeh
by the way did you see what I wrote in my last post?
__________________
New Pearl Fc: 5456 1642 7916 Platinum Fc: 4597 2036 6232 My tradeable Pokemon http://www.doomdesire.it Quote:
|
|
|
|
|
|
|
#1055 | |||
|
Join Date: Mar 2009
Posts: 23
|
Quote:
The broken-ness of Emerald was in the seeding the PRNG with 0 on every boot instead of using more random seed. Quote:
But I'd imagine that it's created very similar to PIDs and therefore comes from the seed at bootup (month*day+minutes+seconds)_(hour)... Did anyone yet try to start a game as quickly as possible and then try with legit.exe whether trainer+secret ID might be the rolls of two early PRNG in sequence? (similar to PID generation on PRNG) One could even misuse the RNG Generator for it. ;-) I'm not at my emu-workplace, so I can't check into the creation right now, but checking for a seed might work. Quote:
Found something that looks more friendly on german wiki, gotta try that - because my "jonny-2-code"-try didn't work. Greetings, TCC |
|||
|
|
|
|
|
#1056 |
|
free agent
![]() ![]()
Administrator
Join Date: Jun 2008
Posts: 3,045
|
@ TCC
For the Shiny PIDs for chains, I have finally found the generation method, so scratch it off the list ;) Unfortunately I can't see a way to get a PID for it so my dream of getting SID from a chained shiny is dead now. You idea about the ID/Sid is interesting if an initial seed could be found for for your starter pokemon immediately after a new game and then using all the RNG calls between the initial seed and the starter to try and find the ones that were correct in the sequence. It would require people to start a new game for Shiny hatching, but for those with no other means for SID it would be worth it. ALSO TCC - This code a) sucks b) will only get the first 624 values. Additionally it puts a lot of things in arrays that don't need to be in arrays, etc. It's just bad. :) And once I was satisfied that it worked I almost immediately switched to using a properly implemented version of MT instead of spending a ton of time fixing the one below. Hopefully this also gets you in the right direction. It's the code that I wrote working with Jonny over the course of a very long morning. Code:
uint initialSeed = 0U;
// Our builder table.
uint[] t = new uint[624];
t[0] = initialSeed;
for (uint cnt = 1; cnt < 624; cnt++)
{
t[cnt] = (0x6c078965 * (t[cnt - 1] ^ (t[cnt - 1] >> 30))) + cnt;
}
// Start building out the S table, which we are going
// to number with how many results we have. Currently
// we will build multiples of these based on how many
// results we want to return.
uint[] a = new uint[624];
uint[] b = new uint[624];
uint[] c = new uint[624];
for (uint n = 0; n < 624; n++)
{
a[n] = n;
if (n <= 226)
{
b[n] = n + 1;
c[n] = n + 397;
}
else
{
if (n <= 622)
{
b[n] = n + 1;
c[n] = n - 227;
}
else
{
b[n] = 0;
c[n] = 396;
}
}
}
uint[] d = new uint[624];
for (uint n = 0; n < 624; n++)
{
uint k0 = (t[a[n]] & 0x80000000) + (t[b[n]] & 0x7fffffff);
uint k1 = (k0 / 2) ^ t[c[n]];
if (k0 % 2 == 0)
{
// Even
d[n] = k1;
}
else
{
// Odd
d[n] = k1 ^ 0x9908b0df;
}
}
for (uint n = 0; n < 10; n++)
{
uint p = d[n];
p = p ^ (p >> 11);
p = p ^ ((p << 7) & 0x9D2C5680U);
p = p ^ ((p << 15) & 0xefc60000U);
p = p ^ (p >> 18);
Console.WriteLine(p.ToString("x"));
}
__________________
Last edited by mingot; Apr 9th, 2009 at 11:34:47 AM. |
|
|
|
|
|
#1057 | |
|
Join Date: Apr 2008
Posts: 1,019
here...where I'm allowed everyThing AlL of the tIme
|
the Jonny2Code has at least 2 mistakes: an | must be replaced with a + and a & with a xor somewhere but I don't remember where...time has passed :D.
__________________
New Pearl Fc: 5456 1642 7916 Platinum Fc: 4597 2036 6232 My tradeable Pokemon http://www.doomdesire.it Quote:
|
|
|
|
|
|
|
#1058 |
|
Join Date: Oct 2007
Posts: 1,852
|
Does the seed you choose have to be the seed closest to the monster seed or can I choose say the 6th (that's say 32456) seed in a list of ten?
__________________
Pearl FC: 4597 6513 9733 Plat FC: 4382 8076 1820 White FC: 4856 6313 5655 |
|
|
|
|
|
#1059 |
|
free agent
![]() ![]()
Administrator
Join Date: Jun 2008
Posts: 3,045
|
Why do you ask? I mean the directions say what a good seed should look like. And if you pick the wrong one (which the 6th, with 32546 will obviously be) you can't get a shiny ...
__________________
|
|
|
|
|
|
#1060 |
|
Join Date: Jul 2007
Posts: 58
|
Not sure if this affects what you guys are doing (have not gone over everything) but the ARNG (what you guys call IRNG) is not just used for eggs. It is also what is used for mystery gift pokemon, shiny prevention, swarm route, great marsh pokemon, among other things.
|
|
|
|
|
|
#1061 |
|
free agent
![]() ![]()
Administrator
Join Date: Jun 2008
Posts: 3,045
|
So why are you calling it the ARNG? (Alternate?)
If this is what is used for mystery gift Pokemon then you have stumbled on something very interesting. Any documentation on this anywhere?
__________________
|
|
|
|
|
|
#1062 | |
|
Join Date: Apr 2008
Posts: 1,019
here...where I'm allowed everyThing AlL of the tIme
|
How do you know this?
__________________
New Pearl Fc: 5456 1642 7916 Platinum Fc: 4597 2036 6232 My tradeable Pokemon http://www.doomdesire.it Quote:
|
|
|
|
|
|
|
#1063 | ||
|
Join Date: Jul 2007
Posts: 58
|
Quote:
There was in the article that SCV released for about mystery gift pokemon not being able to be shiny. But they moved from pokesav.org and now we cannot access that article. Your best bet is to talk to SCV SCV posted this in tsanth's thread at gamefaqs: Quote:
|
||
|
|
|
|
|
#1064 |
|
free agent
![]() ![]()
Administrator
Join Date: Jun 2008
Posts: 3,045
|
A few people here (Wichu/Pink) asked him to look into the Platinum/4th Gen Egg RNG a while back (as in a week or so ago) and he said he would look into it and not that it was already documented as this ARNG. So I dunno, I guess I will see if I can get in touch with him about it.
The seed for this RNG at 0x201BA10 is obtained from the half-words at 0x4000100 and 0x21D37B4. This seems a little strange, though, as the MT does not have a simple seed that you can store in 32 bits. One thing that is very interesting is his Shiny Prevention article mentions the Shiny check bug for hatches, as they test with the old OT and this is pretty much the same bug making things not look shiny on hatch. Always nice when observations line up. Emerald Egg Question - Refer to Wichu or SCV.
__________________
|
|
|
|
|
|
#1065 |
|
ACUPRESSURE
Join Date: May 2007
Posts: 1,508
Cambridge, England
|
If you mean the PID generation for eggs, SCV worked on it a while ago. You should ask him.
EDIT: Beaten :( |
|
|
|
|
|
#1066 | ||||
|
Join Date: Jul 2007
Posts: 58
|
Quote:
Quote:
Quote:
Quote:
Last edited by hrc969; Apr 9th, 2009 at 12:30:50 PM. |
||||
|
|
|
|
|
#1067 |
|
free agent
![]() ![]()
Administrator
Join Date: Jun 2008
Posts: 3,045
|
Er, but that's just the thing. MT is seeded one time only, it's not perpetually fed a seed (nor does it have a location where it need to 'store' its seed) on each iteration as the LCRNG. It actually has to build a table of 624 words.
It could be the location of the initial seed (same as the one used for the LCRNG) but then in that case it would never need to change.
__________________
|
|
|
|
|
|
#1068 | |
|
Join Date: Jul 2007
Posts: 58
|
Quote:
|
|
|
|
|
|
|
#1069 |
|
Join Date: Jan 2009
Posts: 385
India,Gurgaon,Haryana
|
mingoti had a question:
i downloaded that .NET file to load the RNG application but when i downloaded it it said thats it cant download because there is some clash or somethinig like that.What should i do?
__________________
FC is 3136 9667 4806 i EV train the NON hack way i do not have a AR or Pokesav my GMT is +5:30 please check ou my trade thread Mario Kart FC is 3867 6714 3653 |
|
|
|
|
|
#1070 |
|
free agent
![]() ![]()
Administrator
Join Date: Jun 2008
Posts: 3,045
|
@ ayush
"Or something like that" is about the most useless thing you could possibly tell me when trying to solve an installation problem, sorry. @ hrc969 Ok, I went to the memory location listed @ 0201BA10 and described as "Alternate RNG used in some cases: Examples, PID generation for mystery gift pokemon, recalculating a PID after a failed shiny check, number which determines swarm pokemon and great marsh pokemon" It is definately NOT the IRNG. This routine is used, though, as part of the breeding process for international parents to alter pids to increase the chance of it being shiny. Here is what it looks like in my code: pid = pid * 0x6c078965 + 1; It's basically another implementation of an LCRNG, I believe, with a different multiplier and increment. It really looks like they might be calling the routine from a different entry point (or more likely have two implementations of this) one for just using r0 and applying the multiply and add and another for taking a seed for it. Either way, these are not the droids you are looking for.
__________________
Last edited by mingot; Apr 9th, 2009 at 1:00:30 PM. |
|
|
|
|
|
#1071 |
|
Join Date: Feb 2008
Posts: 1,976
Overwhelmed with Life...
|
Quick Question:
How does one acquire their SID? Would someone mind pm'ing me if they could help me. Thanks!
__________________
My Diamond Friend Code: Nick: 4682 5831 2395 (use unless told otherwise) My Platinum Friend Code: 3137 3449 5613 The Sky Dome Tower: my first thread with shadowbulba! The Realm's End Crypt: my old thread with Transmogrify! The Forgotten Tiers: my new thread with klock! Need Any Help? Check out the Smogon Services!
|
|
|
|
|
|
#1072 | |
|
Join Date: Jul 2007
Posts: 58
|
Quote:
The platinum one is at 0201D30C, I asked SCV if he could figure out the platinum one. The information I linked to/quoted was done when platinum was not out and had been updated for platinum. |
|
|
|
|
|
|
#1073 |
|
ACUPRESSURE
Join Date: May 2007
Posts: 1,508
Cambridge, England
|
Ask in the Simple Requests thread, or if you have an AR, find the code.
|
|
|
|
|
|
#1074 |
|
free agent
![]() ![]()
Administrator
Join Date: Jun 2008
Posts: 3,045
|
@ hrc969 - I just did it in DP using the offset listed for DP for the ARNG. The offset for Platinum is simply the same routine at a new offset, I would think.
I used your Notable Breakpoints page to go look at the assembly for the routine. It was definately x = x * 0x6c078965 + 1; Which is definately NOT the IRNG. So three RNGs. I really can't be assed to go find the breakpoint for the IRNG as I already understand what it does, but someone who wants to see if it is used for anything other than egg PID generation might be interested in doing so. Here is one intersting thought, though -- It's been said that this ARNG (in your linked material) generates the PID for wonder card pokemon. I wonder if that's really the case, now, or is it _only_ using this routine for PID modification to un-shiny them, when in fact, there was some earlier method used to create the initial PID. What makes me think it could be is that the IRNG actually uses this routine when you have parents from different regions in daycare to modify the PID (up to 3 times) to increase the chance of it being shiny. So this really could just be some "shuffle pid" routine, which looks like an RNG on initial inspection, and kinda sorta acts like one, but has a very specific use. EDIT MORE: 0x6c078965 is, oddly enough, one of MT's magic numbers. Course what they are doing with the number (iteratively multiplying it by the output of an MT in the case of egg PID generation) does not give the next number in the MT series. By a longshot. Still makes ya wonder why the picked that magic number.
__________________
Last edited by mingot; Apr 9th, 2009 at 1:53:49 PM. |
|
|
|
|
|
#1075 | |
|
Join Date: Jul 2007
Posts: 58
|
Quote:
|
|
|
|
|
![]() |
| Tags |
| random number generator, rng |
| Thread Tools | |
|
|