"This is invisible walls explained, once and for all."
April 16, 2024 6:18 PM   Subscribe

PannenKoek2012: "If you’ve wondered where I’ve been for the past 10 months, it was working day and night on this one video." (YouTube, 3hours, 45 minutes)

"Because nobody really seems to know what invisible walls are or why they’re there. So, I made it my mission to answer that, and put an end to the confusion. So come with me on this journey as we delve into the deep, dark, inner heart of invisible walls."

Pannenkoek knows more about Super Mario 64 than I know about anything, at all. Previously, more previously, and even more previously.
posted by The Pluto Gangsta (7 comments total) 12 users marked this as a favorite
 
I need to watch the video, but as someone who's been personally responsible for more than one invisible wall I am curious to know what he thinks.
posted by keep_evolving at 8:30 PM on April 16 [1 favorite]


Ah, thanks for posting this! I was going to myself, but decided to wait until I had watched the whole thing, and I still have a third of it to go.

It is long, so here's the basics:

What are often called "invisible walls" by players of Super Mario 64 are actually an emergent phenomon. There is actually very little modeled geometry in that game that isn't rendered on-screen. It is true that the game has both visible terrain that is rendered on-screen, and a different terrain that's used for movement and collision detection, but 99% of the time the two are the same. (The places that aren't are shown early in the video!) What presents the impression of invisible walls is rather complex, enough that most of the video is dedicated to showing how it works and all its examples in the game.

Super Mario 64 was the first game of its kind. There were 3D platformers before it (Jumping Flash is an oft-cited example), SM64 brought all the elements together with such immediacy and skill that, at the time, it looked magical. I remember seeing it for the first time, on a kiosk at a Blockbuster Video; it made such a strong impression. Here it was, a 3D version of the 2D Mario games, appearing like it was something that just existed, like it was a window into the Mario Universe, instead of something that had to be created, through over a year of hard work, by a team of dedicated designers, programmers and artists, on hardware that people's living rooms had never seen the likes of before. 3D platformers still largely follow its model.

But as PannelKoek's videos have shown, that illusion was largely hacked together using a lot of tricks and cheats. The Mario 64 engine is kind of a mess! Kaze Emanuar has been working hard at optimizing it and tuning it up in various ways, but the original is known to have problems, and those problems are what we percieve as "invisible walls."

Mario 64 divides terrain into three categories: walls, floors and ceilings. (PannenKoek's done three super in-depth videos going over the implications of this system, here, here and here.) The first interesting thing about the system is that the only difference between the categories, in the game's data, is the surface normal of each triangle in the collision terrain data. Triangles that are very close to vertical in respect to the game's axises are Walls; anything that faces up, and ranges from completely flat to deviating only very slightly from vertical, is declared a Floor; the opposite, triangles that face down, are Ceilings.

The way Mario operates in detecting nearby terrain in the collision data is presented in PannenKoek's videos as "hitboxes," but as an optimization a number of simplifications are done. One of them is that the coordinates of the triangles are "floored," turning floats (a number that can contain fractions) into shorts (numbers that are strictly integers, with no fractional component). Mario 64's worlds are small enough that this doesn't matter as much as you might think, as it still leaves a range of 65535 possible coordinates on each axis. But it does matter once in a while.

Three types of situations in the game's data produce invisible walls. One, geometry that has no rendered version, exists in the game but only in a very few places. Most of the time, it's caused either by what PannenKoek calls "Out Of Bounds," or the uncapped tops of Ceilings.

When Mario moves, the game looks through the level's data under his feet and looks for the nearest triangle. (This search itself is flawed, causing its own problems; PannelKoek goes into that case too) When it finds it, it determined whether it's a Floor or a Ceiling that it's found. If it finds nothing, that's Out Of Bounds. Out Of Bounds, both when it's actually encountered and when it's detected falsely by errors in the game's coding or level data, functions as an invisible barrier.

If Mario's movement takes him into OOB, it cancels movement: he's move up to the point just short of OOB, and doesn't move further in that direction. If he was moving fast, he "bonks," and that's often what's perceived by the player as an invisible wall. Out Of Bounds can readily be experienced at the edited of many levels, including Peach's Castle and Bob-Omb Battlefield, where it's the "edge of the world." Mario doesn't fall off there, even though nothing is visible in that area, he just stops moving. There are maps, like Thwomp's Fortress, where Mario can't so easily experience Out Of Bounds; this is because, though those maps appear like they're floating in the air amidst a sea of nothing, there is a floor: a big wide unrendered floor called the death barrier. The presence of that floor is what allows Mario to fall off the map to his death; if the death barrier floor weren't there, he'd be stopped at the edge of the visible terrain like on Bob-Omb Battlefield.

While it prevents Mario from falling out of the course in many maps, OOB isn't entirely friendly. If Mario somehow manages to find himself, not moving into Out Of Bounds, but in OOB, at the start of a frame, the game immediately kills him! That doesn't happen often, but it can occur in a few places, and PannenKoek demonstrates it a couple of times. OOB is experienced as invisible walls in the middle of levels mostly because of holes in the geometry, either real or falsely detected.

The remaining situations that can cause invisible walls are unbounded ceilings. Regardless of what's rendered on-screen, if the nearest triangle beneath Mario's location (which is a spot centered between the feet of Mario's on-screen model) is a Ceiling, without a Floor in-between, then the engine decides Mario must be colliding with it, and causes him to strike it. These situations happen about as often as finding Out Of Bounds. There's a lot of janky geometry in Mario's terrain. I wonder if it was all created by hand, piecing together coordinates on graph paper, instead of using a modelling program?

This is just a brief overview. It's a long video, but wow is it comprehensive. Time for me to dive back into it now....
posted by JHarris at 1:38 AM on April 17 [24 favorites]


Thanks for the explainer, JHarris! I’m not a gamer at all but was curious about what could cause this after watching the first few minutes of the video. But not enough for three more hours of video…
posted by congen at 6:23 AM on April 17


I'm sorry for the long comment, I've long enjoyed PannenKoek's Mario 64 videos, and posted them here a couple of times before! It's possible that I remember them a bit too well.
posted by JHarris at 7:18 AM on April 17


Yeah, I've been seeing this in my 3am insomnia scrolls on youtube but noticed it was almost 4 hours long. I'll have to break it up into multiple evenings, I think - they're very _very_ comprehensive, their "crashing mario 64 with a pendulum" video is similarly long and detailed and interesting.
posted by Kyol at 7:29 AM on April 17 [1 favorite]


jharris, that comment may be long, but it's several orders of magnitude shorter than four hours of video!
posted by egypturnash at 10:24 AM on April 17 [2 favorites]


I mentioned Kaze Emanuar above, they've got a new video out where they talk about how they've worked around and modified the Mario 64 engine for their own work.
posted by JHarris at 5:30 PM on April 20


« Older Meat asks the trivia questions.   |   Food Origins: Why Jesus never ate a banana Newer »


You are not currently logged in. Log in or create a new account to post comments.