1. Welcome to Wi-Fi! Please remember to read the rules and do NOT create a new thread for simple trades or Friend Safari codes.

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

Discussion in 'Wi-Fi' started by Arseus, Oct 11, 2009.

Thread Status:
Not open for further replies.
  1. GoldenBanana

    GoldenBanana

    Joined:
    Apr 10, 2010
    Messages:
    137
    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?
  2. Zari

    Zari

    Joined:
    Jan 22, 2009
    Messages:
    676
    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 :(
  3. GoldenBanana

    GoldenBanana

    Joined:
    Apr 10, 2010
    Messages:
    137
    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.
  4. mattj

    mattj blatant Nintendo fanboy

    Joined:
    Mar 30, 2009
    Messages:
    4,578
    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.
  5. NixHex

    NixHex If I were gay for a day I'd go all the way ... with guys
    is a member of the Site Staffis a Forum Moderatoris a Pokemon Researcheris a Contributor to Smogonis a Battle Server Moderator
    Moderator

    Joined:
    Oct 6, 2009
    Messages:
    2,501
    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 :/
  6. imapedarsag

    imapedarsag

    Joined:
    Aug 22, 2009
    Messages:
    584
    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?
  7. NixHex

    NixHex If I were gay for a day I'd go all the way ... with guys
    is a member of the Site Staffis a Forum Moderatoris a Pokemon Researcheris a Contributor to Smogonis a Battle Server Moderator
    Moderator

    Joined:
    Oct 6, 2009
    Messages:
    2,501
    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




  8. Toothache

    Toothache Let the music play!
    is a Forum Moderator Alumnus

    Joined:
    Dec 27, 2004
    Messages:
    3,730
    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?
  9. NixHex

    NixHex If I were gay for a day I'd go all the way ... with guys
    is a member of the Site Staffis a Forum Moderatoris a Pokemon Researcheris a Contributor to Smogonis a Battle Server Moderator
    Moderator

    Joined:
    Oct 6, 2009
    Messages:
    2,501
    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.
  10. mattj

    mattj blatant Nintendo fanboy

    Joined:
    Mar 30, 2009
    Messages:
    4,578
    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.
  11. Toothache

    Toothache Let the music play!
    is a Forum Moderator Alumnus

    Joined:
    Dec 27, 2004
    Messages:
    3,730
    Ok, I sent Flovv a PM, the other two I can find on IRC. Thanks mattj
  12. NixHex

    NixHex If I were gay for a day I'd go all the way ... with guys
    is a member of the Site Staffis a Forum Moderatoris a Pokemon Researcheris a Contributor to Smogonis a Battle Server Moderator
    Moderator

    Joined:
    Oct 6, 2009
    Messages:
    2,501
    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!
    [​IMG]

    Failure...
    [​IMG]
    [​IMG]

    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:
    Show Hide
    [​IMG]
  13. Misdreavus

    Misdreavus

    Joined:
    Feb 27, 2009
    Messages:
    1,210
    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?
  14. NixHex

    NixHex If I were gay for a day I'd go all the way ... with guys
    is a member of the Site Staffis a Forum Moderatoris a Pokemon Researcheris a Contributor to Smogonis a Battle Server Moderator
    Moderator

    Joined:
    Oct 6, 2009
    Messages:
    2,501
    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.
  15. Toothache

    Toothache Let the music play!
    is a Forum Moderator Alumnus

    Joined:
    Dec 27, 2004
    Messages:
    3,730
    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.
  16. Arseus

    Arseus
    refuses to accept Contributor

    Joined:
    Oct 13, 2006
    Messages:
    869
    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!
  17. NixHex

    NixHex If I were gay for a day I'd go all the way ... with guys
    is a member of the Site Staffis a Forum Moderatoris a Pokemon Researcheris a Contributor to Smogonis a Battle Server Moderator
    Moderator

    Joined:
    Oct 6, 2009
    Messages:
    2,501
    Give thanks further to Zari for developing the insane idea in the first place!
  18. Zari

    Zari

    Joined:
    Jan 22, 2009
    Messages:
    676
    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:

    MAGIC (open)


    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 ;)
  19. Toothache

    Toothache Let the music play!
    is a Forum Moderator Alumnus

    Joined:
    Dec 27, 2004
    Messages:
    3,730
    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.
  20. Zari

    Zari

    Joined:
    Jan 22, 2009
    Messages:
    676
    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
  21. NixHex

    NixHex If I were gay for a day I'd go all the way ... with guys
    is a member of the Site Staffis a Forum Moderatoris a Pokemon Researcheris a Contributor to Smogonis a Battle Server Moderator
    Moderator

    Joined:
    Oct 6, 2009
    Messages:
    2,501
    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.
  22. Toothache

    Toothache Let the music play!
    is a Forum Moderator Alumnus

    Joined:
    Dec 27, 2004
    Messages:
    3,730
    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.
  23. NixHex

    NixHex If I were gay for a day I'd go all the way ... with guys
    is a member of the Site Staffis a Forum Moderatoris a Pokemon Researcheris a Contributor to Smogonis a Battle Server Moderator
    Moderator

    Joined:
    Oct 6, 2009
    Messages:
    2,501
    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.
    Informative IRC convo! (open)

    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:
    My Seeds! (open)
    Here is the spread Zari found:
    seed: 54cc, f:1838
    Zigzagoon 27 / 28 / 30 / 30 / 27 / 31 naive

    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___________
    9-18-10 - Meh. (open)
    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.


    9/15/10 - Convo with Toothache regarding in-game mechanics (open)

    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.

    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.

    9/13/10 - failed tests (open)

    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.

    9/8/10 - How to modify your tempo (open)

    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
  24. NixHex

    NixHex If I were gay for a day I'd go all the way ... with guys
    is a member of the Site Staffis a Forum Moderatoris a Pokemon Researcheris a Contributor to Smogonis a Battle Server Moderator
    Moderator

    Joined:
    Oct 6, 2009
    Messages:
    2,501
    #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.
  25. GoldenBanana

    GoldenBanana

    Joined:
    Apr 10, 2010
    Messages:
    137
    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:​
    Data (open)

    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:​




    New Method (open)
    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:​
    Old Method (open)

    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
    Objective (open)

    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.
Thread Status:
Not open for further replies.

Users Viewing Thread (Users: 0, Guests: 0)