Grit shared palettes

Post Reply
Massif
Posts: 3
Joined: Wed Nov 17, 2010 7:47 pm

Grit shared palettes

Post by Massif » Thu Nov 18, 2010 4:53 am

I've been having trouble getting the shared palette option in grit to work properly. I have several 8 bit indexed images with different palettes (each palette only has 7 or 8 colors) and I'm trying to create a shared tileset, shared palette and a separate map for each image. Here's the command I'm using:

grit ./*.png -ftc -gS -m -pS -OBG_OL_MINE

This generates a file containing the shared tileset/palette and a separate file for each map. However, the palette does not contain the colors from all of the images. It seems to only be outputting the colors from one image. The weird part is that it only outputs 12 short values instead of 256 and half of those values are 0x0000. If I remove the -pS option, I get 256 values but still only the colors from one image are filled in and the rest are 0x0000.

I've also tried using bmp instead of png, but I get the same result.

Massif
Posts: 3
Joined: Wed Nov 17, 2010 7:47 pm

Re: Grit shared palettes

Post by Massif » Sun Nov 21, 2010 5:50 pm

I downloaded the grit source code and hacked shared palettes in myself. :)

User avatar
Izhido
Posts: 107
Joined: Fri Oct 19, 2007 10:57 pm
Location: Costa Rica
Contact:

Re: Grit shared palettes

Post by Izhido » Mon Nov 22, 2010 6:50 pm

Great!

Now, why don't you, instead of keeping it to yourself, post a patch to sf.net regarding this issue? I'm sure it would be beneficial to us all if you did...

radiodee1
Posts: 10
Joined: Sat Dec 05, 2009 8:50 pm

Re: Grit shared palettes

Post by radiodee1 » Sat Nov 27, 2010 10:45 am

If anyone figures out shared palettes with grit, I'd love to know. I tried the -pS option, rewrote my Makefile, added an output file name, etc. It didn't really work out. Individual separate palettes work fine. :)

RyouArashi
Posts: 29
Joined: Sun Mar 29, 2009 9:23 pm

Re: Grit shared palettes

Post by RyouArashi » Sat Nov 27, 2010 1:49 pm

My current approach is to merge all images which i want to share the same palette into one image and convert it into a BG
structure (Tiles+Map+Palette). At runtime I extract the areas I need from the Tiles and Map Data.

radiodee1
Posts: 10
Joined: Sat Dec 05, 2009 8:50 pm

Re: Grit shared palettes

Post by radiodee1 » Sat Nov 27, 2010 5:27 pm

RyouArashi wrote:My current approach is to merge all images which i want to share the same palette into one image and convert it into a BG
structure (Tiles+Map+Palette). At runtime I extract the areas I need from the Tiles and Map Data.
I've got several sprite images. I'd like to make one palette for all of them... can that be done? Currently I've got grit making separate palettes for each sprite. I tried making a image for grit with every color from every sprite I wanted to use. That image was called 'a.png' or something similar, and I used the palette from that for the sprites. Still, though, things came out wrong.

Massif
Posts: 3
Joined: Wed Nov 17, 2010 7:47 pm

Re: Grit shared palettes

Post by Massif » Sun Nov 28, 2010 3:00 am

Wow, I haven't checked this thread in a while. I'll be submitting a patch shortly.

EDIT: Patch is up:

https://sourceforge.net/tracker/?func=d ... tid=668553

radiodee1
Posts: 10
Joined: Sat Dec 05, 2009 8:50 pm

Re: Grit shared palettes

Post by radiodee1 » Tue Nov 30, 2010 4:21 pm

Hi,

Thanks for the patch.

I tried the following without success. I got the grit source from the svn repository on sourceforge, and downloaded the patch. I moved the patch to the grit directory and tried this (with the included results):

Code: Select all

me@me:~/workspace/SVN/grit$ patch -p0  < sharedpalettes.patch 
(Stripping trailing CRs from patch.)
patching file libgrit/grit_prep.cpp
Hunk #1 succeeded at 35 (offset 1 line).
Hunk #2 succeeded at 598 (offset 1 line).
(Stripping trailing CRs from patch.)
patching file libgrit/grit_shared.cpp
Then I compiled grit with 'make'. Then I copied the resulting executable to the devkitpro folder on my computer. For me this was '/opt/devkitpro/devkitARM/bin/grit'. The results for me are not really good. I find that the grit program isn't putting all my colors in the palette. Also my sprites don't seem to reference the right color. I'm guessing this is part of the same problem. Large parts of my sprites come out black. Am I making a simple error? This is my typical grit file:

Code: Select all

# Set the warning/log level to 3
-W3
# Tell grit to include a palette (the first index in it will be transparent)
-pS
# Tile the image
-gt
# Set the bit depth to 4 (16 colors)
-gB4
I'd really like this to work. Do I need to execute the new grit from the command line? Will it work using a Makefile? Thanks.

EDIT: Hi, I did get this to work. Thanks so much for your patch. In the end I modified the Makefile to execute grit on all the image files in one run, as if I had supplied a list of files to the grit program on the command line. I'm not really good at editing Makefiles, so I won't post my results here unless someone really wants to see it, but it does work. Thanks much.

Post Reply

Who is online

Users browsing this forum: No registered users and 11 guests