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 2016-06-30 20:16:43

CaptainDaddy
New member
Registered: 2016-06-30
Posts: 1

CGB background with more than one color palette

Hey guys,
I'm pretty new to GameBoy Color development and my question is, is it possible to give a background more than one color palette?
I know that it's possible with sprites by laying multiple tiles over each other, but how should it work with a background?

/Captain

Offline

 

#2 2016-07-01 07:58:26

nitro2k01
Administrator
Registered: 2008-02-22
Posts: 249

Re: CGB background with more than one color palette

On GBC, VRAM contains two memory banks. You have to use the VBK register (FF4F) to select VRAM bank 1. VRAM bank 0 is the regular tile/map. VRAM bank 1 contains the attribute map for the background, as well as an extra set of tiles. To set a tile attribute, you write to the same address you wrote to map memory, with an attribute as described in Pan Docs.

http://gbdev.gg8.se/wiki/articles/Video … round_Maps


Blog: Gameboy Genius
"A journey of a thousand miles begins with one small step"
Old Chinese Proverb

Offline

 

#3 2016-07-03 00:50:08

Shonumi
New member
Registered: 2016-07-03
Posts: 8

Re: CGB background with more than one color palette

@CaptainDaddy: When you say use more than 1 color palette, are you perhaps talking about using more than 4 colors per tile? To me, it sounds like that is what you're referring to since you mentioned using overlapping sprites to create that sort of effect with OBJs. If this is indeed what you're after, you can actually just use sprites as "extra" tiles to add color to a BG tile. What I mean is, have a sprite tile overlap a BG tile with the colors you want. In this way, you can get a maximum of 7 colors. This was one technique used in some commercial GBC games (notably the intro animations for LoZ:Oracle of Ages/Seasons). This method has some drawbacks though in that 1) you use up some of your sprites, and 2) you're still limited to 10 sprites per scanline.

There are other methods that try to draw to the background as if it were a bitmap (see the cutscenes from Tomb Raider for example) but that involves quite a bit of work changing color palettes almost every line and whatnot.

Offline

 

Board footer

Powered by PunBB
© Copyright 2002–2005 Rickard Andersson