Home Artists Posts Import Register

Content

Welcome, everyone, to the 29th issue of Supper Mario Broth: Special Zone. 

Today, I will analyze a peculiar interaction in Super Mario Bros. where an off-screen Koopa Troopa shell will seem to disappear before suddenly reappearing.


Ghost In The Shell

If you have played Super Mario Bros. for any longer than a single playthrough, you have likely encountered this, or a similar, scenario:

In the footage, Mario defeats a Koopa Troopa and kicks its shell. Due to the shell going off-screen, it appears to have unloaded, as it does not seem to affect any of the Goombas that would be in its path. However, upon following the shell, it reappears and takes out the Goombas from the other side after rebounding. Somehow it phased through the Goombas while going one way just to hit them while going the other way.

In this article, I will be showing exactly what the prerequisites for this effect are and what is going on behind the scenes, as well as compare it to the Super Mario All-Stars and Super Mario Bros. Deluxe versions of the game.

First, we need to understand the behavior of the shell. Does it ever truly disappear? It is present in memory even when off-screen and is only rendered when on-screen? For this, let us try out following it more slowly. If the shell does not unload unless it is destroyed or falls into a pit, then it has nowhere to go if there is a Hard Block in its path, so it must appear on its way back.

Here, Mario stopped in the middle of the background hill after the four-Question Block formation (this hill will become important later on). The position is one and a half screens away from the Hard Block the shell is supposed to hit, however, waiting for around one second results in the shell completely disappearing.

As it turns out, it is the "camera", or rather, the extent to which the screen has scrolled, that determines when the shell unloads. Here is footage of the furthest the screen can scroll without the shell coming back:

Note that the screen stops scrolling just as the first Brick Block on the upper formation closest to the Hard Block staircase comes into view. Particularly, there must be fewer than 8 pixels of that block displayed on-screen for the shell to unload.

However, here is what happens if the screen scrolls only a few pixels further, past the halfway point of that Brick Block:

Now,  the shell returns due to the Hard Block being close enough so that it does not unload before hitting it. Through testing it extensively here and in other locations in-game, I can say that the deactivation distance for the shell is 5 and a half blocks offscreen, or 88 pixels. Since the game, internally, uses 8x8 tiles, this is a distance of 11 of those tiles.  Note that this distance is to the edge of the Hard Block, non-inclusive; as the game needs the next tile after that to be loaded to check if it is a Hard Block, the shell is active for 12 internal tiles off-screen. 

Here is a graph of the activation distance:

So, now we understand why sometimes the shell comes back and sometimes does not. However, this does not explain why it seems to not affect the Goombas on the way (or any other enemy if this is tested in other levels).

For this, let us look at the behavior of Goombas off-screen. Normally in Mario games, objects are loaded when they are a few blocks away from the edge of the screen. For example, in Super Mario Maker, objects are loaded in (this applies to most dynamic objects; exceptions apply) when they are 3 blocks away from the edge of the screen, but not 4. Thus, a Goomba placed on the third block of a course's second screen will walk on-screen all by itself when the course is started, while one placed on the 4th block will wait for Mario to approach it.

Let us look at the spawning positions of the Goombas in this part of World 1-1, using a data viewer:

As you can see, the first Goomba after the Koopa we have been conducting the experiment with is placed on the block that is on the right edge of the background hill, just to the right of the little black decorations on the hill; or in other words, two blocks to the right of the rightmost Question Block. Now, let us very slowly approach that location and see when the Goomba actually spawns.

It turns out that the Goomba spawns not when it is a certain distance off-screen, but rather, when the screen physically touches it. One could imagine the Goomba being frozen in time while outside the screen, and "coming to life" the moment the screen scrolls far enough to display even a single pixel of it.

Now we are ready to put this together. If the Koopa shell has an activation radius that extends off-screen, but Goombas are frozen in time when off-screen (i.e. not active and just waiting to be spawned), then the reason for the behavior we are investigating is that the Koopa shell simply passes by the Goombas due to them not being spawned. In the end, it is not the Koopa shell that disappears and reappears, it is the Goombas that do not exist when they are even slightly off-screen. Here is more footage of this in action:

Here, the Goomba is not affected even though it was 2 pixels off-screen.

This interaction is interesting because as video game players, we are conditioned to expect moving objects to disappear when they are off-screen, however, in this case, it is not the moving object that unloads, but the object that it is supposed to hit not yet being loaded in the first place.

Now that this is explained, let us take a look at how it happens in the game's remakes. In Super Mario All-Stars, the programming seems to be exactly the same:

Going past the distance of 88 pixels to the Hard Block will result in the Koopa shell rebounding from off-screen. This is moderately surprising due to some programming being changed in this version, such as Mario's jumping height and momentum after breaking a Brick Block. However, the real change can be seen in Super Mario Bros. Deluxe:

Note how the Brick Block can not be seen in the upper right corner, meaning the border of the screen is further away than the 88 pixel distance, however, the shell still comes back. Does this mean the distance was adjusted in the data? No; in fact, it is not the distance that was adjusted, it is the definition of "border of the screen". Take a look at this:

Unlike with Super Mario Bros., where the Goomba walks on-screen immediately after Mario moves the screen one last pixel to activate it, this Goomba appears slightly after Mario moves - in other words, in walks in from off-screen; something the Goombas in the original game cannot do due to the aforementioned "time freeze" whenever they are not on screen.

Also note that the edge of the screen is showing only the left side of the background hill and not the middle as in the NES footage. What this means is that Super Mario Bros. Deluxe has a "virtual screen border" that extends one block, or 16 pixels, to the right of the physical screen border. The virtual screen border acts like the original NES border in terms of spawning, but the physical screen does not display the rightmost block of it.

What this means is that it is theoretically possible to be ambushed by enemies walking in from off-screen in that version, which is not possible in the original.


This concludes today's issue. I hope this view into the spawning/despawning mechanics could be informative.

Thank you very much for reading.

Comments

Ariamaki

Easily one of the best pieces in the Special Zone so far, really enjoyed this walk through the material and the precise yet concise explanations. A great continuation to this new burst of 2020 activity!

suppermariobroth

Thank you very much for your kind words! I hope that the other articles of this kind that I have planned, where I take a close look at some interaction in a game and explain it using animated images, will be satisfactory as well!