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.

Ads

#1 2017-04-20 23:03:56

Alexander the bat
Member
Registered: 2017-03-19
Posts: 31

About Mapping the sprites into a tilemap

So if I'm right Color 0 is always transparent for sprites and mapping or whatever is zero and If I made a tile map will that be transparent as well? the way I look at Dr Mario GB game it has a blue for first then white as second but it's not transparent for the blue color sprites!

how could this be if the sprites are laid out on a map would Color 0 be transparent? I'm basically redrawing the sprites to into it to my Dr Mario Like game that is under my own engine title Headache, it's bascially crazy that the map has blue sprites under color 0 and it's not transparent.

I'm confused on this as I dig into the game and build something similar to the Dr Mario Engine.

Also it's universal with Gameboy Color so how to work the BG palettes so they all work together with the mapping like the title screen and stuff?

Last edited by Alexander the bat (2017-04-21 00:34:58)

Offline

 

#2 2017-04-21 05:06:40

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

Re: About Mapping the sprites into a tilemap

There's transparency on neither of the background or the window.

The renderer more or less checks for which pixel to render in this order :
Sprite pixel, if there is a sprite with a non-color 0 pixel
Window pixel, if the window is present on that pixel
BG pixel, always.

There's only transparency for sprites.


Example with images, taken from BGB's VRAM viewer :

Both of the sprites displayed in the top-left corner of the screen use OBJ palette 0 :
https://puu.sh/vrk6L/f570d12ec0.png
Now, OBJ palette 0 has the following colors, which includes a blue-green color 0 :
https://puu.sh/vrk47/55d5dbe9a6.png
The tile display shows the tiles as having the blue-green color :
https://puu.sh/vrk8l/99afd3f944.png
But on-screen, every pixel which you would expect to have that color lets the background pixel "below" appear.
https://puu.sh/vrkcC/f59acf5e5a.png

Which essentially means that sprite color palettes have only three colors.
But there's no such mechanic for the background, so all four colors of a background palette will be rendered.
Example :
- This tile uses orange, brown and black (colors 0, 1 and 3)
https://puu.sh/vrkkd/47c1c6b971.png
- This one uses orange, brown and light blue (colors 0, 1 and 2).
https://puu.sh/vrkl6/5ca96a769c.png
Full color palette :
https://puu.sh/vrkmO/b85417ae61.png

(Having only three different colors on one tile is a design choice, not a hardware limitation)


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

 

#3 2017-04-21 19:51:49

ssjason123
Member
Registered: 2017-03-21
Posts: 38

Re: About Mapping the sprites into a tilemap

There is a mechanic for drawing sprites behind the background. By using the "OBJ-to-BG Priority" bit on the sprite attribute you can display OBJ behind the background colors 1-3, color 0 is always rendered behind the OBJ.

From the pandocs "VRAM Sprite Attribute Table (OAM)"

Byte3 - Attributes/Flags:
  Bit7   OBJ-to-BG Priority (0=OBJ Above BG, 1=OBJ Behind BG color 1-3)
         (Used for both BG and Window. BG color 0 is always behind OBJ)
  Bit6   Y flip          (0=Normal, 1=Vertically mirrored)
  Bit5   X flip          (0=Normal, 1=Horizontally mirrored)
  Bit4   Palette number  **Non CGB Mode Only** (0=OBP0, 1=OBP1)
  Bit3   Tile VRAM-Bank  **CGB Mode Only**     (0=Bank 0, 1=Bank 1)
  Bit2-0 Palette number  **CGB Mode Only**     (OBP0-7)

I've seen this technique used in a couple games. Metroid II uses it in the intro area to display the ship in front of samus. Donkey Kong Land uses it in one of the early bonus areas where the player swims behind a pillar.

Last edited by ssjason123 (2017-04-21 19:55:10)

Offline

 

#4 2017-04-22 05:56:35

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

Re: About Mapping the sprites into a tilemap

Also (in CGB Mode only) you can set a bit for a specific tile to be rendered above all sprites. It generates the same effect, but is set for a specific tile instead of a specific sprite.


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 2017-04-25 14:22:46

Alexander the bat
Member
Registered: 2017-03-19
Posts: 31

Re: About Mapping the sprites into a tilemap

what About doing the Capcom Way like they did with Megaman Games that tricks the NES that is more then four colors? I know they use a trick to make more color by splitting megman up with a body and face....I'm wonderin' how I can do that if I need it and program it in!

Offline

 

Board footer

Powered by PunBB
© Copyright 2002–2005 Rickard Andersson