Parallel Universe: Difference between revisions

no edit summary
(removed "Super Mario 64")
No edit summary
Line 1: Line 1:
[[File:ParallelUniverseViews.jpg|thumb|A diagram of Parallel Universe movement in [[Hazy Maze Cave]], after [[Mario]] has returned to the main map.]]A '''Parallel Universe''', or '''PU''', is an area in a map at which the game creates phantom floors, walls, or ceilings despite [[Mario]] being "outside" of the level. This is because the casted position value used to check for ground below Mario doesn't have enough bits to go above 7FFF<sub>h</sub> or below -8000<sub>h</sub>, unlike Mario's actual position, which is a [[float]].[[File:Visible PU.png|thumb|184x184px|Frame of [[Peter Fedak|Peter Fedak's]] video where he turns Parallel Universes visible using hacks; notice the lack of [[objects]]|left]] Though usually the term "PU" refers to a horizontal PU (i.e. one caused by truncation of Mario's X and/or Z positions), vertical PUs (where the Y coordinate is truncated) also exist. However, since Mario's Y position cannot exceed 20000 in most circumstances, there are only three ways to reach a positive vertical PU: Hyper Speed Flying, Platform Release Displacement, and Indefinite Owl Flight. Negative vertical PUs can be reached with Hyper Speed Flying, Platform Release Displacement, or an Overflow Jump. Since all object positions are floats, there are no [[objects]] in PUs unless Mario brings one there.
[[File:ParallelUniverseViews.jpg|thumb|A diagram of Parallel Universe movement in [[Hazy Maze Cave]], after [[Mario]] has returned to the main map.]]
 
A '''Parallel Universe''', or '''PU''', is a region of space located far outside the intended map boundaries that reflects certain aspects, especially the floors and/or ceilings, of the main map. When the game looks for floors below (or ceilings above) a given object, it first "truncates" the object's position from a floating point value to a 16-bit integer value. While the range of a floating point value is infinite, the range of a 16-bit integer value is -2<sup>15</sup> = -32,768 to 2<sup>15</sup> - 1 = 32,767. If a coordinate of the object's position falls outside this range, it "wraps around". For example, if one of these floating point values is 40,000, then 40,000 - 65,536 = -25,536 will be used when determining if the object is aligned with a floor or ceiling. This gives the illusion that the floors and ceilings of the main level map are "copied" repeatedly in a uniform 3D grid, at a spacing of 65,536 units.
 
[[File:Visible PU.png|thumb|184x184px|Frame of [[Peter Fedak|Peter Fedak's]] video where he turns Parallel Universes visible using hacks; notice the lack of [[objects]]|left]]
 
The truncation responsible for the existence of parallel universes is only performed when determining alignment with floors and ceilings. This means that walls and objects, both of which use floating point arithmetic to determine collision, do not "exist" in PUs, unless they are brought there.
 
== Vertical parallel universes ==
 
Though usually the term "PU" refers to a horizontal PU (i.e. one caused by truncation of the ''x'' and/or ''z'' coordinates of an object's position), vertical PUs (where the ''y'' coordinate is truncated) also exist. However, these behave completely differently to horizontal PUs. While truncated coordinates are used to ''find'' the floor below the object and the ceiling above the object, the original floating point values are used to determine what ''effect'' these surfaces have on the object.
 
For example, when Mario is less than 160 units below the nearest ceiling, he is considered to be "above" the ceiling, his vertical speed is killed, and he bonks. If Mario moves to a positive (upward) vertical PU, the "nearest" ceiling will be determined based on truncated coordinates, and will therefore be in the main map. But when checking whether he is above this ceiling, floating point coordinates are used instead, and so Mario behaves as though he is stuck in a ceiling. This behavior results in positive vertical PUs appearing to be filled entirely with ceilings.
 
On the other hand, when Mario is below his "nearest" floor, he will snap up to it. This means that if Mario moves to a negative vertical PU, he will, in certain circumstances, upwarp back to the main map. This is called an '''overflow jump'''.
 
It is typically difficult to get to a vertical PU. In the positive direction, there is a ceiling at ''y'' = 20,000 that prevents upward movement. We can bypass this ceiling by pressing against OoB, for example by using [[Hyperspeed Flying|hyperspeed flying]]. We can also use [[Platform Displacement|platform displacement]] or [[Indefinite Owl Flight|indefinite owl flight]] to reach a positive vertical PU.
 
In the negative direction, we can use a [[Negative Jump|negative jump]] to jump downward with large amounts of negative speed, or platform displacement.


==Travel and movement==
==Travel and movement==
[[File:Mario looking from a PU.png|thumb|251x251px|Mario looking to the original map from a PU]]
[[File:Mario looking from a PU.png|thumb|251x251px|Mario looking to the original map from a PU]]
Parallel Universe movement is comparable to movement through a five-dimensional space, as Mario can be modelled as travelling along five axes: relative X, relative Y, relative Z, PU X, and PU Z. This is because Mario can adjust his [[speed]] and [[angle]] to move relatively around the stage regardless of how many PUs he moves in the X or Z dimensions.


Since Mario's movement is split up into 4 quarter steps, and Mario cannot move out of bounds, in the game's courses Mario usually travels at least a '''Quadruple Parallel Universe''' distance, '''QPU''' for short. However, if one of Mario's quarter steps (other than the first one) ends out of bounds, the game will cut his movement short. In this case, Mario does not travel a full 4 PU, instead ending up at a quarter-step between the QPUs depending on where the movement is cut off. This is referred to as a '''misaligned QPU'''.
Parallel universes have found uses in both speed TASes and the [[A Button Challenge]] since they allow greater control of movement through a level. PU routing is comparable to movement through a five-dimensional space, as Mario can be modelled as travelling along five axes: three "relative" axes describing his position within the map, and two integers to specify which PU he is currently in. Mario can adjust his [[speed]] and [[angle]] to move relatively around the stage regardless of how many PUs he moves in the ''x'' or ''z'' dimensions.
 
Mario's movement is split up into four [[Movement Steps|quarter steps]], and if any of these quarter steps attempts to place Mario out of bounds, his movement is cancelled. Therefore in order to move to a PU, Mario's speed must be a multiple of four times the distance between PUs. If Mario takes all four quarter steps, then he will move four PUs in a single frame. This distance is called the '''Quadruple Parallel Universe''', or '''QPU''', distance.
 
If one of Mario's quarter steps (other than the first one) ends out of bounds, the game will cut his movement short. In this case, Mario does not travel the full QPU distance, and instead ends at whichever PU he made it to before his intended quarter step became out of bounds. This is referred to as a '''misaligned QPU'''.
 
As travelling to PUs involves moving very far from the origin, floating point imprecision can begin to have a significant affect on Mario's position, angle, and collision.
 
== Floating point truncation crash ==
 
While in theory the grid of PUs extends indefinitely, the behavior of the truncation operation becomes "undefined" when the floating point value is outside the range -2<sup>31</sup> to 2<sup>31</sup> - 1. The Nintendo 64 versions of the game crash when such a truncation is attempted. The Wii and Wii U virtual console versions of the game do not crash, though it is not currently known whether they wrap around the 32-bit integer range, or cap to the endpoints of the range. Nothing is currently known about iQue version's behavior in this case, since the usual RTA-viable methods of triggering this crash ([[BLJ]] and getting a bully stuck out of bounds) were patched in this version. Most emulators do not properly emulate the crash, except for a specific version of Mupen64, modded to crash correctly.


Floating point imprecision errors on [[Mario]]'s position and angle can affect movement in PUs, causing strange-looking rounding errors.
While movement to PUs at coordinates this large is rarely useful, this crash can occur due to other instances of truncation in the game, even in PUs close to the main map. For example, when determining Mario's tilt while walking, the game multiples Mario's speed by 16,384 and then truncates this value. This means that the game can crash in certain conditions when Mario has a speed of about 131,000, which is below QPU speed.


Parallel universes tend to crash on console due to floating point exceptions. There are at least 4 ways the crash can happen:
While not all conditions for these types of crashes are known, there are some that come up frequently. These are when:
* The camera enters a PU
* The camera enters a PU
* Mario bonks while in a PU
* Mario bonks while in a PU
Line 15: Line 43:
* Mario collides with a wall head-on with PU speed
* Mario collides with a wall head-on with PU speed


Note: It is currently unknown whether PU crashes occur on the [[iQue Player]] version of the game, since it is so hard to obtain.
== Miscellaneous behavior ==
 
== Gameplay ==


Many things can cause strange effects when done in a PU. For example:
Certain objects and graphics behave interestingly while in parallel universes. For example:
* Shadows and coin twinkle effects are glitchy
* Shadows and coin twinkle effects are glitchy
* Spawning a 100 coin star will [[Softlock|softlock]] the game
* Spawning a 100 coin star will [[Softlock|softlock]] the game
== Emulation ==
Most emulators (including the official [[Virtual Console]] versions) do not correctly emulate crashing due to floating point exceptions. A specialized version of Mupen64 was created that crashes when encountering floating point exceptions in order to better test PU routes.