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

Status
Not open for further replies.

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 can always clone in emerald, trade to leafgreen if you've activated the international trade thing, then trade to fiirered. In other news I found the chameleon Gc controller at gamestop and ordered the gameboy player from eBay, so should get it this week and I'll be in business! BTW nice snorlax spread! Best of luck in catching it. PS pu should clone some master balls too, makes it somuch easier.
 

Zari

What impossible odds?
is a Contributor Alumnus
The thing is, I started over so I only have 4 badges >_<. I'm doing ok actually since I abused Pickup+Payday Meowth (for Rare Candies + money) I've caught 19 already (with 65 great balls >_>) but I still need more data before I post my results. (The formula I came up with seems to be correct, but I need to test more to rule out one oddity that popped up.)

Btw, the closest I have come to one of my formula's predictions is 125 seeds away, which, considering there are 65536 of them whizzing by every 3.9 milliseconds, isn't too bad :).
 

Nix_Hex

Uangaana kasuttortunga!
is a Site Content Manager Alumnusis a Forum Moderator Alumnusis a Researcher Alumnusis a Top Contributor Alumnusis a Battle Simulator Moderator Alumnus
The formula: (n) * mod(15360 / T) * 65536 , where n is the # of beats, mod() is take the remainder of the (), and T is tempo in BPM. 65536 is the number of possible starting seeds (0000 through FFFF)

What it does: determines the seed you landed on based on tempo/# of clicks
Tempo, seed(decimal), seed(hex), (seed of spread), nature, ability, IVs, Hidden power, HP power

235, 23704.51064, 5c98/5c99, (5c99), Bold, 1, 30 / 30 / 30 / 28 / 30 / 30, Fighting, 59
Okay, I'm really not understanding what your formula actually means. For example, I'll plug in 235 bpm into your formula:
mod(15360,235) = 85
85 * 65536 = 5,570,560 = ... 0x 550000 what? Neither of those numbers show up on on that line of data, so I must be doing something wrong. Could you clarify your formula a bit? What exactly does that expression give and how is it applicable?
 

Zari

What impossible odds?
is a Contributor Alumnus
Okay, I'm really not understanding what your formula actually means. For example, I'll plug in 235 bpm into your formula:
mod(15360,235) = 85
85 * 65536 = 5,570,560 = ... 0x 550000 what? Neither of those numbers show up on on that line of data, so I must be doing something wrong. Could you clarify your formula a bit? What exactly does that expression give and how is it applicable?
I meant mod to mean take the remainder of the division, IE everything to the right of the decimal point. Everything to the left is a complete cycle and hence irrelevant (because it overflows from FFFF back to 0000 repeatedly). You then take whatever is to the right of the decimal point and multiply it by 65536 (65536, 16^4, the number of possible seeds) that gives you the decimal version of the seed. You would round that answer to the nearest whole number (note this makes it not entirely accurate, part of what I'm testing is to make it more accurate), then convert the decimal seed to the equivalent hexadecimal value. That final answer is the starting seed predicted by the formula.

Unless Mod means something else other than what I thought, that's what is supposed to happen. I'll edit in % to my other post, which in java code means take the remainder of.

If we follow those steps with 235 BPM,

n=1, 15360 % 235 = 65.36170213

.36170213 * 65536 = 23704.51064 which could be either 23704 or 23705, the decimal value of the starting seed, translating to 5c98 or 5c99 in hexadecimal. 5c98/5c99 would be the starting seed. Its an error on my part. Sorry about that.



One other thing I found out is that if you choose any value other than n=1, you need to take the remainder again before multiplying by 65536.
 

mattj

blatant Nintendo fanboy
Did fourteen soft resets yesterday on my twenty six minute target spread. Hit my seed two of those times and was only six frames off. However i was merely using my cell phone stop watch and basically guessing for when to stop for the last few milliseconds. I'm gonna see he i can rig something up with em loop so i can work out those last few milliseconds. Only problem is that my game cube is in our bedroom and our computer is in our living room.
 

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 meant mod to mean take the remainder of the division, IE everything to the right of the decimal point. Everything to the left is a complete cycle and hence irrelevant (because it overflows from FFFF back to 0000 repeatedly). You then take whatever is to the right of the decimal point and multiply it by 65536 (65536, 16^4, the number of possible seeds) that gives you the decimal version of the seed. You would round that answer to the nearest whole number (note this makes it not entirely accurate, part of what I'm testing is to make it more accurate), then convert the decimal seed to the equivalent hexadecimal value. That final answer is the starting seed predicted by the formula.

Unless Mod means something else other than what I thought, that's what is supposed to happen. I'll edit in % to my other post, which in java code means take the remainder of.

If we follow those steps with 235 BPM,

n=1, 15360 % 235 = 65.36170213

.36170213 * 65536 = 23704.51064 which could be either 23704 or 23705, the decimal value of the starting seed, translating to 5c98 or 5c99 in hexadecimal. 5c98/5c99 would be the starting seed. Its an error on my part. Sorry about that.



GOT IT!
okay, yeah, your terminology was a little mixed up, but I'll clarify. Mod just means take the remainder of (like long division in elementary school), which can be found by:

15360 % 235 = mod(15360,235) = 15360 - floor(15360/235)*235 = 15360 - 65*235 = 85

the operation you're speaking of by taking the decimal part is:

15360/235 - floor(15360/235) = 0.36170213

Doing it by hand is a no brainer and doesn't require the second formula, but as far as the programming goes, that's how you get the decimal numbers automatically.

One other thing I found out is that if you choose any value other than n=1, you need to take the remainder again before multiplying by 65536.
So do you mean, take the remainder n times?

EDIT:
One more thing. I think we should come up with another name for that second function, so it will clear up the formula for reading. Maybe:

First: mod(15360, T) = 15360 - floor(15360/T)*T
Second, and more relevant to this discussion... something like modx?
modx(15360, T) = 15360/T - floor(15360/T)
any name would be great, and it would clear up the formula in your sig a whole lot. specifically:

seed(n,T) = { n*modx(15360,T) - floor(n*modx(15360,T)) } * 65536
 

Zari

What impossible odds?
is a Contributor Alumnus
So do you mean, take the remainder n times?
What I mean is you multiply the remainder you got from the % part of the formula by n, then take the remainder of that answer. n in this case is the number of beats that have occurred at the tempo entered (as each beat hits on a different part of the cycle, which could potentially be used to hit different seeds).

The reason we take the remainder twice is that the number before the decimal point is always a set of complete cycles; the only thing relevant to hitting a different seed is the number after the decimal point (which, when multiplied by 100, is the percentage of the way the game is through the cycle [0000 through FFFF])

EDIT: if you don't take the remainder again you get an answer over 65536. The other important info I'd like to point to anyone using this method, is that beat one of your counting is 0000 in hexadecimal. Beat 2 is the answer predicted by my formula(if n=1, and after converting to hexadecimal).



EDIT(#?): For those who are interested in what we have done so far and won't bother to look through the pages:

Code:
n = # of beats
T = tempo in BPM
c = # of cycles from 0x0000 to 0xFFFF

256Hz*65536clks = 16,777,216Hz

65536clks/16,777,216Hz = 0.00390625s

0.00390625s = 1 / 256s

60s / 1 / 256s = 15360s^2

(n-1)*15360s^2 / T = c

modx(15360*(n-1),T) =  15360*(n-1)/T - floor(15360*(n-1)/T)

[B] seed[/B](n,T) = { modx(15360*(n-1),T) }*65536
 

mattj

blatant Nintendo fanboy
Just a note to anyone planning to do all this on a GBA Player with a Turbo Controller like I am. There's a bit of a logistical problem. What kind of timer are you going to use to time it to hit your target frame? As for me, I only have 1 TV, and my Computer is in the other room, so I thought I was kinda screwed, but...I might have figured out how to do it... at least in my particular case.

1) Hook up Gamecube and prep for SR (stand in front of Mewtwo, get Turbo Controller set, etc...)
2) Leave GC on, but unplug it from the TV
3) Hook the Wii up to the TV right next to the GC and get Emloop set up
4) Start Emloop, and when the pre-timer runs out Reset on the GC and hold A on the Turbo Controller (like I normally do)
5) while still holding A, QUICKLY unhook the Wii from the TV, and hook the GC back up
6) press A the first time to "activate" Mewtwo, but not actually "begin the battle", also, turn the Turbo off (like I normally do)
7) Unplug the GC from the TV again, and re-hook up the Wii so you can watch Emloop count down
8) When it ends, press A to "begin the battle with Mewtwo", and re-hook up the GC again.

