Actually making progress: tricked out metasprite routine
Moderator: Moderators
Forum rules
- For making cartridges of your Super NES games, see Reproduction.
Re: Actually making progress: tricked out metasprite routine
Not always enabled, since the subscreen is also used for hi-res; that said, color math and hi-res are the only two ways you can have the subscreen show up on-screen.
However, I did remember something; color 0 does not necessarily have to be black, because you can additionally have color math force main screen layers to be black. Using that, you could effectively force display of only the subscreen for those layers.
That said, when using this particular trick, I don't think there's a case where you'd need color 0 to not be black, because there's no circumstance where it would be displayed. Transparent areas on the subscreen would end up showing the subscreen backdrop color (COLDATA), not color 0.
However, I did remember something; color 0 does not necessarily have to be black, because you can additionally have color math force main screen layers to be black. Using that, you could effectively force display of only the subscreen for those layers.
That said, when using this particular trick, I don't think there's a case where you'd need color 0 to not be black, because there's no circumstance where it would be displayed. Transparent areas on the subscreen would end up showing the subscreen backdrop color (COLDATA), not color 0.
- Drew Sebastino
- Formerly Espozo
- Posts: 3496
- Joined: Mon Sep 15, 2014 4:35 pm
- Location: Richmond, Virginia
Re: Actually making progress: tricked out metasprite routine
I didn't know that the subscreen had a "different color 0".
Yeah, so effectively, BG3 in the center has all the advantages of any other background layer, it's just that it can't be for color math.
Actually, no, because I'm pretty sure Dracula X does this somehow:

Yeah, so effectively, BG3 in the center has all the advantages of any other background layer, it's just that it can't be for color math.
Actually, no, because I'm pretty sure Dracula X does this somehow:

