Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compress TileMap tiles in level file #3124

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Vankata453
Copy link
Member

@Vankata453 Vankata453 commented Dec 2, 2024

TileMap tiles are now saved by replacing a sequence of empty tiles (ex. "0 0 0 0 0") with a single negative number, the absolute value of which preserves the amount of sequential empty tiles (ex. "-5").

Newline separation for tiles in file based on TileMap width is still supported. Example:

(tilemap
  (solid #t)
  (z-pos 0)
  (width 100)
  (height 5)
  (tiles
  -100
  -100
  -100
  -100
  -100
  )

Examples:

  • 0 0 0 0 0 0 45 3 0 0 -> -6 45 3 -2
  • 0 0 0 0 0 43 0 0 0 0 12 0 0 0 -> -5 43 -4 12 -3

Results from re-saving some levels from "The Crystal Catacombs":

  • "The Journey Begins Again": 409.2KiB -> 40KiB
  • "Fjord of Fortitude": 319.1KiB -> 65.4KiB
  • "A Light in the Darkness": 613.3KiB -> 301.5KiB
  • "Light and Magic": 456KiB -> 173KiB

`TileMap` tiles are now saved by replacing a sequence of empty tiles (ex. "0 0 0 0 0") with a single negative number, the absolute value of which preserves the amount of sequential empty tiles (ex. "-5").

Examples:

"0 0 0 0 0 0 45 3 0 0" -> "-6 45 3 -2"
"0 0 0 0 0 43 0 0 0 0 12 0 0 0" -> "-5 43 -4 12 -3"

Results from re-saving some levels from "The Crystal Catacombs":

"The Journey Begins Again": 409.2KiB -> 40KiB
"Fjord of Fortitude": 319.1KiB -> 65.4KiB
"A Light in the Darkness": 613.3KiB -> 301.5KiB
"Light and Magic": 456KiB -> 173KiB
@Vankata453 Vankata453 added involves:performance category:code status:needs-review Work needs to be reviewed by other people labels Dec 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category:code involves:performance status:needs-review Work needs to be reviewed by other people
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant