Log In  

Hi! I was about to share some work on a game by exporting to the html5 player but ran into an issue.

failed: 32k block not generated

I tried this on the chip, raspberry pi, and 32bit linux builds with the same result. I'm guessing it's because the compressed size is too high. Running info shows:

tokens: 6654/8192
program chars: 50401/65536
compressed: 17166/15360

I deleted nearly all of the comments already. Also the sprite sheet, map, and sfx are all blank. Any suggestions?

Side note: I use a lot of classes and the word "self" appears quite a bit in the code. If "local" isn't counted as a token can "self" also not be counted?

Thanks!

P#32812 2016-11-28 18:58 ( Edited 2016-11-30 19:17)

Here is the cloc output for the lua only portion of the .p8 file:

http://cloc.sourceforge.net v 1.60  T=0.04 s (25.6 files/s, 49772.8 lines/s)
-------------------------------------------------------------------------------
Language                     files          blank        comment           code
-------------------------------------------------------------------------------
Lua                              1            208            249           1484
-------------------------------------------------------------------------------
P#32814 2016-11-28 19:04 ( Edited 2016-11-29 00:04)

"Compressed size" refers specifically to compressing the full text of the code region, so the blank sprite sheet etc. won't matter. It is unrelated to the token limit.

This scenario can happen if you have a large quantity of non-code data in your code region, e.g. data encoded as large strings. Is this the case for your cartridge?

P#32815 2016-11-28 21:21 ( Edited 2016-11-29 02:21)

Good to know! No large strings more than a few words. Almost all of the variable and method names are long descriptive types. random_int_plus_or_minus_one(), Sector:add_planet_along_elipse() or Ship:calc_distance_and_angle_to_star()

I'll try to minify it and see if that helps.

P#32816 2016-11-28 21:59 ( Edited 2016-11-29 02:59)

Minifying using luamin did the trick. It's now at

tokens: 6705/8192
program chars: 27637/65536
compressed: 11105/15360
P#32818 2016-11-28 23:35 ( Edited 2016-11-29 04:35)

Interesting! I'm sorry this turned out to be necessary.

If it's useful to you, picotool comes with a minifier that can do it directly to cartridge files. https://github.com/dansanderson/picotool

P#32825 2016-11-29 21:23 ( Edited 2016-11-30 02:23)

Hmm, it's interesting to see that the token count increases after minification.

To jump on the bandwagon here, I'm running into the same issues saving .png carts (cart info - http://imgur.com/a/4Yyk1 ).
I was wondering if there are any options to turn that off in either tool? i.e. just reduce the character count & leave the code layout alone?

P#32829 2016-11-30 00:23 ( Edited 2016-11-30 05:59)

picotool merely removes comments and whitespace and renames the symbols, which should have zero impact on token count. I'd be very surprised if luamin did more than that but maybe there's a weird case where it rewrites an expression and Pico-8 intentionally undercounted the original? I'd be curious to know more about it if anyone finds an example they can share.

P#32846 2016-11-30 14:17 ( Edited 2016-11-30 19:17)

[Please log in to post a comment]