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

Status
Not open for further replies.
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.
Wait, but when I try multiplying 37 by [60s / (185BPM * .00390625)], I get 1 (for obvious reasons). But when I multiply 16 by [60s / (225BPM * .00390625)], I get the same repeating decimal that I get when I don't multiply it by 16. Additionally, I tried this method for 225BPM and I got stuck at (4/15) * n, and for 210BPM, I got 7 beats, instead of 16 and 15 like you did. Did I do something wrong?
 

Zari

What impossible odds?
is a Contributor Alumnus
Wait, but when I try multiplying 37 by [60s / (185BPM * .00390625)], I get 1 (for obvious reasons). But when I multiply 16 by [60s / (225BPM * .00390625)], I get the same repeating decimal that I get when I don't multiply it by 16. Additionally, I tried this method for 225BPM and I got stuck at (4/15) * n, and for 210BPM, I got 7 beats, instead of 16 and 15 like you did. Did I do something wrong?
keep the 256 on the top; maybe a better way to put it is 15360*n / T

divide 15360 by T until you get a remainder, then place that remainder over T. This number is how far through the cycle the game is after 1 beat from the starting point (which is 0x0000 upon the VERY first beat).

now what we have to do is make that number equal to one, two, or any other whole number. I guess I wasn't specific enough in my previous post; all we need is for 15360 mod T /T * n to be a whole number, and therefore a set of complete cycles. n doesn't have to make 4 / 15 = to 1; It can make it equal to four, by making n=15, thereby:

4 / 15 * n, 4 * 15 / 15 = 4 = 4 complete cycles, thus beginning the decimal cycle over again.


Sorry about that ;>_> I've been away from this stuff off and on and I forget where everyone is at in their level of understanding :(
 
Oh! Okay I think I've got it now. So I was wrong before. The beats where the seed repeats for 225 BPM are 1, 16, 31, etc. So it's like polar graphs then, right? Where one cycle is 2pi, so 5pi/2 is equal to pi/2. Similarly, one cycle for 225 BPM would be 15, so 16 beats yields the same seed as 1 beat. So basically, once I find n, I add that number to 1, and each additional term in the arithmetic sequence, getting 1, n+1, 2n+1, and so forth.
 

mattj

blatant Nintendo fanboy
For all you crazy amazing programmers working on this out there too. Something that I've looked and looked and looked for, but haven't been able to find is a multi-stage timer with more than 1 beeping countdown. Kind of like Emloop, Kind of like Pikatimer, but with a full beeping countdown for the "pre-timer" too. I personally have a terribly hard time synching with the pre-timer for this FR/LG stuff with no good beeping countdown.
 

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
Yeah, I've been procrastinating on actually trying to hit spreads for that exact issue. I bet it would be terribly easy to modify the pre-timer in Pikatimer to beep for all counts. If I have time, I'll ask for the source code and edit it myself. For now, though, I'm juggling between endless breeding and working on this project, so it'll have to wait. There really isn't much out there as far as multi-stage timers go :/
 
Sorry for interrupting and changing the subject, but in this post, I'll put the stuff I find about ID and SID creation in FrLg.

