gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

Graphics > tile color re-indexer

#13825 - RaBBi - Tue Dec 23, 2003 3:12 pm

Hi all ^^

As discussed in topics about LevelMapper from GBATools, for those who read and followed them ^^, I decided to code a tool that reindexes pixels of 8x8 tiles from a 256 colors bitmap for 16 color mode use.

I'm going to explain, since this tool is unique-purposed.

Like I'm not a pixel artist, and not really prepared to write an entire game, all of my GBA stuff is only test.
But I like having a certain good looking vision of what I code.
So, when map time came, I didn't have tile graphics ready to use and uncrappy.

I decided to extract ("rip") maps or tiles from commercial game, since my project is only personnal and I don't think to release it until I didn't find an artist to produce our own graphics.

For games that load tiles as meta-tiles and ordered by palette (I thought about Golden Sun), there was no problem.
But this type of game are rare, and rapidly I encoutered others that load tiles as classics 8x8.

I didn't want to spend too much time in editing/creating maps with little tiles like this, so I decided to use the whole maps loaded in "game memory".

But exported/ripped bitmaps are in 16M colors.
So I must first assign the good palette (that I exported too) to this bitmap, with a graphic soft (like PSP or Photoshop).

But when reindexing pixels, these softwares take the first color they find in palette, even if this color is present in other indexes.
So GBA palette and tile concepts for 16 colors modes are lost ! (it's logical since these tools are not aimed for that ^^) cause a tile can use colors from different 16-colors-row.

Thus, when I load these bitmaps into map editors (like LevelMapper->Tile Grabber, or mapEd->Tileset Validator), I have either a bad result map, either an error when grabbing tiles.

Let's go back to the main purpose of this topic now.

I wrote a tool (in a few 8 hours, I'm really surprised that it was so fast :)) that reindexes the 256 colors bitmap so each tile uses colors from a row of 16 (I'm very explicit cause I'm new to GBA dev and I think about others in the same case ^^).

You must use a bitmap to which you already assigned the original palette from emulator for instance.

To conclude, I wanted to know if it's interesting that I release this cause :
1- it's really targetted
2- it's for manage extracted graphics.
3- anyone but me needs to do that, I'm a lazy stealer !!! lol

Tell me what ^^

Note: this tool is written in C#, so the .NET framework is required.
_________________
Sorry for my poor english, but it would be worst for you to understand me if I speak in my native language, French ^^

#13874 - RaBBi - Wed Dec 24, 2003 8:12 am

Ok, as I thought, it is not an interesting tool. So I'll keep it for my needs...
_________________
Sorry for my poor english, but it would be worst for you to understand me if I speak in my native language, French ^^

#14263 - headspin - Sat Jan 03, 2004 3:14 pm

Sounds very helpful actually. Alot of people have issues with palette order and the like.

Perhaps if you made a simple tool that allows people to load a graphic and "drag" palette order around as well as load palettes from other bitmaps would be the ideal tool everyone is looking for. I've even thought about doing this myself, but I'm a little rusty on C++/Windows coding.

Is your tool command-line or windows?

Anyway, provide a link and I'd like to check it out anyway.

#14273 - RaBBi - Sat Jan 03, 2004 5:05 pm

Hi, thank for reply at least ^^

This tool is command-line based and it's not designed to manually manage the palette colors.

It is useful in addition to graphics softwares with which you can assign a 256 colors palette to your original image.
Then, with this tool, you can launch the reindexing of all the pixels of all the tile so the output image is ready to be loaded in 16 colors map editors.

As all my source images have a last 8_pixels_height_row in black tiles, and like someone wasn't interested before you post, I didn't fix a little bug with this last line.

I'll fix it, then write the /? instructions and post a link here ^^
_________________
Sorry for my poor english, but it would be worst for you to understand me if I speak in my native language, French ^^