Compressing data - external vs internal

So... I was wondering if i could compress the music data I'm using and managed to get the 15KB of data down to 4KB (using an edited version of https://github.com/Rochet2/lualzw/blob/master/lualzw.lua)

I thought that would reduce my game size by that same 11KB... but in fact my main binary dropped by only 0.5KB. And the total game size grew by the size of my external binary music data file ~4KB.

So (I guess I should have checked before hand) it seems the compiler (or Lua?) already compresses strings such as embedded JSON? I can't find any sign of the JSON string in the original binary from before this branch.

Still, the key takeaway here is that you can really save some space/filesize by embedding data in your code rather than using external files.

2 Likes