Jump to content

Regarding Gen 5+ Pokemon Editing


english09

Recommended Posts

Starting with Generation 5, a Pokemon's PID and IV's are no longer correlated (thanks to the separate PIDRNG and MTIVRNG). It was said in practice that you could edit a Pokemon's IV's and it would still be considered "legal".

Question 1: Does that mean any combination of PID and IV's can be generated legitimately through normal gameplay (and on any date?), or just that Nintendo's Hack Checks won't notice (thus making the Pokemon technically legal but not really).

Additionally: In Generation 6 and 7, Pokemon now have an Encryption Constant along with their PID and IV's. In the 3DSRNG program, it shows that each frame has an associated PID, EC and IV's.

Question 2: Does that mean that IV's are once again tied to PID and EC (thus meaning you cannot just willy-nilly change IV's anymore while retaining true legality?)

By "true legality" I mean legality which will never be undermined by future discoveries and updates to PKHEX's legality checker (true legality being functionally identical to a legitimate Pokemon).

Lastly: If I want to generate PID and IV combinations that are identical to ones you could obtain through normal in-game means, is RNGReporter/PIDRNG the best way to do so (taking into account starting frames for specific Pokemon (i.e. Distortion World Giratina at 11))?

My goal here is to edit my Pokemon in a way which eliminates the risk of them eventually some day being identified as illegal if there are any new discoveries in Legality research (so I don't have to be worried about going back and re-editing them, which happened with one of my XD Pokemon with one of the more recent PKHEX updates).

Thanks again,

- english09

Edited by english09
Link to comment
Share on other sites

1. Yes, the correlation loosens from gen 4 to gen 5 but there is still a small relationship between PID and IVs. Each PID is correlated to an RNG frame, the problem lies within how gen 5 RNG works. Gen 5 RNG is based on your physical system, so theoretically there is no way to reverse search a PID and find a matching RNG frame. The relationship between PID and IVs  only determines the charateristic; Technically, any combination of IVs are valid as long as the characteristic is the same. Just make sure you don't get confused and say "all PID and IV combinations are valid".

IIRC Encryption Constant has the same effect in gen 6 and 7. but I'm not completely sure.

Kind of answered the other two questions with that lol. Yes, characteristic (as determined by IVs) is tied to PID in gen 5, and Encryption Constant in gen 6/7. In gen 5 you wouldn't be able to reverse search a PID, but you can find a valid PID and apply different valid IV spreads on them, as long as the characteristic is the same.

Link to comment
Share on other sites

On 12/19/2018 at 1:54 PM, ICanSnake said:

Gen 5 RNG is based on your physical system, so theoretically there is no way to reverse search a PID and find a matching RNG frame.

What about Generation 6 and 7? Are those based on the physical system and its MAC Address as well?

Link to comment
Share on other sites

1 hour ago, english09 said:

What about Generation 6 and 7? Are those based on the physical system and its MAC Address as well?

The RNG for Gen 6/7 is seeded by a value saved in your game (where that value comes from I don't remember and it doesn't matter), which is what allows RNGing via PokeCalc to work.
In Gen 6/7, the RNG is 128bits. Each output is only 32bits. That means there is 96 bits unaccounted for. There are more combinations of frames unaccounted for then accounted for.
This means there is no way to reverse the output and get the original frame. You can probably do it for up to 64bits (32 from the output and another 32 that was removed) given enough sequential outputs and computing power, but not an additional 64bits (to make 128 total).
This also means that for every possible PID (32bits), there is every combination of IVs (31bits) billions of times over.

Therefore we do not look at PID/EC/IVs/etc for a correlation.

Also I would like to add that LCRNG which was used in Gen 3/4 is not actually random, and that is how we were able to find correlations:
Linear_congruential_generator-triples.gi

Note the "windows" or "slats" that are created. Knowing what frames are possible is how we can do legality.
Fun fact, if you plot points for wild encounters, pokemon xd, and other "complicated" legality situations, you will get even narrower windows with more gaps.

Gen 6/7 uses fairly uniformly distributed (and a mindbogglingly large number of) frames.

2-Figure1-1.png

For anyone interested in seeing how this looks in realtime without having to do the work to set it up:
https://demonstrations.wolfram.com/LinearCongruentialGenerators/
http://demonstrations.wolfram.com/MersenneTwisterAndFriends/

  • Like 1
Link to comment
Share on other sites

20 hours ago, Sabresite said:

This also means that for every possible PID (32bits), there is every combination of IVs (31bits) billions of times over.

Therefore we do not look at PID/EC/IVs/etc for a correlation.

Does this also mean that for every possible PID you can get any Encryption Constant?

Link to comment
Share on other sites

44 minutes ago, english09 said:

Does this also mean that for every possible PID you can get any Encryption Constant?

I am not 100% sure about how many calls are made, but I would guess that there are at least 5: PID, IVs, Nature, Ability, and EC.
This obviously changes for wild encounters where there are more.
Since the maximum number for these calls is relatively low for most of the calls (25 for nature, 2 or 3 for ability, and 12 or so for encounter slots, plus level spread), the impact on unique spreads is low too. This includes full 32bit outputs like PID/IVs/EC.

Even if the number of sequential calls were enough to technically determine a contrived seed (which I am not convinced it is) it won't matter. It would take an impractical (50k+ super computers and months/years of time) amount of computing power to determine ONE spread.

I'll give you some more context as to how fruitless this is: You can capture pokemon every second for the rest of your life and have a near 0% chance of encountering a duplicate pokemon simply based on PID/IVs alone. If you include EC, it would never happen in 100k lifetimes.

To sum it all up, for practical purposes, you can get virtually any combination of PID/IVS/EC/Nature/Ability/Encounter for every RNG save seed.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...