Hello, I am trying to make a compressed map file for a game I'm working on but I'm having a bit of trouble with making changes to the compressed file. The map files that my game creates are very big but a lot of that data is repetitive so I what I do is I create a big empty map and then compress it. This allows me to have massive maps within tiny files. Now I realize they are only small because it is compressing repeated 0's but even when the actual values of the tiles of the map are implemented they will still be rather repetitive so the size should still remain somewhat small.

With that being said I've been trying to find out how to write compressed data to a compressed file. My game's map structure is formatted in a way such that a collection of tiles is grouped into a block. So each XZ Block contains a certain amount of tiles. What I would like to do is when a player changes tiles of the map the map would find the XZ Block that the modified tile is in and rewrite that entire compressed block but with the new compressed data. From my understanding of how the block compression works, rewriting an entire block shouldn't be any trouble since each block is compressed separately. However, there doesn't seem to be any way to do this. Something like SeekableXZInputStream's "seekToBlock(int blockNumber)" function would be perfect. Is there any reason a SeekableXZOutputStream was not made or needed?

So my question is how possible is this and hard would it be? Are there indexes of the locations of the XZ Blocks somewhere that would have to be updated?

Thank you

--
*Brandon J. Fergerson*

Reply via email to