-Seed 1 is created after pressing A on the Venusaur/Charizard Screen
-Seed 2 is created when you press OK after you have typed your name.
-By saying No, and therefore retyping your name, you can redo the seed.
-Seed 2 is your TID(converted to decimal)
-Seed 2 appears to overwrite Seed 1(or that's my explanation for it)


If you guys already knew this, tell me now so I don't make a fool of myself. Also, a quick double check, if I'm on VBA, I can check the seed using Memory Viewer. If I recall correctly, it's location is 02020000 right?
 

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 for one didn't know that imapedarsag, so thank you for bringing that to our attention. As far as the memory location, I really do not know. User flovv was the one who found out that the seed is generated from the internal clock, since he was the one who ran the debugger.

Also, I need to make a huge correction. Apparently, the frame still advances whether you're in a menu or in any battle. Here's how I firgured that out. First, I used the Turbo controller normally, holding A from soft-reset until the Mewtwo encounter. I caught Mewtwo and checked its seed:
0x9A9A Frame 571

Next, I soft-reset as usual, but before encountering Mewtwo, I opened up the main menu for a few seconds, then closed it and caught Mewtwo:
0x9A91 Frame 973

Finally, I soft-reset as usual, but before encountering Mewtwo, I ran around and very quickly encountered a Ditto. I let the game run a bit, then killed it. I then encountered Metwo, and found:
0x9AA0 Frame 3131

This huge variation in delay can only be a result of time spent in the menu. Therefore, we must go back to my old method of seed verification. I'll repeat it here so you don't have to go back a few pages. Hopefully Arseus will edit the OP to include the original method. Here it goes.

Requirements:

  • A Pokemon who knows Sweet Scent
  • (2) Master Balls
  • 2 empty team slots
  • 10 or so Rare Candies
  • Metalkid's IV Calculator (www.metalkid.info)
This will only work if you are shooting for a very large frame, because you need to allow yourself a great deal of time to check IV's and to verify what seed you are on.

Calibration:

  1. Start the game normally. Start a stopwatch the moment the game seeds.
  2. At the first chance you get, use Sweet Scent, catch whatever insanely high-leveled Cerulean Cave Pokemon appears.
  3. Check its IVs and verify seed.
  4. Stop the stop watch
For the lack of creativity, I'll call this time TCheck. You only really need to do this a few times if you're shooting for high enough of a frame.
Now, make sure that your target frame satisfies:
Code:
Eq. 1 TF >> TCheck (in seconds) * 60

Now, let's say, completely hypothetically, I start the stop watch as the game seeds, use Sweet Scent, catch, say, a Wobbuffet, and check its IVs. As soon as I find my seed from FRLGSeedFinder, I hit STOP. Let's say this time is 5:45. Converting to seconds, I get 5*60 + 45 = 345 seconds. Now, I go back to Equation 1.

TF >> 345 * 60, or TF >> 20700

In other words, this method can only be used for HIGH frames. In fact, it wouldn't even be worth it to use this method for lower frames, as you would probably overshoot your target frame just by doing the calibration.

Now that we're done with that, we can get to the cool part. Let's say you can consistently hit the seed 9AA0. So, you decide to search the frames on this seed and you find this admittedly lame spread:


Frame 44586 Brave 30/30/14/30/25/30

Is this frame high enough to warrant using this method? Plugging 44586 into equation 1 yields 44586 >> 20700, which is obviously true. Now we're set.

  1. Now, create an emloop/pikatimer for a frame of 44586, and Soft-reset.
  2. The moment the game seeds, start the timer
  3. Quickly Sweet Scent, catch, and check seed of the wild pokemon.
  4. If your seed is, in fact, 9AA0, let the timer run its course, then encounter Mewtwo
  5. If the seed is incorrect, you can restart now and save yourself the trouble of waiting another 7 minutes just to get a bad seed




 

Toothache

Let the music play!
is a Community Leader Alumnus
I have a few questions that you might be able to answer. Is it possible to determine what frames wild encounters occur, assuming you are not using Sweet Scent - and therefore is it possible to determine when you can avoid wild encounters and when you can trigger them (assuming I'm working on emulator)? Is the RAM address that determines when a wild encounter happens known?
 

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
You mean, just by walking from one tile to the next? I have no clue how it happens in FR/LG, but I have a feeling that in the 4th gen games, since the frames advance as you walk through grass, it may have to do with encounter slots. As far as the lower level stuff like assembly, debugging, and ram addresses, I really have no clue (though I should, but it wasn't my focus as an Electrical Engineering student lol). I've tried working in Dsmume in debugger mode, and there's just too many damn values to keep up with.
 

mattj

blatant Nintendo fanboy
Yeah, Flovv's the guy to contact about that, or maybe Negator or Syberia too. The rest of us just go straight off the cart.
 

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
Update (8-3-2010):
The program is fully operational but I'm getting some memory management errors sometimes. I was not receiving these errors when it could only search for IVs, so this probably lies in String conversion (converting Objective-C's NSString * class to regular old C's char * type). I'm creating a few variables that are probably unnecessary and aren't getting cleaned up (insert more technical jargon that I don't fully understand here).

The program takes a very long time to cycle through the seeds, which is understandable, and I'll explain why. First, it chooses a seed, then advances the RNG until it reaches fmin. Next, it searches every seed after fmin to fmax. Taking all 65536 seeds into account:

Total pre-advancements = fmin*65536
Total searches = (fmax - fmin)*65536

Finally, here are some screenshots of some successful and failed search attempts.

Success!


Failure...



Every day I work on this I get closer and closer. Once I get these annoying memory management problems fixed, we can finally have a close-to-usable program. The next goal is to get the Zari's metronome stuff ironed out and hopefully have it in code format to integrate into this program.

Outdated Screenshots:
 
Looks good! I'm guessing the String you're having trouble converting is for the nature? Again, I'm not familiar with Objective-C, nor am I familiar with programming anything on this large of a scale in any language, but are you sure that you need to convert from String to char*?

Just out of curiosity, what kind of linked data structure (linked list, stack, queue, AVL tree, binary search tree, etc.) are you using for the spreads?
 

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
1. The return type for the nature from the pkmnGen class is NSString * but the input from the console is of type char *. I can only compare two C strings to see if there's a match.

2. I don't know any search algorithms like that, but I do brute force. It's a loop that goes from 0 to 65536, with a nested loop that cycles through the frames specified by the user and checks for a match. If there's a match, it simply outputs the spread info to the console, then the pkmn on that frame is released from memory completely.
 

Toothache

Let the music play!
is a Community Leader Alumnus
If you guys already knew this, tell me now so I don't make a fool of myself. Also, a quick double check, if I'm on VBA, I can check the seed using Memory Viewer. If I recall correctly, it's location is 02020000 right?
A list of useful RAM addresses to watch would be very handy indeed.

Also I started doing some research into the combat system, more specifically I wanted to find out if critical hits were easy to manipulate. I entered the first rival battle, and couldn't get a crit to occur within the first 40 or so frames. I found this a little odd, since 1/16 should on average give a crit 4 times a second (a bit less, but for safety's sake 3-4 is about right).

Has anyone looked into when move hit/crits are determined in each round? I might be trying things a little wrong, since I was working from after when the Fight option is selected, it might be what frame you choose Fight that determines when a crit etc occurs.
 
Toothache, I am afraid that nobody has done any research into battle mechanics, as far as I am aware; at the very least, nobody has posted anything about them in this thread. Are you sure that critical hits are determined after selecting "Fight" rather than a specific move? If the RNG is constantly running, I would imagine it would just make a call after a specific move is chosen. This would mean that there would be no need to discard a "critical hit check" if say, Protect is chosen; I'm not a programmer however, so I really have no idea how this works! As I'm sure you've noticed, this thread is more concerned with capturing Pokémon, so I apologize in advance if you can't find the answer you're looking for here.

On another note, NixHex has released his BeatFinder program, which has been attached to the main post. However, please know that at the moment, it will only work on Mac OS X computers. I have tested the program myself, so I can attest to the fact that it works, and I have also dedicated a section of the original post for this new development. Thanks to NixHex for developing BeatFinder; I'm sure many users will appreciate your efforts!
 

Zari

What impossible odds?
is a Contributor Alumnus
Yo, it's been far too long since I last posted here, but I've got a new goody that everyone can play around with: n!

Here's the magic formula:

n = (256t * T) / 15360 + 1

where t is the time desired, T is a tempo (IE a varying value variable), and n is the number of beats.

I finally managed to remove the annoying fractional function!!!

Here's how:

Ok, we start with the fractional function for a seed (I will be expressing it with the floor() function included):

(15360 * (n-1) / T - floor(15360 * (n-1) / T))*65536 = s

Now divide each side by 65536, like so:

15360 * (n-1) / T - floor(15360 * (n-1) / T) = s / 65536

What follows is fun part #1; recall from some of my earlier posts that I discovered the following formula:

(n - 1) / T = t / 60

We already know what n and T are, but "t"????

"t" is the time that it you have to wait until you press a to hit your seed; essentially is is a time length not unlike 4th gen delays. So what does this mean?

It means we can rewrite the the edited seed formula above, incorporating t instead of n and T:

256 * t - floor(256 * t) = s / 65536

Here's fun part #2!!! We're gonna do some good old substitution; let's substitute "floor(256 * t)" for the variable "z" :

256 * t - z = s / 65536

Now, add z to both sides (essentially shifting the side it is on)

256 * t = s / 65536 + z


The next few steps are fun part #3--we're gonna re-substitute n-1 / T for t, remembering to take in account the fact that it is t / 60 that equals n-1 / T, not just t:

15360 * (n-1) / T = s / 65536 + z

Now let us get rid of that annoying fraction by multiplying each side by T:

15360 * (n-1) = (s / 65536 + z) * T

While fractions are annoying, the next step is to get n all by itself, as follows:

15360 * n - 15360 = (s / 65536 + z) * T

15360 * n = (s / 65536 + z) * T + 15360

n = ((s / 65536 + z) * T + 15360) / 15360

Well from here we know that 15360 divided by itself is 1:

n = ((s / 65536 + z) * T) / 15360 + 1

Now, recall that z is the floor() function from earlier? Well, it's still clogging up the equation, so let's get rid of it, shall we?

Remember one of the very first equations I listed in this post?

256 * t - z = s / 65536

Guess what--we can substitute once more, this time for s / 65536:

n = ((256 * t - z + z) * T) / 15360 + 1

You've probably figured out what comes next:

z, aka the floor() function cancels out, so we're left with:

n = (256t * T) / 15360 + 1

Say goodbye to the fractional function~

It's MAGIC :D


I know I haven't been the greatest contributor here in the last few months, but I wanted to let everyone know that I still care about this :)

note: the new formula also reduces the amount of searching we have to do through tempos/beats; I bet you can all guess why too :)

