Wii VC Round-to-Zero: Difference between revisions

From Ukikipedia
Jump to navigation Jump to search
m (Nim moved page Wii VC Round-To-Zero to Wii VC Round-to-Zero: Proper capitalization)
No edit summary
Line 1: Line 1:
[[File:WiiVC BitFS.png|thumb|300px|right|Stream by Switchpalacecorner, after 71.5 hours of raising in Wii Virtual Console]]  
[[File:WiiVC BitFS.png|thumb|300px|right|Stream by Switchpalacecorner, after 71.5 hours of raising in Wii Virtual Console]]  
[[File:WiiVC BitFS 146hr.png|thumb|300px|right|After 146.5 hours (6 days 2.5 hrs)]]  
[[File:WiiVC BitFS 146hr.png|thumb|300px|right|After 146.5 hours (6 days 2.5 hrs)]]  
'''Wii VC Round-To-Zero''' is a special phenomenon caused by emulation inaccuracy exclusive to [[Virtual Console|Wii Virtual Console]] (Wii VC). This is a new glitch discovered on May 28, 2018, that contributes to the [[A Button Challenge]].
'''Wii VC Round-to-Zero''' refers to an emulation inaccuracy in the [[Virtual Console|Wii Virtual Console]] (Wii VC). When converting a double precision floating point number (a "double") to a single precision floating point number (a "float"), the N64 typically uses the round-to-nearest rounding mode. This means that if the double is not exactly equal to a float, it will round up or down to the float that is closest in value to the original number. While this behavior is accurately emulated by most emulators and the Wii U VC, the Wii VC instead uses the round-to-zero mode. This mode will always round the double up if it is negative, and round it down if it is positive.


In the Wii Virtual Console, it is possible to raise the moving platform at the beginning of [[Bowser in the Fire Sea|BitFS]], due to a rounding error that is unique to the Wii Virtual Console. It is believed this happens because the Wii doesn't round double precision floating point numbers to the nearest single precision float, as the [[Nintendo 64|N64]] does, but instead rounds to the one closest to zero (truncation). Since the moving platform is below 0, it tends towards it. It is possible to use a dive recover in about 8 days, and it is possible to use [[Vertical Speed Conservation|VSC]] with a lava boost in 3 days.
While the programmers did not intentionally use doubles very often, favoring single precision floats instead, they occasionally used them accidentally.


The glitch was discovered by '''Andru!''' when he went to sleep leaving the Wii powered on for several hours in Bowser in the Fire Sea (BitFS), and found that the oscillating platforms had left their original positions.<ref>https://www.youtube.com/watch?v=MFxJuq3FRgI&feature=youtu.be</ref>
<syntaxhighlight lang="c">
y -= sins(t) * 0.58;
t += 0x100;
</syntaxhighlight>


==Applications==
In the above code sample, <code>y</code> and <code>sins(t)</code> are both single precision floats. However, in C, the numeric literal <code>0.58</code> is a double since it lacks a trailing <code>f</code>, as in <code>0.58f</code>. This causes the expression to evaluate to a double, which is then converted to a float before being stored in <code>y</code>. Examples such as this one arise in many places in the game's source code, and over time they result in large discrepancies between the N64 and Wii VC versions of the game. For this reason, TASes produced for one of these platforms can not generally be played back on the other without desync.
Currently, only the blue moving platforms in BitFS and LLL on Wii Virtual Console are known to have this property. The original N64 and the Wii U Virtual Console do not have this rounding error.
 
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 platforms at the beginning of the level are below ''y'' = 0, and so they gradually rise upward. Over the course of several days, they become high enough that 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 get high enough to dive recover into the elevator shaft, but using [[Vertical Speed Conservation|VSC]] with a lava boost, this time is reduced to just under three days.