I really need one of those lil "multi input" thingys where you can switch between inputs on your TV @_@
 

Zari

What impossible odds?
is a Contributor Alumnus
Just a note to anyone planning to do all this on a GBA Player with a Turbo Controller like I am. There's a bit of a logistical problem. What kind of timer are you going to use to time it to hit your target frame? As for me, I only have 1 TV, and my Computer is in the other room, so I thought I was kinda screwed, but...I might have figured out how to do it... at least in my particular case.

1) Hook up Gamecube and prep for SR (stand in front of Mewtwo, get Turbo Controller set, etc...)
2) Leave GC on, but unplug it from the TV
3) Hook the Wii up to the TV right next to the GC and get Emloop set up
4) Start Emloop, and when the pre-timer runs out Reset on the GC and hold A on the Turbo Controller (like I normally do)
5) while still holding A, QUICKLY unhook the Wii from the TV, and hook the GC back up
6) press A the first time to "activate" Mewtwo, but not actually "begin the battle", also, turn the Turbo off (like I normally do)
7) Unplug the GC from the TV again, and re-hook up the Wii so you can watch Emloop count down
8) When it ends, press A to "begin the battle with Mewtwo", and re-hook up the GC again.

I really need one of those lil "multi input" thingys where you can switch between inputs on your TV @_@
Use a DS maybe? It's what I use for RNG in DPPt, because with the touch of a button you can set the time to the beginning of any minute/hour/whatever. I suppose if you need a timer timer, you could set the DS clock to 00:00 and then count upwards (with the seconds hand) Or alternately you could set the DS time so that when the time(for the RNG) runs out it changes the hour, and goes Ding!

Just an idea.
 

mattj

blatant Nintendo fanboy
Use a DS maybe? It's what I use for RNG in DPPt, because with the touch of a button you can set the time to the beginning of any minute/hour/whatever. I suppose if you need a timer timer, you could set the DS clock to 00:00 and then count upwards (with the seconds hand) Or alternately you could set the DS time so that when the time(for the RNG) runs out it changes the hour, and goes Ding!

Just an idea.
That's actually a pretty good idea. Unfortunately though that only deals with seconds and we need milliseconds. I was actually able to get very very close to my target frame (within 6 frames above and below) with just my lil Cell Phone Stop Watch, so that idea does have merit, but the above idea that I had is actually easy and less complicated than I thought it would be.

I didn't realize I already had one of those lil "multi-input-switcher devices", so I just hooked it all into that. I set up on my GC, then switched over to the Wii and set up Emloop, then switched back to the GC and got it set up for the wait, and now I'm just waiting for the timer to run down and see how I need to adjust. I think this is going to go well.

