Packing multiple PNG files into one file

Hey guys,

So I have a fully functional 2D tile engine that loads map data from 2 png files for each layer of terrain. 2 files isn’t that bad, but I am planning to add a Collision layer, an Object layer, and possibly a mob density layer (depending on how i do mob spawning), so there will be many different png files in one map folder. So I was wondering if I can pack multiple png files into one readable text file and convert that file back to Buffered Images on run-time.Conversion time should be considered but is not a priority.

Yeah so more of a development-side question, but a solution would be helpful ;D

Just make a spritesheet out of them? (maybe “Texture Atlas/Map” is more applicable, but you get the idea)

As for readable text format, that is entirely subjective. Preference of it’s use is also entirely subjective. For instance, I would consider PNGs in their natural state as images, viewable in any editor far more readable than any text format. They are images after all. Unless of course you’re just using PNGs as a convenient medium for the information, but then why bother if you’re going to convert them anyway? But as you are making BufferedImages in the end, I suspect that they are in fact images.

I hadn’t thought about a sprite sheet :yawn:. I’ll probably end up using that but I am still kind of curious how I would accomplish the original problem. I know that Gimp .xcf files have this functionality.

Also, can I convert a TextureRegion to a BufferedImage or at least get the hex color values from each pixel of a Texture Region?

Sounds like it might be easier and more practical to make a simple custom map editor for it?