RNG Manipulation in FireRed/LeafGreen: Wild Pokémon Supported in RNG Reporter 9.93

Status
Not open for further replies.

Zari

What impossible odds?
is a Contributor Alumnus
Gah, I never get natural shiny pokemon.
Will they be soon publishing a Noob's Guide to FRLG RNG?
I don't know about the "soon" part, though there will be an article/thing about it eventually(I think >_>). The thing is, if you're new to RNG, starting with FR/LG isn't a wise idea; even for those who know DPPt/HGSS RNG, FR/LG is on a whole new level of difficulty. (think of the length of a second; divide that by 16777216 and you get the length of time FR/LG spends on a single seed).

So yeah, the guide will most likely be written sometime, most likely after the 3rd gen RNG reporter at least has a beta version (which could take a while, depending on what it needs to include), so I wouldn't be expecting it to come "soon", although I should have the program finished before summer's end.
 
hello guys! I already RNG in HGSS. So I was wondering if its all the same RNG'ing with FR/LF? I have a LG as the moment. So I'm trying my chance to catch the other Pokemon that is not available to my SS.
 

Nix_Hex

Uangaana kasuttortunga!
is a Site Content Manager Alumnusis a Forum Moderator Alumnusis a Researcher Alumnusis a Top Contributor Alumnusis a Battle Simulator Moderator Alumnus
hello guys! I already RNG in HGSS. So I was wondering if its all the same RNG'ing with FR/LF? I have a LG as the moment. So I'm trying my chance to catch the other Pokemon that is not available to my SS.
Welcome to Smogon!
The most important and helpful thing you can do at the moment is read the OP, then scan the rest of the pages after that. MattJ's work is really where it starts coming together, and that's the info you should focus on. 11 pages seems like a lot, but its worth a read and its the only way you'll truly become familiar with this. Also, you should learn how to rng in emerald, as that is a simplified version of fr/lg's rng. Most of all, thanks for checking this out. We are nearing the end, but there's still a lot of hands on testing that needs to be done. If you are able to get your hand on this and a gamecube controller with a turbo function, you can start doing mattj's experiments. We are pretty much past that stage of research, so you should check out the math on the previous pages and see if you understand zari's material on tempo/beats to choose seeds.
 

Nix_Hex

Uangaana kasuttortunga!
is a Site Content Manager Alumnusis a Forum Moderator Alumnusis a Researcher Alumnusis a Top Contributor Alumnusis a Battle Simulator Moderator Alumnus
Guys, I have started to lose hope. MattJ brought up a huge concern a few months ago (a few pages back) about the tremendous speed of the clock that determines the seed. Let's say we decide to hit A (select the seed) several T's from 0 (T=n/256). I hit seeds f4e0 and f4e1 a scary amount of times, making my supposed reaction time 1/(25536*256) = virtually 0.
Compare this to my delay range for a 60 frames/sec rate for hgss, which I can usually narrow down to 2 or 4 frames if I use pikatimer. that's 2/60 and 4/60 respectively, or 33.33 ms / 66.66 ms (forget the fact that the 4th gen games pretty much lock onto odd or even values depending on your cartridge, making pinpoint accuracy even less necessary). This all just doesn't mesh. How are we getting such close results on a huge clock, yet it takes most beginners a long time to calibrate for a frame on a 60 fps clock? This is the only reason that I question the tempo/beat theories, because human error is still a huge issue.