EDIT: for those, who noticed the new formula doesn't incorporate the seed, tMIN (smallest t value possible) is equivalent to s / 65536, so that is how it is incorporated in the formula ;)
 

Toothache

Let the music play!
is a Community Leader Alumnus
Ok, bit of an update, I found that it was only the very first attack (where Oak is all "Inflicting damage is the key to battle") that is rigged not to crit. Every other attack so far has been possible to crit just by hitting the correct frame. I would therefore assume critical hits are only set when you hit the A button on your move, and as such can be easily manipulated using frame advance.

Wild encounters seem to be another issue though. It seems that you have a fixed number of steps before a wild encounter occurs. Through careful input manipulation I was able to delay this by 1 step in the grass, but I'm not completely sure how I managed it and wasn't able to replicate it so far. In short, I doubt wild encounters are manipulable at all, instead have fixed occurance. What determines the number of steps before the next encounter? That is something I want to work on next. It might be something to do with when the previous battle finishes, it sets the number of steps before the next encounter is set to occur. It will require some further testing, but I do have a couple of RAM addresses that appear to be related to this, so I have something I can watch and analyse.
 

Zari

What impossible odds?
is a Contributor Alumnus
Some more formulae to make everyone's life easier:

Seed to Time [spent at menu]:

s = 0x1000000 * t & 0xFFFF

Seed to Beat/Tempos:

s = (0x3C000000L * (n - 1)) / T & 0xFFFF

Basically, I figured out that in this case the fractional function can also be expressed using the bitwise operator "&", limiting it to 0xFFFF, or the largest seed # possible.

This version is a lot cleaner than the ugly fractional one ^^ (and should be much easier to put into code too!)

Additionally, I found what I did in my last post was nothing more than proving what we already knew, that:

n = t * T / 60 + 1

which in itself is still useful, but :x

the new seed formula should cut down the amount of code required by a LOT :D
 

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
Some more formulae to make everyone's life easier:

Seed to Time [spent at menu]:

s = 0x1000000 * t & 0xFFFF

Seed to Beat/Tempos:

s = (0x3C000000L * (n - 1)) / T & 0xFFFF

Basically, I figured out that in this case the fractional function can also be expressed using the bitwise operator "&", limiting it to 0xFFFF, or the largest seed # possible.

This version is a lot cleaner than the ugly fractional one ^^ (and should be much easier to put into code too!)

Additionally, I found what I did in my last post was nothing more than proving what we already knew, that:

n = t * T / 60 + 1

which in itself is still useful, but :x

the new seed formula should cut down the amount of code required by a LOT :D
These are perhaps the best versions of the formulas. I'm going to replace the one in my signature with that since it's more technically correct as far as computation goes. Thanks to the nature of binary/hex math, there is no rounding or floor function needed because the data type is integer.
Have you done any more metronome/beat testing? If I get over laddering tonight I'm going to take a few shots at hitting that seed Arseus chose to use in the screenshots, 0xC28F, since it yielded an integer tempo (125.0 BPM) and a low beat counts (3, 28, 53, ..., 3 + 25m). If I can hit that seed, it will seriously be groundbreaking. In fact, I think that when we start hitting desired seeds, Arseus should write up the formal guide so we can eventually get this on site. It would be cool to have an article about Gen III on site before Gen V comes around. Let's pray this works.

Something else I'm going to do is write up the BeatFinder in Java. It is such an easy program to write, especially with those formulas, that there really is nothing exclusive to the Mac OS 10.5* Foundation framework that I can't do in Java, thus making it multiplatform.

* Oh yeah, I tried downloading my program at work where I'm running 10.4, and it didn't load. I hope the program isn't only compatible with Leopard. It obviously worked for Arseus as you can see in the screenshots, and he is running Leopard.
 

Toothache

Let the music play!
is a Community Leader Alumnus
By using the RAM Search feature, I was able to find addresses that appear to be related to the x and y positions of Red. These are, respectively, 0202065C and 0202162C. I notice they advance every frame rather than every step, which probably gives a good indicator of how wild encounter locations are worked out.

