Language:
Page Info
Skill Level:
Engine Version:

Reducing Packaged Game Size

Choose your OS:

No matter what platform your UE4 project is targeting, reducing the size of the packaged game can be challenging. In the following guide, we will cover steps you can take to help reduce your projects final package size to be as small as possible using nothing but the tools provided to you in the UE4 Editor.

Creating a New Empty Project

When you first start working on your Android based mobile project, you might be tempted to use an existing project as a base to work from or create a new project that has the Starter Content enabled. DO NOT do this, instead, create an entirely new, empty C++ or Blueprint based project, and then use the Migration Tool to bring over the content that you want to use. This way, you ensure that the only content in your project is content that needs to be there.

Compressing Cooked Content

The easiest and quickest way to reduce your APK package size is to tell UE4 to compress the APK packages during the packing process. To turn on package compression, you need to do the following in the UE4 Editor.

  1. First, open up the project's settings by going to the Main Toolbar and selecting the Edit option, then selecting Project Settings.

    T_Project_Settings_Menu.png

    T_Project_Settings_Menu_Mac.png

  2. Under the Project section, click on the Packaging section to show the options for how the project will be packaged.

    Click for full image.

  3. Click on the Advanced Properties that is at the bottom of the Packaging settings to expose the Advanced Project Settings.

    Click for full image.

  4. Look for the option labeled Create compressed cooked packages and enable it (if not already enabled).

    Click for full image.

If you have not packaged your game with the Create compressed cooked packages checkmark box enabled you should see a huge difference in size when your project is re-packaged with it enabled. In fact, it is not uncommon for some project's APK packages to be reduced in size by up to 50% when Create compressed cooked packages is enabled.

Shared Material Shaders & Libraries

Enabling both Share Material Shader Code and Share Material Native Libraries will help to reduce the overall package size of your project, but this comes at the cost of increased loading times. To enable these this option in your UE4 project, you will need to do the following:

  1. First, on the Main Toolbar go to Edit > Project Settings.

    T_Project_Settings_Menu.png

    T_Project_Settings_Menu_Mac.png

  2. At the bottom of the Packing section, there will be the following two checkmark boxes that you should enable.

    • Share Material Shader Code

    • Share Material Native Libraries

    Click for full image.

Excluding Editor Content

Enabling this option will make sure that none of the content that the UE4 Editor uses will be packaged in your project. Note that enabling this could cause issues with missing content in projects that might make use of the Editor content. To enable these two options in your UE4 project, you will need to do the following:

  1. First, on the Main Toolbar go to Edit > Project Settings.

    T_Project_Settings_Menu.png

    T_Project_Settings_Menu_Mac.png

  2. Under the Project section, click on the Packaging section to show the options for how the project will be packaged.

    Click for full image.

  3. Click on the Advanced Properties that is at the bottom of the Packaging settings to expose the Advanced Project Settings.

    Click for full image.

  4. Scroll down until you see the Exclude editor content when cooking option and enable it by clicking on the checkmark box next to it.

    Click for full image.

    Note that enabling this could cause issues with missing content in projects that might make use of the Editor content.

Setting up a Project's Levels

One overlooked area that can lead to the bloating of APK package sizes is failing to properly set up your project's options, like which levels should be loaded by default, or which levels should be used between level transitions. To set which level (or levels) should be used for this type of interaction, you can do the following.

  1. First, on the Main Toolbar go to Edit > Project Settings.

    T_Project_Settings_Menu.png

    T_Project_Settings_Menu_Mac.png

  2. Then, under Project in the Maps & Modes section look for the Default Maps section.

    Click for full image.

  3. Click on the arrow next to Game Default Map and from the asset, list select the map you want to use for the games default starting level.

    Click for full image.

  4. Repeat this process until you have level's input for each required map type.

Selecting which Content to Package or not Package

In the Packaging section of your project settings, you can specify which maps and content should or should not be packaged with your game. To specify which maps should be included in your project you will need to do the following:

