TCG1 RNG Mechanics

Locked
Mountebank
Bug Catcher
Posts: 19
Joined: Tue May 06, 2014 5:32 pm

TCG1 RNG Mechanics

Post by Mountebank » Thu Nov 26, 2015 8:10 pm

Hmm, where to start...

The RNG in pokemon TCG is always set to the same value on reset and it advances once per frame almost everywhere except during a battle (this includes intro, title screen, overworld). Unlike gens 1-2, the new RNG state depends only on the previous RNG state, so it can be manipulated. Put another way, if you save+reset and then start a battle after a fixed number of frames, you should always get the same battle.

Of course, this is probably not possible outside of a TAS and I am actually having quite a bit of trouble hitting a frame consistently. I am off by at most +/- 8 or so, though this is probably because I don't have a good setup yet. We can mitigate this using clusters: find some consecutive frames that give good RNG and set up the timer so that you can hit one of them.

The main way to abuse this is deck stacking, as the RNG determines how your deck is shuffled. For example, if you know in advance that your opening hand consists of the cards at positions [9, 13, 20, 22, 44, 49, 53], then you can stack your deck in advance by placing favorable cards at those positions to get a good opening hand. Deck stacking rules are below:

- If you add a card, it is placed at the end. For example, if your deck currently contains 20 cards and you add a new card, that card will be at position 21.
- If you remove a card, the card removed is the one with the earliest position. For example, if you remove a machop and your deck has machop at positions [5, 18, 39], the machop at position 5 will be removed and all cards after it will be shifted by one.
- You can also press START to sort your deck. Energy cards are first, pokemon cards are second, and trainers are last.

Unfortunately, there is no easy way to put a card in a desired position. If you want to put a computer search in position 1, you have to remove every other card from your deck first. This means that it is definitely not worth it to manipulate a perfect turn 1 fight for every trainer because we would have to do a ton of really slow deck edits. Ideally, we would like to be able to do a deck edit and reuse the stacked deck for multiple trainers, and I have some ideas on how this can be done. Current idea is to set up a bunch of frames so you always draw a card in one of two positions. For example, if I can find a group of frames where I will always get either card 22 or card 50 in my opening hand, then I can put computer search at 22 and dugtrio at 50 to always guarantee a dugtrio. This type constraint is lenient enough that I can actually find a lot of frames which satisfy it.

It is also worth mentioning that shuffling advances the RNG by 120 and you shuffle your deck before the opponent shuffles theirs (the shuffle rules are a bit more complicated for club leaders but let's stick with this for now). This means that you and your opponent actually use the same set of shuffles: if you hit frame X and your opponent gets opening hand [9, 13, 20, 22, 44, 49, 53], then if you hit frame X-120 then you will get opening hand [9, 13, 20, 22, 44, 49, 53].

What makes this more complicated is the 0-basic mulligan rule: if your opening hand has no basic pokemon in it, you have to reshuffle it back and draw another hand. This gets particularly tricky if the opponent has to shuffle too: if you initially hit frame X, then the first mulligan will get the deck order at X + 240, but the second mulligan is at X + 360. Thus, if you both shuffle, your opponent has deck X + 360, but if you don't shuffle, your opponent has X + 240. What this means is that the cards in your deck actually influence the shuffle order and we can take advantage of this because it gives us more options for a favorable setup.

That looks like quite a lot of information for now, too lazy to write more. I'll probably release a python script that can tell you what you and opponent will draw once I clean it up a bit. For now here is the raw data:

All deck orders:
https://www.dropbox.com/s/aspltwzbwjtpf ... matted.txt

Same as above, but only opening hands:
https://www.dropbox.com/s/edpu7ycx6v2w6 ... first7.txt

Opponent decks:
https://www.dropbox.com/s/crsw38akwpe3fqa/Decks.zip

Locked

Return to “Pokémon Trading Card Game”

Who is online

Users browsing this forum: No registered users and 0 guests