Programming DPP/HGSS Method 1/J/K IV Checker

A while back, I was wondering about IV checkers. The current standard is, as far as I know, Metalkid's, because it can use Rare Candy information to pin down the IVs more accurately. However, there's a lot more information out there that can help pin down IVs; Metalkid's also handles Hidden Power type, but perhaps the biggest source of information is the RNG. Pretty much anyone who's tried to make a Shoddy team with a legendary knows about the IV/Nature restrictions that the RNG places on them; for instance, you can't get a flawless Adamant Method 1 legendary (which is most of the non-event legendaries in the game). The same applies to other less interesting Pokémon, too, from flawless right down to awful IV sets, and can be used to narrow down the possible combinations of IVs.

There are other ways to narrow down IVs, too. If you know the time at which you pressed "Continue" to start your current session at playing the game (not all that accurately; like RNG Reporter, my checker only needs the minute), that clamps the possible RNG seeds down dramatically; people who are IV checking to determine how their RNGing went wrong are definitely going to know this, but it's a plausible piece of information to check whenever you load the game if you're planning to be doing serious IV checking as it is. (People who soft-reset for legendaries the "old-fashioned" way, for instance, shouldn't have much problem checking.) I've managed to IV-check a level 15 Pokémon, freshly bought from Game Corner, down to one plausible possibility (and a few unlikely ones) via this method. Better still, once you've IV-checked one Pokémon in a session, you know what seed it was caught at, and future Pokémon caught without restarting the game can then be IV-checked very accurately even at extremely low levels. This is not useful in most cases, but is very useful when catching Pokémon to determine your frame during RNGing; RNG Reporter can sort-of do this, but not really (it relies on using an IV checker to come up with IV ranges, then plugging them as bounds into RNG Reporter, which is time-consuming and requires a lot of human intervention).

Therefore, I've created an RNG-aware IV checker. Even for a Pokémon which isn't method 1/J/K-created, it's around as good as Metalkid's, although with a rather different interface (it can incorporate all the same information, though). For Pokémon that are, though (that's pretty much all 4th gen Pokémon; the really major exceptions from a competitive point of view are bred and chained Pokémon, and there are a few minor exceptions too), it can help give a more accurate check than any other IV-check method, and it has features to help in RNGing. As a bonus, I've added in an IV-to-PID feature (which is trivially added if you're messing with the RNG anyway), and likewise an IV+TID-to-SID feature (which I'm surprised hasn't been automated on any of the online checkers yet, given how suitable for computer calculation the formula is, although RNG Reporter can do it).

Although I don't have anywhere permanent to host it, the HTML file can be downloaded from http://filebin.ca/gksxq/method_1_IV_finder.html and viewed locally. It's still a work-in-progress at the moment; originally, I just made it for my own benefit (I'm experimenting with unusual forms of RNGing), but I realised it would be useful for other people too, so here it is in C&C. Let me know what you think (or just lock the thread if I'm really off-topic here...)
 

eric the espeon

maybe I just misunderstood
is a Forum Moderator Alumnusis a Researcher Alumnusis a Top CAP Contributor Alumnusis a Tiering Contributor Alumnusis a Top Contributor Alumnus
I'm not a wifier so won't be using it personally, but this looks very cool indeed. If you're looking for a host, I can make some enquires about getting a finalised and tidied up version of this this added to the site.

If you're looking for suggestions, adding an option to input EVs, allowing for "unknown" as the characteristic, and an option to disable the RNG specific parts to save slower computers would be good if you want this to be a more general use calc. Maybe use a checkbox for multilevel IV checks on the same Pokemon rather than two buttons?

Nice tool, hope we can find a good home for it.

Edit: And as a token minor nitpick, the forme names you used are non standard (i assume you got them from shoddy?), the standard form names are on this page.
 
I've updated the IV checker; it's now at what would be the proofreading stage, if it were an analysis. The current version is stored temporarily at http://filebin.ca/rpdto/iv_stat_legality_checker.html (again, you have to download it from that location to use it; better hosting would be appreciated). I've incorporated all the suggestions in the thread (allowing nonzero EVs, allowing unspecified characteristic, an option to not use the RNG-based check, and fixing forme names (and stat names) to the Smogon standard); however, I changed the interface for Rare Candy IV checking altogether, to be more like Metalkid's calculator), as well as a few changes of my own. Probably the biggest is that I've tidied up the interface a lot, to make it look more professional; most of the optional features are hidden behind checkboxes, much the same way as in Doug's damage calculator. It now does four main things (calculate IVs, calculate stats from IVs, calculate SIDs, and search for legal Pokémon with IVs in a given range); it's been expanded to incorporate information about gender and ability (which can be pretty important in cutting down probabilities; if you've just caught a female Combee, the fact that you were lucky enough to get a female puts strong constraints on which nature/IV combinations are possible). The legal-IVs-within-range calculation can be used to find good Hidden Power spreads for legendaries, or just near-flawless legal spreads if you want something other than Modest or Timid (the only natures which flawless non-Wondercard legendaries can have). In terms of the algorithm, it now also takes the characteristic tiebreak into account (which makes IV readings on Pokémon with two or more equal IVs, such as near-flawless Pokémon, much more accurate). I suppose it could even be used for a rudimentary hack check (testing lots of things that many hackers might not think of), although of course it would be easily fooled by someone who knew what they were doing (like all other hack checks!)

The tool can also be useful for RNGers; it duplicates the IV Check (obviously), Seed Finder, and IV to PID features of RNG Reporter (mostly because the features are useful, and it was only a few more lines of code to add them as the information had to be calculated). I've been using it in some of my own RNGing experiments, where using the full power of RNG Reporter would be too clunky (mostly because I needed to do quick RNG-enabled IV checks; strangely, RNG Reporter's IV checker ignores the RNG). I've modified it to work out a suitable delay and frame for any IV spread you want (although some of them are rather awkward to hit; not all spreads are good for RNGing!), although the one it chooses might not always be the one a human would choose, especially if the Pokémon in question is available on HGSS (it tries to choose values comfortable for DPP, because they work for HGSS too, but there are some combinations which work in HGSS but not DPP). Mostly, though, it's just meant to be a really good IV checker. (It regularly gets Pokémon of around level 48 down to one possibility even without the help of Rare Candy or prior information about the RNG seed; and it's even got a level 15 Pokémon down to one plausible possibility with no information but info about the Pokémon itself, and the time at which the DS was switched on, information that players can easily record if they want to. I think this is better accuracy than all other IV checkers, although I'm not sure.)
 

eric the espeon

maybe I just misunderstood
is a Forum Moderator Alumnusis a Researcher Alumnusis a Top CAP Contributor Alumnusis a Tiering Contributor Alumnusis a Top Contributor Alumnus
Mostly for RNGable spread searching, allowing you to plug in a hidden power power range would be a nice addition. Also, how often would it be useful to have multi level checks with different EVs for each level?

New version is much better imo, like all the changes to it. This is becoming an extremely versatile tool.
 
Mostly for RNGable spread searching, allowing you to plug in a hidden power power range would be a nice addition. Also, how often would it be useful to have multi level checks with different EVs for each level?

New version is much better imo, like all the changes to it. This is becoming an extremely versatile tool.
Hidden power power range is entirely doable; I'll need to find somewhere on the interface to put it, but that shouldn't be too hard. As for different EVs at each level, I don't see what the point would be; EV-training takes time, and multilevel checks are normally done by using Rare Candies then resetting. The setting in question would therefore be useful only in the situation that someone was carefully training a Pokémon while tracking EVs, IV checking at every level; and it's hard to imagine someone doing that in most cases, and someone with that level of commitment would likely be able to allow for the EVs by hand. (That said, I can just-about imagine someone really committed power-levelling with their starter to check its IVs, then resetting if they were bad.)
 
New version posted, available at http://shaym.in/apps/iv_checker as before. (If you want to use it locally, just download the HTML file via file | save page as... or right-click on the link then choose save target as... (for Firefox, other browsers will have similar commands).) As well as several bugfixes, there are many new features; Hidden Power power range has been added (to help for finding possible spreads with good legendaries), but the new features are mostly RNG-related; the application's now fully-featured enough to allow RNGing of method 1/J/K Pokémon without using RNG Reporter (although it isn't a substitute for the whole thing due to having fewer features, it is a lot faster for very specific questions like "flawless Timid Kyogre"). Upon choosing a spread (either in terms of stats or IVs), all the pertinent RNG information not shown elsewhere on the table, such as one possible session seed ("initial seed" in RNG Reporter terminology), and a time and date needed on the DS to hit that seed, is shown on hovering the mouse over the delay. Additionally, support for method J and K frame calculation has been added, and it turned up something interesting to even battlers who never touch Wifi.

Currently, Shoddy, and presumably other simulators, use an algorithm for checking the legality of legendaries and event Pokémon that's the same regardless of the Pokémon; they check to see if there's a valid Method 1 seed for the Pokémon in question. This makes for a pretty good check, because for all Method J and Method K spreads, there's an Method 1 spread identical but for the frame number. Unfortunately, the reverse isn't true; there are a very few spreads which, for instance, have a Method 1 and Method K frame, but which are unreachable via Method J. This matters because some legendaries are unavailable in-game via Method 1, and are forced to a fixed nature by events (for instance, Heatran is Method J only in-game, and the event Heatran is always Quiet). This means that an IV spread like Timid, 30 HP/30 Def/30 SpA (all others 31), which might seem vaguely plausible for an HP Grass Heatran that's mostly a special attacker but doesn't want to drop Explosion's power any more than the negative nature does, is actually impossible, even though such a spread is completely legal for, say, Kyogre or Giratina (Kyogre is available in generation III, or as a Method K in HGSS; Giratina is available as a method 1 in HGSS). The problem is that there just isn't a frame that hits the spread in question, not even with the help of Synchronize. (Incidentally, do Cute Charm, Magnet Pull, etc, work on a similar mechanic to Synchronize internally, or is it completely different? If it's similar, it could maybe make some of the apparently impossible spreads possible.) This seems to be a rather rare occurence, but it does happen occasionally.

One other large difference with Method J/K spreads is that just as there can be no Method J, or Method K, spread corresponding to a Method 1 spread, there can be more than one; often a very wide range of frames is possible. For a flawless Method K Timid Kyogre, for instance, 14 different frames are possible; for the delay/seed combination chosen by the IV checker, they range from 71 to 111 (other combinations are possible and would give different frame numbers, but not change which frames were possible and which ones weren't). One piece of information that's very important for catching such Pokémon is what sort of Synchronizer is needed to hit the frame in question (in that case, all of them require a Timid Pokémon with Synchronize to work, but some frames might allow other natures of Synchronizer, or even require no Synchronizer at all). Going outside the realm of legendaries, another very useful piece of information is to do with which Pokémon appear where when RNGing. For instance, can you catch the flawless Modest Ditto with seed 469FB838 (the only seed for a flawless Modest Pokémon that's at all easy to hit in practice, although two others are theoretically possible) anywhere in Johto or Kanto? It turns out that the answer is yes, but only in certain locations; for instance, it's possible on Route 47, but not on Route 34, vital information to anyone intending to get a flawless Ditto of their own (because Ditto can't be bred, it has to obey the method J/K restrictions in Gen IV, probably the only non-legendary that has that issue). Another new feature allows the user to click on a Method J/K frame to get a list of all the encounter slots where it can appear (which can be translated into in-game locations using a guide like http://www.eggmove.com/encounterheartgold.htm which crossreferences Pokémon, routes, and encounter slot numbers), and what sort of Synchronizer is required to be able to hit those slots in practice. (As a bonus, it's more convenient than RNG Reporter's report of the same information because it lists all the slots at once, rather than requiring the user to check each frame separately.)

There are a few other random enhancements as well, mostly improved hover information. Try the new checker out, and let me know what you think! (Also, from a technical point of view, I'm wondering about browser compatibility; as I use Linux, I only have Gecko-based and WebKit-based browsers installed (so it should work on Firefox, Safari, and Chrome), and in particular I'm wondering if it fails horribly on Internet Explorer 6, like pretty much everything else that isn't specifically designed for it does. I hope not, though.)

(A note to Shoddiers wanting to know about wifi legality, btw: anything in DPP affected by Synchronize is method J, anything in HGSS affected by Synchronize is method K, pretty much everything else is method 1. Or you can find lists of methods, at least for DPP, in Smogon's article about ingame RNGing.)
 

eric the espeon

maybe I just misunderstood
is a Forum Moderator Alumnusis a Researcher Alumnusis a Top CAP Contributor Alumnusis a Tiering Contributor Alumnusis a Top Contributor Alumnus
Just checked on IE8.. None of the checkbox options bar "Use IV range rather than IVs" make the appropriate options appear, and most things are a bit ill sized. It also has a random 33 here: "the Pokémon must be shiny. 33 ". yay IE. I'll test more/get some screenshots after exam tomorrow.

Good stuff on the extra features!
 
Just checked on IE8.. None of the checkbox options bar "Use IV range rather than IVs" make the appropriate options appear, and most things are a bit ill sized. It also has a random 33 here: "the Pokémon must be shiny. 33 ". yay IE. I'll test more/get some screenshots after exam tomorrow.

Good stuff on the extra features!
I see what you mean. At least the random unexpected 33 should give a big clue as to how exactly Internet Explorer is mangling the page; maybe I'll be able to guess how to fix it. (Or even find a copy owned by a friend and fix it that way.) The screenshot for IE8 lists an "Unbekannter Laufzeitfehler", German for "Unknown runtime error"; at least it told me what line number it was on, but unfortunately the calculator seems to be hitting a bug in MSIE. Perhaps I'll be able to change things round a bit in order to keep IE happy.

At least the same site implies that the page renders correctly, at least, in Safari and Chrome (which I could only test indirectly); because there's a lot of JS involved even in the rendering, hopefully if that works everything else will too. (Opera doesn't quite render correctly, but it's close enough, and I have a feeling it'll work anyway.) Ugh, I hate IE...
 
A quick run-through of the source yielded this immediately after the paragraph, which is where the 33 appears:

Code:
<span id="widthcheck">33</span>
widthcheck is called in your JS here:

Code:
    var ivwidth = document.getElementById("widthcheck").
        getBoundingClientRect().width;
    for (var n in statabbrevs) for (var i=0; i<=31; i++)
        document.getElementById(n+i).style.width = ivwidth;
    document.getElementById("widthcheck").style.display="none";
}
I don't do much JS, but perhaps you should add
Code:
#widthcheck { display: none; }
or something to the stylesheet?
 
A quick run-through of the source yielded this immediately after the paragraph, which is where the 33 appears:

Code:
<span id="widthcheck">33</span>
Aha, I've got what happened. The 33 is set to display: none in JS, but in IE none of the JS runs because it crashes with an unknown runtime error earlier, so it never gets hidden. This also explains eric the espeon's observations that the hide/show boxes didn't work in IE (presumably because the setting display to none and to default in JavaScript was failing for some reason).
 
New version up, http://shaym.in/apps/iv_checker as always. I've improved the interface slightly and added support for the Wondercard method of IV generation, but there are only really two major improvements. First, I've tried to get this working cross-browser; it's been tested on Firefox, Chromium, IE6, and Opera. (I couldn't get IE7 or IE8 running to test, but I've checked whether the bugs I found in IE6 carried over to IE7 and IE8 as well, and hopefully incorporated appropriate fixes. There are some really bizarre bugs in IE6...)

The other change I've made is to add extensive instructions for use (which could do with a grammar check!) They're hidden behind a link at the top by default, because they're rather long.
 

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

Top