Oh, and I still need to post my last results with my cell phone stopwatch. I guess I'll get around to that, lol!
 

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
EDIT(#?): For those who are interested in what we have done so far and won't bother to look through the pages:

Code:
n = # of beats
T = tempo in BPM
c = # of cycles from 0x0000 to 0xFFFF

256Hz*65536clks = 16,777,216Hz

65536clks/16,777,216Hz = 0.00390625s

0.00390625s = 1 / 256s

60s / 1 / 256s = 15360s^2

n*15360s^2 / T = c

modx(15360n,T) =  15360*n/T - floor(15360*n/T)

[B] seed[/B](n,T) = { modx(15360*n,T) }*65536
Looks fantastic... I've chugged a bunch of these numbers and it seems to work just fine. Now, finally, to make this thing PROACTIVE!!! What I'm assuming we do is:

1. Click "Time Finder" in RNG Reporter
2. Set limits on our desired IVs
3. Grab the seed for a desired spread
4. Plug into NeoSyrex's seed-finder
5. Plug the seed from step 4 into RNG reporter and find our spread to verify.
6. This is where it gets confusing:

How do we get 'n' and 'T' from our seed? Since the formula requires use of the non-linear floor function, a reverse formula would be quite difficult. This seems to be X-Act's area of expertise (is/was he a math major? His method of finding the reverse RNG formula was brilliant). I guess we can say "I want this many beats (n), now tell me what BPM I need." Loop through a bunch of 'T' values, say 1 - 400, until one satisfies the seed. Use that value and hope for the best.

Anyone have any other ideas?
 

mattj

blatant Nintendo fanboy
Looks fantastic... I've chugged a bunch of these numbers and it seems to work just fine. Now, finally, to make this thing PROACTIVE!!! What I'm assuming we do is:

1. Click "Time Finder" in RNG Reporter
2. Set limits on our desired IVs
3. Grab the seed for a desired spread
4. Plug into NeoSyrex's seed-finder
5. Plug the seed from step 4 into RNG reporter and find our spread to verify.
6. This is where it gets confusing:

How do we get 'n' and 'T' from our seed? Since the formula requires use of the non-linear floor function, a reverse formula would be quite difficult. This seems to be X-Act's area of expertise (is/was he a math major? His method of finding the reverse RNG formula was brilliant). I guess we can say "I want this many beats (n), now tell me what BPM I need." Loop through a bunch of 'T' values, say 1 - 400, until one satisfies the seed. Use that value and hope for the best.

Anyone have any other ideas?
PM X-Act and just ask. He's around and he's a math professor at some University in Malta.
 

Zari

What impossible odds?
is a Contributor Alumnus
Looks fantastic... I've chugged a bunch of these numbers and it seems to work just fine. Now, finally, to make this thing PROACTIVE!!! What I'm assuming we do is:

1. Click "Time Finder" in RNG Reporter
2. Set limits on our desired IVs
3. Grab the seed for a desired spread
4. Plug into NeoSyrex's seed-finder
5. Plug the seed from step 4 into RNG reporter and find our spread to verify.
6. This is where it gets confusing:

How do we get 'n' and 'T' from our seed? Since the formula requires use of the non-linear floor function, a reverse formula would be quite difficult. This seems to be X-Act's area of expertise (is/was he a math major? His method of finding the reverse RNG formula was brilliant). I guess we can say "I want this many beats (n), now tell me what BPM I need." Loop through a bunch of 'T' values, say 1 - 400, until one satisfies the seed. Use that value and hope for the best.

Anyone have any other ideas?
Ok, I'm going to assume that we are working in decimal (and not hexadecimal, since the formula itself does not convert to hexadecimal). A few things to note:

400BPM? that is insanely fast! for button mashing the human limit is around 256 (which coincidentally is what I propose the upper limit to be, because that is the timer speed, and gets the result of 60 in the formula, with nothing after the decimal point)

Another thing...this formula does not hit every seed every beat(as far as I know); It would be better to search keeping T constant and searching for a beat, n, that fits the criteria (due to there being more beats than tempos!)

I think for determining n and T, you can divide the seed by 65536, then run the formula searching for a close match.

You would keep T <= 256 and n < (T/256)*x, where x is the number of beats it would take at the tempo T for the intro to start up again (something like that?)

If we did that then there would be a set number of beats / tempos to look through, which would make the search faster. Granted that might not be the most effective way to go about it, but it is a possibility.

What I've found out:
EDIT: I think there's a possibility x in this case would be a constant. If flovv or someone could look into the games code to see how long it takes (from the button press that starts the cycling to the time when the intro would start over again), we could assign a value to x. I would think that time length would be constant, provided no button presses occur between the one that starts the cycle and the one that stops it.

EDIT2: After number crunching for a bit I had one of those "duh!" moments. The minimum n can be is 2, because no tempo (above 60BPM) takes as long as it does for the intro into the "Venu/zard" scene to complete. Hence, the minimum n can be is 2, which, in reality is beat three:


  • beat 1 is the initiated button press, starting the cycle at 0x0000

  • beat 2 is the dead count, or alternately a button press to skip the intro to the "press start" screen
  • beat 3 is the minimum beat for stopping the cycle. (in order to avoid confusion I will change the formula to reflect that)
EDIT3: So as to not clog up the thread with more posts I'll put this here:

Code:
for reference:

modx(a,b) =  a / b - floor(a / b)

using this and my previous formula:

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

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


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

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

n = seed / modx(15360, T)*65536 + 1


EDIT to the EDIT: I don't believe what I did previously was legal. I have now changed it to the correct form.

The new problem: It only tells you how many beats you would have to wait to COMPLETE the cycle, and hit the desired seed. Most of the time it's not going to be a whole number, so the next step would be to figure out how many beats it would take to become a whole number.

Note that some of the tempos produce non-repeating decimals, which will NEVER hit a whole number. We would have to put some sort of limit on how far it would search (maybe x from n<(T/256)*x above!) before moving onto the next tempo.
Now we need to find T.

EDIT4: After a bit of math (that's a lie, It was like 4+ pages of trying various things), I have come to the conclusion that it is impossible(or close to it) to get T out of the floor() function. Unless X-Act or anyone else comes up with something, I believe the best way to go about finding n and T(other than by hand) would be to write a program that searches for a match. I have some experience in Java coding, and the solution I came up with is this:


T = 60;

while(T<257){
n = 3;
while(n<(T/256)*x){
FormulaSeed = Math.round(modx(15360*(n-1),T)*65536);
if(FormulaSeed != DesiredSeed){
n++;
}
else{
return n,T;
}
}
T++;
}

Obviously to any advanced coders out there, my understanding of java is very basic, I know that. What I need to know is if I am on the right track. At this point I don't know what the value of x is (I will find that out after I finish typing this edit), but it should be a constant.

EDIT5: I did a few tests with a metronome and my FR cart, and found x~= 224 at 256 BPM, which comes out the the ratio of 7/8 (or .875 in decimal form). We can then set n < .875*T as the upper limit for n.

EDIT6: to confirm the two formulas (one to find the seed, the other to find n) we'll search for a zapdos spread (right now I just have to beat silph co, get the masterball and then we're go for zapdos), then put it through the formula for n. The results of the search/testing are here:




searched under time finder for 26+ / x / 26+ / 26+ / 31 / 31 timid, ensuring at least a decent hidden power

found this spread:
Code:
nature, ability, IVs(HP/ATK/DEF/SPA/SPD/SPE), hidden power, HP power, seed(hex), seed(decimal), frame

Timid, 1, 30 / 19 / 27 / 30 / 31 / 31, Grass, 70, 1b7e, 7038, 21359
I don't have the program that calculates n yet, so I did this part by hand (with a calculator)
Code:
[COLOR=Red][SIZE=4][SIZE=2][COLOR=Black] tempo(T), [/COLOR][/SIZE][/SIZE][/COLOR][COLOR=Red][SIZE=4][SIZE=2][COLOR=Black]beats(n)[/COLOR][/SIZE][/SIZE][/COLOR][COLOR=Red][SIZE=4][SIZE=2][COLOR=Black], [/COLOR][/SIZE][/SIZE][/COLOR]within range(yes/no)
[COLOR=Red][SIZE=4][SIZE=2][COLOR=Black]
255, 66.99501038, 223.125, yes
254, 27.00085754, 222.25, yes
253, 61.00005951, 221.375, yes
252, 68.99117737, 220.5, yes
251, 31.00213498, 219.625, yes
[/COLOR][/SIZE][/SIZE][/COLOR]

I stopped here to rethink the limitations I chose. I wanted it to be <.01, but every one so far was returning a value that met all the criteria. Here I tried it with <.001 as the criteria:
Code:
[COLOR=Red][SIZE=4][SIZE=2][COLOR=Black]tempo(T), [/COLOR][/SIZE][/SIZE][/COLOR][COLOR=Red][SIZE=4][SIZE=2][COLOR=Black]beats(n)[/COLOR][/SIZE][/SIZE][/COLOR][COLOR=Red][SIZE=4][SIZE=2][COLOR=Black], [/COLOR][/SIZE][/SIZE][/COLOR]within range(yes/no)

[COLOR=Red][SIZE=4][SIZE=2][COLOR=Black] 255, ---, no
254, 27.00085754, yes
253, 61.00005951,  yes
252, ---, no
251, ---, no
250, ---, no
249, ---, no
248, ---, no
247, ---, no
246, ---, no (closest here was 173.001297)
245, ---, no (194.0013428)
244, ---, no
243, ---, no
242, ---, no
241, ---, no (if we extend the range, this gets 242.9990917)
240, ---, no 
239, ---, no[/COLOR][/SIZE][/SIZE][/COLOR][COLOR=Red][SIZE=4][SIZE=2][COLOR=Black] (268.9996033)[/COLOR][/SIZE][/SIZE][/COLOR]
238, ---, no (751.0001841)
237, ---, no
236, ---, no
235, ---, no
234, ---, no
233, ---, no
232, ---, no
231, ---, no 
230, ---, no
229, ---, no
[COLOR=Red][SIZE=4][SIZE=2][COLOR=Black]
[/COLOR][/SIZE][/SIZE][/COLOR]



I'll continue to edit this as I follow through with the formula.

One thing I'm concerned about is limiting n. Obviously there isn't going to be a "whole" number(unless by some extremely low chance) so we would need to determine the limit of how close/far "n" has to be from a whole number.
 

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


EDIT4: After a bit of math (that's a lie, It was like 4+ pages of trying various things), I have come to the conclusion that it is impossible(or close to it) to get T out of the floor() function. Unless X-Act or anyone else comes up with something, I believe the best way to go about finding n and T(other than by hand) would be to write a program that searches for a match. I have some experience in Java coding, and the solution I came up with is this:


T = 60;

while(T<257){
n = 3;
while(n<(T/256)*x){
FormulaSeed = Math.round(modx(15360*(n-1),T)*65536);
if(FormulaSeed != DesiredSeed){
n++;
}
else{
return n,T;
}
}
T++;
}

Obviously to any advanced coders out there, my understanding of java is very basic, I know that. What I need to know is if I am on the right track. At this point I don't know what the value of x is (I will find that out after I finish typing this edit), but it should be a constant.

Edit5: I did a few tests with a metronome and my FR cart, and found x~= 224 at 256 BPM, which comes out the the ratio of 7/8 (or .875 in decimal form). We can then set n < .875*T as the upper limit for n.
Exactly what I was thinking. The reason he was able to come up with a reverse formula was due to some euclidean crap I know nothing about, and since it's a recursive function. This formula however is not based on any previous formula. An inverse floor function would be ambiguous since it can be any number between one integer and the next. Therefore, yes, the loop you have devised is exactly what I had in mind, but there's still the issue of the "legality" of a seed/"n." That is the next, and hopefully final, path we must take. I can try to write up some cheap command line java app that implements your loop; in fact I'm very eager to as I have not written anything applicable since school. I might start tonight but I need to refresh my memory so it might be a couple days, if not a week. Maybe during that time more information will come about. Awesome work so far though.
 

Zari

What impossible odds?
is a Contributor Alumnus
Exactly what I was thinking. The reason he was able to come up with a reverse formula was due to some euclidean crap I know nothing about, and since it's a recursive function. This formula however is not based on any previous formula. An inverse floor function would be ambiguous since it can be any number between one integer and the next. Therefore, yes, the loop you have devised is exactly what I had in mind, but there's still the issue of the "legality" of a seed/"n." That is the next, and hopefully final, path we must take. I can try to write up some cheap command line java app that implements your loop; in fact I'm very eager to as I have not written anything applicable since school. I might start tonight but I need to refresh my memory so it might be a couple days, if not a week. Maybe during that time more information will come about. Awesome work so far though.
What legality issue? There is none that I can find:

Code:
seed = modx(15360[B]*(n-1)[/B], T)*65536

n = seed / (modx(15360, T)*65536) 

we can do away with the +1, as that is only how far after 1 beat; not relevant to this problem

n = modx(15360*[B](n-1)[/B], T)*65536 / (modx(15360, T)*65536) 

65536 cancels out

n = modx(15360*[B](n-1)[/B], T) / modx(15360, T) 

seed / n = modx(15360*[B](n-1)[/B], T)*65536 / (modx(15360*[B](n-1)[/B],T) / modx(15360,T) )

dividing is equivalent to multiplying by reciprocal

seed / n = modx(15360*(n-1),T)* (modx(15360,T) / modx(15360*(n-1))*65536

modx(15360*(n-1)) cancels once

seed / n = modx(15360, T)*65536

seed / n = modx(15360, T)*65536
Unless I made a grave error, I don't see anything wrong with that. The important difference is that in the formula for n, the "modx" portion is missing "(n-1)".
 

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 just remembered a bunch of stuff about impossible to hit seeds, that is all. I'm still soaking it all in. Awesome job with those
formulae. I think we're nearing the end (or the beginning). Just a question, have you had any time to test this formula for certain seeds? Also, how do we get this thread
sticky'd?
 

Cathy

Banned deucer.
One more thing. I think we should come up with another name for that second function, so it will clear up the formula for reading.[...]
Second, and more relevant to this discussion... something like modx?
modx(15360, T) = 15360/T - floor(15360/T)
any name would be great, and it would clear up the formula in your sig a whole lot.
This function already has a well known name, namely the fractional part function. Also, notice how

frac(a, b) := a/b - floor(a/b)

only depends on the ratio of a/b, so it's actually a function of one variable. So then when you guys later come up with
seed(n,T) = { modx(15360*n,T) }*65536
It's clear that seed(n, T) is also only a function of one variable, namely n/T. So, from this formula, given a seed, you can only get a value of n/T, not independent values of n or T.
 

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
It's clear that seed(n, T) is also only a function of one variable, namely n/T. So, from this formula, given a seed, you can only get a value of n/T, not independent values of n or T.
Thanks for clearing that up. I knew that you couldn't find n and T independently by any possible way, but since the tempo T is chosen by the abuser, n can be found.
 

mattj

blatant Nintendo fanboy
Well i'm still s r ing for yo target me w two. I've gotten very close several times. However it seems i'm running into a bit of a problem with em loop. I'm confident that i'm hitting my very last button press because there's that nice beeping count down to synch up with. I really think i'm botch ing the end of the pre timer though because of the lack of a beeping count down. I keep varying by around ten frames. :( SO I think i'm going to set my pre timer for something small like twenty seconds and use a lil external metro nome i have set on sixty b p m to give myself a little bit of a beeping count down. Hopefully this will help my inconsistency. :)
 

Zari

What impossible odds?
is a Contributor Alumnus
I just remembered a bunch of stuff about impossible to hit seeds, that is all. I'm still soaking it all in. Awesome job with those
formulae. I think we're nearing the end (or the beginning). Just a question, have you had any time to test this formula for certain seeds? Also, how do we get this thread
sticky'd?
I tested the seed formula on snorlax (for 0x0000 at 128 BPM), and I was getting results close enough to the formula's prediction for me to believe it's accurate (within <1000 seeds. I think that portion of error is mostly human error with inconsistent timing). Currently I'm working on devising a limiting case of how close n can be to a whole number based on tempo (because at a slower tempo, the same distance from a whole number is actually greater in distance from a target seed). Once I figure that out I'm going to run a test of the formula using that timid spread I found in my other post on moltres, and hope that the results line up with the formula predictions.

EDIT: If the formula predictions hold true, I will write up a more formalized java code that includes the limiting case for n.

EDIT2: Okay, after some number crunching, I have decided the limiting case for n has to be <0.0001, preferably <0.00001. why this low? well, if there are 65536 possible seeds whizzing by every 3.9 milliseconds, 65536*.0001 = 6.5536 seeds off the target seed. Even with that small of a difference, you still don't hit your target seed. I'll compile a listing of tempos and how long it takes for them to hit this amount using the example spread in my earlier post, then edit the list into this one.

EDIT3: I have found some tempo/beats that work for testing the formula, the one I will be using in bold:

Code:
tempo, beats, offset from desired seed

255, 284.0005875, 38.5024
254, 1419.999644, 23.330816
253, 61.00005951, 3.90004736 (my metronome only goes up to 250 BPM :[)
...
191, 48.99947777, 34.22486528
190, 168.0015583, 102.1247488
...
181, 352.0002729, 17.8847744
179, 94.00354067, 232.0413789
178, 346.005046, 330.694656
177, 190.0027618, 180.9973248
...
[B]158, 2.99810791, 124.0000102[/B]
157, 113.9992729, 47.6512256
...
150, 325.9989471, 69.0028544
 

mattj

blatant Nintendo fanboy
Depressing Update T_T

Been SRing for over a week now trying for this Hasty Mewtwo. No luck. Seems my frames are just too inconsistent. I started out just using my Cell Phone stopwatch, but noticed the inconsistency, so I switched to emloop to try to remedy it. Nope. No better. So then I started using a little external metronome to give me countdown beeps for my pre-timer too. Nah, didn't help. :/ Now I'm gonna see if it's just that the target frame is too high and that even Emloop becomes inconsistent at that range by attempting another popular target spread at a much lower frame.

It's not at all that I'm getting terrible results. I'm RIGHT IN THE FRIGGIN BULLSEYE AREA but I'm just not consistent enough to warrant weeks on end of 30 minute SRs. I need to figure out what's throwing me off. :/

Data:
Code:
Actual Attempt at FR, SD Mewtwo:

Saved in front of Mewtwo.  Done hundreds of different Calibration SRs.  Best target spread so far:[quote]7706  -  3/30 (10%)
Hasty, 25 / 31 / 30 / 26 / 29 / 31  F: 94714 (26:18:56)(26:27:91**)[/quote]Using:
1) a Fire Red Cartridge
2) a Nintendo Gamecube
3) a Nintendo Gameboy Player and Disk (for Gamecube)
4) a wired GameStop Gamecube Controller (with programable speed Turbo Setting)
5) a TV
I'm going to:
1) set my Turbo on A to the 2nd from fastest setting
2) hold down the Reset button on the Gamecube and hover over the A button on the Controller
3) release the Reset button AND hold down the A button at the exact same time
4) begin a stopwatch on my cell phone at the VERY last note of the Venu/zard intro
5) let off A the moment I see Mewtwo
6) CAREFULLY turn the turbo off on my controller which will also "activate" mewtwo, but NOT BEGIN THE BATTLE
7) wait there until my timer runs to 26:18:56
8) immediately press A again to begin the battle with Mewtwo
9) Masterball it, check it's nature/stats*
10) if it's off, find it's starting seed and frame, make adjustments and try again

