• Snag some vintage SPL team logo merch over at our Teespring store before January 12th!

RNG Manipulation in Pokemon Showdown

If you use the move Metronome 8-9 times in a battle, you have enough information to reverse engineer the RNG of Pokemon Showdown, and then you can predict all future random events:

Wasting time on Metronomes is of course quite bad, but being able to predict the RNG can give a huge advantage, so maybe this can be made into a viable strategy in the future.

Edit:
I've now also managed to reverse the RNG using 16-17 damage rolls from normal attacks:
 
Last edited:
1735233635597.png

He knows too much
 
is it only relevant in ADV? or can it be extended to modern gens?
This can be used in all gens. As far as I know they currently all use the same RNG, and the metronome mechanics are the same in all gens except in gen2 and gen4.
But the way you keep track of random calls will be different for every gen. So for every gen you need to put in some work so you know exactly how many random calls happen.

In Gen7 you probably only need 7 metronomes, because the move list is longer so each metronome gives you more information.
 
is this like, against the rules at all? if someone did this in a tour match would there be any consequences or is this fair game?

this is probably getting patched soon but i'd like to know Just in Case :3
 
First of all - this is insanely cool. I love deep mechanics dives like this, so seeing it on a game I spend so much time on is uniquely special.

I was about to ask if this would work the same on cartridge, but you actually answered that question in the video! Showdown being considered not-faithful-to-cartridge due to this exploit is amazing.

is this like, against the rules at all? if someone did this in a tour match would there be any consequences or is this fair game?

this is probably getting patched soon but i'd like to know Just in Case :3

Considering this technique works on cartridge (and even easier than on showdown) I would have to assume that this is not considered cheating, and is simply tool use akin to the likes of showdex or the damage calculator. However would love to see an opinion from someone like DaWoblefet who has in-depth knowledge of the games mechanics
 
In my humble gamer opinion,
this unintended mechanic seems balanced and skill expressive. I hope that it is not patched or removed because it is impractical in current state. However, I might change my mind if RNG enlightenment becomes sufficiently advanced/easier to pull off.

Great research, thanks.
 
I don't know exactly how this works, but if it's based off trying to find your battle's seed based off the extra information gained from probabilistic events that happen each turn (crits, misses, lack of crits, ties - ie not just metronome) then I'd imagine 100s of turns of low information gain moves like the ones I mentioned could be enough to then figure out the seed of the battle - which would definitely come into play in longer games / stall.

This seems very problematic to me
 
I don't know exactly how this works, but if it's based off trying to find your battle's seed based off the extra information gained from probabilistic events that happen each turn (crits, misses, lack of crits, ties - ie not just metronome) then I'd imagine 100s of turns of low information gain moves like the ones I mentioned could be enough to then figure out the seed of the battle - which would definitely come into play in longer games / stall.

This seems very problematic to me
Yeah, you can definitely also reverse the RNG using other information than just metronomes.
If there are 15-16 crits in a battle that should also be enough info to reverse the RNG. If both players constantly successfully attack, it takes on average roughly 150 turns to get enough crits to reverse the RNG from crit information alone.
 
Yeah, you can definitely also reverse the RNG using other information than just metronomes.
If there are 15-16 crits in a battle that should also be enough info to reverse the RNG. If both players constantly successfully attack, it takes on average roughly 150 turns to get enough crits to reverse the RNG from crit information alone.
So, can gen 2 RNG get reversed via critical hits only or does it works differently aswell?
 
100s of turns of low information gain moves like the ones I mentioned could be enough to then figure out the seed of the battle - which would definitely come into play in longer games / stall.

This seems very problematic to me
this is already happening in the brain, albeit imperfectly. after thousands of hours of play, one can recognise or decipher seeds subconsciously as a "gut feeling". i'm curious to hear from more experienced players on this.
 
You coulda kept this hidden and used it for good, like a Smogon Premier League Finals - [No Winner]...

for realsies though, really cool work & how feasible would it be to create code that doesn't rely on metronome and share all the remaining seeds after every turn

this is already happening in the brain, albeit imperfectly. after thousands of hours of play, one can recognise or decipher seeds subconsciously as a "gut feeling". i'm curious to hear from more experienced players on this.
There are far too many seeds and far too many things happening for anyone to have a gut feeling
 
From a youtube comment by Myren Eario,
You need to collect 64 bits of informations.
Every metronome gives you 7-10 bits of info, depending on the generation.
Every critical hit gives you roughly 4 bits of info.
Every full paralysis gives you 2 bits of info.

I happen to play a generation where games are quite long, and paralysis is very common. I checked through the replays of a random recent sample - 43 games of RBY OU in Week 1 of the recent RBYPL.
If I'm understanding correctly, one game (here) definitely reached a state where full RNG prediction was possible, with 52 FPs in 178 turns, without either player even trying - I wonder if Tarvold armed with full RNG prediction tools could have broken the game to steal a win here?
Four more games got over the 20 FP mark and relatively close to the 32 FPs mark - (this) had 28, (this) had 26, (these two) had 22. The game with 28 FPs also had two crits and a freeze by Turn 5, so I am quite comfortable saying a 'complete' RNG prediction tool would be able to break games relatively frequently in this tier, without needing to gimp yourself with Metronomes at all.

