UE4-HTML5
Boss wants to change old pc games to mobile, but the game are based the DX11 and C++,so i have to change them to Unreal Engine 4. Addtionally, the boss require that the game will run on minigame in WeChat. For all that, I choose the UE4.27.2 with html5 to be the game Engine.
I have study from :
https://github.com/SpeculativeCoder/UnrealEngine-HTML5-ES3/blob/main/README.md
Firstly, clone the source code
git clone -b 4.27-html5-es3 --single-branch https://github.com/SpeculativeCoder/UnrealEngine.git ue-4.27-html5-es3
Secondly, Download and replace the Commit.gitdeps.xml file in the folder Engine/
I download the file from https://github.com/EpicGames/UnrealEngine/releases/tag/4.27.2-release
Replace the file, then enter the folder ue-4.27-html5-es3 and open the git bash and execute the command:
./Setup.bat
When it’s done, enter the folder ue-4.27-html5-es3\Engine\Platform\HTML5 and open the git bash and run the command following:
./HTML5Setup.sh
in this step, you will encounter some errors, I have gotten some cues from this link: https://blog.csdn.net/jiadu/article/details/134408276.It mainly make changes as follow:
![](http://xcodep.oss-cn-beijing.aliyuncs.com/2024/03/20240319065753745.png?x-oss-process=image/auto-orient,1/quality,q_90/format,webp)
![](http://xcodep.oss-cn-beijing.aliyuncs.com/2024/03/20240319065819692.png?x-oss-process=image/auto-orient,1/quality,q_90/format,webp)
![](http://xcodep.oss-cn-beijing.aliyuncs.com/2024/03/20240319065736322.png?x-oss-process=image/auto-orient,1/quality,q_90/format,webp)
Subsequently, apped the code line to the the end of file ue-4.27-html5-es3\Engine\Plugins\Runtime\AR\Microsoft\HoloLensAR\Source\HoloLensTargetPlatform\HoloLensTargetPlatform.Build.cs
bEnableUndefinedIdentifierWarnings = false;
// Copyright Epic Games, Inc. All Rights Reserved.
using System;
using System.IO;
using UnrealBuildTool;
public class HoloLensTargetPlatform : ModuleRules
{
public HoloLensTargetPlatform(ReadOnlyTargetRules Target) : base(Target)
{
PrivateDependencyModuleNames.AddRange(
new string[] {
"Core",
"CoreUObject",
"Settings",
"EngineSettings",
"TargetPlatform",
"DesktopPlatform",
"HTTP",
"Json",
"HoloLensPlatformEditor",
}
);
PrivateIncludePathModuleNames.Add("Settings");
int Win10Build = 0;
Version ver = null;
if (Version.TryParse(Target.WindowsPlatform.WindowsSdkVersion, out ver))
{
Win10Build = ver.Build;
}
//there is a WinSDK bug that prevented to include the file into this version
if(Win10Build != 0 && Win10Build != 16299)
{
PrivateDefinitions.Add("APPXPACKAGING_ENABLE=1");
}
else
{
PrivateDefinitions.Add("APPXPACKAGING_ENABLE=0");
}
// compile withEngine
if (Target.bCompileAgainstEngine)
{
PrivateDependencyModuleNames.Add("Engine");
PrivateIncludePathModuleNames.Add("TextureCompressor");
}
PublicSystemLibraries.Add("shlwapi.lib");
PublicSystemLibraries.Add("runtimeobject.lib");
bEnableUndefinedIdentifierWarnings = false;
}
}
Generate VS project
Of course, you must install vs 2019 or 2022 and .netfromwork 4.6.
Then enter the folder ue-4.27-html5-es3, and run git bash.Execute the command in the bash window:
./GenerateProjectFiles.bat
Subsequently, it will generate a UE4.sln
Build the UE4.sln
Open UE4.sln
in Visual Studio. You will probably see a popup asking if it is OK to upgrade the .NET programs from 4.5 to 4.8 (or similar). You can accept this in each case (I typically click the “do this for all” checkbox to get through this quicker).
Now you can build all the programs. CTRL-Click the following projects to select them all at once:
- UE4
- AutomationTool
- AutomationToolLauncher
- HTML5LaunchHelper
- ShaderCompileWorker
- UnrealBuildTool
- UnrealFrontend
- UnrealHeaderTool
- UnrealLightmass
- UnrealPak
Now Right Click -> Build Selection
This will take a long time. UE4 will be built last and takes the longest. If you see any failures at the end, try again at least once in case there was any ordering issue etc.
If you want know more usage, please visit the url:https://github.com/SpeculativeCoder/UnrealEngine-HTML5-ES3/blob/main/README.md