469
edits
mNo edit summary |
mNo edit summary |
||
Line 6: | Line 6: | ||
While the programmers did not intentionally use doubles very often, favoring single precision floats instead, they occasionally used them accidentally. | While the programmers did not intentionally use doubles very often, favoring single precision floats instead, they occasionally used them accidentally. | ||
<syntaxhighlight lang=" | <syntaxhighlight lang="C" line='line'> | ||
y -= sins(t) * 0.58; | y -= sins(t) * 0.58; | ||
t += 0x100; | t += 0x100; | ||
Line 15: | Line 15: | ||
The example given above is taken from the code controlling the oscillation of the platforms at the beginning of [[Bowser in the Fire Sea]]. Using the N64's rounding mode, the <code>y</code> variable, which represents the platform's height, will repeatedly return to its original value and continue oscillating with fixed maximum height. Even though each double to single conversion produces a small amount of error, this error balances out over the course of the platform's cycle. On the Wii VC, however, the error always accumulates in the same direction (upward if the platform is below ''y'' = 0, and downward if the platform is above ''y'' = 0), and so the platform slowly drifts in the vertical direction. This is known as '''Wii VC platform drift'''. | The example given above is taken from the code controlling the oscillation of the platforms at the beginning of [[Bowser in the Fire Sea]]. Using the N64's rounding mode, the <code>y</code> variable, which represents the platform's height, will repeatedly return to its original value and continue oscillating with fixed maximum height. Even though each double to single conversion produces a small amount of error, this error balances out over the course of the platform's cycle. On the Wii VC, however, the error always accumulates in the same direction (upward if the platform is below ''y'' = 0, and downward if the platform is above ''y'' = 0), and so the platform slowly drifts in the vertical direction. This is known as '''Wii VC platform drift'''. | ||
From its starting position of y=-3065 | From its starting position of y=-3065 until it reaches y=-2048, this platform rises 254 times by 1/4096th of a unit for each 256 frame cycle, 127 times as it goes up, 127 times as it goes down (at the peak and bottom of the oscillation cycle, the platform stays still so no rounding occurs). So doing the math, 127/128*1/4096units*30frames*60seconds*60minutes, we get that the platform drifts by ~13.0806 units/h. | ||
Once it passes y=-2048, the platform halves in rising speed: ~6.5403 units/h. The platform continues to halve in speed as it passes through y=-1024, y=-512, y=-256, and all other 2^n boundaries til it comes to a halt near y=0. | Once it passes y=-2048, the platform halves in rising speed: ~6.5403 units/h. The platform continues to halve in speed as it passes through y=-1024, y=-512, y=-256, and all other 2^n boundaries til it comes to a halt near y=0. | ||
As it passes through a 2^n boundary, its behavior becomes complex. Throughout its up-down oscillation cycle, the platform is sometimes past the 2^n boundary and sometimes not. The overall speed decrease as the platform's average height passes through the 2^n boundary is represented by a differential equation of < | As it passes through a 2^n boundary, its behavior becomes complex. Throughout its up-down oscillation cycle, the platform is sometimes past the 2^n boundary and sometimes not. The overall speed decrease as the platform's average height passes through the 2^n boundary is represented by a differential equation of <math>v_y=\frac{dy}{dt}=\arccos(y)</math>: the platform suddenly slows down quickly, then at a slower rate before it decelerates faster again, and finally, suddenly the platform's acceleration completely stops, the speed settling at a constant, half of what it started with. | ||
The platforms at the beginning of the level are below ''y'' = 0, and so they gradually rise upward. Over the course of several days, they are high enough they can be used to reach the elevator past the pole, which previously required one A press to get past. It takes eight days for the platform to reach high enough for a dive recover to land in the elevator shaft, but using [[Vertical Speed Conservation|VSC]] with a lava boost requires only three days. | The platforms at the beginning of the level are below ''y'' = 0, and so they gradually rise upward. Over the course of several days, they are high enough they can be used to reach the elevator past the pole, which previously required one A press to get past. It takes eight days for the platform to reach high enough for a dive recover to land in the elevator shaft, but using [[Vertical Speed Conservation|VSC]] with a lava boost requires only three days. | ||
Line 30: | Line 30: | ||
==Applications== | ==Applications== | ||
After several failed attempts by various players, the A press save in Bowser in the Fire Sea was console verified RTA on 20 Jun 2018 by ethanwhitesm64.<ref>[https://youtu.be/B1m-5LWOxW0 "BitFS 0x A Presses" by Ethan White]</ref> Six days later, pannenkoek2012 TASed the red coin star in zero A presses using a modified N64 emulator that replicated the rounding error.<ref>[https://youtu.be/Aa_CciaM4aM "Bowser in the Fire Sea with Red Coins 0x A Presses (Wii VC Only)" by UncommentatedPannen]</ref> | After several failed attempts by various players, the A press save in [[Bowser in the Fire Sea]] was console verified RTA on 20 Jun 2018 by ethanwhitesm64.<ref>[https://youtu.be/B1m-5LWOxW0 "BitFS 0x A Presses" by Ethan White]</ref> Six days later, pannenkoek2012 TASed the red coin star in zero A presses using a modified N64 emulator that replicated the rounding error.<ref>[https://youtu.be/Aa_CciaM4aM "Bowser in the Fire Sea with Red Coins 0x A Presses (Wii VC Only)" by UncommentatedPannen]</ref> | ||
==References== | ==References== |