Search the web
Sign In
New User? Sign Up
gbadev
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Message search is now enhanced, find messages faster. Take it for a spin.

Best of Y! Groups

   Check them out and nominate your group.
Having problems with message search? Fill out this form to ensure your group is one of the first to be migrated to the new message search system.

Messages

  Messages Help
Advanced
Various sprites and one palette   Message List  
Reply | Forward Message #10725 of 15019 |
Re: [gbadev] Various sprites and one palette

A rather belated reply to the thread as I'm busy finishing up my current
project.

Muddying the waters even further here's my 2 penn'orth worth. I actually use a
couple of different methods depending on the view. I have one placed in the game
where I have a large 256 colour sprite on-screen, which obviously uses fixed
colours so I use a "fixed" palette, the sprite uses the first 64 entries in the
palette, I then over-write certain other portions of the palette for a number of
16-colour sprites that share the same screen. For another view I use a fixed
palette but switch out the first four banks of 16 colours for various team
colours, each team has two sets of colours, some of the colours are the same
(the sleeves on their shirts change colour, their caps change colour), but skin
colour and hair colour changes depending on racial origin. So I can mix and
match the players. All of these slots are "fixed" in the sense that the sprites
"know" which palette to use but the colours there may change. For the menu
systems all of the sprites are 16 colours and the palettes are dynamically
assigned. One footnote, when you mix 256 colour sprites and 16 colour sprites,
if you are "clever" with your colour allocations you can have a 256 colour
sprite and a 16 colour sprite sharing the same region of the palette, also for
the 256 colour sprite, those "transparent" colours that are modulo 16 (0, 16,
32, 48, 64, etc) are usable as normal.

Fixed palette
Info: The entire palette is determined at pre-compile time by the artist or
programmer, or determined at compile time by the compiler.
Pros: a) Allows the use of 256 & 16 colour sprites on the same screen
Cons: a) Inflexible approach. b) Can quickly run out of colours c) Artists hate
it.

Static palette
Info: Portions of the palette are loaded under programmer control as and when
needed, the colours are dynamic but the entries they are loaded to are static,
i.e. load the palette for the player at slot #5.
Pros: a) Flexible approach. Useful for both 256 colour & 16 colour sprites,
especially when mixing on the same screen.
Cons: b) Difficult to explain to the artist. b) Programmer has to worry about
which slots are open. c) Can make re-arranging palettes difficult.

Static palette & Dynamic palette
Pros: a) Flexible approach. b) Allows automatic changing of palettes on the fly.
Cons: a) Bloody difficult to explain to the artist. b) Tedious to implement. c)
Can be slow to execute if your in-game resource management system is not
implemented properly.

Fully Dynamic palette
Pros: a) Totally flexible b) You don't worry about where the palettes are
allocated.
Cons: a) Not suitable for 256 colour sprites. b) Can be difficult to debug. c)
Same as point c) above. d) Extra lookups during run-time to see which palette to
use for a particular sprite/animation frame. d) Artists love it. e) Extra
overhead when de-allocating palettes no longer in use. f) You can run out of
palettes if you have an over-zealous level designer or artist who will usually
say something along the lines of "just make it work", "don't bother me with
details", and "is there any way we can get another 128 hardware palettes?".


----- Original Message -----
From: Andrew Crowe
To: gbadev@yahoogroups.com
Sent: Tuesday, March 26, 2002 3:42 AM
Subject: Re: [gbadev] Various sprites and one palette


> I have many sprites to show simultaneously in the game I`m working on,
and I`d like to know from you guys the best way to work with the palette. Do
all sprites have to share the same palette, as in the GBC? Which would be
the best way to set up a complete palette of all my sprites? I was thinking
about making a big PCX with all of them and then saving the palette, and
then applying it back to each sprite separately, but I don't know if this
works, and it feels like brute force. Is there any other way?

Sprites use one 256 colour palette, either all 256 colours at once (all
sprites have the same palette) or each sprite can use 16 colours from the
palette, taken in groups of 16.

