So the intro to Final Fight 2 for the SNES has Maki calling up Mayor Mike Haggar on the phone, and Maki appears in a little "I'm on the phone" bubble, right?
It turns out that's done by having both of them be entirely background tiles, and on different layers.
Mike's office is layer 1, and Mika's place is layer 2.
Which means there's parts of Mika's background we never see!
There's nothing interesting there, it just continues the pattern, but it was neat to see how it's done.

As for how is it done... it's slightly tricky, but neat.
So the SNES graphics don't work like a PC: it's not bitmapped. You don't just have a bunch of pixels you can set individually, you have to deal in tiles and sprites.
This'd really limit what you could do with the game, so there's extra effects you can do on them.
The SNES has 4 layers of tiles, and you can scroll them separately, and in order to do more complicated effects, you can adjust them while the screen is being drawn... but with limitations.
The SNES was a console from the CRT era, so it is generating pixels in a specific order, so they can be shot out the electron gun towards the front of the CRT.
It starts at the top left, then goes to the top right, then goes down a line and repeats until it gets to the bottom
The graphics chip is separate from the CPU, so your code can be doing stuff while this is happening (which is not the case on some older system, like the Atari 2600!) but you have a tight time window for making any changes.
if you had a super-fast CPU, you could draw the whole screen in one color, and just vary it so fast that it'd change for every pixel drawn, and you'd get a pseudo-bitmapped display.
The SNES cpu... is definitely not that fast. It's 3.5mhz.
So you can't change this super-fast. But the SNES has special support to make some changes possible: HDMA!
So, DMA: On a simple naive computer, you don't need Direct Memory Access.
If you have code at place A and want it at place B, you just do:
for i in number_of_bytes:
read A+i into X
write X into A+i

and let your CPU copy each value byte-by-byte.
But this is slow, and maybe you want your CPU to be doing something else instead at this time?
So DMA was invented. Basically you have a DMA controller which gets programmed with a start address, length, and destination address, and it'll do the memory copying itself
So the CPU can be off doing important things like calculating if your character's missile has hit the enemy, while the DMA controller does boring things like copying sprites around.
The SNES has something called HDMA, which is a type of DMA that is automatically triggered during H-blank, which is when the screen finishes drawing a line and is getting ready to draw the next one.
So this makes it really easy to change something every single line, as you now just need to make sure your code is fast enough to change it once per line, and the HDMA will get it copied at the right time.
Neat. But will it work here? Well... no.
See, it's per-line.
You could use it to adjust which layer is on top (1 or 2), but since you can only change it per line, you'd be limited to a screen-wide rectangle, certainly not a circle.
You saw this kinda of use of HDMA on the NES, which only really had one layer of tiles. Like, look at this screenshot of Castlevania:
The top status bar doesn't scroll when the level does, but they're both on the same level.
This is because the code is changing the scrolling between the status bar and the main level display.
Otherwise they'd both scroll at the same speed, which'd look KINDA WEIRD
ok so we can't use HDMA.

It's not a sprite effect, either, so what's left?
The answer, is WINDOWS!
Not the Microsoft kind, mind you.
But the windowing effect: The SNES graphics chip has some special registers which let you decide how wide a layer is, by setting a left and right limit for that layer.
So if you tell it layer 1 is only half the screen wide, you'll see layer 2 in the parts the windowing registers are blocking.

But there's no matching "top" or "bottom" windowing setting. So windows have to be as tall as the screen, and you definitely can't make them circles.
So let's sum up what we know so far:
We want THIS:
and if we use HDMA, we can only change it per-line, so we'd get this:
And windowing only lets us set the left and right crop, so we'd get this.
Which, I mean, looks better? but it's still not great.
So we have no "circle transparency" option.
But wait, let's zoom into that circle we saw in the output image.
Notice how it's made of pixels? (everything is, but shut up)
Here's the trick: What if we think about the circle not as a circle, but as a bunch of horizontal lines?
Each one has a different width, but we can break down any circle into a bunch of horizontal lines, right?
And if each circle is just a bunch of horizontal lines, we can use these two tricks that wouldn't work on their own TOGETHER to make it work.
We use the windowing register to set the vertical column that gets shown... and use HDMA to change the width of that column with every single line drawn.
So now we can effectively crop out a circle of the background to draw over the other background!
A neat thing about how this trick gets implemented is that it's exactly backwards from how you'd do it in modern graphics.
Instead of making a transparent circle on the top layer and letting the bottom layer show through it, we're only showing parts of the "bottom" layer (actually the top layer) when the windowing makes it visible.
BTW, once you know how this trick is done, you'll realize it's used EVERYWHERE in SNES games.
For example... Super Mario World uses it and shows that the shape doesn't have to be a circle.
(from )
As long as the shape can be broken down into a set of single horizontal lines, you could build it using this effect.
so like you could do a capital I shape, but not a V or an H.
BTW, another use of HDMA that you might not have guessed was even a trick?
Gradients on dialog boxes in Final Fantasy 6 (aka US FF3)
instead of using tiles to make up the background, they are changing the background color every couple scanlines, use HDMA
the time gates in Chrono Trigger are another neat use of this effect, combined with a third one: palette cycling!
if you watch the palette while the time-gate is being shown, you'll see they're remapping 15 of the colors repeatedly.
And here's the thing: You know how I said the same windowing trick was used in Chrono Trigger?
Well, it is.
But not where you expect, exactly.
Check out this screenshot:
And here's the sprites being shown in that screen.

Wait, it's a sprite? It's just a sprite.
So if it's a sprite (well, several sprites), why do they need windowing?
So let's figure it out by stopping it.
Here's the effect with the windowing turned off.

It looks... fine? Not terrible, but something's missing.
and here it is with the effect turned on.
See the difference? There's a rim-light effect that's moving around semi-randomly! How do they do that?
More sprites? NOPE! Windowing!
it turns out if you turn off the swirly-palette sprite, the actual layer they're windowing looks like this.
It's a bunch of blobs scrolling around.
That whole layer actually looks like this.
It's a bunch of blobs made out of a few tiles. It gets moved around while the time warp is open, but you can only see a thin line of it since the sprite is over it.
so combine HDMA, windowing, palette cycling, a layer you never see fully, and a bunch of big sprites, and you get this lovely effect.
ANYWAY if you want more blibbering about SNES, I talked about a type of transparency that worked better in the CRT era here: https://twitter.com/Foone/status/1061486360073125888
or the time I talked about some neat expansions that were built into SNES carts: https://twitter.com/Foone/status/1177644211790729216
or the fact that two copies of Pilotwings can have exactly the same code in their ROM, but one will crash on the intro and one won't: https://twitter.com/Foone/status/1126996260026605568
You can follow @Foone.
Tip: mention @twtextapp on a Twitter thread with the keyword “unroll” to get a link to it.

Latest Threads Unrolled:

By continuing to use the site, you are consenting to the use of cookies as explained in our Cookie Policy to improve your experience.