Tuesday, May 9, 2017

The solid background flag

During normal operation, Plane A shows the foreground layer the player can interact with, whereas Plane B shows a parallax background which has no influence on gameplay. However, the two planes are completely interchangeable, except for the order the VDP in which draws them.


When you step inside this indoor section, the background in Plane B can no longer be seen, so the game can get rid of it. Instead of scrolling at a slower speed, Plane B is made to scroll at the exact same rate as Plane A. The background patterns are temporarily shifted aside and replaced with a pile of sand, carefully positioned so the highest point lines up with the cork object. Finally, the game turns on the titular background collision flag, which instructs Sonic to also check for collision with Plane B in addition to Plane A.


Everything is ready, so when you destroy the cork object, all the game has to do is start scrolling Plane B up. All the sand patterns have their high priority flags set, so they appear in front of Plane A's tunnel background. However, the terrain patterns in Plane A are also set to high priority, so it covers the rising sand. The result is that the sand appears to emerge from the ground, ostensibly piling up from the nearby torrent.

This trick was first used in Sonic 2 for Hill Top Zone's earthquake sections. In order for the transition to be seamless, the background must first be completely hidden from view, but Marble Garden Zone goes the extra mile.


The stage's regular background is attached to the top of the rising floor, and although vertical scrolling is sacrificed, the horizontal parallax keeps running like normal. While the whole thing is moving upwards. I don't even understand how they got that to work!

1 comment:

  1. I figure with all the work you've done for your ROM hack, plus the SonLVL definitions and stuff, you've probably already worked it out by now, but with the Nov. 1993 proto surfacing, I've been playing S3/S3C a lot and got curious about that MGZ scroll at the bottom of the post.

    From the looks of it in SonLVL - the rising ground is part of the background layer, and it has the dark green of the "bushes" in the background baked into it. The game seems to apply its regular (horizontal) BG scrolling to all but the bottom row of the background (the chunks you stand on), which is... I guess either handled by normal screen scrolling, or through careful parallax to keep it moving at the same rate as the foreground.

    I probably don't know enough ASM to follow S3K's code that well, but looking at it, it seems to use an "offset" screen/camera position of some sort for... something. I'd guess that's how it keeps the parallax from "leaking" into the solid tiles at the bottom, by keeping track of what the camera's "looking" at?

    Or maybe I'm just talking out of my ass here. One of the two.

    ReplyDelete