Live data from Hacker News

Super Mario Bros warp zones were intended to work slightly differently [video]

youtube.com

41–50 of 108 posts

Re: Super Mario Bros warp zones were intended to work slightly differently [video]

#41

Understanding the cause of a bug like this is intriguing. Like, it's interesting to see a mistake in one of the greatest video games ever made that I could see myself doing.

Here's another :)

https://tcrf.net/Super_Mario_Bros.#Unused_Spiny_Egg_Behavior

https://tcrf.net/Bugs:Super_Mario_Bros.

Re: Super Mario Bros warp zones were intended to work slightly differently [video]

#42

I wonder if this kind of obsessive analysis of popular NES-era games will end in a couple decades, as the people who grew up in the console's heyday grow too old; or if they'll continue because interest in these particular games transcended a particular generation (and they're simple enough for people to really take them apart).

I don't think so. Those are the only generation of games that can be analyzed this thoroughly. Plus, computer geeks in the future will still be interested in the fundamentals of computing. And console games are really the only piece of mainstream software whose assembly would be interesting to look at. Granted, this is already niche content, and it will continue to be going forward. But I bet a lot of people watching…

SNES, N64, and even Gamecube (though less so) games get this level of scrutiny as well. Some examples are Mario 64 and Super Smash Bros Melee as some of the most popular examples on later platforms receiving assembly-level scrutiny.

Re: Super Mario Bros warp zones were intended to work slightly differently [video]

#43
post #2

For those who can't watch the video or just want a text summary: The underground 1-2 level is supposed to stop scrolling as soon as the mundane return-to-surface pipe comes onto the right edge of the screen. (Unless you're walking on the ceiling.) But because of a programming error, it keeps scrolling, revealing that the warp zone room is there. It was originally intended to be a much more hidden secret than it turne…

Bugs with the scrolling exists throughout the game though. You can do wrong warps within both 4-2 and 8-4.

Re: Super Mario Bros warp zones were intended to work slightly differently [video]

#44
Does anyone out there remember / have more information on an effort to actually create the warp pipes in real life?

I have a very distinct memory of reading about this in Nintendo Power magazine in the late 90s / early 00s but have never been able to find anything concrete on the internet about it. I'm curious if I'm having a Mandela Effect type thing going on.

Re: Super Mario Bros warp zones were intended to work slightly differently [video]

#45
post #2

For those who can't watch the video or just want a text summary: The underground 1-2 level is supposed to stop scrolling as soon as the mundane return-to-surface pipe comes onto the right edge of the screen. (Unless you're walking on the ceiling.) But because of a programming error, it keeps scrolling, revealing that the warp zone room is there. It was originally intended to be a much more hidden secret than it turne…

Even better. they take Y & expecting that condition to be false only when Y==0, but it appears to be false whenever the lowest bit of Y is 0, which means for any even numbered vertical position. Fantastic! Here Y is the vertical position of Mario (0--> on top of the level). So, one bug is: there was supposed to be a scroll stop unless Mario was on top of the level. Because you can scroll the screen while not on top o…

> The memory location is corrupted because they set a boolean flag with an increment operation, which of course causes an overflow instead of setting a zero to a 1.

Huh? No, the increment operation simply changes the warp zone control flag from 0 to 1. The valid values are normally 4, 5, and 6 (since they only use the low 2 bits to index into a table, and 0 is reserved for "no warp zone") -- so 1 is treated identically to 5.

Why this increment is even there is not clear at all, since the 1 should just get overwritten by a 4 later on, once the screen is scrolled all the way to the right and the warp zone is properly loaded. The only situation where this 1 has any effect is when entering the warp zone before it's properly loaded in order to go to the minus world.

Given that this increment is right after the nonsensical AND, I'm just gonna guess that whoever wrote this code was very sleep-deprived :)

Re: Super Mario Bros warp zones were intended to work slightly differently [video]

#46
post #2

For those who can't watch the video or just want a text summary: The underground 1-2 level is supposed to stop scrolling as soon as the mundane return-to-surface pipe comes onto the right edge of the screen. (Unless you're walking on the ceiling.) But because of a programming error, it keeps scrolling, revealing that the warp zone room is there. It was originally intended to be a much more hidden secret than it turne…

Even better. they take Y & expecting that condition to be false only when Y==0, but it appears to be false whenever the lowest bit of Y is 0, which means for any even numbered vertical position. Fantastic! Here Y is the vertical position of Mario (0--> on top of the level). So, one bug is: there was supposed to be a scroll stop unless Mario was on top of the level. Because you can scroll the screen while not on top o…

