How to reduce the size of the game's release bundle for HTML?

Godot Version

4.3

Question

Platform: Windows 11
Target build: HTML 5 (release)
Game: Simple 2D platformer (3 match)

Settings for export:

As a result, the game, whose assets and code occupy a maximum of 100 kilobytes, ends up with a release size of several megabytes. In this case, it’s almost 40 megabytes.

For example, a similar game built on the Defold engine takes about 3 megabytes:


PS: The archive directory took up about 500 kilobytes.

My question is, what methods are there to reduce the size of the final bundle for the HTML platform in Godot? 40 megabytes is a significant size that may not even load on some mobile phones.

See the documentation:

Note that even with all optimizations in place, you can’t get Godot to be as small as Defold. When running in the browser, Defold is a pure web game engine while Godot is a WebAssembly port of its C++ codebase. This will always lead to much larger files, but since Godot is much more complex than Defold, it’s the only viable approach porting-wise.

1 Like

Unfortunately, the section of the documentation you mentioned is very unfriendly to beginners. It does not describe the specific steps that need to be taken to solve the problem. For example, everything related to the scons build system requires separate documentation — how to install it, how to use it, etc. This section only lists the flags for it.

You can find the documentation on compiling web export templates here:

It’s also a good idea to go through the documentation for compiling for your native target platform, as it describes how to install SCons in more detail, e.g.

1 Like