Unreal Engine 4 Mobile. Build Android project + DLC





Unreal Engine 4 provides enough functionality to fully develop games for mobile platforms. Unfortunately, the topic is not well covered, and the application building process itself is full of bugs. I decided to summarize the information that is relevant at the moment and share my own experience of overcoming this difficult path. This tutorial covers the following processes in detail:





  • Setting up a project for developing a mobile application





  • Creating a release version of the application





  • DLC creation and its connection to the project





  • Downloading DLC ​​from the server









We will need:





  • Unreal Engine 4.25.1





  • Python 3





  • Node.js (optional)





  • Android device with a working USB port





Project creation and content preparation

If you already have a finished project, you can skip this stage.





Create an empty C ++ project





Create a folder structure in the Content directory





Add cards

  • Save the starter level to a MapRelease folder called Release_Map





  • Create a new level via File-> New Level-> Default and save it in the MapDLC folder called DLC_Map





Create test content

Creating an Actor to test content work
  1. Open Release_Map





  2. Create Blueprint Actor in MapRelease folder and name ReleaseCube





  3. In the same folder create Material, name it m_cube and set any color for it





  4. ReleaseCube Static Mesh Component





  5. Details Static Mesh None





  6. View Options, Show Engine Content





  7. None Cube





  8.  Material (m_cube)





  9. ReleaseCube Release_Map









Level Blueprint





DLC_Map. Blueprint Actor DLCSphere m_sphere MapDLC. DLCSphere DLC_Map .





Edit->Plugins. .   , .





  • Android Runtime Permission





  • Online Subsystem





  • Online Subsystem Null





  • Online Subsystem Utils





  • TCP Messaging





  • UDP Messaging





  • Mobile Patching Utilities





  • GooglePAD





  • Online Subsystem Google Play









  • Actor Layer Utilities





  • Actor Sequence





  • Alembic Importer





  • Apple Image Utils





  • Apple Movie Player





  • Audio Capture





  • Cable Component





  • Camera Shake Previewer





  • Chaos Cloth





  • Chaos Cloth Editor





  • Cahos Niagara





  • Cahos Solver





  • CahosEditro





  • CharacterAI





  • Custom Mesh Component





  • Editable Mesh





  • Facial Animation Bulk Importer





  • Level Sequencer Editor





  • LigthPropogationVolume





  • Magic Leap





  • Magic Leap Light Estimation





  • Magic Leap Media Player





  • Magic Leap Passable World





  • Mesh Painting





  • Niagara





  • Oculus VR





  • Online Subsystem iOS





  • Paper2D





  • PhysX Vehicles





  • Procedural Mesh Component





  • Steam VR









Edit-> Project Settings.





Target Hardware Mobile/Tablet





Game Default Map





Packaging .





Packaging

Share Material Shader Code. DLC .





Packaging
Click to expand the advanced settings box
,

:





  • Create compressed cooked packages β€” 





  • List of maps to include in a packaged build β€”  ( ), .









Project
  • Full Rebuild





  • , For Distribution . (gradle)









Rendering

Rendering , β€”  Bloom. .









. . , . Support Atmospheric Fog, Atmospheric Fog  World Outliner. Sky Sphere . .





Android SDK β€”  . SDKConfig.





SDKConfig





(com.YourCompany.[PROJECT]). . aBigCompany YourCompany MyProject (AndroidDLC). . My Project with DLC.





APK Packaging








  • Target SDK Version: 29  Google Play





  • Store Version. , Google Play. 1





:





  • Package game data inside .apk β€”  APK . , Google Play APK (100 mb). APK Android App Bundle,





  • Use ExternalFilesDir for UE4Game files β€”  . SaveGame Object , . , ,





  • Orientation β€”  . . β€” 









arm64 will do in most cases
arm64





Windows. :





keytool -genkey -v -keystore MyProjectKey.keystore -alias MyProjKey -keyalg RSA -keysize 2048 -validity 10000
      
      



. .









C:\User\(Current user) MyProjectKey.keystore.





  Build Folder (…\AndroidDLC\Build\Android) .









().





Project Launcher

Window->Project Launcher.





Create Minimal Android APK + DLC
Minimal Android APK + DLC
Create a folder to store received files and create profiles
Created profiles
Generated folders









, . - .





Any Project :





Google Play APK DLC Shipping . Development .





Android APK

Android APK.





. :





, :





:









APK

:





Done Project Launcher.





, . , ...\AndroidDLC\Saved\Cooked\Android_ETC2.





EngineMaterials

, DefaultBloomKernel.uexp. Bloom , *.pak , , .





DLC

DLC Unreal Engine 4 . *.pak , .





, . . , , ( ).  





DLC

Edit -> Plugins.





  1. New Plugin





  2. β€”  Content Only





  3. (DLC1)





  4. Create Plugin





.





Android DLC

Android DLC.





, DLC, , Android APK. :





:





…/Android_Release/HTTPchunks DLC1.0 DLC.





Browse DLC:





:





, DLC:









DLC