Damage rolls are also much easier to use for information, since you can pretty safely assume everything is max EVs/DVs, so I think damage rolls from enemy attacks are reliable sources of info to track the seed as well (and I think they give more info than in modern gens since there's >16 damage rolls in RBY, as opposed to every subsequent generation).
GSC might also be extremely easy to determine through received damage rolls for the same reason, but I'm not super clear on just how much info one roll gives

I think unless the cartridge RNG for RBY is so busted that this somehow doesn't apply, this might just completely break our meta. Haha, lmao


@ Myren it would be interesting, as a further proof of concept, if you could demonstrate the potential of these other seed detection methods on the replays provided. it's one thing forcing it with Metronome, it's another thing giving a demonstration based on actual tournament games that this tool can already break games. it would be big
 
Last edited:
From a youtube comment by Myren Eario,


I happen to play a generation where games are quite long, and paralysis is very common. I checked through the replays of a random recent sample - 43 games of RBY OU in Week 1 of the recent RBYPL.
If I'm understanding correctly, one game (here) definitely reached a state where full RNG prediction was possible, with 52 FPs in 178 turns, without either player even trying - I wonder if Tarvold armed with full RNG prediction tools could have broken the game to steal a win here?
Four more games got over the 20 FP mark and relatively close to the 32 FPs mark - (this) had 28, (this) had 26, (these two) had 22. The game with 28 FPs also had two crits and a freeze by Turn 5, so I am quite comfortable saying a 'complete' RNG prediction tool would be able to break games relatively frequently in this tier, without needing to gimp yourself with Metronomes at all.

Damage rolls are also much easier to use for information, since you can pretty safely assume everything is max EVs/DVs, so I think damage rolls from enemy attacks are reliable sources of info to track the seed as well (and I think they give more info than in modern gens since there's >16 damage rolls in RBY, as opposed to every subsequent generation).

I think unless the cartridge RNG for RBY is so busted that this somehow doesn't apply, this might just completely break our meta. Haha, lmao
advocating for cartridge-accurate 32-bit RNG for RBY and GSC, making both metas broken after a mere 16 FPs / uses of Sleep Talk (or are GB/GBC only 16 bits?)
 
I think outside of ladders that this clearly breaks (like metronome battle ofc) this is based, funny, and we should keep it

If you can get 8 Metronomes in an SPL game of SV OU you deserve it.
 
I think outside of ladders that this clearly breaks (like metronome battle ofc) this is based, funny, and we should keep it

If you can get 8 Metronomes in an SPL game of SV OU you deserve it.
funnily enough, this does not break metronome battle at all, because once a game of metronome begins, you have no decision-making power. Meaning no way to actually influence the RNG in your favour
 
funnily enough, this does not break metronome battle at all, because once a game of metronome begins, you have no decision-making power. Meaning no way to actually influence the RNG in your favour
but maybe you find out the opposing Heracross-Mega is going to use Absorb the next turn, so you don't Tera Ghost your Ting-Lu quite yet in order to trigger the Weakness Policy...

I'm still more interested in seeing how this works in regular battles though. A damage roll alone could give 4 bits of info, so not even accounting for many secondary effects, just 8 turns of attacking on both sides could be enough to reverse engineer the seed. (Of course this only works when you know the opponent's spread, but this holds for rands and some oldgens)
 
The solution is obviously for the sim to move to a cryptographically secure PRNG, current one is only partially accurate anyway—from what I can see in the repo only Gens 5 and 6 used a linear congruential generator with the same a and c values as the sim currently uses—so there is nothing lost in just changing it altogether.
 
The solution is obviously for the sim to move to a cryptographically secure PRNG, current one is only partially accurate anyway—from what I can see in the repo only Gens 5 and 6 used a linear congruential generator with the same a and c values as the sim currently uses—so there is nothing lost in just changing it altogether.
There is no "solution" because there is no problem. This is awesome. There is no bug, there is only feature.
 
From what I can see for GSC, if someone were to make one of these based off damage rolls the you would be able to get the rng seed within 15-18 instances of you taking damage (depending on what is attacking and being hit). This is assuming that I understood it correctly, i.e. the set of seeds is continuously filtered down with each new piece of information until one initial seed remains.

This is a huge advantage given to anyone using this tool in gen2 and likely gen1 as well, which becomes usable in the early-mid game - which would change the way the tier is played completely (e.g. curse lax can stay in on machamp risk free or knowing what talks will be called). I don't think this advantage is acceptable for a few reasons: 1) its an offsite tool so will hurt new/not in the know players 2) its a big divergence from what it aims to simulate (i.e. link cable/in person play), as its never acceptable to show up with a pc to try and get the rng seed (like showing up with a card counting device) 3) it makes the game much more boring/less fun - it will reduce the ability to play back into a game if I can see when a crit is called/a roll will go my way.

It should be really be made obsolete like Vertigo said as its a matter of time before someone makes one of these that is usable on a normal game, and they may not want to share it.
 
To be honest, when I first saw this thread I thought it was a joke.
It took me several hours to realize that this is a topic which should be seriously discussed.
I apologize it.

I've heard in another RBY/GSC thread that Pokemon Showdown doesn't reproduce Cartridge's RNG habit.
If it takes consider that, Pokemon Showdown's unique technique of making RNG predictable may create a metagame which is far different from that of the actual Cartridge, and depending on the degree, I think that Pokemon Showdown (or a simulator that replaces it) may have to take measure to prevent from such attempts.
 
Wow this is super cool. I imagine this could alter how we all play longer games at higher levels, which may end up getting the RNG altered as a result. But like, what you just did is awesome regardless! I love seeing people break apart game mechanics and reverse engineer things like this, this is sick.
 
Back
Top