*Target is:[quote]Mewtwo, Hasty, L70, 245 / 180 / 136 / 238 / 151 / 228[/quote]Time Stopped,  (Nature) /IVs/ ,  Seeds,   Frames*,  Adjustment:
[quote]Shooting for S:7706  F:94714  T:26:27:91[/quote]1) 26:18:90, (Bashful): 6 / 31 / 12 / 6 / 11 / 22, 55d, 94190,  Pretty sure my Retarded Cell phone screwed up my timer, cuz it was on the charger to keep it from dying and when it fully charged it popped a message up which looked like it temporarily stopped my timer >_?
2) 26:18:50, (Hardy): 29 / 18 / 4 / 23 / 2 / 27, 55d, 94153,  Hmmmm.... maybe the Cell Phone DIDN'T screw it up...  ADDING 9.35 SECS
3) 26:27:67, (Naïve): 21 / 8 / 13 / 2 / 28 - 29 / 12, 571, 94703, 
4) 26:27:78, (Mild): 4 / 10 / 16 / 16 / 31 / 20, 7706, 94708  DANG SO CLOSE!!
5) ??:??:??, (Bold): 17 / 20? / 13? / 20 / 31 / 26, 7de7, 94709 >_? friggin forgot to write the time down before I started again!!
6) 26:27:86, (Impish): 7 / 21 / 5 / 24 / 6 / 31, 572, 94731<<< Not sure why I got 17 too high...maybe 26:27:80 is spot on?
7) 26:27:67, (Sassy): 23 / 29 / 8 / 0 / 15 / 25, 565, 94704
8) 26:27:81, (Lax): 11 / 30 / 0 / 20 / 23 - 24 / 28, 569, 94710
9) 26:27:63, (Docile): 8 / 31 / 1 / 18 / 29 / 13, 562, 94722
10) (Hasty): 4 / 31 / 15 / 28 / 23 / 12, 935d, 94721 DANG!! thought I had it!! xD
11) 26:27:75, (Lax): 24 / 25 / 28 / 13 / 11 / 25, 7706, 94733
12) 26:27:67, (Brave): 6 / 15 / 25 / 19 / 5 / 28, 565, 94707
13) 26:27:76, (Sassy): 25 / 23 / 17 / 8 / 26 / 10, 569, 94708

