Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - SadisticMystic

Pages: [1]
1
Generation VII Glitch Discussion / Damage rollover
« on: May 11, 2018, 09:23:01 pm »
So it turns out that the damage formula that's been in place ever since BW is structured so that if the damage figure, or any intermediary result at any point in the formula, exceeds 2^32, only the lowest 32 bits of precision are kept and anything above that is simply discarded without incident. Even as this capacity has apparently been in the game for quite a while, it became much easier to reach the rollover point with the uncovering of Rollout storage, and in fact that mechanic is what first led me to hypothesize the existence of this one, and then to concoct the test suites that would definitively prove it was a real thing. I have three separate battle videos, all recorded on the Ultra games (under the battle protocol version that corresponds to patch 1.1-1.2), that demonstrate this in various ways.

AHMW-WWWW-WWWL-YQN7
Here the attacker is a level 95 Pikachu, with a raw attack stat of 239 after a Power Split (since 239 is too high for Pikachu to reach without that help), then +6, Light Ball, Huge Power, and Flower Gift all applied on top of that. The defender is a minimum-defense Smeargle at -3 (the smallest change that makes it possible to reduce a stat to 1 point), and Pikachu (who was turned into a Water-type specifically to remove STAB) is using Bolt Strike with the help of a Charge last turn, two Helping Hands this turn, and a latent 32x boost from rollout storage. Those numbers were carefully calibrated so that upon multiplying all the main factors together, the result would be 4,295,116,800. But the registers in the 3DS can't hold a number that big, so it really counts as just 149,504, and this scenario sees to it that everything in the damage formula that comes after that point is focused on knocking the number down, not building it up. Between the burn, the double resist, the usual division by 50, and the random variation roll, the damage range would have been around 10 million if rollover wasn't a thing, but if it was, I would expect a damage range of 317 to 374. Sure enough, the actual damage ended up being 347, which could fit within Mew's health bar (after it transformed into Smeargle) without being a KO. In the battle video, you can observe that it survives in red health.

55VG-WWWW-WWWL-UQGX
This one is especially egregious. Mewtwo goes Mega-X (increasing its attack stat from 346 to 522 in the process), steals a Belly Drum, and gets its ability changed to Huge Power, before a level 74 Mew transforms into it (because I specifically wanted the combo of 74 and 522, and this was the most convenient way to do it). Later on, a level 1 Growlithe gets to -6, and with the help of Sunny Day and Flower Gift, Mewtwo proceeds to use Flare Blitz (via Me First, for a 50% bonus) against Growlithe. This time, if you multiply together all the factors that led to rollover in the first video, you only get 34,953,120, which fits with plenty of room, but we're not done yet. Weather boosts don't apply until after that big multiplication, and they're also not implemented in the most intuitive way: instead of being "multiply by 3, then divide by 2", a positive weather boost is actually "multiply by 6144, then divide by 4096". Normally there's not much of a difference between those two operations, but of course it's possible to get a rollover in between those two steps, and the 6144 version is far more susceptible to it. In fact, this test was again carefully engineered so that the rollover after the multiplication would reduce the number to 81920, and the division further knocks it down to 20, enough so that with just the single resist afterward, the level 1 Growlithe survives with its standard health bar, as the damage range is 8-10.

GBXG-WWWW-WWWL-YQNC
This setup was built along similar lines to the first one, but with slightly tweaked numbers. Pikachu is now level 100 instead of 95, its attack stat after the Power Split is 269 instead of 239, and instead of a Charged Bolt Strike, the attack it uses is Power Trip with 10 boosts (for 220 power). This was intended to produce the number 4,295,047,680, which would roll over to the smaller margin of just 80,384, and after the burn and the resist, the damage range was supposed to be 170-201. But upon trying it out in practice, the damage dealt was only 74, which is smaller than my prediction by enough of a margin that even an extra factor of 1/2 wouldn't be enough to get down that far. I suspect the culprit here is something that has to do with the inner workings of Power Trip, which hasn't yet been documented, but since it takes a pretty precise landing spot to roll over by just enough of a margin that the remainder doesn't exceed a Pokemon's health bar, it's unclear what that mechanism could be. Increasing the move power to 221, for instance, would cause the margin of rollover to exceed 40,000 damage, which is way too much to be detectable. Any ideas?
Pages: [1]