How to Minify Godot's Build Size (93MB --> 6.4MB exe)

Hey folks, I just made a post where I dramatically reduce Godot’s export size by using various techniques. Some sacrifices to performance were made, but this should serve as a guide to anyone looking to shrinking their file size (say for example if you’re sharing webgames or small applications).

18 Likes

That is amazing! Thank you for sharing. Will be coming back to this in the near future when I am ready for exporting. Thankyou very much.

Fantastic write-up!

I think your final builds download is the same web.zip for both the windows and web link. Stating the version would help make these links more useful, but ultimately I think uploading your final custom.py profile would be more helpful for future and previous version builds.

I think your final builds download is the same web.zip for both the windows and web link.

Whoops! Fixed that now.

I didn’t upload the custom.py file since I was worried people would just copy/paste it. What you should have in the file depends specifically on what your game uses. Here it is anyway for reference:

# custom.py
target="template_release"
debug_symbols="no"
optimize="size"
lto="full" # Slower build times, smaller export size

disable_3d="yes"
disable_advanced_gui="yes"

deprecated="no"  # Disables deprecated features
vulkan="no"      # Disables the Vulkan driver (used in Forward+/Mobile Renderers)
use_volk="no"    # Disables more Vulkan stuff
openxr="no"      # Disables Virtual Reality/Augmented Reality stuff
minizip="no"     # Disables ZIP archive support
graphite="no"    # Disables SIL Graphite smart fonts support

modules_enabled_by_default="no"
module_gdscript_enabled="yes"
module_text_server_fb_enabled="yes"
module_freetype_enabled="yes" # Needed alongside a text server for text to render correctly
module_svg_enabled="yes"
module_webp_enabled="yes"
module_godot_physics_2d_enabled="yes"
2 Likes

I posted “thanks” on Reddit, but I’ll post here as well. Very nice write-up!

1 Like

Thanks! And yeah, though digging through scons -h is not much fun, I think your list is a great starting point!

Great writeup, thanks a lot for the detailed breakdown! It already helped me to know the wasm-opt parameters to use for godot 4.4 (The one’s we talked about back then did had little to no effect for 4.3+).

Do you know of any repo already having some CI to build docker images with custom godot templates? I guess that would be potentially an interesting addition for my loading test repo.