I've been working on figuring out a file format for a while now, and I finally got it to render properly, but it's using a method I've never seen or even read about before. It's from an MMO called Angels Online.
The format itself consists of 5 parts, like so:
1)Header
2)Row Pointer Table
3)Batch Table
4)Palette
5)Pixel Data
I've taken some creative liberties with the names for the various sections.
In depth:
1) Header
Contains the width and height. Lots of flags, eg AlphaChannel, ColorDepth, and DisablePalette. I still haven't completely mapped what all the flags do, but I've got everything rendering correctly, so I guess they are specific to the engine.
2) Row Pointer Table
This is where the weirdness starts. There are a bunch of entries in this table, the number of which is always exactly the image's height. Each entry consists of a 4 byte pointer to later in the file.
3) Batch Table
The entries in the Row Pointer Table point to this area. For each row, there are a series of what I am calling Batches. Each batch consists of: An X-offset, A PixelLength, and another pointer which I'll call a PixelDataPointer.
Need to do some explaining at this point. When the image is rendered, the renderer will go through each row, skip any transparent pixels by going directly to the X-Offset variable, and draw ONLY the pixels that have color. Thus, the X-Offset variable tells the renderer at what location on the X axis (left to right) to begin copying. The PixelLength variable is how many pixels to copy from that point, and the PixelDataPointer is where the beginning of the pixels are that should be copied.
4) Palette
Contains 256 entries. Entries are either in 16bit rgb565 format, or 24bit rgb888 format depending on the flags in the header.
5) Pixel Data
A series of bytes, each byte refering to a color in the Palette. If the AlphaChannel flag is active, then each pixel is immediately followed by an extra byte that sets it's alpha.
So now that the wordy description is done, what I'd like to know is this:
A) Has anyone ever seen something like this before? If so where? I couldn't find anything describing this kind of setup.
B) What is the benefit of this format? After some testing, a compressed PNG is much smaller. I think it might render faster than a normal bitmap where each pixel is tested against an color key, but doesn't including an alpha channel pretty much nullify that speed boost?
C) The game engine is using some crazy form of palette swapping to recolor sprites and images. It's not a full palette swap, rather some algorithm is being performed to changed the Hue of a target color in the palette. Is there ANYWHERE that describes these kinds of esoteric techniques? Where would you learn something like this?
Thanks in advance, I hope someone out there can help me out.