If you do not specify which maps should be cooked then all maps will be cooked including any testing maps that you might have. Failing not to specify which maps should be cooked will result in your final packaged game being bigger than it needs to be.

  1. First, open up the project's settings by going to the Main Toolbar and selecting Edit > Project Settings.

    T_Project_Settings_Menu.png

    T_Project_Settings_Menu_Mac.png

  2. Then, under Project in the Packaging section look for the Packaging option.

    Click for full image.

  3. Click on the small white triangle at the bottom of the Packaging section to expose the advances packing options.

    Click for full image.

  4. Scroll to the lower part of the Advanced Packaging options till you see a checkmark box for Cook everything in the project content directory(ignores list of maps below) option. The options that you see here will allow you to specify which content and maps should be packaged or should not be packaged with your project.

    Click for full image.

  5. To include or exclude an item press the white plus sign next to the option you want to use to create a new entry.

    Click for full image.

  6. Then click on the three small white dots next to the new entry and from the windows that are displayed, choose which assets to include or exclude from the build.

    Click for full image.

  7. When you have selected an asset, the entry box will now contain a link to where that asset is in your project's folder.

    Click for full image.

Property Name

Description

Cook everything in the project content directory(ignore list of maps below.

Cook all things in the project content directory.

Cook only maps(this only affects cook all).

Cook only maps(this only affect the cook all flag).

Create compressed cooked packages.

Create compressed cooked packages(decreased deployment size.

Do not include editor content in this package may cause game to crash/error if you are using this content

Skip cooking Editor content.

List of maps to include in a packaged build

List of maps to include when no other map list is specified on command line.

Additional Asset Directories to Cook

Directories containing .uasset files that should always be cooked regardless of whether they're referenced by anything in your project. Note: These paths are relative to your project Content directory.

Directories to never cook

Directories that should never be cooked.

Additional Non-Asset Directories to Package.

Directories containing files that should always be added to the .pak file(if using a .pak file; otherwise they're copied as individual files) This is used to stage additional file that you manually load via the UFS (Unreal File System) file IO API. Note: These paths are relative to your project Content directory.

Additional Non-Asset Directories to Copy.

Directories containing files that should always be copied when packaging your project, but are not supposed to be part of the .pak file. This is used to stage additional files that you manually load with using the UFS (Unreal File System) file IO API, ex, third-party libraries that perform their own internal file IO. Note: These paths are relative to your project Content directory.

Checking what Content will be Cooked

To ensure that only the content that is related to your project is added to your APK file, you can check which content is being added to your project's APK by looking in the Cooked folder in your project. You can find the Cooked folder by going to (ProjectName)\Saved\Cooked and then choose the folder with the format you cooked your project for.

Please note that you will only be able to see the content in the Cooked folder after you complete your first cook.

Click for full image.

Click for full image.

The image below shows the Texture folder from the Match 3 sample game. The content in the folder has been sorted by size, so it is easier to see what assets are the biggest. Once the most significant assets have been determined, you can then examine the assets inside of UE4 to see if in fact they can be reduced in size without sacrificing the integrity of the asset.

Click for full image.

Click for full image.

Development VS Shipping Build Size

When trying to figure out the final size your project will be, keep in mind that the Development version of your project will be slightly larger than your Shipping build size. On the Medieval Match example game, the difference in size between a Development and Shipping build was around 14 percent. However, since each project has different requirements, the saving between the two different build types for your project could be more or less than a 14 percent savings.

Per-Device Texture LOD's

With the release of Unreal Engine 4.8, you can now specify which size Texture should be used on which devices. You can read more about this in the Texture Guidelines for Mobile Platforms section.

Removing Unused Content

When your project is finally ready to be packaged up for the store, make sure to first remove any unused or testing content by selecting it in the Content Browser and deleting it. You can delete content by first selecting the content you want to delete and then either press the Delete key on the keyboard or use the Delete option in the Right - Click menu. When you do try and delete something from your project, the Delete Assets menu will be displayed like in the following image.

This is the preferred method of deleting objects in UE4 and should be used over just simply deleting/removing the assets from their location in the content folder.

DeleteAssets_Windows.png

Click for full image.

The Delete Assets menu will inform you if the asset you are trying to delete is referenced by another asset. If it is not referenced, you can simply delete it, however, if it is referenced by other assets, you can use the Replace References option to replace the reference to that asset to another asset that is supposed to be packaged in your project.

Removing Unused Plug-ins

Disabling any unused plug-ins inside of the UE4 Editor is another way to ensure that unnecessary content and code do not make it into your project's final APK package file. This is because some plug-ins require a particular set of base assets and code to work correctly. If the plug-in is not disabled, the assets and code that are needed to make the plug-in work will not be removed from your project. While this might not reduce your project's size as much as reducing or removing a large Texture would, every little bit can help when trying to slim your project down to the 100 MB size. To disable a plug-in inside of UE4, you need to do the following:

Make sure you thoroughly test your project to ensure that the plug-ins you are disabling do not interfere with the functionality of your project.

  1. First, open up the Plug-ins Manager by going to the Main Toolbar and clicking on the Window option and then selecting the Plug-in option.

    T_Open_Plugins_Browser.png

    T_Open_Plugins_Browser_Mac.png

  2. From the Plug-in Browser, select the different sections and disable any plug-ins you are not using by un-checking the check mark box next to Enabled. When you have disabled all the plug-ins, you will need to re-start the UE4 Editor and then make sure to re-package your project.

Package Black List

You can now place a text file in your project's Build/Platform/(Target Platform Folder) directory that will tell the cooker to exclude partial or complete file paths from being packaged into your project. Projects can have multiple Black List files for Debug, Development, Test, and Shipping builds that can be setup to include or exclude whatever project data you want. You can even have different Black List files for each platform your project supports like one for Android, one for iOS, etc. Here is an example of what the Black List files would look like for Tappy Chicken on Android.

Click for full image.

Click for full image.

Here is an example from Tappy Chicken where the cooker is told not to include the following files when the game is cooked and packaged.

  • Blacklist Text File Location & Name: TappyChicken/Build/Android/PakBlacklist-Shipping.txt:

    T_Black_List.png

    T_Black_List_Mac.png

The first three entries should be safe for any project, but there may be cases where the AssetRegistry.bin is needed at runtime (depending on your project). It is highly recommended that you thoroughly test to ensure that the content you are removing will not negatively impact your project. An easy and straightforward way to go about this is to open up all your project's levels to ensure that they correctly load and have no errors or warnings. If you run into further problems and are not sure where they are coming from, check the Logcat for errors.

Max Dynamic Point Lights

The property, Max Dynamic Point Lights which can be found under the Mobile section of the Project Settings can help reduce the number of shaders that are generated for dynamic lights. This feature is particularly useful for mobile games that do not require dynamic lighting.

Click for full image.

To completely disable this feature, set the Max Dynamic Point Lights from 4 to 0 and then re-start the UE4 Editor when prompted.

Max_Dyn_Point_Lights_To_0.png

Depending on the size of your project and the number of Materials used, the size saving you can achieve can range from just a few MB to the multiple MB ranges. Using the default Third Person template, for example, we can see what the size savings are when Max Dynamic Point Lights are enabled versus when Max Dynamic Point Lights are disabled completely.

State

Packaged Game Size

Savings

ON

54.3 MB

0

OFF

53.2 MB

1.1 MB

Build with Hidden Symbols

You can build the shipping configuration with hidden visibility by default which will result in a smaller .so file. However, this will also remove symbols used to display call stack dumps so your ability to debug crashes, will be limited. To enable these this option in your UE4 project, you will need to do the following:

  1. First, open up the project's settings by going to the Main Toolbar and selecting the Edit option, then selecting Project Settings.

    T_Project_Settings_Menu.png

    T_Project_Settings_Menu_Mac.png

  2. Then go to Platforms > Android > Advanced Build and enabled the Build with hidden symbol visibility in shipping config by clicking on the checkmark box.

    Click for full image.