Build Size

About

Build size is crucial for web-games.
Target Build Size - 20MB

Code Size

GitHub Branch

OptimizationSize (MB) .wasmSize (MB) .wasm.gzComment
Vanila17630Build from Engine folder
No Plugins13825DisableEnginePluginsByDefault is very useful
Shipping5616
-Oz Optimization Level4613Using my patched version
Link time optimization4212Using my patched version. Slow to build
No Debug Info3210

Examples

Shared Build

TODO:

  • Put game-specific modules and plugins into a separate .wasm

Build Config

Source/ALSV.Target.cs
using UnrealBuildTool;
using System.Collections.Generic;

public class ALSVTarget : TargetRules
{
	public ALSVTarget(TargetInfo Target) : base(Target)
	{
		Type = TargetType.Game;
		DefaultBuildSettings = BuildSettingsVersion.V2;

		bool isShipping = Target.Configuration == UnrealTargetConfiguration.Shipping;
		bAllowLTCG = isShipping;
		bCompileForSize = isShipping;

		bForceDebugInfo = !isShipping;
		bDisableDebugInfo = isShipping;
		bOmitPCDebugInfoInDevelopment = isShipping;

		//bUseLoggingInShipping = true;

		bCompileChaos = false;
		bUseChaos = false;

		bCompileICU = false;
		bUsesSlate = !isShipping; // Need for console

		ExtraModuleNames.AddRange( new string[] { "ALSV" } );
	}
}

Resources Size

  • No fallback font (DroidSansFallback.uasset)
  • No AtmosphericFog on map
  • Reduced textures size (DefaultDeviceProfiles.ini)
  • Reduced size blue noise texture (BlueNoiseTextureName=/Game/…)
  • ForceNoPrecomputedLight

TODO:

  • Cleanup fonts
  • Cleanup localization
  • Remove Slate 🤔

Examples

Shared Build

TODO:

  • Share resources between independant games. Special project setup will be needed.