Friday, September 1, 2017

Act transitions, part 5: horizontal underflow

Marble Garden Zone's act 1 boss is interesting in that it is already waiting for you on screen as you walk up to it, much like his earlier appearances in the level. This creates an opportunity for a standalone Sonic 3 exclusive bug to emerge. Once again, this was documented by the legendary GoldS in his glitches and oversights video series.


Essentially, because the boss spawns within the level's boundaries, a second player can use Tails to run up ahead and start damaging the boss before player 1 advances the camera into its final position. If the boss is defeated under these circumstances, then when the act transition occurs, all sprites are deleted from the screen and the game locks up.


So what's happening here? The image below once again illustrates where the camera usually locks in the act 1 layout.


Whereas the image below illustrates the matching position in the act 2 layout, once the act transition has taken place.


Uh-oh. Unlike Mushroom Hill Zone, the act 2 layout starts at the exact point of act 1's camera lock, with no grace region preceding it. As such, if act 1 is cleared before the camera scrolls into place, the transition will set the camera's position to a negative value, which is interpreted as a really high positive value, effectively removing the left bound on the object and ring object loading routines, causing them to try and load everything, which quickly destroys the game.

Incidentally, if you defeat the boss while it's still off screen, but then move all the way to the right before the level results start, you survive the act transition, since the camera's position is set to zero. However, the left boundary is still stuck at a negative value, so when the level results end and the player is released, the left boundary pushes him far beyond the end of the level, which is counteracted by the right boundary pushing him back, making the camera scroll to the left and once again leading the ring loading routine into unbounded territory.

Sonic & Knuckles fixed this by forcing the left boundary to move into place when the boss is defeated, but it introduced another bug: first the boundary moves, and then it checks if it needs to continue moving. So if it was already in the right position, it will nonetheless move once, making the level one pixel narrower than the actual screen, resulting in a jittery camera lock when you move from one side of the screen to the other.

4 comments:

  1. So THAT'S the reason the game crashes.

    Though this kind of horizontal underflow is not Sonic 3 exclusive - it can be also done with Hyper Sonic in ICZ1.

    After glitching through Knuckles' path to his boss, nothing prevents you to trigger the transition and immediately double jump back to spawn outside of the level.

    This doesn't freeze the game, but it does reset it.

    ReplyDelete
    Replies
    1. Yeah, the ICZ stuff is really interesting and I'll make a post about it soon.

      Delete
  2. Nineko documented this error in September 2006, a few years before GoldS: https://www.youtube.com/watch?v=S_Ttg0wYC6M

    ReplyDelete