News: 11 March 2016 - Forum Rules
Current Moderators - DarkSol, KingMike, MathOnNapkins, Azkadellia, Danke

Author Topic: Any common tile map compression/generation algorithms?  (Read 323 times)

USC

  • Submission Reviewer
  • Sr. Member
  • *****
  • Posts: 318
  • Obviously Outdated
    • View Profile
Any common tile map compression/generation algorithms?
« on: February 25, 2021, 05:11:29 pm »
Hello! So, the game I'm currently working on uses the same compression algorithm for graphics as its prequel, which is great! Unfortunately, it now *also* compresses the tile map, which is both efficient and aggravating.

Are there any common patterns for compressing tile maps? Unlike the compressed graphics code, this seems to be generating a sequential list of tile numbers rather than "looking back" and copying prior sequences. For example, this is an uncompressed sequence:

03 00 03 00 03 00 03 00 03 00 03 00 03 00 04 00 05 00 06 00 06 00 06 00 06 00...

This is generated from D5 00 03 56. Changing the "00 03" to an arbitrary value offsets the uncompressed sequence by that amount (e.g. Replacing it with 00 06 would make the run start at 06 and then transition to 07 00 08 00 09 00 09 00...). D5 is a control character, as is 56 - changing them results in different behaviors (D4 leaves a "blank" in the 4th "03 00" spot, while D6 extends the sequence and makes it jump to 04 00  sooner and for longer).

If anyone's run across a similar compression method in a game and is willing to share their thoughts, it'd be appreciated!