Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

Compressed Size Factors

A topic by NorthStateGames created Sep 02, 2022 Views: 308 Replies: 7
Viewing posts 1 to 4
Submitted

Hey everyone,

I've never really dealt with the compressed limitation in Pico8, so this jam has been great. One thing I've noticed though, is sometimes I can add several characters worth of code and get barely any increase in compression size, and other characters add substantially more. Is there a rhyme or reason for this? Is it general ascii versus mathematics or functions?

HostSubmitted

Hiya,

Alas, I'm not the best to speak on this subject (hopefully Zep or someone else can speak with more authority)

But my basic understanding is that, like most forms of data compression - it works very well with "similar blocks of same data".
So, for example, if you have a string with 50 "X" chars in it - it'll compress well, because the compression routine will store something like (use an "X" 50 times).
Whereas, if you have data that is always very different - then there's little "similarities" for it to squeeze down.

In the meantime - see here and here for some info on how the PICO-8 can compress data.

But yes, the compression a definitely dark art - even Zep said so! 馃槄

Hope some of this helps!

Submitted(+1)

Thanks, that makes sense at a high-level. Just wanted to make sure I wasn't going crazy, as I've got just over 2k worth of characters and I'm only taking up a compressed size of 700, it just seemed too good to be true haha.

(+4)

Just released an online/itch.io tool PXAVIZ which lets you visualize the PICO-8's "PXA" compression as you type. Hope it helps folks develop an intuition for optimizing compressed code size in their carts. In short, PXA compresses very well with repeated blocks of characters, and does better than normal with recently used characters (that fall outside copied blocks). 

HostSubmitted

This is a fantastic tool - thank you Carl for making it. 馃檹
Should prove very helpful in crushing some much-needed bytes for my entry! 馃槄

Submitted

Fascinating! I will be playing with this and my sources to learn more about how the compression works :-)

Submitted

Really nice tool, thank you Carl 馃檹

(+1)

Glad some people are finding it useful! There's been a few updates based on people's suggestions; feel free to give your feedback or suggest improvements you'd like to see and I'll do my best to accommodate.