HAVING SOME REAL ISSUES WITH THE PRECISION OF MY CELL PHONE STOPWATCH. BECAUSE IT DOESN'T HAVE A TIMER, I BASICALLY HAVE TO "GUESS" WHEN I'M SUPPOSED TO STOP IT (AT THE MILLISECOND LEVEL THAT IS). BECAUSE OF THIS I'M GOING TO "TRY" TO USE EMLOOP TO HELP ME HIT MY FRAMES.  IT HAS A NICE 10 SECOND BEEP AT THE VERY END, BUT ONLY 1 BEEP TO MARK THE START. SO WHAT I'M GONNA TRY IS...
1) GIVE IT A 1 MIN (OR WHATEVER) PRE-TIMER
2) TURN THE COMPUTER VOLUME WAY UP 
3) SYNCH MY CELL PHONE STOPWATCH TO IT.
4) RUN INTO THE BEDROOM AND WAIT FOR THE REAL TIMER TO BEGIN (SHOULD ALREADY HAVE THE TIME PRETTY MUCH FIGURED OUT, WITHIN REASON)
5) LET GO OF RESET WHEN THE REAL TIMER STARTS
6) WAIT 26:31:26 >_?
7) ENCOUNTER MEWTWO AT THE END OF THE FINAL COUNTDOWN
8) MASTERBALL AND MAKE ADJUSTMENTS
[CODE]EMLOOP SETTINGS:
F: 95476
T: 26:31:26
PT: 60
SO: 0
CD: 9
Shooting for S:7706 F:94714 T:26:27:91
14) (Docile): 13 / 30 / 26 / 22 / 26 / 24, 565, 94297, First time trying to use Emloop, ran several programs while Emloop was going, plus I may have not synchronized very well, and I know I encountered 1 second too early on the final countdown (changing that to 9 seconds instead of 10).
15) (Lonely): 3 / 17 / 31 / 24 / 25 / 21, dc94, 94346, Basically repeated the above, but SR'd on time adding 368 to Delay to get "95844"
16) (Lonely): 12 / 2 / 29 / 23 / 9 / 9, 571, 94704!! close! :D Gonna add 8 to the Delay to get: "95852"
17) (Quiet): 10 / 5 / 5 / 2 / 15 / 21, 55a, 94716!! :D cloooooose gonna keep this for a bit!!
18) (Rash): 1 / 6 / 17 / 31 / 31 / 1, 565, 94718 :) Dropping Delay by 3 to get "95849"
19) (Calm): 16 / 14 / 9 / 23 / 22 / 9, 565, 94709, Need to stick with this for a while. Hit same delay, adjusted by 3 and got 10 different.T_T
20) (Timid): 19 / 31 / 9 / 27 / 27 / 30, 571, 94708, weeeeeeeird, for a SR this is really great ?! gonna stick with it a bit more...
21) (Lonely): 11 / 4 / 26 / 17 / 21 / 2, 564, 94724?! still gonna stick with it and see how it works out... I want to see it on the same seed...
22) (Lax): 11 / 30 / 0 / 20 / 23 - 24 / 28, 569, 94710 Lol a repeat spread from when I was using my Cell Phone Timer! xD
23) (Gentle): 16 / 13 / 15 / 27 / 9 / 9, 556, 94714!!!!!! FINALLY! HIT MY FRAME!! :D
24) (Lonely): 4 / 29 / 26 / 3 / 11 / 18, 571, 94712 adding 1 to get "95850"
25) (Serious): 23 / 29 / 10 / 23 / 4 / 24, dc94, 94722 T_T
26) (Timid): 11 / 12 / 29 / 15 / 14 / 21, 7706, 94703 :( :( :( :( :(
27) (Lax): 20 / 27 / 4 / 21 / 3 / 25, 569, 94712
28) (Hasty): 30 / 25 / 5 / 6 / 17 / 1, 565, 94718 first try with metronome for intro, dropping Emloop Delay by 3 to get 95847
29) (Adamant): 31 / 29 / 16 / 19 / 25 / 31, dc90, 94706 GRRRRRRRRRRRRRRRRRRRRRRR sticking with it a few times >_?
30) (Sassy): 4 / 23 / 13 / 3 / 0 / 30, 565, 94716 not terrible. :/
31) (Quirky): 1 / 1 / 22 / 30 / 12 / 11, 55a, 94703
32) (Modest): 7 / 27 / 0 / 5 / 2 / 16, 7de7, 9407 swtiching back to...95849 T_T STICK WITH THIS FOR A WHILE!!!! >:p
33) (Quiet): 10 / 5 / 5 / 2 / 15 / 21, 55a, 94716!! :D cloooooose gonna keep this for a bit!!
34) (Bashful): 18 / 14 / 22 / 31 / 1 / 8, 562, 94722 >_? CAAAANT BEEE CONSIIIIIIIISTENT?!!?!!!!
35) (Quirky): 9 / 1 / 0 / 21 / 0 / 8, 572, 94713!!! "felt reeeeally close to spot on"
36) (Quirky): 6 / 9 / 2 / 31 / 16 / 17, 55d, 94710 "possibly a hair early" this makes no sense in the light of my frame T_T
37) (Docile): 7 / 30 / 23 / 20 / 20 / 28, 572, 94710 "spot on"
38) (Hasty): 27 / 17 / 2 / 9 / 20 / 5, 55a, 94707, "hair late?"
39) (Modest): 30 / 4 / 24 / 3 / 27 / 6, 55d, 94717 "noticeably early"
40) (Lonely): 24 / 13 / 21 / 26 / 25 / 27, 565, 94711, "spot on"
41) (Modest): 30 / 4 / 24 / 3 / 27 / 6, 55d, 94717 "noticeably early"
42) (Calm): 7 / 7 / 9 / 23 / 30 / 10, 7706, 94706 >_? "hair early/spot on"
43) (Quirky): 6 / 9 / 2 / 31 / 16 / 17, 55d, 94710 "DEAD ON"
44) (Sassy): 28 / 23 / 9 / 14 / 22 / 19, 55a, 94713 "spot on"
45) (Sassy): 23 / 29 / 8 / 0 / 15 / 25, 565, 94704 "dead on"
46) (Adamant): 12 / 10 / 23 / 20 / 17 / 23, 571, 94720 "volume off >_?"
47) (Timid): 1 / 13 / 24 / 9 / 0 / 26, 9354, 94711 "hair late"
[/code]Did a quick incomplete breakdown looking for popular seeds (post using emloop cuz I noticed a pretty obvious shift) that maybe had good lower frame target spreads and found this nugget:
Code:
55a  -  5
Naive- 26/25/27/27/29/31  F:35939 (9:58:98!!)  switch maybe?? :/
^^^^179 / 127 / 108 / 204 / 99 / 200

