Suggestion Issue: Asset packing when publishing HTML5 games


Pages: 1

Justin

  • Master Stencyler
  • *
November 03, 2020, 11:09:23 am
We can provide smaller games that download faster by packing assets into single files.

This has been the default in private builds for some time now, but there are occasionally problems with it, and we should allow more control over it.

http://community.stencyl.com/index.php/topic,59252.0.html

We default to a gzip pack, but a plain, uncompressed pak may be better in some cases (apparently the gzip pack is problematic with itch.io right now), and no packing at all may also be preferred.


Issue updated by Justin - November 03, 2020, 11:09:59 am
  • Tags added: 4.1.0


Justin

  • Master Stencyler
  • *
June 24, 2021, 12:49:28 pm
I just heard from another user about trouble with the gzip pack method for itch.io, so I took a look to try to determine the cause.

The default method of packing assets that Stencyl uses when publishing html5 games is lime's gzip method. Lime's gzip method compresses each asset individually, and then combine them all into one big file. So it looks something like this:

Code: [Select]
[                               default.pak                                           ]
[packed-asset-1.gzip][packed-asset-2.gzip][packed-asset-3.gzip]...[packed-asset-N.gzip]

When this file is downloaded from a server, normally it should download it as-is, and then lime knows how to decompress each individual asset as needed. However, itch.io, in order to properly support some game engines, auto-detects if a file is gzipped, and sets the content-encoding: gzip header when such files are downloaded. Because the packed data we send is just a bunch of gzipped filed back-to-back, this probably causes itch.io's gzip detection to think the file is one big gzipped file. So when the browser downloads the .pak file, it probably proceeds to extract it, beginning at the start, and going until the end of the first asset in the pack. By the time it gets to lime, it's already unzipped, defying all our expectations.

Basically, we expect to receive this
Code: [Select]
[packed-asset-1.gzip][packed-asset-2.gzip][packed-asset-3.gzip]...[packed-asset-N.gzip]

And instead we get this
Code: [Select]
[asset-1-already-unzipped] ... nothing else

That's my working theory. Will try to get a fix ready for this, assuming that's correct.
« Last Edit: June 24, 2021, 12:50:33 pm by Justin »


Pages: 1

Details

  • Reported
    November 03, 2020, 11:09:23 am
  • Updated
    December 18, 2023, 01:31:13 am

  • View Status
    Public
  • Type
    Suggestion
  • Status
    New
  • Priority
    Normal
  • Version
    (none)
  • Fixed in
    (none)
  • Assigned to
    (none)
  • Category
    Compiling/Testing Games

Tags