I guess it's probably too much to ask if someone has a program to do this already, but here's what I'm wondering...
Imagine that you have a set of maps that reference a tileset. This tileset is a 256 color bitmap that you want to fix so that it is compatible with the 16 palettes of 16 color modes ( so your artists don't have to do it by hand ). When you run the program, it reads in the maps and the tileset, and outputs the maps modified with the individual tile palettes correctly mapped, and so that the tileset is correctly allocated.
I started writing a little app to do this, but am having trouble finishing it... I was just thinking maybe others will have ideas of good ways to do this.
My thoughts:
1. Each tile can have a maximum of 16 colors (one being transparent), so if any 8x8 tile has more than that number, reduce "similar" colors until 16 colors remain.
2. Create a list of the palette generated for each tile.
3. Find tile palettes that are subsets of other tile palettes and combine them.
4. While we are over the limit (number of palettes)
combine "similar" palettes.
This should work, but I'm having trouble with finding the most "similar" palettes, and keeping track of all the remapped colors. As far as finding similar colors, I've just been using standard color distance sqrt((r0-r1)^2...) stuff, but am not totally sure if that's the best way.
Everyones' ideas will be much appreciated :)
Ben