55d  -  4
7706  -  2
565  -  6
556  -  1
571  -  4
564  -  1
569  -  2
dc94  -  2
dc90  -  1
Ima take a break from the 30 min SRs tomorrow and see if these lower frame target spreads don't give me more consistent results. Even if I don't get it tomorrow, it'll be a useful experiment with emloop. I need to find out what's making me jump around any where from +10 to -10. :/

[edit]
NEW TARGET:
Naive- 26/25/27/27/29/31 S:55a(5/33 "P.E.") F:35939 (9:58:98!!)
Naive-179/127/108/172/98/165
Naive-179 / 127 / 108 / 204 / 99 / 200
EMLOOP:
D:37074 MT:10:17:09 PT:25 CD:7 Everything Else: Blank or "0"
 

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
Tempo Database:
For music aficionados, I found a cool website where you search for any song and it tells you the BPM of that song. Obviously, it's best used for songs with a steady beat. I was listening to the radio right now and heard Pink Floyd's "Run Like Hell." It's got a really heavy, steady bass line and it's a really tight knit song. I'll list some songs I can think of (really steady songs in bold, and songs you should really tap at twice the tempo with a red asterisk. Definitely DO NOT double Flowing or Higher ground since they are in 6/8 and unless you are a drummer, your ears will be tricked):
Code:
BPM, Song,            Band,         Album
[B]126, Flowing,          311,            Soundsystem
[/B]140, Higher Ground, Red Hot Chili Peppers, Mother's Milk
[B]170, New, No Doubt, Return of Saturn
86 (172), No One Knows[/B][B][COLOR=Red]*[/COLOR][/B][B], Queens of the Stone Age, Songs for the Deaf
[/B][B] 110 (220), Another One Bites the Dust[COLOR=Red]*[/COLOR], Queen, Greatest Hits[/B]
116 (232), Love Rollercoaster[COLOR=Red]*[/COLOR], Red hot Chili Peppers, Greatest Hits
[B]118 (236),  Run Like Hell[/B][B][COLOR=Red]*[/COLOR][/B][B], Pink Floyd, The Wall
[/B]
These are all the songs I can think of at the moment. Hopefully later I can make a list of seeds you can hit with these tempos.

