Hi, sorry if this has been done to death, I've looked at some of the discussions where it's cropped up, just not clear what the implications are...
if our shiny new cart is over the compressed size limit, we can't distribute it as a .PNG, ok I get that.
Does that really hamper us much? we can still put it on Windows, Mac and as a file for Pico-8 owners to load and run. Can we still host it in a browser?
I've been through and cut down some of my comments (sob), variable names etc will be next but given that we're talking compressed size, I imagine there's not a lot to be really gained doing that, as most stuff will be compressed/tokenised anyway.
On the subject of tokens - we're using about half the characters space and we have lots of tokens left. Should I just be less bloody wordy with my code? :-)
Note that you don't have to loose your comments & formatting! Have a command line tool that takes your chatty source file as an input and emit a minified version for publication.
Multiple options:
- remove all tabs, trailing spaces & comments (see bash script below). That's usually enough.
- use picotool (https://github.com/dansanderson/picotool) to even further reduce footprint
minify_reg.sh
#!/bin/sh if [ "$#" -ne 1 ]; then echo "Usage: $0 source" >&2 exit -1 fi cat $1 | sed -E -n -f minify_rules.sed |
minify_rules.sed
/--\[\[/,/\]\]/d s/--[ ]*(.[^\"])*$// s/^[ \t]*// s/[ \t]*$// /^$/d p |
Usage:
./minify_reg.sh ../carts/biggame.p8 > ../carts/biggame_fmt.p8 |
ooh, ok.... I might revert to my pre-butchered code and try your tool then. Thank you very much, that's brilliant. :-)
[Please log in to post a comment]