Language:
Page Info
Skill Level:
Engine Version:

Reducing Packaged Game Size

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 a completely 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

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

    T_Project_Packaging.png

  3. Click on the small white triangle that is at the bottom of the Packaging settings to expose the Advanced Project settings.

    T_Expose_Advanced_Props.png

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

    T_Enable_Comp_Packages.png

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.

Setting up a Project's Levels

One overlooked area that can lead to the bloating of APK package sizes is failing to properly setup 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.png

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

    T_Set_Maps.png

  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.

    T_Project_Settings_Default_Game_Map.png

  4. Repeat this process until you have levels setup 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 to not 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

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

    Content_To_Pack.png

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

    Advanced_Packing_Section.png

  4. Scroll to the bottom of the advanced Packaging options till you see a checkmark box for Cook everything in the project content directory(ignore 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.

    Advanced_Packing_Options.png

  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.

    Add_New_Item.png

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

    Select_Items_To_Cook.png

  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.

    Selected_Item_Location.png

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 cookall 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 commandline.
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 choosing 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.

T_Cooked_Content_Folder.png

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 biggest 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.

T_Cooked_Content.png

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.

T_Delete_Menu.png

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 certain set of base assets and code to work correctly. If the plug-in is not disabled, the assets and code that are required 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 fully 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

  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

With the release of Unreal Engine 4.9 and later 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, ect. Here is an example of what the Black List files would look like for Tappy Chicken on Android.

T_Blacklist_Packages.png

Here is an example from Tappy Chicken where the cooker is told to not 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

The first three entries should be safe for any project, but there may be cases were 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 simple 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

With the release of UE 4.9 a new option has been introduced that can help reduce the number of shaders that are generated for dynamic lights. Making this feature is particularly useful for mobile games that do not require dynamic lighting. The property, Max Dynamic Point Lights can be found under the Mobile section of the Project Settings.

Max_Dyn_Point_Lights.png

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 amount of Materials used, the size saving you can achieve can range from just a few MB to the multiple MB range. Using the default Third Person template for an 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