You know what, I'll search by Zari's desired tempo, 158 BPM:

Here is the only song I recognize, and it's a very steady beat, so it works really well.
Sunday Morning, No Doubt, Tragic Kingdom

Feel free to search for more songs at that tempo, as I'm sure others on here will recognize songs that I don't.
 

mattj

blatant Nintendo fanboy
Excelent Idea!
That's such a great idea there, finding songs that match your desired BPM. I've been meaning to throw this out there for a while and now seems like a good time for you and Zari to think about this...

It seems that not only your BPM but when you begin tapping A makes a difference in what consistent seeds you get.

Point in case:
Starting seeds from Holding A with Turbo on fastest the moment I Reset:
Seed Breakdown:
Code:
     c04  -  13/70
c05  -  10/70
bfe  -  10/70
c291  -  7/70
c298  -  5/70
c28e  -  5/70
c0e  -  4/70
ea53 or 9a9c  -  3/70
c297  -  3/70
c09  -  2/70
9e0a  -  2/70
c285  -  2/70
bfd  -  1/70
c07  -  1/70
Starting seeds from holding A with turbo on the fastest at the beginning of the beat at the final note on the Nido/gar scene:
Seed Breakdown:
Code:
     60c9  -  5
596d  -  4
60c7  -  3
3c49  -  3
34e9  -  2
58a5  -  2
5964  -  1
3421  -  1
38fc  -  1
3c4f  -  1
fd13  -  1
387d  -  1
ebb2  -  1
eae6  -  1
3c45  -  1
5c7a  -  1
5d6f  -  1
I have NO IDEA why I get different seeds when using the same BPM Turbo setting but start holding A at a different point, but it's pretty clear I do. I just wanted to point this out cuz I don't know if it'll have any impact on that equation for linking BPM to starting seeds.
 

