Jump to content
  • Advertisement

bonbonbaron

Member
  • Content Count

    5
  • Joined

  • Last visited

Community Reputation

0 Neutral

About bonbonbaron

  • Rank
    Newbie

Personal Information

  • Interests
    Art
    Audio
    Design
    Programming
  1. bonbonbaron

    How tightly can I compress my sprites?

    I know you're onto something HappyCoder, but the problem in that solution is that I'm storing my images as greyscale images where the pixel values are indices to color palettes. That means storing a difference in index values like the one above means I'm just storing something as big as the original image anyway. I'm gonna tinker with RLE'ing the difference images. And if the RLE'd diff image is significantly smaller than the original, I'll store it and cut the orig.
  2. bonbonbaron

    How tightly can I compress my sprites?

    Thanks for all your help. I see. Instead of storing that information in image data, I think I'll represent it as groups of rectangles per image. That way each group of changes is a couple bytes instead of a whole image. If a certain threshold of pixels between two frames is different though, I'll go ahead and declare the second frame a unique frame and store it in memory.
  3. bonbonbaron

    How tightly can I compress my sprites?

    Thanks. So I take it the frame that's similar enough to be considered a "diff" frame would have this data something like this (assuming my image and animation data stored separately in disk): Source frame index (or source tile, depending which saves more room for this info) Destination frame index where this image will go Top left corner of the rectangular area where the difference is Bottom right corner "..." Signed integer for the color index difference Am I on the right track? Google is suprisingly unhelpful for a "sprite image diff" search. Similar keywords didn't help either.
  4. bonbonbaron

    How tightly can I compress my sprites?

    Thanks Lorenzo. I've been considering that this morning. Every PNG has a header too, so putting everything in the same PNG would save memory too. That's fine. But practicality aside, let's humor the question for the fun of making the smallest game data possible. When I see games like Pokemon Red/Blue and Zelda 1 capture imaginations everywhere, it makes me want to similarly charm people using the fewest bytes possible. Just for the joy of it.
  5. I have a tileset generator. It grabs all unique tiles from an image and makes a new PNG out of them. You know how tilesets work. I tried homebrewing a compressor/decompressor algorithm that mimicked the NES's 2-bits-per-pixel method. Lots of bit-packing. Every two bits indexes a color in that sprite's palette. I saw some success with my algorithm when a 16-by-16px sprite was 1) only two colors and 2) symmetrical both horizontally and vertically. It turned such a 227-byte PNG into 8 bytes! It could then decompress it in a millisecond, which seems slow for such a small image. But I'll accept it. But when I used 7 colors and needed 4 bpp, the compressed image would be larger than the original. So then I tried just using PyPNG. It takes the same 227-byte, two-color image I mentioned before and compresses it to 81 bytes. That seems wrong. But the same PyPNG method does turn my attached, 7-color michael.png (548 bytes) into michael_output.png (327 bytes). Code snippet's below: w = final_tileset.shape[1] h = final_tileset.shape[0] writer = png.Writer(w, h, bitdepth=bitdepth, palette=color_palette) #bitdepth is 4 in this case, and palette has 7 RGB vals. output_file = open("michael_output.png", "wb") writer.write(output_file, final_tileset_iterable) Seems like I could still squeeze it even smaller somehow. I'm sure you seasoned pros have a few tricks up your sleeves for this. How small can I possibly make this particular attached image?
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!