-
-
Notifications
You must be signed in to change notification settings - Fork 21.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Size of HTML5 exports has increased significantly between 3.x and 4.0.beta #68647
Comments
Related: #41118 (the first comment mentions the biggest factor is likely the sheer size of the WASM payload) Related: godotengine/godot-proposals#190 which would be likely closed when #47054 is merged |
Unfortunately, I don't see much ways to reduce engine binary size compared to what we have now. All the new features in 4.0 come at a cost. Now you know why we try not to bloat the core too much 🙂 What could be tried to speed up instantiation would be to split the WASM into several files, and try to download and initialize them in parallel. This is easier said than done though.
This is now implemented with feature build profiles, providing you build a custom HTML5 export template. |
It would be helpful for us to investigate where exactly the extra 20 mbs are coming from. While the size of the engine has certainly increased, it hasn't doubled in size. Perhaps we are mistakenly including debug symbols or something, or a dependency that wasn't previously exposed to HTML5 builds now is. On that note, @netAction Could you confirm whether you are using debug or release builds for the HTML5 export? |
One thing we might do for mobile and web platforms is disable TextServerAdvanced by default, as it represents several MBs of binary size (it links against HarfBuzz and all that). The downside is that support for right-to-left typesetting and complex scripts would be lost in mobile/web by default. It also increases the chance of bugs surfacing only after you export the project to a mobile/web platform (due to a different TextServer being used by default). Users wishing to use TextServerAdvanced on mobile/web platforms would have to compile custom export templates with TextServerAdvanced enabled. |
After switching off Debug in Godot 4.0 beta4, the export has 24MB rather than 41MB. After switching off Debug in Godot 3.5, the export has 13MB rather than 17MB. Sorry I missed this option. |
I'm investigating if Godot could replace my engine of choice for web development (I'd prefer to code in C# than TS) and thought I'd share some insights. I just tested Godot 4.0 beta8, I got these results with a release web build with just a cube, a light and a camera Aiming for something around 1-2M after compression would still be worst than JS based engines (I don't think Godot will ever be able to beat those), but competitive enough to be used professionally for web games :) Are the feature build profiles already available somewhere in the beta ? I don't understand how to get that window displayed in the PR. |
If file size is critical for you, I would recommend you stick to 3.x but also use GDScript instead of C# (as it removes the need to embed Mono). 3.x will also run better on low-end devices with limited RAM, and it'll remain supported for a while after 4.0 is released.
Which compression level did you specify? I don't remember if the Brotli CLI uses the highest compression level of 11 by default. This is recommended for static files as decompression speed is not impacted by the compression level. I wish browsers started adopting Zstandard, but something tells me that won't happen…
Even with an export template compiled after a build profile, I don't think it's possible to get below 3 MB compressed in 4.0 (while 3.x can certainly fit within that size).
Yes, but you need to compile an HTML5 export template from source to benefit from the generated build profile. You can display that dialog using Project > Customize Engine Build Configuration… at the top of the editor window. Note that this dialog's automatic detection doesn't automatically disable some features that aren't needed in your project: #69820 |
Please excuse my ignorance, I am new to Godot but how do you export to HTML5 with Godot 4? I am using the beta 8 version. I've downloaded and inspected the export templates zip file and I only see Mac, Linux, and Windows templates. Thanks |
You must be using the .NET build, which currently only supports desktop platforms (like .NET Core itself). |
Could something like Defold's build server help by allowing less experienced users to remove parts of the engine they don't use? https://defold.com/manuals/extensions/#the-build-server They are emscripten based as well and are able to get down to <1MB for simple game like pong. |
Godot version
4.0 Beta 4
System information
Windows 64
Issue description
The HTML5 export of a single empty 2D node has a size of >40MB. Godot 3.5 HTML5 export is already >20MB.
Users on low bandwidth are kept away from the game. The most important advantage of HTML5 over native apps is the easy access. You can start a game via scanning a QR code. But exactly this benefit of HTML5 is weakened in regions like Germany where cellular coverage and wifi quality are low.
The other issue is the CPU load caused by the huge amount of executable code. 40MB JS and WASM code affects the device speed more than a PNG of 40MB. I didn't benchmark this though.
I am aware Godot does come with some basic functionality and WASM wrapper that already needs about 1MB. But the other engine size could be optimized. Maybe a selection of different engines could make sense that are chosen depending on the featured needed for the game.
There are methods for compression of WASM. It can be done by Apache mod_deflate or even the Javascript zlib library pako. This helps a lot but does not shrink the game by a magnitude.
Steps to reproduce
Create a new project. Add 2D node. Export HTML5.
Minimal reproduction project
No response
The text was updated successfully, but these errors were encountered: