9

For those of you who are unfamiliar, Super Mario 64 is an extremely competitive speed game, and because glitches are allowed on most major leaderboards, many very talented glitch hunters have torn the game to pieces.

One of the more obscure glitches is the ability for Mario to enter 'parallel' universes.

How does something so obscure and so unusual exist? What coding errors cause the game to create them?

16
  • 3
    Good article about it: pannenkoek2012.fandom.com/wiki/Parallel_Universe
    – aybe
    Commented Oct 25, 2019 at 10:48
  • 9
    I'm voting to close this question as off-topic because gaming.stackexchange.com is a much better place for this question. Commented Oct 25, 2019 at 14:05
  • 2
    So... it sounds like the short answer is: because floors on the map are stored with 16-bit integers, but objects are positioned with 32-bit floats and collision detection is handled via truncation, and sometimes you can accelerate an object quickly enough to cause it to escape the range of 16-bit integers centred on 0, after which it is detected to interact with floors outside of the normal level area?
    – Tommy
    Commented Oct 25, 2019 at 15:52
  • 6
    I don't see why this is closed, and yet Why does the Minus World exist? is highly-voted and still open.
    – Dranon
    Commented Oct 25, 2019 at 23:59
  • 2
    @Raffzahn "Why", in the present tense, asks for the reason something happens, i.e. why, when you run the game and do these things, the game spits out that result. That's the same as asking "how do they work?" – both are asking after the mechanism behind it. And this is a moot point; if you think the question could be improved for clarity, you can edit it.
    – wizzwizz4
    Commented Oct 26, 2019 at 10:39

1 Answer 1

12

This answer is based solely on the information here and the original Parallel Universe video.

There is a part of the game's code that detects whether Mario is standing on the floor. This part of the code uses 16 bits to process Mario's position in the X, Y and Z direction (so 48 bits total, but 16 bits per direction). 16 bits is enough to store a number between -32768 and 32767. The Y direction (up and down) is irrelevant, so let's focus on X and Z.

Let's say there is a floor you can stand on, at coordinates X=0, Z=0. If Mario is at the same coordinates X=0, Z=0, then the code will (of course) detect that he's standing on the floor at X=0, Z=0. And Mario will be able to stand on the floor.

Now let's say Mario is at coordinates X=0, Z=32769. When the game runs the code to check whether he's standing on a floor, it will try to store 32769 in 16 bits. 32769 is out of the range that will fit, and it wraps around to -32767. Then, the floor-checking code will look for a floor at the coordinates X=0, Z=-32767, which is not Mario's actual position!

If Mario is at X=0, Z=65536, then it wraps all the way around back to 0. Basically, any multiple of 65536 gets removed. So if there's a floor at X=0, Z=0, then Mario is allowed to stand at X=0, Z=0, or at X=0, Z=65536, or at X=0, Z=131072, or at X=65536, Z=0, or at X=65536, Z=65536, or at X=65536, Z=131072, or so on.

This makes a grid of valid positions for Mario, which is the "PU grid" (Parallel Universe grid). If Mario is in any position where it gets wrapped around for the floor check (i.e. any of his coordinates are less than -32768 or greater than 32767), then we say he's in a parallel universe.

This "bug" specifically affects the floor check. It does not affect many other parts of the game code, so many features of the game do not function in a parallel universe way, including things like wall checks.

Not the answer you're looking for? Browse other questions tagged .