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?

Mark Williams
  • 4,062
  • 1
  • 23
  • 50
Badasahog
  • 4,031
  • 3
  • 24
  • 61
  • 3
    Good article about it: https://pannenkoek2012.fandom.com/wiki/Parallel_Universe – Eric Cartman Oct 25 '19 at 10:48
  • 9
    I'm voting to close this question as off-topic because https://gaming.stackexchange.com/ is a much better place for this question. – manassehkatz-Moving 2 Codidact Oct 25 '19 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 Oct 25 '19 at 15:52
  • 1
    @manassehkatz I'm not so sure. It's talking about the implementation of the software, and how software and hardware interact to cause a specific program to exhibit a specific behaviour. If this wasn't a game, it would be on-topic, and (unless I've missed a rule change somewhere in the last several months) we don't treat games differently to any other pieces of software. – wizzwizz4 Oct 25 '19 at 17:17
  • @wizzwizz4 I'm really not so familiar with these games. It almost sounds like a feature rather than a bug. The game experts (here or elsewhere) can answer authoritatively. – manassehkatz-Moving 2 Codidact Oct 25 '19 at 17:21
  • @manassehkatz It's not a feature, but an implementation artefact. This is asking why it occurs. – wizzwizz4 Oct 25 '19 at 17:49
  • @wizzwizz4 Exactly, it's a glitch, not a feature, so a question of 'why' doesn't make any sense at all, as the only answer is "because" (of a bug). – Raffzahn Oct 25 '19 at 19:57
  • @Raffzahn The question of why does make sense, because there is a reason. It's like asking "why does this processor do XYZ when you put in an undefined opcode?" – why does Super Mario 64 do this when you put in a large value for Mario's position? – wizzwizz4 Oct 25 '19 at 21:02
  • @wizzwizz4 No, since the answer to Why is (in both cases) it's a bug. Thus asking Why is useless. Could it be, that the question you have in mind is not "Why" but "How"? – Raffzahn Oct 25 '19 at 21:10
  • 6
    I don't see why this is closed, and yet Why does the Minus World exist? is highly-voted and still open. – Dranon Oct 25 '19 at 23:59
  • @Dranon Highly-voted is because it hit HNQ. Though, beware of the Broken Windows effect – that question might be off-topic now due to scope drift, in which case it should be closed. – wizzwizz4 Oct 26 '19 at 09:44
  • 1
    @Raffzahn Is there a difference? The question uses one in the title and the other in the body. Here's another "why" that can be answered with "it's a bug". – wizzwizz4 Oct 26 '19 at 09:44
  • @wizzwizz4 Yes, there is a huge difference, why asks for a reason something happened, while how asks for the way it works. Why is there a gate is quite different for how does the gate work. Isn't it? And yellowing of plastic isn't man made nor a bug, but a chemical property. – Raffzahn Oct 26 '19 at 10:19
  • 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 Oct 26 '19 at 10:39
  • I think this could use an explanation what a ‘parallel universe’ actually is, but otherwise is in-scope. – user3840170 Aug 05 '22 at 04:40
  • Another pretty good exposition: https://youtu.be/9Oid5AkSzv4?t=1113 – user3840170 Oct 15 '22 at 08:30

1 Answers1

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.

user253751
  • 725
  • 8
  • 11