I am also very curious about the behaviour of address 02021658. As far as I can tell, every two steps through grass, it advances between values of 0 and 8, and increases by 1 each frame, resetting to 0 after it gets to 8, for exactly 50 changes. I also notice when a wild encounter is trigger it reaches a value of 9. So I guess this has something to do with wild encounters, but I'm not exactly sure what.

Anyone with more familiarity with this sort of thing? I'm only just getting to grips with this, so anyone with more knowledge and experience might be able to shed more light on wild encounter behaviour

All of these values are 2-bytes, signed.
 

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
From now on, I will be using this post as an info dump, updating it whenever something new comes up, be it data or other information.

9/20-21/10
Well, I was glad to see Zari on #frlg today. We discussed his fast tapping method that has yielded very consistent results, without a Gamecube controller! I eliminated any irrelevant text. Fast tap method is hilighted in red, important final notes in bold. At least read the red text.
Toothache hey Zigzagoon, NickHexum
14:31 Zigzagoon wow
14:31 Zigzagoon I just hit a seed
14:32 NickHexum shit. desired?
14:32 Zigzagoon with 27 / 30 / 30 / 29 / 28 / 31
14:32 Zigzagoon jolly
14:32 Zigzagoon no
14:32 Zigzagoon just testing
14:32 NickHexum just keep that haha
14:32 Zigzagoon seeing where I hit so I can search the area
14:32 Zigzagoon no
14:32 NickHexum are you playing on a ___?
14:32 Zigzagoon I didn't get that
14:32 Zigzagoon no
14:32 NickHexum aw
14:32 Zigzagoon but the seed had it
14:32 Zigzagoon frame 4037
14:32 NickHexum nice
14:33 Toothache how close are we to cracking a consistent RNGing method for FRLG anyway?
14:33 Zigzagoon well
14:33 Zigzagoon I have a method that's consistant
14:33 Zigzagoon but
14:34 Zigzagoon it's kinda hit or miss where you land
14:34 Zigzagoon like
14:34 Zigzagoon you'll hit the same area consistently
14:34 Zigzagoon but I don't know where that area group of seeds always is
14:34 NickHexum so you're not hitting desired, only a certain range?
14:34 NickHexum not a range that you're necessarily going for
14:34 Zigzagoon well
14:34 Zigzagoon not yet at least
14:35 Zigzagoon theoretically it's possible
14:35 Zigzagoon all you have to do is wait longer for the charizard/venusaur flash
14:35 Zigzagoon then press A
14:35 Zigzagoon I'm just doing it skipping the entire thing
14:35 Zigzagoon since that's getting me consistent results
14:35 Zigzagoon for the moment
14:36 NickHexum hold that thought
14:38 Zigzagoon oh snap
14:38 Zigzagoon just got an idea
14:38 Zigzagoon hold on brb
14:38 Zigzagoon lemme test it first
14:58 Zigzagoon ergh
14:58 Zigzagoon just not consistent enough
15:01 NickHexum what was it, anyway?
15:02 Zigzagoon hitting a when the "press start" blinks on and off
15:02 Zigzagoon but anyways I have my target
15:03 Zigzagoon I'm gonna revert back to the consistent method
15:03 Zigzagoon I just landed like
15:03 Zigzagoon <12 seeds off my target
15:03 Zigzagoon I hit 308b
15:03 Zigzagoon I want 3081
15:04 Zigzagoon I gotta be EXTREMELY fast with button mashing tho
15:06 NickHexum what spread do you get from that seed?
15:07 Zigzagoon 30 / 30 / 26 / 30 / 30 / 31 hp flying 70 hasty
15:07 NickHexum cool
15:07 Zigzagoon at just over 6 minutes into the game that's not a bad deal
15:08 NickHexum it'll still probably take hours worth of hunting :(
15:08 NickHexum ok so i need a refresher
15:08 Zigzagoon hours worth of hunting for what
15:08 NickHexum well, getting your seed, then hitting your frame dead on
15:09 Zigzagoon welll
15:09 Zigzagoon I'm getting seeds <12 off consistently
15:09 Zigzagoon b/c of this method
15:11 Zigzagoon wowzer
15:12 Zigzagoon I found a decent zapdos spread
15:12 Zigzagoon on a seed I just hit
15:12 NickHexum hm
15:12 Zigzagoon it seems to rotate kinda heh
15:12 Zigzagoon 28 / 14 / 29 / 30 / 31 / 31 hp grass 66 lol
15:12 Zigzagoon modest
15:13 NickHexum haha
15:13 NickHexum too bad mewtwo is the only thing worth going for now
15:13 NickHexum besides mew or deoxys
15:14 Zigzagoon heh I may go for that jolly spread from earlier
15:14 Zigzagoon since I know I can hit the seed
15:14 Zigzagoon lemme search through this range tho for anything better
15:14 NickHexum okay so i need a little refresher, just to be sure i have everything right
15:15 NickHexum the "seed clock" (256 Hz) starts when you press A during or after the GameFreak star animation?
15:15 Zigzagoon during
15:15 Zigzagoon also oh snap
15:15 NickHexum then it stops when?
15:15 Zigzagoon the venu/char cry
15:16 Zigzagoon or 4 after that
15:18 NickHexum so at what times are you pressing A?
15:18 Zigzagoon for what
15:18 NickHexum to start and stop the seed clock?
15:18 Zigzagoon uh
15:19 Zigzagoon exactly as the intro starts and then twice consecutively as fast as I can after that
15:19 Zigzagoon basically what I'm doing is trying to reduce the margin time of error to as little as I can
15:20 Zigzagoon ok ima go try for the jolly spread
15:26 Zigzagoon fffff
15:26 Zigzagoon seed 3082
15:26 Zigzagoon 1 above the hasty spread
15:26 Zigzagoon hmmm
15:26 Zigzagoon decisions decisions
15:27 NickHexum you got that frame?
15:27 NickHexum 1 above it?
15:27 Zigzagoon no
15:27 Zigzagoon the seed
15:27 Zigzagoon 1 above the seed
15:27 Zigzagoon for the hasty 30 / 30 / 26 / 30 / 30 / 31 spread
15:28 NickHexum :-/
15:29 Zigzagoon that's the closest I've ever gotten to that seed
15:29 Zigzagoon I haven't hit it yet

