Is there a way to have phaser read assets from a .zip file?

To me it seems like it would be a lot more efficient to have a single HTTP request for some sort of archive file (i.e. .zip) than to have each audio/image/tilemap/etc. file downloaded via separate HTTP requests.

Is there a way to do this?

I doubt it would be more efficient.

HTTP/2 is designed to transfer multiple small files simultaneously without much overhead. By avoiding concatenation, browser cache can work much more efficiently.
HTTP data is compressed before it is sent from the server: compliant browsers will announce what methods are supported to the server before downloading the correct format; browsers that do not support compliant compression method will download uncompressed data. The most common compression schemes include gzip and Deflate


thanks for your answer

For images, use Texture Atlas:

You can also merge audio files.

1 Like

thanks @yannick its really help me to load assets quickly

mh what Milton said - unless you can use some kind of torrenting picking small files in succession from the same server is probably better (unless configured differently) since the connection is open it will probably (probably lol) not be closed during semi-simultaneous requests

you can use a json file to load all assets if you want (and if need be generate that with php from a folder on the server , w/ cron or whatever call it from the page first but it will still load the files sep ofc)

i read using atlas textures is more efficient in more than one way , also in unity e.g. for performance but im not enough of a teknomage to say why, maybe cards have this thing where they can access it faster, … google is your friend heh

If you want to reduce the number of individual files to load, you can use sprite sheets and audio sprites. Escpecially using a sprite atlas/sprite sheet is way more efficient, both in loading and displaying.

Keep in mind that reducing the number of files doesn’t always reduce load times. Breaking sprites up by like colors and compressing png8 results in much less data than simply having all sprites in ones sheet. Think of shipping two smaller boxes often being cheaper than one large heavy box at the post.