Log In  

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? :-)

P#56309 2018-09-06 16:19 ( Edited 2018-09-06 21:21)

2

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:

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
P#56313 2018-09-06 16:32 ( Edited 2018-09-06 20:33)

ooh, ok.... I might revert to my pre-butchered code and try your tool then. Thank you very much, that's brilliant. :-)

P#56319 2018-09-06 17:21 ( Edited 2018-09-06 21:21)

[Please log in to post a comment]

Follow Lexaloffle:          
Generated 2024-04-19 13:15:47 | 0.005s | Q:12