You can still get the minus world bug even if you go above the top of the screen. If you only fix the scroll stop AND bug, do the normal minus world bug, reach the right side of the screen, jump up on top of the level (to unlock the scroll), and drop down into the warp zone room as soon as possible, then the text hasn't loaded yet but you can still enter the pipes, which results in the normal minus world behavior. The real bug is that the scroll stop unlock object, for some reason, increments the variable the video author calls WarpZoneCtrl, resulting in it containing a value of 1, while the actual warp zone routine expects 4, 5, or 6, which it subsequently ANDs with 3 (removing all but the bottom two bits, leaving 0, 1, or 2). Entering this subroutine with an incorrect value of 1 results in the value remaining 1 (since 1 AND 3 is equivalent to 5 AND 3) and thus treating the warp zone as world 5, which is corrected when the routine that prints the warp zone text appears. The real minus world bug is the incrementation of WarpZoneCtrl. Removing that, and keeping the value at 0 until the warp zone text loads, makes the pipes use the last known pipe destination - the L-pipe that leads to the normal 1-2 level end.

The video author did not discuss level 4-2, but I would presume there may be a similar scroll unlock object present at the end of that level (in fact, my long history of playing SMB1 leads me to remember that I feel like I have also experienced in 4-2 that slight scroll hiccup the author mentions if you jump just right and keep the low bit of your X position set). However, since the standard end-of-level warp zone in 4-2 is meant to take you to 5-1, and there is only one pipe, the minus world bug doesn't apply as entering the routine with WarpZoneCtrl set to 1 is equivalent to entering it with WarpZoneCtrl set to 5.

Re: Super Mario Bros warp zones were intended to work slightly differently [video]

#47
post #2

For those who can't watch the video or just want a text summary: The underground 1-2 level is supposed to stop scrolling as soon as the mundane return-to-surface pipe comes onto the right edge of the screen. (Unless you're walking on the ceiling.) But because of a programming error, it keeps scrolling, revealing that the warp zone room is there. It was originally intended to be a much more hidden secret than it turne…

Do you happen to know why the minus world is the way it is? Was it a level that was designed, or is it a level where it's rendering some random program or other data? I'd love to learn more about that part too.

Re: Super Mario Bros warp zones were intended to work slightly differently [video]

#48
post #47
post #2

For those who can't watch the video or just want a text summary: The underground 1-2 level is supposed to stop scrolling as soon as the mundane return-to-surface pipe comes onto the right edge of the screen. (Unless you're walking on the ceiling.) But because of a programming error, it keeps scrolling, revealing that the warp zone room is there. It was originally intended to be a much more hidden secret than it turne…

Do you happen to know why the minus world is the way it is? Was it a level that was designed, or is it a level where it's rendering some random program or other data? I'd love to learn more about that part too.

The minus world is technically an out-of-bounds level. The game treats it at world 36-1 (since the digits are tile numbers 0-9, followed by the alphabet, then a space tile at $24 or 36). Since doing so reads a whole host of other data out-of-bounds as well, it ends up pointing at the level layout for 2-2, but without the data that properly sets the pipe destination, resulting in an infinitely-looping level.

Other versions of SMB have different minus worlds (and some versions had the bug either fixed as in Super Mario All-Stars, or blocked off as in VS Super Mario Bros). Famicom Disk System version of SMB1 has a three-level minus world that ends with a Bowser fight that completes the game as if it was 8-4.

The minus world is a total bug. It was not designed or intended to exist. The bug was solely the result of the INC WarpZoneCtrl instruction that the video author mentions, which makes the game treat the warp zone pipes as the 4-2 warp zone until the text appears. Remove that INC, and the game will instead dump you out as if you'd gone in the L-pipe prior to the warp zone.

Obviously this bug doesn't exist at all in SMB DX for Game Boy Color, as it is a completely rewritten engine. I would presume the bug didn't exist at all in Super Mario Bros 35.

Re: Super Mario Bros warp zones were intended to work slightly differently [video]

#49

TIL these games were written in assembly.

Yes, it was the only way to do the weird optimizations and tricks needed to make a cutting edge real time game like Mario.

Even in the '90s developers embedded assembly in the performance critical areas of C code.

Re: Super Mario Bros warp zones were intended to work slightly differently [video]

#50

Earlier quoted context omitted.

Even better. they take Y & expecting that condition to be false only when Y==0, but it appears to be false whenever the lowest bit of Y is 0, which means for any even numbered vertical position. Fantastic! Here Y is the vertical position of Mario (0--> on top of the level). So, one bug is: there was supposed to be a scroll stop unless Mario was on top of the level. Because you can scroll the screen while not on top o…

> The memory location is corrupted because they set a boolean flag with an increment operation, which of course causes an overflow instead of setting a zero to a 1. Huh? No, the increment operation simply changes the warp zone control flag from 0 to 1. The valid values are normally 4, 5, and 6 (since they only use the low 2 bits to index into a table, and 0 is reserved for "no warp zone") -- so 1 is treated identical…

Perhaps they meant to increment another variable and typed the label or address wrong (labels back then were generally much more limited in length on the average development system, I bet that the actual name for the variable in question was nowhere near the length of WarpZoneCtrl, most likely it was limited to 6 or 8 characters). I don't know the low level logic of the engine enough to know if there is a different variable that it would actually make sense to increment in this place.
Post reply on HN