htmlpackagingunreal-engine4unreal-development-kitunreal-blueprint

Problems with Packaging in Unreal4 for HTML5


I'm trying to pack a project for HTML5, but cannot make it less than 159 mb. I've tried the configurations below on version 4.16.3 and 4.17.1.

List of files produced by the engine

The packaging options being used can be seen in the picture below. I'm also using a blacklist (which is being read 'cause it appears in the log) to exclude some content with no use that was being packaged.

Same project when packaged for Windows gives 82.4 mb (which I also find very big since it's a very simple project... it uses 19.7 mb on the .pak file, 50.1 mb on the UE4Game-Shipping.exe and 14 mb with plugins that I don't know how to get rid off since I don't use any of them).

Packaging options, blacklist and plugins not being used but packaged

I have no Starter Content since my last attempt to reduce size was to begin a new clean blueprint project with no Starter Content and migrate only the level that is going to be packaged to this new clean project.

Does anyone know what can I do to make this smaller? Thanks in advance for the help!


Solution

  • TLDR: try WebAssembly

     Regarding Content/asset size (~17Mo)

    I can see that you have already done a good work at using the most important option "Cook only Maps" (and not "Cook everything in the project content directory").

    Perhaps can you also try to "Exclude editor content when cooking" but I don't think you can get much out of it, because it seems to me that you used Blacklist to achieve the same.

    Regarding UE4-Game-Shipping ASM js (~150Mo)

    Known issue

    It seems there is an unresolved issue about this stating "By Design"!

    Packaging for HTML5 seems to have grown in package size

    Disable Plugins

    You could try to look into various mobile and HTML5 answers on how to reduce Engine size by disabling plugins. For instance (old thread) : https://answers.unrealengine.com/questions/144136/how-to-reduce-html5-package-size.html

     ASM deprecation, try WebAssembly

    ASM.js is going to be deprecated in 4.18 (see the Trello Roadmap) :

    Packaging UE4 for HTML5 will now use WebAssembly by default. ASM.js is being deprecated and support is being removed from UE4 as major browser vendors are moving towards WebAssembly due to its reduced compilation time and improved execution speed in the web browser.

    Also, it seems that WebAssembly is more size optimized (see this answer HTML5 404 Error (and large file sizes?)) :

    Try doing a build that targets WebAssembly. That will replace the .asm.js file with a much smaller .wasm file. Also enable gzip compression of the .wasm file to serve a .wasm.gz file which should come down to about 10MB.

    So perhaps should you switch to this new format and report here if it helps!