+1 vote

Hi all!

I am looking for ways to reduce the build size for Web.

I made an empty scene with a low poly model (200 KB in size), and just making a build out of it, the build folder's size comes around 24 MB.

The .wasm file comes around 19 MB, while the .pck file comes around 180 KB, which seems excess for a nearly empty game scene.

I searched around for a while, and followed this guide to reduce the size : (https://www.reddit.com/r/godot/comments/8b67lb/guide_how_to_compress_wasmpck_file_to_make_html5/)

Following it, I compressed the .wasm and .pck file, and the build came out to be 5MB. But it's still a bit big, I need even an smaller size.

I need to reduce it even further.
Also, I am aware of stripping the engine and compiling it, which I'm saving as the last step. Also, I am quite unsure of how to approach this whole "building" thing works.

Do any of you have any ideas for this?

asked Feb 28 in Engine by xyber (24 points)

2 Answers

0 votes

That 19 Mb is the cost of having a fully-featured engine that remains as easy to use for small and large games while targetting any kind of platform. 5 Mb is actually a very good compression ratio for something as featured as Godot.

If you want to reduce it further, the last thing you can do is indeed compile it by stripping features you don't want, as explained in https://docs.godotengine.org/en/stable/development/compiling/optimizing_for_size.html
Not everything can be stripped, as it becomes increasingly difficult to do so without starting to breaking interdependent parts of the engine (while some others still need to be improved to support stripping).

If this is still not enough, then the question of using Godot at all rises. If your game is going to be smaller than perhaps 4 Mb, you could be using something more dedicated to the web platform, like Three.JS directly with Javascript.

Note: if you have separate .pck and engine runtime, I can imagine that your browser can actually cache the engine file so it won't reload it next time you go on the page, if the engine file didn't change of course.

answered Feb 28 by Zylann (26,143 points)
edited Feb 28 by Zylann
0 votes

Web games in particular are difficult to minimize, since you still want to be available on as many platforms as possible.
The best approach here is to keep all resources as small and optimized as possible, which is then expressed in a small .pck file.
For the rest you have to start cutting the engine piece by piece.

The video here will surely help you:
enter image description here

PS: Most online-hoster also compress their games to save server-storage (like itch.io or GotM)

answered Jun 19 by ProggerParrot (118 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.