Skip to games
Hadukis

Writing

Keeping a game bundle under 10 MB

· 3 min read

Most curated web-game portals cap the upload somewhere between 5 MB and 20 MB, and several reject anything over the line without a second look. The reason is not storage. The portal serves the game to a phone on mobile data, and a slow first load is a player who left before the game started. The size limit is a proxy for "will this open".

Our nine originals run from 63 KB to 2.49 MB. Here is where the weight actually sits, in the order it matters.

1. Art, uncompressed

This is almost always the whole problem. A folder of PNGs exported straight from a drawing tool is the single biggest line item in a game bundle, by an order of magnitude.

When our sync script re-encodes the source art to WebP, one game's art folder went from roughly 25 MB of PNG to 1.4 MB. Same pixels, same game, visually identical. WebP is supported everywhere that matters now, and for game art — flat colour, hard edges, few gradients — it is close to free.

If you do one thing, do this.

2. An engine you use a tenth of

A general-purpose engine ships a physics solver, a particle system, a spine-animation runtime, a tilemap loader and a dozen other subsystems, whether or not your game touches them. Tree-shaking helps less than you would hope because a lot of it is wired together internally.

Our three Phaser games are 1.33, 2.09 and 2.49 MB. Our six no-engine games are 63 KB to 390 KB. That gap is almost entirely the engine. It can be the right trade — see the post on building without one — but you should know you are paying it.

3. Audio

Uncompressed WAV loops are heavy. Convert music to a low-bitrate format and keep sound effects short. A minute of ambient loop has no business being larger than the rest of the game.

4. Everything else

Code is almost never the problem. A whole game's logic minifies to tens of kilobytes. If you are minifying JavaScript to hit a size limit, you are optimising the wrong file.

Texture atlases, and the one real trade

Packing forty small images into one sheet turns forty HTTP requests into one, and lets the engine upload a single texture to the GPU instead of dozens. The cost is a build step and a bit of tooling. For anything past a handful of sprites it is worth it; below that it is ceremony.

What not to do

Do not strip features to hit a number. A size limit is a constraint on delivery, not on scope. If the game is 12 MB and the cap is 10, the answer is in items 1 through 3 above — it is never "cut the third world". Players did not ask for a smaller game; the portal asked for a faster one, and those are different problems with different fixes.

Measure, do not guess

Build the game, look at the output directory, sort by size. The offender is always obvious once you actually look, and it is almost never where you assumed. We publish the per-game figures on the licensing page for exactly this reason: a number you can check beats a number you typed.

Filed under gamedev, performance, portals.