Saturday, December 28, 2013

FMod - No More LZW

If I ever see the letters "L", "Z", and "W" together in that order ever again in my life, I think I will scream.

Including my research today, I have discovered three incorrect implementation of the LZW compression algorithm. Surprisingly, I got correct results from, of all places, Wikipedia. My problem was that I was always using the newly generated code instead of emitting the code for the longest string already in the dictionary. With that done, Keen 1 accepted my compressed version with one problem: sprite colors planes were obviously offset. It turns out that Keen 2, against which I had been testing uncompressed IO, never had small-sprite aberrations. My handling of those was incorrect. After correcting that, everything worked great in Keen 1 - but trying to compress the graphics of Keen 2 resulted in something incredibly messed up. Apparently, the "decompressing graphics" message shown by Keen 2 never actually decompressed the graphics; they removed that functionality for the later games. I'll just have to not compress those games' graphics.

LZW: done. Next up: Carmack.

No comments:

Post a Comment