Gameboy Development Forum

Discussion about software development for the old-school Gameboys, ranging from the "Gray brick" to Gameboy Color
(Launched in 2008)

You are not logged in.

#1 2019-09-24 07:17:38

Mozartkügel
New member
Registered: 2019-09-24
Posts: 4

Sprite stacking?

Hi guys! I'm new here, but I've always liked the original gameboy ever since I played super mario land on it over at my friends place back in the day. I've got a noob question here.

I've been playing around with some gameboy mock-ups of my work in progress game, and I feel I already found out most of the things I need to know about graphics and sprites on the gameboy for starters. One thing I couldn't find out though: can you stack sprites to achieve four colors instead of three, for example on the main character in your game, like you could on many other early systems (like on the c64 or msx for exemple)? Obviously you'd neet to take into account the ten sprites per line in your game design then too.

Thankful for any help! smile

Offline

 

#2 2019-09-24 14:15:57

Tauwasser
Member
Registered: 2010-10-23
Posts: 160

Re: Sprite stacking?

Yes, that's possible. However, you need to take into account the sorting (which differs between GameBoy and GameBoy Color) for it to work as intended.

Offline

 

#3 2019-09-25 01:58:53

Mozartkügel
New member
Registered: 2019-09-24
Posts: 4

Re: Sprite stacking?

Thanks Tauwasser! A fellow retro-developer enthusiast shared the info with me yesterday, so I thought I might post it here too if someone else new sees this thread and needs the info:

You can stack sprites, but you'll have two things to consider:

- As I said, only 10 sprites can be displayed on a single horizontal line. If you exceed that the number, only the 10 sprites with the lowest index in the OAM will be displayed onscreen.

- The display order is quite strange, especially on the original GB (it was fixed on the GBC). In theory, the sprite priority is simple: the sprite with the lowest index in the "object attribute" array is displayed over a sprite with an higher index. But, on the original GB, if two sprites overlap, their priority is actually relative to their current X position (the one with the lowest X position is displayed over the others).

So if you are stacking sprites, you may have some glitches related to this behavior. On the GBC, only the OAM index is used, so it's more reliable.

Offline

 

#4 2019-09-28 05:14:06

ISSOtm
Member
From: Somewhere in Echo RAM
Registered: 2017-04-18
Posts: 160
Website

Re: Sprite stacking?

Note that if two sprites are placed on the same X position, the OAM index is used as a tie breaker (basically like GBC priority)

As for the practicality of doing this, this will probably increase OAM usage (both in global and per-scanline counts), and the DMG screen isn't good with contrast, to a point where it's not always easy to distinguish all three colors in sprites; a 4th will probably look invisible.


The French Lord Of Laziness.
Legend of Zelda and Undertale fan, I also tend to break Pokémon R/B/Y a little too much.

Twitter | Me on GCL | Discord : ISSOtm#9015 | Skype : isso.tm (I don't login anymore)

Offline

 

#5 2019-10-04 17:14:04

AntonioND
Member
Registered: 2014-06-17
Posts: 134
Website

Re: Sprite stacking?

Take a look at the Harry Potter GBC games in an emulator. All sprites of people are actually made of 2 stacked sprites. I noticed once that I was playing and when there were two many people in the same line the color of the sprites disappeared but not the outlines (or something like that).

Offline

 

Board footer

Powered by PunBB
© Copyright 2002–2005 Rickard Andersson