Zari

What impossible odds?
is a Contributor Alumnus
That's such a great idea there, finding songs that match your desired BPM. I've been meaning to throw this out there for a while and now seems like a good time for you and Zari to think about this...

It seems that not only your BPM but when you begin tapping A makes a difference in what consistent seeds you get.

Point in case:
Starting seeds from Holding A with Turbo on fastest the moment I Reset:
Seed Breakdown:
Code:
     c04  -  13/70
c05  -  10/70
bfe  -  10/70
c291  -  7/70
c298  -  5/70
c28e  -  5/70
c0e  -  4/70
ea53 or 9a9c  -  3/70
c297  -  3/70
c09  -  2/70
9e0a  -  2/70
c285  -  2/70
bfd  -  1/70
c07  -  1/70
Starting seeds from holding A with turbo on the fastest at the beginning of the beat at the final note on the Nido/gar scene:
Seed Breakdown:
Code:
     60c9  -  5
596d  -  4
60c7  -  3
3c49  -  3
34e9  -  2
58a5  -  2
5964  -  1
3421  -  1
38fc  -  1
3c4f  -  1
fd13  -  1
387d  -  1
ebb2  -  1
eae6  -  1
3c45  -  1
5c7a  -  1
5d6f  -  1
I have NO IDEA why I get different seeds when using the same BPM Turbo setting but start holding A at a different point, but it's pretty clear I do. I just wanted to point this out cuz I don't know if it'll have any impact on that equation for linking BPM to starting seeds.
I'll take a look into this. It might take me a little bit, and a lot of SRs, but I should be able to find out what's going on. When I was SRing for moltres, I noticed some of the seeds I was hitting were way off from the rest (like 20000+ seeds), leading me to the same conclusion. I believe it has something to do with what point during the intro you begin tapping the A button.

As far as I know, the stuff before the leading intro (with the star going across the screen) has nothing to do with the starting seed. I have a hypothesis however.

It could be that the game begins looping the starting seeds at the beginning of the introduction, not when you first press the A button.

I know this idea would contradict what flovv has already said, but we shouldn't rule out any possibility. What leads me to believe this is the results from the snorlax testing I did.

When I SR'd for snorlax, I started out by hitting the wrong beat, completely by accident. That beat was supposed to land on 0x0000. But I kept getting answers in the 12000 range (for the decimal version of the seed) or about 15% off the actual prediction.

for those tests I was SRing on the ding! of beat one in 4/4 time. Then I switched it up.

after I got those results, I started SRing, Starting the metronome when I first pressed A this time, I was getting waaay closer results, accurate enough to lead me to believe the formula was accurate.

Now this was odd. How could the same BPM get offsets of different amounts?

The Answer?

When resetting with a metronome, where the first button press of A/start happens matters

now I don't know why this is yet, but I do know that when I SRed on the ding! and when I SRed with the metronome on the first beat were at different locations during the introduction.

One possibility that I came up with was that the game starts cycling through the seeds at the beginning of the introduction. Upon the first button press, the seed on which the first button press occurred becomes the new starting place for the cycle.

I don't have the smallest clue as to how/if this could be true, but it was the only feasible solution I could come up with.
 

mattj

blatant Nintendo fanboy
That's a good hypothesis. I just think it has to do with how many times and when exactly the game checks for button presses. Maybe, if you're off by 1 millisecond or whatever it "misses" your one button press and catches the next, thereby lengthening the time between button presses. Say I hold Turbo A at the same moment I Reset, it might consistently be missing the second button press thereby throwing the whole thing off. But when I try hold Turbo A at the final note in the Nido/gar scene it may be picking it up, and giving me a different set of seeds. Or vice versa, whatever.

Just a guess though on my part.
 
Status
Not open for further replies.

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

Top