The glitch was fully console verified RTA on 06/20/18 by ethanwhitesm64,<ref>[https://youtu.be/B1m-5LWOxW0]https://youtu.be/B1m-5LWOxW0</ref> and used by Pannenkoek2012 to collect the red coin star 0x 6 days later using a modified N64 emulator that replicated the rounding error.<ref>[https://youtu.be/Aa_CciaM4aM]https://youtu.be/Aa_CciaM4aM</ref>
The glitch was discovered by '''Andru!''' when he left his Wii powered on overnight while in Bowser in the Fire Sea, and noticed that the oscillating platforms had left their original positions.<ref>https://www.youtube.com/watch?v=MFxJuq3FRgI</ref>


The first attempt, by ethanwhitesm64, failed because he DR'd to early and missed the platform.<ref>https://www.twitch.tv/ethanwhitesm64/clips</ref>
==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]https://youtu.be/B1m-5LWOxW0</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]https://youtu.be/Aa_CciaM4aM</ref>


The second attempt, by barruuuu, failed because after a successful DR, he overshot the elevator and when he ran back, he fell through the hole.<ref>https://clips.twitch.tv/OpenDependableClintVoteNay</ref>
No other console or emulator is known to reproduce this rounding inaccuracy, including the Wii U VC. At the time of its discovery, the bug did not occur on the Dolphin emulator, but has since been corrected.


The third attempt, by Switchpalacecorner, failed because after a successful DR, the top moving platforms loaded and moved down below the lava. While it is possible to get the next platform using the side ledges, Switch missed it and fell down back to the first floor.<ref>https://clips.twitch.tv/TriumphantHelpfulYogurtSeemsGood</ref>
No other objects are known to have similarly exploitable behavior, though the rounding bug does cause many discrepancies between the original and Wii VC versions of the game, including slightly different surface normals.


==References==
==References==
<references/>
<references/>

Revision as of 06:00, 15 August 2018

Stream by Switchpalacecorner, after 71.5 hours of raising in Wii Virtual Console
After 146.5 hours (6 days 2.5 hrs)

Wii VC Round-to-Zero refers to an emulation inaccuracy in the Wii Virtual Console (Wii VC). When converting a double precision floating point number (a "double") to a single precision floating point number (a "float"), the N64 typically uses the round-to-nearest rounding mode. This means that if the double is not exactly equal to a float, it will round up or down to the float that is closest in value to the original number. While this behavior is accurately emulated by most emulators and the Wii U VC, the Wii VC instead uses the round-to-zero mode. This mode will always round the double up if it is negative, and round it down if it is positive.

While the programmers did not intentionally use doubles very often, favoring single precision floats instead, they occasionally used them accidentally.

y -= sins(t) * 0.58;
t += 0x100;

In the above code sample, y and sins(t) are both single precision floats. However, in C, the numeric literal 0.58 is a double since it lacks a trailing f, as in 0.58f. This causes the expression to evaluate to a double, which is then converted to a float before being stored in y. Examples such as this one arise in many places in the game's source code, and over time they result in large discrepancies between the N64 and Wii VC versions of the game. For this reason, TASes produced for one of these platforms can not generally be played back on the other without desync.

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 y 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 platforms at the beginning of the level are below y = 0, and so they gradually rise upward. Over the course of several days, they become high enough that 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 get high enough to dive recover into the elevator shaft, but using VSC with a lava boost, this time is reduced to just under three days.

The glitch was discovered by Andru! when he left his Wii powered on overnight while in Bowser in the Fire Sea, and noticed that the oscillating platforms had left their original positions.[1]

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,[2]. Six days later, pannenkoek2012 TASed the red coin star in zero A presses using a modified N64 emulator that replicated the rounding error.[3]

No other console or emulator is known to reproduce this rounding inaccuracy, including the Wii U VC. At the time of its discovery, the bug did not occur on the Dolphin emulator, but has since been corrected.

No other objects are known to have similarly exploitable behavior, though the rounding bug does cause many discrepancies between the original and Wii VC versions of the game, including slightly different surface normals.

References