15:32 NickHexum "exactly as the intro starts" <-- when the GF star starts?
15:33 Zigzagoon no
15:33 Zigzagoon when the screen opens up to blue
15:33 Zigzagoon before the star goes across the screen
15:33 NickHexum okay
15:34 NickHexum how do you press A *exactly* on that moment? luck?
15:34 Zigzagoon careful timing
15:34 Zigzagoon and lots of attemtps
15:34 Zigzagoon I'm not able to do it every reset
15:34 Zigzagoon so I have to do a whole bunch of resets
15:35 Zigzagoon more like press a as close to that point as you can
15:35 Zigzagoon you don't want to see any of the "opening" before the star
15:36 Zigzagoon you also don't want to see any of the charizard/venusaur white flash either
15:43 NickHexum by
15:43 NickHexum by "before the star" do you mean the copyright info?
15:43 Zigzagoon no
15:43 Zigzagoon after that
15:43 Zigzagoon but before the screen opens up from the middle

15:43 Zigzagoon *right at that point
15:48 Zigzagoon oh fuck
15:48 Zigzagoon things just got even more interesting
15:48 Zigzagoon more testing time
15:54 NickHexum ok i'm sort of "practicing" on a ___
15:54 NickHexum best i can do from work
15:55 NickHexum if i had a battery save of my lg game this would be bitchin
15:56 NickHexum so basically, I sr, then tap rapidly and hope not to see the dark blue?
15:57 Zigzagoon no
15:57 Zigzagoon well
15:57 Zigzagoon I find it easier if I wait until just before the dark blue would happen before I start tapping
15:57 Zigzagoon less strain that way
15:57 Zigzagoon if you reset a few times you eventually learn where it is
15:58 NickHexum ah
15:58 Zigzagoon and whoo hit 54d3 again
15:59 NickHexum which are you going for?
16:12 Zigzagoon i dunno
16:13 Zigzagoon I'm currently trying to nail down consistency of hitting seeds
16:13 Zigzagoon there are like 4 groups I hit
16:13 Zigzagoon all from minute differences
16:18 NickHexum brb
16:33 NickHexum so yeah, i've been practicing
16:33 Zigzagoon oh snap
16:34 Zigzagoon 54cc
16:34 NickHexum what i do is start the rom, SR, then I pretty much found the spot to hit A
16:34 NickHexum what are you going for again?
16:34 Zigzagoon 27 / 28 / 30 / 30 / 27 / 31 naive
16:34 NickHexum seed?
16:34 Zigzagoon frame 1838
16:34 Zigzagoon <Zigzagoon> 54cc
16:34 Zigzagoon thats fucking 30 seconds into the game
16:35 Zigzagoon I just hit 54cb
16:35 NickHexum oh got it
16:35 NickHexum so your method is sort of a "reactive proactive" method
16:35 NickHexum narrow it down to a range of seeds, pray that there's a good early spread on any of those seeds
16:37 Zigzagoon not really
16:37 Zigzagoon I find the range of what I can hit
16:37 Zigzagoon and
16:37 Zigzagoon there are like 5 ranges
16:37 Zigzagoon lol
16:37 Zigzagoon but yes
16:37 Zigzagoon and I would do it differently
16:37 Zigzagoon except this method is EXTREMELY precise
16:37 NickHexum do you think the whole beat/tempo thing is out then?
16:38 Zigzagoon no
16:38 Zigzagoon it still has merit
16:38 Zigzagoon b/c with the reactive proactive method I'm dealing with now
16:38 Zigzagoon there's a limited number of seeds you can hit
16:38 NickHexum how fast are you tapping?
16:48 Zigzagoon really fast
16:48 Zigzagoon like
16:49 Zigzagoon 1 musical note between entering the press start screen and the charizard cry
16:51 NickHexum and it's consistent?
16:51 NickHexum well obviously lol
16:52 NickHexum i'm on a mac but not intel so i don't have rngreporter atm, could you see if there's anything interesting on C28F?
16:53 *** Zigzagoon quit (Ping timeout)
16:54 *** Zigzagoon joined #frlg
16:54 *** Zigzagoon quit (Connection reset by peer)
About an hour later, I was finally able to sit down with my LG and do some hunting on my own. The results I got were, like Zari's, very consistent - I even hit some of his exact seeds, which, to my knowledge, has not been accomplished by two separate players, even with a GCN Turbo controller! Here are my results:
Here is the spread Zari found:
seed: 54cc, f:1838
Zigzagoon 27 / 28 / 30 / 30 / 27 / 31 naive
286 f:941*
c286 f:414*
c286 f:1843 (31/9/20/31/29/2)
c28f f:1853 * (c28f, arseus' example seed. coincidence?)
c28f f:1840 *

54cb f:440 **
54cb f:468 **
54cc f:573 ** (zari's target)
54d4 f:1755
54cb f:1853 !!
54d4 f:1845
54c2 f:1835 !!
54c6 f:1835 !!
54cf f:1845 !!
54d5 f:1830

0bef f:492
0c00 f:453
0bf5 f:417
0bfb f:619
0bf8 f:1513
0bfb f:1710
0c05 f:1822
0c07 f:1840
0c07 f:1851
0c00 f:1843
0c01 f:1834
0C00 F:1842

9d0b f:1863
9e14 f:1849
9e0a f:1841
9e13 f:1849
9e15 f:1845
9e14 f:1838 (frame match)
9e14 f:1824
Many of these results coincide with Zari's results, and as he has stated many times, the seeds come in groups. These seeds were not found in this order; this is a rearranged list.


___________Older Updates___________
I doubt anyone will be interested in this during the next 6 or 7 months following the Japanese and English releases of Black and White, and I will be pretty involved myself at the birth of this metagame. As such, with the impending hustle of the new metagame, the overhaul of Middle Cup, the possibility that I will be entering grad school in spring after almost a two year brake after my bachelor's (the application is in), and trying to get a job will infringe upon my time dedicated to this research. I promise that I will get more done with this, though it will be in sporatic, short bursts of time. I encourage anyone that is still interested in this cause to please keep chugging and keep it alive. The IRC channel is up but I don't know how often I will be on it. Toothache and I have been idling in it lately, but we would love to see more of you join and discuss amongst yourself. If you would like to help out but the recent information is a little intimidating, send me VM's (NOT PM's!!) with any questions you might have, and I'll try my best to answer them.


I had a short but informative conversation with Toothache on the IRC Channel #frlg today. Here is part of the log, since I had to switch from my phone to a real computer half way. For some background information: Toothache is figuring out the inner workings of the game for a TAS (tool-assisted speedrun) in order to find the most efficient ways to blow through battles and catch enough Pokémon to receive the national dex. I then showed him flovv's original post containing the mechanics of seed generation via the GBA's timer.

#FRLG said:
Toothache: here's a quick summary of what things I might need for this TAS: character's ID and SID, wild encounter initial seed, combat RNG location, damage RNG, accuracy, critical hits, Quick Claw activation
Toothache: also some way to manipulate ID/SID to generate a good IVed starter from initial power on (clear SRAM)
Toothache: I know this is all asking a lot at this point, but it is a very involved undertaking
NixHex: http://www.smogon.com/forums/showpost.php?p=2540481&postcount=144
NixHex: Hopefully it doesn't take us until generation 6 to get this ironed out
NixHex: you see, the generation of the seed is very obvious, but hitting a desired seed is something different
NixHex: He makes a point that autofire can help you hit consistent seeds, but I think autofire is too inaccurate
Toothache: yeah
Toothache: 256 Hz is pretty crazy, no wonder it is so inconsistent
Toothache: problem is the game only accepts input each frame, so you get 60/256 possibilities each second

NixHex: hm
NixHex: you know what...
NixHex: hold on let me gather my thoughts
NixHex: it still doesn't make sense that my gamecube controller can hit seeds that are like 10 off from eachother
NixHex: that's too small of a deviation to say that autofire is inaccurate
Toothache: I think I know why that might be tbh
Toothache: gamecube controllers can send multiple inputs each frame
Toothache: this was causing a lot of desyncs in dolphin until someone figured it out
The bolded text, in fact, might be very useful. I won't say anything else about it now because I don't want to get my hopes up.

I have only done minimal seed hunting and the results aren't very good, but my sample size isn't big either. These are copied straight from my text editor and are not formatted. Seed is on the left, frame is on the right. I did not include nature or IVs, since they are not the focus of these tests. Note that i did these tests before I devised my tempo modification technique.

Code:
Test 1:
target: c28f
5ee2
0f6f
ab1d (naive, 30/6/31/5/22/31)
a4c4
4ee7
1457
c5cd * (830 seeds off target)
Code:
Test 2:
target seed: C28F @ 125 BPM, 3, 28, 53 ... taps
1e28  f785
61ba* f580
a25b  f578
60db* f566
54bb  f576
a52b  f582
98cd  f584
3a37  f568

*223 seeds apart, but nowhere near c28F
223/(256*65536) ~= 0.000013291835785 = 0.013 milliseconds
More importantly, Zari and I discussed the seed offset after you press A. User flovv stated that the seed you choose is 4 off from when you press A. The implications of this are still to be determined, but 4 seeds is such a tiny offset.

Well folks, I've taken some logs trying to hit 0xC28F, and have not been very successful, save for a few seeds that were within about 500 of each other (but not close to C28F, unfortunately). The fact that I hit seeds that close is giving me hope in the tempo/beat method that has been developing, since I don't think it was merely a coincidence that they were similar. Still, I cannot shake the fact that these seeds were nowhere near C28F, but we'll put that aside for now.

In the mean time, I have figured out a way to multiply a tempo by a constant in order to decrease the margin of error in hitting our seed.

How to Modify Your Tempo

Some worries have been brought up about the blindingly fast clock that determines the seed in FireRed and LeafGreen, notably by mattj, flovv, Zari, and myself. To rectify this, Zari invented the metronome method, which has proven to be quite elegant in its implementation. However, the spacing between each beat is too wide for a person to hit accurately, so I came up with a way to speed up the the tempo to increase reaction time. Taking a look at the seed formula:

s = (0x3C000000L * (n - 1)) / T & 0xFFFF

Let's look just at the term

Code:
X = (n - 1) / T
If you remember Zari's original formula, the term was n/T, which didn't reflect the initial tap. Let's go back to this formula, but substitute m for his original n as to not confuse it with our current n:
Code:
X  = m / T
Now, let's say we want to double the tempo. We must find the number of beats, n' that will keep X the same. We must define a new m, called m', then n' will be determined by m'.

Code:
X = 2m / 2T = m' / 2T
m' = 2m
Our new number of beats, n', will be defined similarly to n, as m' + 1
Code:
n' = m' + 1
   = 2(n - 1) + 1
n' = 2n - 1
This means that if we have a seed 0xC28F, with a Tempo of 125, and n = 28, we can double the tempo and use our new number of beats:
Code:
T' = 2T = 250 BPM
n' = 56 - 1 = 55
To verify, substitute into our original formula:
Code:
 X = (55 - 1)/250 = 54/250 = 27/125
In fact, if we want to multiply our tempo even further, we can define a general variable, a, so that T' = aT, and m' = am

Code:
 n' = am + 1 = a(n - 1) + 1 = an - (a - 1)
Now, I used n = 28 for the above example, but our seed formula for 0xC28F was actually multivalued:
T = 125
n = 3, 28, 53 ...

Let's say we want to use n = 3 in order to minimize our pain, and a small multiplier, 3. Now,
Code:
X = 2 / 125
and
n' = 3n - 2 = 7
substituting this into our equation for X, we get
Code:
X = m' / a*T = m' / 375 = 6 / 375
X = 2 / 125
 

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
#frlg

I wanted to avoid unnecessary postcount++, but I figured a new post would garner more attention and interest. A new IRC channel is availabe: #frlg
This is for the discussion of our research including seed generation and battle mechanics in FireRed and LeafGreen. Please keep the discussion related to these topics; this isn't the place for asking how to hit your target frame in Emerald or any 4th Generation game. Try to refrain from bringing outside topics unless they relate to FR/LG Research.

The previous post will remain my info dump, so look to that for updates.
 
FRLG Roamer(Entei) Creation

Despite the fact that it is competetively pointless to find out when the legendary dogs in FRLG are generated, I am going to continue this research anyway whenever I have time for the sake of completion.
==================================================
12-10-10
I have completed one more trial:​
When giving Celio the sapphire, there are five different instances at which Entei could be generated:
1. "Trainer handed the sapphire to Celio." This starts the conversation.(This line of text comes after I have pressed A) (00:10)
2. "Celio: 'Now it's my turn to work for you! Please give me a little time.'" The last line of text before he starts fixing his machine. (Press A at this line) (00:30)
3. "Celio: 'Okay, this looks good...'" He pauses while fixing the machine. (Press A at this line) (00:40)
4. "Celio: 'I did it! I linked up with Lanette!'" The screen on the machine blinks on. (Press A at this line) (00:50)
5. "Celio: 'Thanks to you, my dream came true...'" The last line of text in the conversation. (Press A at this line) (01:10)​
Trial 1: 1, 2, 5, 2(x2)
Trial 2: 5, 2(x2)
Trial 3: 1, 5
Trial 4: 3, 5, 3(x2)
Trial 5: 2, 2(x2), 5, 4(x2)​


Since it looks like the 5th line has appeared in every trial, I'm going to start trying to hit a desired seed using the information from my trials. So far, it looks like the last input when talking to Celio before Entei is generated is pressing 'A' when he says 'Thanks to you, my dream came true...'.

11-26-10
So I started testing again today, and I have more results to post. But before that, I have made changes to my procedure, which has helped me to easily deduce my initial seed. Instead of catching waiting until after catching Entei to get pokemon to check my seed, I catch a single Tentacool at any level and record the time it appeared immediately after generating Entei. After catching Entei, I level up the Tentacool to a Lv.55 Tentacruel and then check its IVs with Metalkid's IV calculator. This way, rather than looking through several seeds outputted by Seed Finder with high frames, I can pick out the seed with the lowest frame and be certain that it's my initial seed. Also, in response to NixHex's new findings for when the frames start advancing, I wait until the white screen fades out/the continue screen fades in to start the timer. For a more formal change:​




  1. I start the game and press A twice to skip the intro and arrive at the 'press start' screen.​
  2. I press A to go to the 'continue' screen and start a timer as soon as the white screen begins to fade into the continue screen.
  3. I press A at the 'continue' screen, press B to skip the 'Previously on your quest' sequence, and wait 10 seconds after the timer has started to talk to Celio.
  4. At 00:10, I press A to give Celio the sapphire. I skip through the next lines of text and wait at the second line where Entei is possibly generated.
  5. At 00:30, I press A and wait for the third line of text to appear. (In consideration of whether or not the One Island Pokemon Center is a Noisy or Quiet place, I wait past 00:20)
  6. At 00:40, I press A and wait for the machine to start working and the fourth line of text to appear.
  7. At 00:50, I press A and skip through the next lines of text and wait at the last line.
  8. At 01:10, I press A to end the conversation with Celio. (Once again, I wait past 01:00 considering that the area might be Noisy)
  9. This is the new part. Now, I exit the Pokemon Center and surf under One Island and through Treasure Beach until I find a Tentacool at any level and catch it. (So far, switching routes has not given me any trouble with finding my initial seed)
  10. Now that Entei has been generated, I return to Kanto to search for him. I go to Route 6 (the Route above Vermillion City), spray repel, bike back and forth twice through the long stretch of grass underneath the tunnel entrance. If Entei does not appear, I enter and exit the tunnel and repeat the process.
  11. Once I encounter Entei, I catch it in a Master Ball.
  12. Next, I level up my Tentacool to a Lv.55 Tentacruel and use Metalkid's IV calculator to check its IVs. I also check Entei's HP and Attack IVs at this time. (Note: So far, Entei's Attack IV has not been matching up with the Attack IVs on the spreads, so I no longer use it to determine his frame)
  13. I find the seed(s) using the IVs to PID tab in RNG Reporter, and then plug that(those) seed(s) into Seed Finder. Since I encountered Tentacool so early after entering the game, it is easy enough to tell which is my initial seed.
  14. I then enter this initial seed into RNG Reporter, select Method 1(default), enter Entei's HP IV, and his nature, and then click generate and look for the following times: 00:10, 00:20, 00:30, 00:40, 00:50, 01:00, 01:10, 01:20, 01:40, 02:20. The italicized times are to check if the area is Noisy.
  15. When I find a match, I take note of the numerical value of the corresponding line of text.
  16. Once I have repeated this trial several times, and have a list of consistent data, I should be able to find out when the last input must be given to generate Entei.


I'm fairly certain about the data for trials 1 and 4, since I was able to deduce my initial seed. I wasn't for the other two, so that data isn't entirely reliable. I know that it seems like Entei is generated after the very last line of text, but nothing is certain until I actually have my Shiny Entei.

10-27-10
Progress!!! I was finally able to deduce my initial seed! In the past, when I would use NeoSyrex's FRLG Seed Finder application, none of the initial seeds that I found using one pokemon's spread matched the initial seeds found using the other pokemon's spread (I catch two pokemon to check my seed because Entei can only be identified by his HP IV and very rarely his Attack IV). Today, however, I found one matching pair, so I assumed that that must be my initial seed. I don't know if this was random, but hopefully this will be happening a lot more in the future.​

I will start posting my data, which will refer to the background information from the previous post, but for convenience's sake, I'll paste it along with my data. I will list the trial number, and the possible line numbers at which Entei was generated. A number with a "(x2)" after it means that it is possible that the Center is a Noisy area and the frame Entei was generated at was double the time of the indicated line number.​

10-26-10
What makes this research particulary challenging is that in order to find out when Entei is generated when fixing Celio's machine, I need to correctly identify both, the seed that I'm on, and the frame Entei was generated on. This can be ambiguous though, since, most of the time, the only way to identify the frame is by looking at Entei's HP IV, and more than often, I am not certain about the seed. My method is listed below:​
A bit of background:
i. I have saved the game in front of Celio. I have 72 Rare Candies in my PC, which is enough to level up two Level 64 Pokemon to Level 100. I have one Master Ball, 1 Repel, 20 Super Repels, 2 Max Repels, and 6 Escape Ropes in my bag.​

ii. When giving Celio the sapphire, there are five different instances at which Entei could be generated:
1. "Trainer handed the sapphire to Celio." This starts the conversation.(This line of text comes after I have pressed A)
2. "Celio: 'Now it's my turn to work for you! Please give me a little time.'" The last line of text before he starts fixing his machine. (Press A at this line)
3. "Celio: 'Okay, this looks good...'" He pauses while fixing the machine. (Press A at this line)
4. "Celio: 'I did it! I linked up with Lanette!'" The screen on the machine blinks on. (Press A at this line)
5. "Celio: 'Thanks to you, my dream came true...'" The last line of text in the conversation. (Press A at this line)​
  1. I start the game and press A twice to skip the intro and arrive at the 'press start' screen.
  2. I press A to go to the 'continue' screen and start a timer at the same time. (Assuming that the frames start advancing 4 frames after pressing A at the 'start screen')
  3. I press A at the 'continue' screen, press B to skip the 'Previously on your quest' sequence, and wait 10 seconds after step 2 to talk to Celio.
  4. At 00:10, I press A to give Celio the sapphire. I skip through the next lines of text and wait at the second line where Entei is possibly generated.
  5. At 00:30, I press A and wait for the third line of text to appear. (In consideration of whether or not the One Island Pokemon Center is a Noisy or Quiet place, I wait past 00:20)
  6. At 00:40, I press A and wait for the machine to start working and the fourth line of text to appear.
  7. At 00:50, I press A and skip through the next lines of text and wait at the last line.
  8. At 01:10, I press A to end the conversation with Celio. (Once again, I wait past 01:00 considering that the area might be Noisy)
  9. Now that Entei has been generated, I return to Kanto to search for him. I go to Route 6 (the Route above Vermillion City), spray repel, bike back and forth twice through the long stretch of grass underneath the tunnel entrance. If Entei does not appear, I enter and exit the tunnel and repeat the process.
  10. Once I encounter Entei, I catch it in a Master Ball.
  11. Next, I go to the basement floor of Cerulean Cave to catch two high-leveled pokemon. They are usually any of the following: a L.67 Kadabra, a L.67 Ditto, or a L.64 Parasect.
  12. Once I've caught them, I return to Cerulean City with an Escape Rope and Fly to the Pokemon Center. There, I withdraw my two pokemon caught at Cerulean Cave, Entei, and 72 Rare Candies. I level up both pokemon from Cerulean Cave to L.100 first, and then use the remainder on Entei.
  13. Then I use Arty2's IV calculator to determine the IVs of the two L.100 pokemon, and the HP and Attack IVs of Entei. I open RNG Reporter and enter the necessary information into the 'IV to PID' tab. I also make sure that I keep the seeds outputted from one pokemon separate from the seeds outputted from the second. I then check if any of the seeds from one group matches a seed from the second. (So far, none have matched)
  14. Next, I open NeoSyrex's FRLG Seed Finder application and plug in the seeds I received from RNG Reporter to find the initial seeds. Once again, I make sure that I keep the initial seeds outputted from one group of seeds separate from the initial seeds outputted from the second. Sometimes, no initial seeds are outputted. (This gets frustrating since I can't continue any further without my initial seed, meaning that I have wasted my time. Is there a reason why the application sometimes yields no initial seeds?) Other times, there are multiple initial seeds. I also compare the initial seeds to see if any of the initial seeds from one group matches an initial seed from the second. (I have found one match!!!)
  15. To find my initial seed from the list of possible initial seeds, I run every seed through RNG Reporter and look for the IVs and Natures of both L.100 pokemon in each seed. I also make sure that I look through every Method (that is, Methods 1-4) when searching for the IVs/Natures.
  16. Once I have found my initial seed, I enter the seed into RNG Reporter and generate the list of frames. I then search for Entei's Nature, HP IV, and (if and only if it is less than 7) Attack IV around the following times: 00:10, 00:20, 00:30, 00:40, 00:50, 01:00, 01:10, 01:20, 01:40, 02:20. The italicized times are to check if the area is Noisy.
  17. When I find a match, I take note of the numerical value of the corresponding line of text. (See background and steps 4-8)
  18. Once I have repeated this trial several times, and have a list of consistent data, I should be able to find out when the last input must be given to generate Entei.

10-23-10
Well, I see that no one has posted here in a long time. It's been so long, in fact that this topic was pushed back to the second page. Well, it's no wonder, with all the Black and White research, and other commitments people must make.

Nevertheless, I have finally managed to collect enough rare candies to start testing RNG manipulation in FireRed. As some of you may be aware, (and to most people's disbelief) I will be attempting to abuse for the roaming Entei. No, it will not have good IVs because of the well known glitch that roamers in R/S/FR/LG have been afflicted with, but it will be shiny, so that makes up for it.

Unfortunately, the legendary guide does not exactly state when, meaning at what line of text, the roamers are generated after fixing Celio's machine. I'll be researching this first, so hitting desired seeds will have to wait just a bit longer. Once I've reached my conclusion, I'll let you all know when the roamers are generated, that is, if anyone even cares.
 
Status
Not open for further replies.

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

Top