The way that I'm planning to do is give each sprite it's own 16 colour
palette, then build the main palette dynamically

eg.

say you have 2 copies of sprite 1 which has palette A, and another sprite
with palette B:

Sprite 1: colours 0-15
Sprite 2: colours 0-15
Sprite 3: colours 16-31

Palette:

colours 0-15 : A
colours 16-31 : B


If I moved sprite 3 off screen, and broght on a different sprite, I'd
replace colours 16-31 with the new palette

That way you could have any number of colours for sprites, tho you'd have to
write palette management routines, and of course you could only have 16
different "types" of sprite onscreen at once



Andrew



Yahoo! Groups Sponsor
ADVERTISEMENT




Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.





Tue Apr 2, 2002 2:01 am

otaku@...
Send Email Send Email

Forward
Message #10725 of 15019 |
Expand Messages Author Sort by Date

Hi, I have many sprites to show simultaneously in the game I`m working on, and I`d like to know from you guys the best way to work with the palette. Do all...
cappeca
Offline Send Email
Mar 26, 2002
11:20 am

Hi, I always try and use 16 colour sprites where possible, simply to cut down on VRAM usage, and my CLUT code handles all palettes individually, so I simply...
Francis Lillie
francis_lillie@...
Send Email
Mar 26, 2002
11:38 am

... and I`d like to know from you guys the best way to work with the palette. Do all sprites have to share the same palette, as in the GBC? Which would be the...
Andrew Crowe
andrew_crowe
Offline Send Email
Mar 26, 2002
11:45 am

... (all sprites have the same palette) or each sprite can use 16 colours from the palette, taken in groups of 16. ... colour palette, then build the main...
cappeca
Offline Send Email
Mar 27, 2002
8:24 pm

As to the latter question, I would do what you suggested - that is, placing all the sprites in a single image and reducing to n colours (256, say). But then...
Andrew Davie
adavie2
Online Now Send Email
Mar 26, 2002
11:12 pm

Hi Guys, ... Ok first problem is PCX is a crap format (doesnt support many modes), save them as 16 colour PNGs or something (tho you'd need to use a different ...
Andrew Crowe
andrew_crowe
Offline Send Email
Mar 27, 2002
8:59 pm

... a ... I found DeBabelizer a good tool for fiddling around with formats and palettes. DeBabelizer for instance lets you swap around colors in the palette...
Jan-Lieuwe Koopmans
jan-lieuwe@...
Send Email
Mar 27, 2002
9:41 pm

I found that a combination of ProMtion and PaintShop Pro worked for me. I also didn't find any tools out there that really did the trick for me with regards to...
Francis Lillie
francis_lillie@...
Send Email
Mar 27, 2002
10:55 pm

... GIMP solves this. Take your transparent image and convert it to indexed mode, dithering it to 16 colors. Make sure that the pixel in the upper-left...
Damian Yerrick
yerricde
Offline Send Email
Mar 28, 2002
11:53 pm

How do I put a sprite in mode 4 (mode 3 will help too anyway). I have tried this tutorial: http://216.167.73.47/~dovoto/English/tutorial_3.html and my sprite...
Cesar Cappellozza
cappeca
Offline Send Email
Mar 30, 2002
7:01 pm

Check out my site at proger.netfirms.com it has examples with sprites and background layers, text and some other stuff. I havent been able to update but i...
vc6proger@...
vc6proger
Offline Send Email
Mar 31, 2002
3:25 pm

A rather belated reply to the thread as I'm busy finishing up my current project. Muddying the waters even further here's my 2 penn'orth worth. I actually use...
Otaku
otaku@...
Send Email
Apr 2, 2002
8:05 am

In the way of using dynamic palettes, You can implement a control system in the level compilation. While compiling, the program detect if more than 16 palettes...
Christian Votava
cvotava@...
Send Email
Apr 2, 2002
2:37 pm
Advanced

Copyright © 2009 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines - Help