Tuesday, June 6, 2017

What is a loopback?

The term "loopback" was first coined by GoldS in his legendary Sonic 3 and Knuckles Glitches and Oversights video series. Essentially, if you go beyond the natural end of some levels, you'll find yourself in an empty copy of the layout that's completely devoid of objects and shifted up for some reason.


So what exactly is going on, and why does it happen?

Well, the second question is easy. It happens because the developers neglected to properly set the horizontal size for levels in which they thought you would never be able to reach the physical end of. Generally speaking, this means it's left at the default value of $6000 pixels.


As for what's going on, think about it: a level layout is little more than an array of chunk IDs. Mapping that array across multiple horizontal rows is just one way to interpret it, kind of like word-wrapping some text over several lines. And just as with word wrap, an equally valid way of displaying the same data is to just ignore the limit and keep adding onto the same row. Which is what happens with level layouts, except for every row:


Notice how by simply continuing to draw chunks beyond the natural end of the level, we've managed to create an exact replica, except every chunk has been shifted up a single row, which lines up perfectly with what we see in-game. There are no objects because this is just a quirk in the level layout format: for all the game knows, the level really is that long; there's just nothing placed in that last bit.

No comments:

Post a Comment