Then again, flovv supplied the proof that the seed is copied from an internal clock at or around the time you press A, so that has to be how it is generated. I'm starting to wonder if certain blocks of seeds, such as those shown in mine and MattJ's data, are available based on the amount of clock cycles (T's) you wait, or something. Unfortunately, I've had 0 time to work more on this, and I also wanted to bump this thread to see if anyone was interested in this anymore. The only reasons I see that it is necessary to RNG abuse on FRLG is to obtain the exclusive Selfdestruct Mewtwo, and for sheer completeness. I hope this is motivation enough to keep this cause going.
 

mattj

blatant Nintendo fanboy
Believe it or not, I'm going to start back up on this now that the VGCs are over for me this season. Depending upon a million factors we don't know yet, they probably will allow Uubers next year just because of how much faster 99.9% of the matches went (DARN YOU LEN AND YOUR STALL BLISSEY) so there's a good chance Mewtwo will be allowable next year IMO. Now would be a good time for me to focus on this once again.
 

Nix_Hex

Uangaana kasuttortunga!
is a Site Content Manager Alumnusis a Forum Moderator Alumnusis a Researcher Alumnusis a Top Contributor Alumnusis a Battle Simulator Moderator Alumnus
In the meantime, I'm learning how to program in Objective-C, which is the primary language for iPhone/iPod Touch/iPad and Mac OS X development. I know zari is pretty busy right now with LC and hasn't had much time to work on the seedfinder, but I thought I would at least build a mac compatible program, just to have SOMETHING. The reason we stopped using Java is because it does not handle unsigned 32 bit integers (which is what all seeds and pid's are) without the clumsy and memory intensive use of 64 bit signed integers. So, we lose multiplatform compatibility (at the moment until I become more proficient or until Zari finishes) for performance.

In essence, what the program will be is sort of a subset of PokeRNG that instead limits itself to 2-byte starting seeds, with a gui resembling a very stripped-down RNG Reporter, allowing for search of spreads within a user defined delay range. This will intially only be used to find spreads -- metronome implementation will come much later.
 
In the meantime, I'm learning how to program in Objective-C, which is the primary language for iPhone/iPod Touch/iPad and Mac OS X development. I know zari is pretty busy right now with LC and hasn't had much time to work on the seedfinder, but I thought I would at least build a mac compatible program, just to have SOMETHING. The reason we stopped using Java is because it does not handle unsigned 32 bit integers (which is what all seeds and pid's are) without the clumsy and memory intensive use of 64 bit signed integers. So, we lose multiplatform compatibility (at the moment until I become more proficient or until Zari finishes) for performance.

In essence, what the program will be is sort of a subset of PokeRNG that instead limits itself to 2-byte starting seeds, with a gui resembling a very stripped-down RNG Reporter, allowing for search of spreads within a user defined delay range. This will intially only be used to find spreads -- metronome implementation will come much later.
Cool! I'm glad to hear that this is being worked on again. I can't say I'm familiar with Objective-C, but from what I saw on Wikipedia, Objective-C programs that don't use certain libraries can be compiled on any gcc compiler (on any OS), so if your program doesn't use those libraries and you'd be willing to share your source code with me, I'd be happy to compile it and upload a Windows-compatible version.
 

Nix_Hex

Uangaana kasuttortunga!
is a Site Content Manager Alumnusis a Forum Moderator Alumnusis a Researcher Alumnusis a Top Contributor Alumnusis a Battle Simulator Moderator Alumnus
As long as I stick with command line, I can make do without the Cocoa libraries (which is THE library for GUI development for everything Apple). Last night I was able to finish my pRNG class. I'm not on my main computer but from the top of my head, here's a break down of what I have. Notice how weird this syntax is compared to C++ or Java.
Code:
// pRNG.h
#import <Cocoa/Cocoa.h>
@interface pRNG : NSObject // pRNG inherits from NSObject
{
     unsigned int seed;
}
@property unsigned int seed; //this makes a setter for the variable seed

-(void) advance;
-(void) reverse;

@end
Code:
//pRNG.m
#import "pRNG.h"

@implementation pRNG 
@synthesize seed;
-(void) advance //from the PID/IV creation guide, thanks to X-Act
{
      seed = ( 0X41C64E6D*seed + 0X6073 ) % 0X100000000;
}
-(void) reverse //from page 2 of this thread, thanks to X-Act
{
      seed = ( 0XEEB9EB65*seed + 0XA3561A1 ) % 0X100000000;
}
@end
Code:
//TestRNG.m
#import <Cocoa/Cocoa.h>
#import "pRNG.h"

int main(int argc, char *argv[])
{
      NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
      pRNG * p = [[pRNG alloc] init];
      [p setSeed:0XF4E0]; //one of the seeds I hit frequently
      NSLog(@"Initial Seed: %X", p.seed); //show in hex format in caps
      [p advance]
      NSLog(@"Current Seed: %X", p.seed);
      [p advance] 
      NSLog(@"Current Seed: %X", p.seed);
      [p reverse]
      NSLog(@"Current Seed: %X", p.seed);
      
      [p release];
      [pool drain];
      return 0;
}
Basically, pRNG.m is a class that contains a seed (set by the user) and two "methods," advance and reverse, that change the seed based on the formulas supplied by X-Act.
Here's what the test program TestRNG.m does:

  • Creates an instance, p, of class pRNG
  • Sets the seed of p to F4E0
  • Prints out the initial seed
  • Advances the p, prints out the current seed (x2)
  • Reverses the p, prints out the current seed
I also created a modified TestRNG.m
Code:
...
int n;
NSLog(@"Forward");
for (n=1; n<=20; n++) {
      NSLog(@"Frame %i: Seed: %X",n,p.seed);
      [p advance];
}
NSLog(@"Reverse");
for (n=20; n>=1; n--) {
      NSLog(@"Frame %i: Seed: %X",n,p.seed);
      [p reverse];
}
...
All this does is run through and print the first 20 seeds, then uses the reverse formula to print the same seeds in reverse order. This code works. When I get to my computer I'll take a screen shot of it in action.

What I plan to have next is a class that extends pRNG called PkmnGen that contains PID, genderNumber, nature, ability, TrainerID, and SecretID, and methods that calculate these values. Since I got all this done from scratch last night, I'm hopeful that I'll be able to implement the PkmnGen class rather soon, so we can get started with the real work.

EDIT: I'm keeping this here for the time being.
This is the incomplete PkmnGen class. It does not yet generate IVs, and I haven't tested this yet. As stated in the code, this will only work for Method 1. I'm assuming the demand for methods 2, 3, and 4 (especially 3) is pretty low, so implementing them is of absolute lowest priority, almost to the point that if I were to implement them, it would only be for completeness.
Code:
#import <Cocoa/Cocoa.h>
//PkmnGen.h
//Method 1 Only....
@interface PkmnGen : pRNG {
    unsigned int PID;
    int TrainerID;
    int SecretID;
    int natureNumber;
    int genderNumber;
    int abilityNumber;
    bool shiny;
}
-(void) setTID: (int)T setSID: (int)S;
-(void) generatePkmn: (int) s; //input the new seed to create the PID
-(unsigned int) getPID;
-(int)  getNatureNumber;
-(int)  getGenderNumber;
-(int)  getAbilityNumber;
-(bool) getShiny;
@end
Code:
#import <Cocoa/Cocoa.h>
#import "PkmnGen.h"
//PkmnGen.m

@implementation PkmnGen
-(void) generatePkmn: (int) s
{
    //method 1, so 4 RNG calls: [PID][PID][IVs][IVs]
    //1st call
        [self setSeed: s];
    int HID = seed / 0X10000;
    
        //2nd call
    [self advance];
    int LID = seed / 0X10000;
    
    PID = HID * 0x10000 + LID;
    
    //add 3rd and 4th call (IV generation) later.    
}
-(void) setTID: (int)T setSID: (int) S {
    TrainerID = T;
    SecretID  = S;
}
-(unsigned int) getPID {
    return PID;
}
-(int) getNatureNumber {
    return PID % 25; //decimal 25, returns 0 - 24
}
-(int) getGenderNumber {
    return PID % 0X100; //between 0 and 255
}
-(int) getAbilityNumber {
    return PID % 0X10; //0 or 1
}
-(bool) getShiny {
    int HID = PID / 0x10000;
    int LID = PID % 0x10000;
    int shinyNumber = HID ^ LID ^ TrainerID ^ SecretID;
    if (shinyNumber <= 7) return 1;
    else return 0; 
}
@end
 
Great work! The syntax does look to be much different... as someone who's familiar with C and Java, the only lines of code that I'm familiar with are the math and the "for" loops.
 

Zari

What impossible odds?
is a Contributor Alumnus
I am busy with LC and all, but if need be I can post the code here if others want to work/adjust/test stuff with it. One thing that has distracted me from my work on the tempo beat stuff, is figuring out that if you skip the intro/ charizard or venusaur flash entirely, you get remarkably consistent seeds (I was able to hit the same seed within 11 tries, and obtained many, many duplicates thereafter) The only problem with that is that a. it requires tremendously fast button mashing and b. so far I have only been able to hit certain ranges of seeds.


Right now the code I have is just basic RNG spitting out (aka primitive RNG reporter), because I don't have neosyrex's code for the FR/LG seed finder (can you get that from the download?)

If people want it, I'll edit the code into this post so others can work on it/etc.

EDIT:

Code:
import java.util.*;
import java.io.*;
import java.lang.*;

public class Prng32 {
    private long seed;
    private final long Af = 0X41C64E6D; //going forward
    private final long Cf = 0X6073;
    private final long Ar = 0xEEB9EB65; //reverse
    private final long Cr = 0xA3561A1;
    
    public long getSeed() {
        return seed;
    }
    
    public Prng32 (long s) {
        
        seed = s;
    }
    
    private long getNext(long s) {
        long bitmask = 0xFFFFFFFFL;
        seed = (Af*s + Cf) & bitmask;
        return seed ;
    }
    
    public long next() {
        return getNext(seed);
    }
     
    private long getPrev(long s) {
        long bitmask = 0xFFFFFFFFL;
        seed = (Ar*s + Cr) & bitmask;
        return seed;
    }
    
    public long prev() {
        return getPrev(seed);
    }

    
    public static void main (String [] args) {
        long s0 = 0;
        long sF = 0x10000 - 1;
        //int s = 0x9d08ff08;
        //int s = 0x0000a14a;
        long s = 0x6073;
        long bitmask = 0xFFFFFFFFL;
        Prng32 P = new Prng32(s);
        PidGen Mewtwo = new PidGen(s);
        for (int i=0; i<65536; i++) {
            //long t =  s ^ 0xFFFFFFFFL;
            //System.out.println( " Frame: "+i+" seed: "+Long.toHexString(s & bitmask)+" "+Long.toHexString(t & bitmask)/*+Mewtwo.getNature(s)*/);
            
            
        //    System.out.println(" Frame: "+i+" seed: "+Long.toHexString(s & bitmask));
        //    s = s + 0x41C64E6D;
            
            //s = P.next();
            
            //Mewtwo.next();    
        }
        /*System.out.println( "Frame: 1 Seed: "+Integer.toHexString(s) + " "+ Mewtwo.getNature() );
        s = P.next();
        System.out.println( "next seed: "+s+" "+Integer.toHexString(s) );
        //Mewtwo.setNext(s,1);
        Mewtwo = new PkmnGen(s,1);
        System.out.println( "Frame: 2 Seed: "+Integer.toHexString(s) + " "+ Mewtwo.getNature() );*/
            
    }
    
}
Code:
import java.util.*;
import java.io.*;

public class PidGen extends Prng32 {
    private long seed;
    private final long Af = 0X41C64E6D; //going forward
    private final long Cf = 0X6073;
    private final long Ar = 0xEEB9EB65; //reverse
    private final long Cr = 0xA3561A1;
    String nature;
    Long PID, n;
    long s;
    
    String[] IVs = { "HP", "Atk", "Def", "SpA", "SpD", "Spe"};
    
    private final String[] natureList = 
        {"Hardy","Lonely","Brave","Adamant","Naughty",
         "Bold", "Docile","Relaxed","Impish","Lax",
         "Timid","Hasty", "Serious", "Jolly","Naive",
         "Modest","Mild","Quiet","Bashful","Rash",
         "Calm","Gentle","Sassy","Careful","Quirky"};

    
    public PidGen(long s) {
        super(s);
        seed = s;
    }
    
    public String getNature(long s){
        seed = s;
        calcPid(s, 1);
        n = PID % 25;
        Integer N = new Integer(n.intValue());
        String nature = natureList[N];
        return nature;
    }
    
    
    public long getSeed() {
        return seed;
    }
    
    private long getNext(long s) {
        long bitmask = 0xFFFFFFFFL;
        seed = (Af*s + Cf) & bitmask;
        return seed ;
    }
    
    public long next() {
        return getNext(seed);
    }
     
    private long getPrev(long s) {
        long bitmask = 0xFFFFFFFFL;
        seed = (Ar*s + Cr) & bitmask;
        return seed;
    }
    
    public long prev() {
        return getPrev(seed);
    }
    
    public long setNext(long s) {
        return s;
    }
    
    public void calcPid(long s, int method) {
        switch (method) {
            case 1: method1(s); break;
            case 2: method2(s); break;
            case 3: method3(s); break;
            case 4: method4(s); break;
        }
    }
    
    private void method1(long s) {
        //do method 1 stuff
        long Lid = s / 0x10000; //rng call 1
        s = getNext(s);
        long Hid = s / 0x10000; //rng call2
        PID = Hid*0x10000 + Lid;
        String Pid = Long.toHexString(PID);
        System.out.print(" PID: "+Pid);
        s = getNext(s);
        long IVsHigh = s / 0x10000; //rng call 3 -->  Defense, Attack, HP
        s = getNext(s);
        long IVsLow = s / 0x10000; //rng call 4 --> Speed, Special Attack, Special Defense
        setIVs(IVsHigh,IVsLow);
    }
    
    private void method2(long s) {
        //do method 2 stuff
    }
    
    private void method3(long s) {
        //do method 3 stuff
    }
    
    private void method4(long s) {
        //do method 4 stuff
    }
    
    private void setIVs(long high, long low) {
        Long HP = high % 32;
        high = high/32;
        Long Atk = high % 32;
        high = high/32;
        Long Def = high % 32; 
        Long SpA = low % 32;
        low = low/32;
        Long SpD = low % 32; 
        low = low/32;    
        Long Spe = Math.abs(low % 32);
        IVs[0] = Long.toString(HP);
        IVs[1] = Long.toString(Atk);
        IVs[2] = Long.toString(Def);
        IVs[3] = Long.toString(SpA);
        IVs[4] = Long.toString(SpD);
        IVs[5] = Long.toString(Spe);
        System.out.print(" "+IVs[0]+" / "+IVs[1]+" / "+IVs[2]+" / "+IVs[3]+" / "+IVs[4]+" / "+IVs[5]);
    }
    
    public static void main(String [] args) {
        PidGen P = new PidGen(0xe2cca5ee);
    }
}
 

Nix_Hex

Uangaana kasuttortunga!
is a Site Content Manager Alumnusis a Forum Moderator Alumnusis a Researcher Alumnusis a Top Contributor Alumnusis a Battle Simulator Moderator Alumnus
I would love to see the code you have. How is the R/S stuff going? Also, what exactly do you mean skipping the flash entirely?
 

Nix_Hex

Uangaana kasuttortunga!
is a Site Content Manager Alumnusis a Forum Moderator Alumnusis a Researcher Alumnusis a Top Contributor Alumnusis a Battle Simulator Moderator Alumnus
Is that the same java code we worked on way back? Did you ever decide if you were going to stick with java or go with c instead?
 

Nix_Hex

Uangaana kasuttortunga!
is a Site Content Manager Alumnusis a Forum Moderator Alumnusis a Researcher Alumnusis a Top Contributor Alumnusis a Battle Simulator Moderator Alumnus
Hey guys, last night i worked on this a lot more and finally got the PkmnGen class ready! Here are some screenshots. If you are thinking that this is a poor man's RNG Reporter, you are right, but remember that this is no where near the final goal. As long as I have a program that's able to list spreads, I can be on my way to making it searchable. Also, IVs have not been implemented -- this just shows the PID and all the useful info contained in the PID.

PS. I'm running RNGReporter on Mac =)
 
Okay, so as you see you people caught my interest enough to actually register here. I'm a complete newb to RNG abuse, and I admittedly haven't read the 11 pages completely, but this seems to be interesting.

Right now, I'm playing with what I've read about the initial seed generation a bit. I have no experience with debugging console games at all, but I am interested in assembly, so this could be fun.

If I do find out something, I'll share my results.
 

Nix_Hex

Uangaana kasuttortunga!
is a Site Content Manager Alumnusis a Forum Moderator Alumnusis a Researcher Alumnusis a Top Contributor Alumnusis a Battle Simulator Moderator Alumnus
Okay, so as you see you people caught my interest enough to actually register here. I'm a complete newb to RNG abuse, and I admittedly haven't read the 11 pages completely, but this seems to be interesting.

Right now, I'm playing with what I've read about the initial seed generation a bit. I have no experience with debugging console games at all, but I am interested in assembly, so this could be fun.

If I do find out something, I'll share my results.
your first ever post on smogon is on this thread... you're a champ! We need all the help we can get still, and in the mean time, try to familiarize yourself with emerald rng, since the mechanics are the same minus the always 0 seed. Pages 6 through 9 is where the meat of the info came in, so you also make time to read about all the match and such. Welcome to smogon!
 

mattj

blatant Nintendo fanboy
Yeah shinyness isn't really even on any of our agendas at the moment. Maybe after we get IVs ironed out, but maybe not even then.
 

Nix_Hex

Uangaana kasuttortunga!
is a Site Content Manager Alumnusis a Forum Moderator Alumnusis a Researcher Alumnusis a Top Contributor Alumnusis a Battle Simulator Moderator Alumnus
The reason we are doing this.

Thank you mattj. In light of the never-ending shiny infatuation (and its overall irrelevance in this project), I want to clarify, at least to myself, the overall goal here. Let's face it: due to Platinum and now HG/SS, abuse of FRLG legendaries is all but unnecessary, save for one: Mewtwo. He seems to be the main Pokémon on our minds because, for research's sake, he comes at such a high level that it's easy to verify its IVs. More importantly, only the Generation 3 Mewtwo can learn Selfdestruct (through XD move tutor). Articuno, Zapdos, and Moltres don't learn much of consequence, though the purified ones from XD get some interesting moves (Baton Pass Zapdos, Heal Bell Articuno), but that is a completely different subject. The legendary beasts are all generated with four 0 IV's, and aren't worth discussing. Anything else can be bred in emerald with relative ease with an everstone.

As for shinies, my Seed Finder program can find shiny spreads, but abusing for shinies is really a small subset of RNG abuse. As mattj said, shininess really isn't important at this point.

I fear a lot of things with Generation 5 at our footsteps, but one of my biggest fears is Mewtwo somehow getting Selfdestruct/Explosion, essentially negating all of this work. If this happens, this project will basically become a thing of "completeness." However, I find this unlikely of happening.

In other news, my program is able to list IVs, so the ability to search for spreads and seeds is upon us! For an alpha version, I think I will only implement ">=" and "==" searches, with more advanced searches (Hidden Power) and more obscure searches like "<=" for Trick Room, being left until later. I have been unable to work on this in the past few days due to a tremendously exhausting trip to San Francisco for a 5k/marathon, but hopefully I can get started on this again tonight.
 

mattj

blatant Nintendo fanboy
That program sounds really nice! Can't wait till its up and going!

Yeah, but to be honest bro... I totally DO hope Mewtwo gets SD in Gen 5 :x

Just so I can be done with this @_@
 
Just so you know, NixHex, if your program effectively replaces NeoSyrex's (which it sounds like it will), I will put it as the attachment in the first post when it is released. That way you don't have to worry about what file uploading site to use so that the most users can download it, it doesn't go down for no reason, and so on. If you'll notice, Syrex's original link is down, and there were some problems in the old Emerald thread as well, so these issues can be resolved by tethering it to the first post.
 

Nix_Hex

Uangaana kasuttortunga!
is a Site Content Manager Alumnusis a Forum Moderator Alumnusis a Researcher Alumnusis a Top Contributor Alumnusis a Battle Simulator Moderator Alumnus
I really don't like those mega upload sites, so that would be awesome. However, I do not mean to replace NeoSyrex's program because it's not really the same thing (though my pRNG class has the reverse method thrown in there, so it is easy to rewrite his program, though unnecessary). The only problem, again, is that for now it is Mac only, until I discover how to compile it for Windows. Misdreavus and I are working on that, so we should hopefully have it done soon.
 
So I just finished reading about all the information thus far in this thread, and I have a question about using a metronome to hit a desired seed.

Say I wanted to use a tempo of 225 bpm to hit a certain seed.

At 225 BPM we end up with a decimal of .26666...., which repeats after 16 beats (becoming 4.26666...., but we can discard the 4 because it is a set of complete cycles)

Then there is 210 BPM; a decimal of .2857143 (approx.) which repeats after 15 beats, etc.

Here is the entirety of my findings:

Code:
BPM, decimal,% of cycle complete, repeats after X beats
 
240, 0 , 100%, always repeats
225, .26667, 26.67%, 16
210, .142857, 14.29%, 15
200, .8, 80%, 16
195, .76923, 76.92%, 14
180, .3333, 33.33%, 4
165, .0909..., 9.09%, 12
150, .4 , 40%, 11
...
60, 0, 100%, always repeats
According to this, the seed cycle is 26.67% complete and repeats after 16 beats. How exactly do you figure out the number of beats it takes for a seed to repeat and what exactly does this mean? What I understand is if the the metronome is started when the game begins to seed, the first beat will hit the desired seed, and every 16 beats after will do so as well, so the beats to hit would be 1, 17, 33, 49, and so on. Is this correct?

I found that using a tempo of 185 bpm would help me get close to hitting the seed 01ca, but I don't know the number of beats it will take for this seed to repeat.
 

Nix_Hex

Uangaana kasuttortunga!
is a Site Content Manager Alumnusis a Forum Moderator Alumnusis a Researcher Alumnusis a Top Contributor Alumnusis a Battle Simulator Moderator Alumnus
So I just finished reading about all the information thus far in this thread, and I have a question about using a metronome to hit a desired seed.

Say I wanted to use a tempo of 225 bpm to hit a certain seed.



According to this, the seed cycle is 26.67% complete and repeats after 16 beats. How exactly do you figure out the number of beats it takes for a seed to repeat and what exactly does this mean? What I understand is if the the metronome is started when the game begins to seed, the first beat will hit the desired seed, and every 16 beats after will do so as well, so the beats to hit would be 1, 17, 33, 49, and so on. Is this correct?

I found that using a tempo of 185 bpm would help me get close to hitting the seed 01ca, but I don't know the number of beats it will take for this seed to repeat.
You'll want to PM Zari about that. Admittedly, I can't wrap my head around the tempo/beat method completely, and since he devised it, he might be able to help you. Thanks for reading through the thread!

In other news, I'm getting close to a fully functional, searchable program. Here's a screenshot:
EDIT: I noticed there's a one off error with the frame. I'll have to work it out later but it's really inconsequential for now. For example, the frame for that beautiful Naive spread in RNG Reporter is 779, but my program says 780.


and, the code.... it doesn't want to do my indentations, so it's gonna look messy:
#import <Foundation/Foundation.h>
#import "pRNG.h"
#import "PkmnGen.h"

int main (int argc, const char * argv[]) {
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];

// insert code here...
//
int seed;
NSLog(@"Searching...");
//all seeds in FRLG are 2 bytes
for (seed=0; seed<=0xFFFF; seed++) { //run through all possible seeds
pRNG * p = [[pRNG alloc] init];
int f,fMax;
fMax = 5000;
[p setSeed:seed];
for (f=1; f<=fMax; f++) { //search through an individual seed
PkmnGen * pkmn = [[PkmnGen alloc] init];
[pkmn generatePkmn:[p seed]];

NSString * shiny;
shiny = [pkmn getShiny] ? @"!!!" : @" ";
int thresh [] = { 30,30,30,30,30,30 }; //minimum
bool T [] = { pkmn.HP >= thresh[0], pkmn.Atk >= thresh[1], pkmn.Def >= thresh[2],
pkmn.SpA >= thresh[3], pkmn.SpD >= thresh[4], pkmn.Spe >= thresh[5]
};
bool match = T[0] && T[1] && T[2] && T[3] && T[4] && T[5];
if (match) {
NSLog(@"Seed: %X F%i %X %@ %i/%i/%i/%i/%i/%i %@", seed, f, [pkmn getPID],[pkmn getNature],
pkmn.HP, pkmn.Atk, pkmn.Def, pkmn.SpA, pkmn.SpD, pkmn.Spe, shiny);
}
[p advance];
[pkmn release];
}
[p release];
}
NSLog(@"Finished!");

[pool drain];
return 0;
}
 

Zari

What impossible odds?
is a Contributor Alumnus
So I just finished reading about all the information thus far in this thread, and I have a question about using a metronome to hit a desired seed.

Say I wanted to use a tempo of 225 bpm to hit a certain seed.



According to this, the seed cycle is 26.67% complete and repeats after 16 beats. How exactly do you figure out the number of beats it takes for a seed to repeat and what exactly does this mean? What I understand is if the the metronome is started when the game begins to seed, the first beat will hit the desired seed, and every 16 beats after will do so as well, so the beats to hit would be 1, 17, 33, 49, and so on. Is this correct?

I found that using a tempo of 185 bpm would help me get close to hitting the seed 01ca, but I don't know the number of beats it will take for this seed to repeat.

I'll try to put this as simply as I can.

"Cycles" occur 256 times a second, since that is the speed the game moves at (256 Hz). the formula for determining how far through the cycle the game is at a particular beat/tempo is:

c = 256*60*n / T

Where n is the # of beats that have passed after the first beat, c is the cycles amount, and T is the selected tempo.

Basically, to figure out how many beats it takes to repeat, keep that equation in fraction form and simplify it.

With your 185 BPM tempo, it would work like this:

256 * 3 * 5 *2 * 2 *n / 5 *37

that leaves us with 3072 *n / 37

now what you would do is MOD this equation (MOD = divide until there is a remainder, then take that remainder as the answer) while simultaneously removing the "n" variable; think of it as (3072 MOD 37) *n.

what is left is 1, or more technically (1 / 37) * n, or when simplified, n / 37.

The goal now is to make the equation we just got equal to 1; essentially when the cycle restarts. In this case, 37 beats after the first at 185 BPM, the cycle would restart.

Admittedly, this is very hard to pull off, both because of finding AND starting the metronome at the exact location where the game starts seeding. In theory, however, this should be accurate.


there really isn't any way to talk about this without involving math/numbers sadly :/
 
Status
Not open for further replies.

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

Top