DLC:





:





- *.mainfest:





, . …\Android_Release\HTTPchunks\DLC1\Android_ETC2. :





DLC1\AndroidDLC\ *.pak . AndroidDLC\Plugins\DLC1\Saved\Cooked\Android_ETC2





CloudDir .





.





Android_Release\App\1.0\Android_ETC2.









Install_AndroidDLC-arm64.bat . , .





My Project with DLC . Release_Map. 10 DLC_Map, .





DLC Mobile Patching Utilities

Android, .





Level Blueprint Release_Map.





blueprint .





Request Content DLC :

:





  • Remote Manifest URL β€”  yourserver.com/manifest_name.manifest





  • Cloud URL β€”  yourserver.com/[folder_with_ChunksV3_folder]





  • Install Directory β€”  ( β€”  DLC)









ChunksV3 CloudDir:





ChunksV3 *.pak DLC, .





Install Directory , , :





*.pak Mount:
  • Pak Order β€” 





  • Mount Point  β€”  .









, . Node.js.





:





http-server "F:\Unreal Projects\AndroidDLC\Android_Release\HTTPchunks\DLC1\Android_ETC2\CloudDir"
      
      



Server started





Level Blueprint
  • Remote Manifest  β€”  http://127.0.0.1:8080/AndroidDLC_AndroidDLCDLC1.manifest





  • Cloud URL β€”  http://127.0.0.1:8080









Play, Release_Map. ...\AndroidDLC\PersistentDownloadDir\DLC *pak , .









DLC

DLC .  , *.pak .





Level Blueprint





Android APP .   AndroidDLC-Android_ETC2.pak AndroidDLC_AndroidDLCDLC1.manifest APK.





APK





Install_AndroidDLC-arm64.bat . :





%ADB% %DEVICE% shell rm -r %STORAGE%/Android/data/com.aBigCompany.MyProject/files/DLC

%ADB% %DEVICE% push AndroidDLC_AndroidDLCDLC1.manifest %STORAGE%/Android/data/com.aBigCompany.MyProject/files/DLC/AndroidDLC_AndroidDLCDLC1.manifest
%ADB% %DEVICE% push AndroidDLC-Android_ETC2.pak %STORAGE%/Android/data/com.aBigCompany.MyProject/files/DLC/AndroidDLC-Android_ETC2.pak

      
      







. .  , DLC .





DLC





DLC

*.pak . . . -. 





.





FTP , FileZilla.





Site Manager





  1. New Site





  2. (FTP Port : 21)





  3. Connect









DLC

app-content. DLC.









. :





func.php
<?php

function generateLink($link){
    return '<a href="'.$link.'">'.$link.'</a>';
}
 
function genFileStructCurrentDir($root_dir){
    if (is_dir($root_dir)){
        $files = opendir($root_dir); {
            if ($files){
                while (($item = readdir($files)) !== FALSE){
                    if ($item != '.' && $item != '..' && $item != 'index.php'){
                        echo generateLink($item) . " <br>";
                    }
                }
            }
        }
    }
}
 
 
?>
      
      







index.php
<?php
include '/var/www/uXXXXX/data/www/[YOUR_DOMAIN]/func.php';
?>
 
<html>
<head></head>
<body>
<?
$full_dir =  __DIR__;
genFileStructCurrentDir($full_dir);
?>
</body>
</html>
      
      







include:





include '/var/www/uXXXXX/data/www/[YOUR_DOMAIN]/func.php';
      
      



:

web-file-gen.py - Python index.php DCL1.





web-file-gen.py
import os
import shutil

path_to_index = 'index.php'

def copy_file_to_directory(destination:str, path_to_file:str):
    if os.path.isdir(destination):
        shutil.copy(path_to_file,destination)
    

def get_subdirectories(root_dir:str):
    out_list = []
    if os.path.isdir(root_dir):
        for item in os.listdir(root_dir):
            rel_pth = f'{root_dir}/{item}'
            if os.path.isdir(rel_pth):
                out_list.append(rel_pth)
                out_list += get_subdirectories(rel_pth)
    return out_list


def copy_file_to_dirs(dir_list:list, path_to_file:str):
    for folder in dir_list:
        if os.path.isdir(folder):
            copy_file_to_directory(folder, path_to_file)
        
dir_list = get_subdirectories(os.getcwd())
copy_file_to_dirs(dir_list,path_to_index)

input("Done")

      
      







.../www/your_domain func.php.





.../app-content index.php DLC1.





http://your_domain/app-content/DLC1/ChunksV3/





If you see the folder structure, then most likely everything is done correctly.
If you see the folder structure, then most likely everything is done correctly.









Edit the Level Blueprint





Change the URL for downloading files, rebuild and reinstall the project to your mobile device.





The DLC is now being downloaded and installed.





Conclusion

I recommend that you think about the organization of files in your application in advance. Try to keep all the code and assets used in different DLCs in the main assembly. This approach will eliminate duplicate files and reduce the overall weight of the application.





I hope this material will help save someone's time.








All Articles