Re: Actually making progress: tricked out metasprite routine
Yeah, it's outside of the normal 256-color palette, which is a little strange. Can be useful for some things though, like using color math with a solid color that needs to be different from the backdrop color.
Dracula X isn't using the same trick; it simply puts BG3 (the fire) on the subscreen, then applies color math to BG2 (the background), adding the fire to it.
The trick DKC3 uses only needs to be done if you want BG3 to not be transparent.
Dracula X isn't using the same trick; it simply puts BG3 (the fire) on the subscreen, then applies color math to BG2 (the background), adding the fire to it.
The trick DKC3 uses only needs to be done if you want BG3 to not be transparent.
- Drew Sebastino
- Formerly Espozo
- Posts: 3496
- Joined: Mon Sep 15, 2014 4:35 pm
- Location: Richmond, Virginia
Re: Actually making progress: tricked out metasprite routine
Yeah, from all this, it seems you can pretty much arrange the BG layers however you want to. Fine with me! 
I'll try and get started on my DMA tilemap thing now, that just stood out to me.
I actually had a genius idea of using a GBA tilemap editor and having 8 of the palettes look exactly the same and use the last palette bit as the priority bit but, I found out that the order of the bits isn't the same.
GBA: PPPPVHCCCCCCCCCC
SNES: VHOPPPCCCCCCCCCC
"O" is priority, the rest is self explanatory.
You know what, it would be much easier to just make a GBA to SNES tilemap converter than to deal with making one from scratch.
I'll try and get started on my DMA tilemap thing now, that just stood out to me.
I actually had a genius idea of using a GBA tilemap editor and having 8 of the palettes look exactly the same and use the last palette bit as the priority bit but, I found out that the order of the bits isn't the same.
GBA: PPPPVHCCCCCCCCCC
SNES: VHOPPPCCCCCCCCCC
"O" is priority, the rest is self explanatory.
You know what, it would be much easier to just make a GBA to SNES tilemap converter than to deal with making one from scratch.
Re: Actually making progress: tricked out metasprite routine
Nicole wrote:you can't use different color math modes at once
And here we have the exception that proves the rule. In pseudo-hires mode, you can blend the main screen and subscreen at 50:50, like the add and divide by two option, and also use colour math with the subscreen backdrop.Nicole wrote:color math and hi-res are the only two ways you can have the subscreen show up on-screen
The 50:50 blending in this case is only an approximation, since what it's actually doing is just alternating half-dots and betting on the TV being blurry enough for the result to look good. The COLDATA math is real though.
-
psycopathicteen
- Posts: 3001
- Joined: Wed May 19, 2010 6:12 pm
Re: Actually making progress: tricked out metasprite routine
So the subscreen only shows up on main screen backgrounds with color math enabled. What happens if a sub screen layer has color math enabled? Does that mean that layer shows up transparent everywhere?
Re: Actually making progress: tricked out metasprite routine
All in all, the SNES is incredibly flexible in the stuff you can do with its graphics settings. It's nothing compared to modern hardware of course, but I do feel like there's a lot of potential that hasn't necessarily been exploited in a lot of games.
However, it is possible to have a layer on both the main screen and the subscreen, so it's possible to apply a layer to itself in that case. What that does depends on the mode: addition would double the brightness of the color, since it's adding the color to itself; averaging would leave the color unchanged; subtraction would make the layer black; subtraction with halving would also make the layer black.
Color math only affects the main screen, essentially. If BG1 was in the main screen, BG2 was in the subscreen, and color math was enabled for BG1 (so BG2 was added to BG1), enabling color math for BG2 as well would make no difference whatsoever.psycopathicteen wrote:So the subscreen only shows up on main screen backgrounds with color math enabled. What happens if a sub screen layer has color math enabled? Does that mean that layer shows up transparent everywhere?
However, it is possible to have a layer on both the main screen and the subscreen, so it's possible to apply a layer to itself in that case. What that does depends on the mode: addition would double the brightness of the color, since it's adding the color to itself; averaging would leave the color unchanged; subtraction would make the layer black; subtraction with halving would also make the layer black.
-
psycopathicteen
- Posts: 3001
- Joined: Wed May 19, 2010 6:12 pm
Re: Actually making progress: tricked out metasprite routine
What happens if only BG2 has color math enabled?Nicole wrote:All in all, the SNES is incredibly flexible in the stuff you can do with its graphics settings. It's nothing compared to modern hardware of course, but I do feel like there's a lot of potential that hasn't necessarily been exploited in a lot of games.
Color math only affects the main screen, essentially. If BG1 was in the main screen, BG2 was in the subscreen, and color math was enabled for BG1 (so BG2 was added to BG1), enabling color math for BG2 as well would make no difference whatsoever.psycopathicteen wrote:So the subscreen only shows up on main screen backgrounds with color math enabled. What happens if a sub screen layer has color math enabled? Does that mean that layer shows up transparent everywhere?
However, it is possible to have a layer on both the main screen and the subscreen, so it's possible to apply a layer to itself in that case. What that does depends on the mode: addition would double the brightness of the color, since it's adding the color to itself; averaging would leave the color unchanged; subtraction would make the layer black; subtraction with halving would also make the layer black.
On the topic of animation, I think animation is pretty simple to program once you've already figured out what works and what doesn't. When I first started homebrewing I tried uploading every dynamically animated 16x16 sprite at a fixed 30 fps, in the same order they appeared in OAM. I ended up wasting vblank time, being limited to half the available sprites, and inflexible frame rates.
Last edited by psycopathicteen on Wed Jul 13, 2016 8:42 pm, edited 1 time in total.
- Drew Sebastino
- Formerly Espozo
- Posts: 3496
- Joined: Mon Sep 15, 2014 4:35 pm
- Location: Richmond, Virginia
Re: Actually making progress: tricked out metasprite routine
What now?psycopathicteen wrote:being limited to half the available sprites
Re: Actually making progress: tricked out metasprite routine
Color math only affects the main screen. If only BG1 is on the main screen, all you'll see is BG1. Color math doesn't do anything if the layer it's enabled on isn't on the main screen.psycopathicteen wrote:What happens if only BG2 has color math enabled?
-
psycopathicteen
- Posts: 3001
- Joined: Wed May 19, 2010 6:12 pm
Re: Actually making progress: tricked out metasprite routine
Back in 2010, my first attempt at dynamic animation, I did page switching on the bottom 8kB of sprite patterns to double buffer the sprites. I uploaded 4kB one frame, and 4kB the next, and then switched pages. Everything had to be animated at 30fps, and the oam was delayed a frame to sync up with the vram.Espozo wrote:What now?psycopathicteen wrote:being limited to half the available sprites
This caused a lot of problems. The first was having trouble getting it all in vblank. I wasted time trying to make an unrolled loop, but it still didn't work out. So instead I had it copy the sprite patterns to work RAM, and then DMAing it from there. This was so frustrating for me back then that I had to take a break in programming.
-
psycopathicteen
- Posts: 3001
- Joined: Wed May 19, 2010 6:12 pm
Re: Actually making progress: tricked out metasprite routine
You can probably do that to fake a background with Mode-7. Having a wall one color, with sprite bricks on the edges, and having the sky behind it another color.Espozo wrote:So, whenever you use the subscreen, color math is always enabled? It does kind of stink though, because color 0 can't necessarily be whatever you want it to be. I've found that DKC3 does a couple of cool tricks with the video hardware that the other games didn't, like I really like how the tree levels put a window layer behind each tree to have it to where each BG tile can look like it's partially over sprites instead of all or nothing:
About camera movement, wouldn't this be the way to detect what direction the camera has moved in? (assuming it doesn't move #$8000 in one frame)
Code: Select all
lda CameraX sec sbc PreviousCameraX beq camera_x_not_moved cmp #$8000 bcc camera_moved_right
- Drew Sebastino
- Formerly Espozo
- Posts: 3496
- Joined: Mon Sep 15, 2014 4:35 pm
- Location: Richmond, Virginia
Re: Actually making progress: tricked out metasprite routine
I've thought about putting a window layer behind BG3 to where you could potentially have 5 colors in one 8x8 block, like this could work great for clouds or mountains or something like that. You could also combine this with scrolling the BG layer vertically every couple of lines and also then changing the tilemap for 5 colors in an 8xWhatever sized area.
-
psycopathicteen
- Posts: 3001
- Joined: Wed May 19, 2010 6:12 pm
Re: Actually making progress: tricked out metasprite routine
Or fake a couple mode-7 clouds.
Random news: I'm actually working on adding duplicate checks to my game. I already added an animation number to every metasprite so it can use a "super long list" to point to a CHR table. I will eventually use a linked list too, but I need to have something working first.
Random news: I'm actually working on adding duplicate checks to my game. I already added an animation number to every metasprite so it can use a "super long list" to point to a CHR table. I will eventually use a linked list too, but I need to have something working first.
- Drew Sebastino
- Formerly Espozo
- Posts: 3496
- Joined: Mon Sep 15, 2014 4:35 pm
- Location: Richmond, Virginia
Re: Actually making progress: tricked out metasprite routine
psycopathicteen wrote:I'm actually working on adding duplicate checks to my game. I already added an animation number to every metasprite so it can use a "super long list" to point to a CHR table. I will eventually use a linked list too, but I need to have something working first.
