UE导入图集:TexturePacker

When developing games, a large number of image resources are used, and the purpose of using texture atlases is to reduce DrawCall and improve performance. In UE, there is no packaging tool for texture atlases, and a popular solution is to use the third-party texture packing tool TexturePacker. The new version of TexturePacker supports direct export of UE4 Sprites and can be imported directly into the engine. In earlier versions, it was possible to import data via a Json Array using VaTexAtlas, but compared to the direct export of UE Sprites by TexturePacker, VaTexAtlas does not have an advantage. UE Sprites can be previewed directly, while VaTexAtlas cannot. Given that official support is already available, it is not recommended to use VaTexAtlas as a method for importing texture atlases into UE.

This article mainly focuses on documenting the analysis of TexturePacker atlas generation files, importing into UE, introducing options, and recording the issues encountered while using it in UE.

Read more »

UE开发笔记:Mac/iOS篇

The main content of this article introduces the deployment of the UE development environment on Mac, configuration of iOS remote packaging, the application of UPL on iOS (intervening in the ipa packaging process), tools and development skills, as well as analysis of related engine code, documenting some pitfalls encountered in the project. It is primarily compiled from my previous notes, and related Mac and iOS content will also be updated in this article in the future.

Read more »

UE热更新:需求分析与方案设计

Game hot updates are a way for players to obtain the latest game content without reinstalling the game. They are widely used in network games on both PC and mobile platforms, as quick adjustments, bug fixes, and content updates are often needed after a game goes live. If even the smallest change requires players to update the app through the App Store, or manually download and install it from a website, and given that different platforms have inconsistent review rules and feedback times, operations could become chaotic.

While there may be relatively mature solutions for hot updates in other engines, comprehensive discussions on implementing hot updates in UE4 are not commonly found. Fortunately, I have previously analyzed and implemented UE4’s hot update mechanism and plan to write a couple of articles to document my thoughts and implementation plans, along with a runnable demo, which I hope will be of help to those who need it.

To conveniently collect and manage common questions and solutions regarding hot updates and HotPatcher, I’ve created a new article to document and organize them: UE4 Hot Update: Questions & Answers. If you encounter issues, please check this FAQ page first.

Read more »

ModularFeature:为UE4集成ZSTD压缩算法

UE uses Zlib by default as the compression algorithm for packaging resources, but it is not the best choice in terms of compression ratio and decompression speed. The efficiency comparison of various compression algorithms can be seen from the Squash Compression Benchmark. I chose the Facebook open-source ZStandard to replace Zlib, as ZSTD provides a good compression ratio while also having decent decompression speed. This article will not only explain how to integrate a compression algorithm into UE but will also briefly introduce a modular organization method for some features in UE—ModularFeature. Using this method makes it easy to replace certain functionalities, and the replacement compression algorithm in this article serves as a practical example.

I integrated ZSTD into UE by writing a plugin. The source code is available on GitHub: hxhb/ue-zstd, which supports Android, Windows, iOS, and macOS. Feel free to give it a star.

Read more »

UE热更新:基于UnLua的Lua编程指南

UE uses C++ as a compiled language, which means it becomes binary after compilation, and players can only update the game by reinstalling it. However, in game development, there’s often an urgent need for requirement adjustments and bug fixes, and frequently prompting players to update the app is unacceptable. Generally, game projects use Lua as the scripting language to transform the immutable C++ code at runtime into updatable Lua code.

Although UE does not officially support Lua, Tencent has open-sourced UnLua, which is being used in my current project. Over the past few days, I’ve organized some materials on UnLua (mainly the official documentation, issues, and presentation PPT) and combined it with my own experience from testing UnLua while writing a small demo, resulting in this programming guide for UE combined with UnLua. This article summarizes some basic methods and pitfalls for using UnLua to write business logic and will be updated continuously.

Additionally, Lua files can be packaged into Pak using my previously open-sourced tool: hxhb/HotPatcher. I’ve also modified a version based on UnLua, adding some extra optimizations. The source code integrates the Luasocket/Luapanda/lpeg/Sproto/Luacrypt libraries, and you can use LuaPanda for debugging. The GitHub address is: hxhb/debugable-unlua.

Read more »

