Posts for Kaphotics

Post subject: Re: Regarding any theoretical TAS of a Pokemon game after D/P
Experienced Forum User
Joined: 1/25/2012
Posts: 10
Zowayix wrote:
However, according to Kaphotics, all the Pokemon games (or at least the most recent ones) use the same or very similar RNG mechanics. If the mechanics behind one are revealed, they will also be revealed for all the others.
It's not just the same RNG mechanics, they like to re-use the same process for tons of stuff because why change what works? PKM structure, scripting structure, rand call ordering/operations, saves...
Zowayix wrote:
without also opening avenues for dishonest Wi-Fi players to 'cheat' without any third-party devices?
They'd need a cheat device to pull it off. However, I've demonstrated on my YouTube that it is possible to 'hide' the AR by removing it before booting the target game. For tournaments, you can ensure that they aren't cheating by having them visibly start their games with the power off. Too bad the tournament interface takes a little bit of time to get to from a restart.
grassini wrote:
3If someone already knows the intricacies of the system,who can tell if somebody isn't already winning battles with knowledge of this?Spreading the word might help to counter this precious info.
Keeping quiet has worked well thus far :)
Patashu wrote:
IMO the best way to get a stronger RNG for the next pokemon game is to flagrantly and publicly abuse it as much as possible. Nip the problem in the bud so to speak :) (And the fact that programs like RNG Reporter exist mean that understanding of how RNG works is strong and that the capability is there anyway)
Pretty true, but that'd likely ruin the online (and tournament) interaction. RNG of Pokemon is inherently good; you can share the Pokemon you obtain with your hard work. For RNG in battles, it's a selfish thing that can't be done without cheating or emulating.
ais523 wrote:
(BTW, if this works on Poké Balls too, the information would be very useful in preparing for tournaments; we could RNG the catches as well as the Pokémon's stats.) But yeah, if someone manages to top the GBU ladder with this (preferably singles, because doubles is used for all official tournaments), it'd be a clear sign to TPCi that something is broken. They wouldn't be able to fix it before probably the sequels to X/Y, though.
It does work on Pokeballs, but why when you have false swipe. All in-battle rand() determinations are from the BRNG. As for topping the GBU ladder, xfr/bond697/myself have joked about it. Sure, doing it for the lulz would be cool, but other things are more important to us (personal life/school). If someone let the cat out of the bag, you might see it happening like 4ch gaming the Time Magazine polls. == When starting a battle, they generate a battle seed to operate entirely separate from the main PRNG and use it to calculate the random decisions. We know how that seeding routine works, and it's possible to game that seeding to get a luck riddled set of frames. It's essentially the same thing as RNGing a Pokemon, except that the timer0s are not constant (as they vary with time - main PRNG seeds at boot with the same starting set of params). The amount of parameters that play a role in seeding is quite large, so there's an exponential amount of seeds possible in Gen V relative to Gen IV. Only with an emulator (or using AR codes to cheat) can you abuse the BRNG seeds (because timer0 is veryfast). No player can naturally do that! The main vulnerability isn't that they openly give you your opponent's team (although they do, lol scripts).. it's that they don't sanity check. It's a quick fix to do the handshaking... but they haven't bothered because they don't expect people to abuse their games to this extent. The exploit is not just RNG related; someone's opponent on RM figured out a different way to exploit it. It's quite easy to put the pieces together, which is why I'm quiet about it all. We haven't let the information go to waste; at Pokecheck we've added battle video processing/playback emulation which has been a quite popular addition to the site's functionality!
Experienced Forum User
Joined: 1/25/2012
Posts: 10
No it's not possible to alter the outcome... Nintendo learned their lesson from RSE :)
Experienced Forum User
Joined: 1/25/2012
Posts: 10
jlun2 wrote:
Kaphotics wrote:
dem questions-- input file: The battle RNG can be abused online; for this reason I won't upload it because I do not want to openly share the information on how the battle RNG operates. I've demonstrated this to my friends at Smogon and we've decided to keep battle RNG under wraps due to BW being the active game.
So...if a TASer somehow figured it out alone, and submitted the TAS, online play would be wrecked? 0_o
Since I already uploaded a video of the run, the only thing the input file would provide is insight for how the luck manipulation worked. Everything but the Battle RNG is super easy to find information on; how I manipulated the Battle RNG is the majority of the luck abuse. That's the benefit of the input file, and giving out the input file is essentially giving out how to abuse the Battle RNG. That's my stance and it definitely won't change :P
Experienced Forum User
Joined: 1/25/2012
Posts: 10
dem questions-- input file: The battle RNG can be abused online; for this reason I won't upload it because I do not want to openly share the information on how the battle RNG operates. I've demonstrated this to my friends at Smogon and we've decided to keep battle RNG under wraps due to BW being the active game. critical captures: It's impossible to get a critical capture with a low Pokedex; I've seen that the current hypothesis on how CC works is not entirely accurate, it'll eventually be debugged but we have other priorities at the moment. surf: Last time I played through the game was almost a year ago, nobody had an answer for me in IRC so I just taught it anyways just in case. Surfing in Victory Road would be slower than biking through it. criticals: I was trying to PP manage, although low kick and rock throw are quicker I just don't have enough PP. patsen29 and GimMick explained this well :) duo-run: Mainly for PP management, switching took only a few seconds compared to many Pokecenter runs if I didn't. EXP is reduced when you get overleveled, and it gets boosted when you are underleveled. item attaching: I didn't want to waste time opening my menu so I think I did this whenever I had to switch Pokemon or something. The lost xp might have made a difference on what I could KO, idk. paralysis: there's really no opportunities to get paralyzed until the 4th gym, so I got it then. when I got healed there wasn't any quick opportunity; I didn't exactly need it at the time to KO stuff so I just got it at Victory Road. PP: The final stretch before the 8th gym was kind of hard; I didn't know if I was going to be able to take out the gym and cheren without healing. I ended up playing it safe and just healing. The plasma's Garbodor was the reason I switched, I think it was because my current pokemon couldn't OHKO with a crit. TMs: Kinda out of the way, ended up needing none of them. When a TM is taught the current PP won't change, only the max&move will. --- Last night I did an entralink abuse using the RNG to get a flawless beneficial nature Pokemon. Since it doesn't use the battle RNG (100% capture in entralink by default), I don't mind sharing it. Link to video I used (5215 - Pokemon - White (DSi Enhanced) (J).nds) ROM from the net, and a modified MAC address desmume (this is included in the zip)
Experienced Forum User
Joined: 1/25/2012
Posts: 10
uploaded a one-video of the complete run Link to video 3:01:56, I do believe it is possible with improvements (this was mainly just a dry run figuring things out as I went along) it will be possible to get under 3 hours. improvements: - getting Pokerus earlier than after the first gym (OHKO lvl8 oshawott maybe?) - doing it in winter to skip the hiker battle (saves at least a minute) - different nature to use ember a little if needed (blaze is active when I have ember) - managing PP a little better so that just enough is had for the gym & cheren battle before he heals you (no pokecenter heal needed) - abusing the MTRNG for evadable moves in the early half of the run (dont have to use water during gym battle) - Remembering to always talk to a trainer rather than having them ! @you (save a bunch of seconds overall) - C-gear can be turned on earlier to avoid waiting for NPCs, maybe during the 4th gym wait period. - did I even use surf? lol was fun doing this :P
Experienced Forum User
Joined: 1/25/2012
Posts: 10
Changing the nature would change the Gym Battle a bit. Panpour's +1 Water Gun does 20 damage with the lowest random variation, 14 without a boost (against a flawless un-dropped SpD) A change to a -defensive would decrease the respective defensive stat from 20 to 18 (assuming it was flawless IV'd to begin with). Argument against Naughty: That SpD drop would make the minimum Water Gun (SpA 19 -> 18 SpD) damage 24, and that's enough to 2HKO (from max 43 hp). Argument against Lonely: Take more physical damage from other opponents. You'd end up with less HP against the Panpour; then it wouldn't use Work Up because Water Gun would finish you off at +0. Argument against Brave: Pretty sure you won't outspeed the leader's Lillipup. The -Def might be the best option, if you're able to have 15 or more HP when against the Panpour. That's a difference of 3 HP from what I've done. However, after the many attacks absorbed I don't think a -Def run would arrive at 15 HP. It's worth noting that all trainers usually have 0 IVs for their stats. Cheren's level 8 Oshawott can't be OHKO'd by the critical max damage tackle. It's just not enough! ===edit run playlist http://www.youtube.com/playlist?list=PLCF0C3F84EC9781C2 3:01:56 including the credits (sav file). The last battle was completed before the 3 hour mark on both Total Time and Played Time.
Experienced Forum User
Joined: 1/25/2012
Posts: 10
Toothache told me to post this here. Earlier yesterday I uploaded a version where I forgot to use a XP patched ROM, fixed that and extended the video up to beating the first gym. Link to video youtube descrip
WIP: [Start ~ Trio Badge] Tool Assisted Speedrun of Pokemon White (english). Abuse of the RNG for Pokémon Nature/IV/Gender in addition to the Battle Outcome (criticals), which makes this the very first Pokémon B/W TAS utilizing these mechanics! Check out the Shiny Minccino that Professor Aragi has :D Run comments: Speed tie with Snivy, as Tepig has an Adamant nature. BRNG*2 = 0 for me to go first. Tutorial Catching is completely scripted, it ignores Battle RNG and Battle Options (plays animations). 2HKO on the Patrat because Ember doesn't do enough to OHKO with my -SpA nature. If I changed natures, I would not be able to beat the first gym without healing first. I ended up having to use a healing item anyway, but the ingame battle UI is quick compared to out of battle. The Gym Leaders are programmed to always OHKO if they can. Since this will probably be my first and only TAS, I'm not too competitive / worried about frames. I just want to be as fast as I can without worrying about exact frames to press buttons on. I used the turbo button function because I'm lazy =)
Experienced Forum User
Joined: 1/25/2012
Posts: 10
FractalFusion wrote:
Thanks, Kaphotics. By the way, I'd like to point out that when making the Ruby TAS, I found that the Lv. 8 Taillow is considered by the game as one slot (the 85-89 slot in that area). If Pokemon Ruby uses random levels, then I didn't know about it. Also, I've never seen vblank activate in the middle of encounter generation in Ruby/Sapphire, but I have seen it occur in Emerald. The technical details are interesting.
Oh, it doesn't use random levels, only for fishing (oops). The game does still uses a frame to calculate it however; on the Wiki page the ????xxxx between the slot and nature is actually the level calc. It's just a redundant calculation because (I think) the high and low values of wild encounter mons are the same (so it becomes rand%1 = 0) correcting myself: random level is [rand%(max-min +1 )]+min 85-89 corresponds to slot 7.
Slot      0     1     2     3     4     5     6     7     8     9  10  11
Rate    20%   20%   10%   10%   10%   10%    5%    5%    4%    4%  1%  1%
Value  0-19 20-39 40-49 50-59 60-69 70-79 80-84 85-89 90-93 94-97  98  99
Using the encounter table that was extracted from the ROM (this is constant between languages but different between color versions) we can see that that particular Taillow slot (7) occurs only at Route 116. Which is where you caught it :P The emulator speed running Sapphire (I've noticed) is fast enough so that almost everything follows "Method 1", where no vblanks interrupt the generation routine. Luckily, when you did it, the game found a suitable nature PID within ~24 PID iterations (fairly fast) so the chance of getting interrupted was essentially zero. Looking at RNG Reporter Method H-1 (your PID type), with your starting seed... we see... Pretty sweet. The game just so happened to give you what you wanted! It followed the selection routine perfectly. Since we normally use sweet scent instead of walking into patches, the wild encounter decision isn't considered in reporter's frame output. in addition to wild encounters, the <320 criterion for producing an encounter is only valid for certain areas. There's something called "density" which is usually 20 for most land routes. You can see the densities of each RSE location & encounter type here. It would be...
if (rand%0xB40) / 0xF          <    density
   encounter pokemon

alternatively written:

if rand%2880 < 16*D, encounter
For caves, the encounter rate is 2 times less. For water routes, the encounter rate is 5 times less :) --- The vblank interrupt is pretty annoying in FR/LG, where you see it usually interrupt like so: PID PID (interrupted) IV IV, following method 2. --- if you havent, be sure to check out the Researcher function in RNG Reporter. It allows you to output different operations on the RNG seed sequence to predict when certain events occur (say, pickup candies). eh, I guess this is directed towards anyone who isn't as skilled
Experienced Forum User
Joined: 1/25/2012
Posts: 10
just dropping by to further what FractalFusion said about the wild pokemon determination.
FractalFusion wrote:
I do not know if that is the root cause, but the developers seem to like fiddling with wild Pokemon generation that appears to be beyond just making one ability work. In Emerald, I discovered some time ago that it's even worse, and I'd rather not go into it now. I might eventually figure out the "how does it work" of it, but the "why" part of it I will never know. By the way, the new run will be on Pokemon Ruby. I know you might think it is slower, but the main reason is that we're using Taillow/Swellow for this one, like in cstrakm's run. I'll leave you to fill in the details. We hope to save another minute or so from the test run.
Over at smogon I (and a few other researchers) figured out the Pokemon selection, based on knowledge of the RNG of Gen 4. The tool we use is called RNG Reporter, and the lead programmer OmegaDonut has added in this selection method (dubbed Method H) http://www.smogon.com/forums/showpost.php?p=3655033&postcount=743 http://www.smogon.com/forums/showpost.php?p=3663648&postcount=747 Basically the game calculates if an encounter should occur, calculates the "Encounter Slot" (we have tables), then the Random Level via rand%(max-min)+min, then calculates what nature via %0x19. Then generates sets of PIDs until the nature of that pid matches the nature #. Then it generates IVs. (we don't know about PokeRus) There's something we've affectionately called the "vblank". It causes the different PID / IVs where a random number is "skipped". The game interrupts the PIDIV generation routine to do the ~60/s advancement. It results in "method 1 / 2 / 4" PIDIVs. We've gotten a really good handle on how the gen 3/4/5 games work
Experienced Forum User
Joined: 1/25/2012
Posts: 10
I've made a habit of derping around seeing what I can do on the games, and the RNG is one of my favorites. As almost everyone knows, we have been able to control the IV / PID RNGs in every game (gen 3/4/5) for awhile. However, the RNG in Gen5 changed to a 64 bit RNG, and the battle portion of it was not apparent. I got haxed out first round at a VGC regional so I felt it was appropriate to smash the game back with its own RNG that it uses for battles. Toothache already posted some information I gave him, but nothing really came of it... I've made a few research posts on the battle RNG over at Smogon, and corrected a few misconceptions in regards to protect rate and the "random damage" aspects of battle sims. Here's a preview of what I've been able to do, pretty much full control of the battle RNG. I'm not a TAS kind of guy, so don't expect full on runs from me! Link to video Link to video relevant posts regarding the battle RNG here