UEC++与标准C++的区别与联系

Due to the impact of COVID-19, I’ve been confined at home throughout the Spring Festival, and I haven’t returned to work yet. I can only read books and organize my notes, hoping the pandemic ends soon and that my friends stay healthy.
The main content of this article is to analyze the differences in syntax between the C++ used in UE development and standard C++. UEC++ is essentially a superset of C++, supporting and utilizing all features of C++, but it has built its own syntax on top of the standard features. Many compilation issues during development can only be quickly and accurately identified at different stages by understanding the boundaries between the two. For those who learned C++ before using UE, this isn’t a problem, but for students who first encounter UE and then gradually learn C++, this can be quite a significant issue.

Standard C++ is based on the language standard ISO/IEC 14882 (C++98/03/11/14/17, etc.), while UEC++ is Epic’s extended usage built on standard C++. This article will not cover topics like GC or reflection or various libraries in UE, focusing instead on the core syntax level.

Read more »

UE源码分析:修改游戏默认的数据存储路径

By default, after packaging a game with UE and installing the Apk on a phone, launching the game will create the game’s data directory under /storage/emulated/0/UE4Game/ (which is at the root of the internal storage). According to Google’s rules, it is best for each app’s data files to be placed in their own private directory. Therefore, I want to put all the game’s data packaged by UE into the directory /storage/emulated/0/Android/data/PACKAGE_NAME (regardless of whether it’s log, ini, or crash information).
This seemingly simple requirement has several different approaches involving UE4’s path management, JNI, Android Manifest, and analysis of UBT code.

Read more »

UE资源热更打包工具HotPatcher

Important Notice: The author does not have any platform or channel to record paid courses and does not endorse any commercial activities by third parties. Please stay vigilant and be cautious of scams.
The open source license of this software: Allows free use of features in commercial projects, but does not allow any third party to charge any form of secondary fees based on this plugin, including but not limited to recording paid courses, secondary distribution of the plugin and code, etc.

HotPatcher is a tool used for managing hot updates and resource packaging, aimed at tracking changes in original resources of project versions to generate patches. It supports one-click cooking for multiple platforms, one-click packaging for multiple platform patches, and editor support for Windows and MacOS. Writing a process to download patches from a server creates a complete hot update solution for games. HotPatcher has been used in many UE projects and will continue to update to support new engine versions. Issues are welcome.

HotPatcher differs from the Patch mechanism in UnrealFrontEnd; there are some issues with UE’s Patch management for projects: based on the original project version, it is difficult to generate identical patches on different computers, it is not possible to generate a new patch based on the version of a patch, and the content included in a patch cannot be previewed intuitively. Additionally, it is not convenient to package external files into pak (such as lua files, db, and other non-assets, which often reside outside the Content directory), nor to manage project and patch versions easily.

This plugin is designed to solve such issues by using the project’s original resources as the version basis, only needing to manage the project itself without paying attention to other files generated by UE. It allows easy operations such as cooking, generating pak, extracting resource information from basic packages, diff between versions, and patch splitting. It has very rich configuration options and Commandlet support, making it convenient to achieve an automated hot update packaging process.

The currently supported engine versions are UE4.21-UE5, and support for the IoStore mechanism is provided! Many friends have contacted me privately to inquire about plugin-related issues, so I created a group to discuss UE hot updates and the HotPatcher plugin (QQ group 958363331). You are welcome to join and exchange technical knowledge related to UE.

To conveniently collect and manage common questions and solutions regarding hot updates and the HotPatcher, I have created a new article to document and organize: UE4 Hot Update: Questions & Answers. If you encounter problems, you can check this FAQ page first. Regarding the issue that many people have reported about the inconsistency between the configuration parameters in the plugin and the previous recorded video, it is because the plugin has undergone many updates. You can check the Change Log for detailed changes for each version.

Read more »

UE项目的设计规范和代码标准

Recently, a new project has been initiated, summarizing some issues from previous projects and listing design specifications and code standards for UE development projects (the term “code standards” seems too strict; coding habits are quite subjective, and “coding conventions” would be a better term, but strict execution is necessary for promotion within the team). This article will be continuously updated and organized, and feedback and discussions are welcome.

Read more »