Unreal engine loading method and device, equipment and storage medium
By independently setting the Unreal Engine code files and resource files as Unreal Engine installation packages, and using the dynamic loading methods of class loader path extension and resource call interface, the problem of limited volume reduction after compression of Unreal Engine resource files in the existing technology is solved, and a greater reduction in installation package volume and resource quality assurance is achieved.
Patent Information
- Application Number
- CN202311584775.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-11-23
- Publication Date
- 2025-05-23
AI Technical Summary
The prior art reduces the volume of the installation package of the application by compressing Unreal Engine resource files, but the reduction is relatively limited and cannot effectively reduce the volume of the installation package.
Set Unreal Engine code files and resource files separately into Unreal Engine's installation packages to make them independent from the application's installation packages. By extending the class loader path, dynamic loading of Unreal Engine code files is realized, and the resource calling interface in the application's installation package is used to realize dynamic loading of Unreal Engine resource files.
By independent of the Unreal Engine resource files from the application's installation package, the application's installation package volume is significantly reduced, while ensuring the quality of the resource files, avoiding the quality reduction caused by compression.
Smart Images

Figure CN120029679A_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the field of computer technology, and in particular to a method, device, equipment and storage medium for loading an Unreal Engine. Background Art
[0002] Unreal Engine has been widely used in scenarios such as games. Developers use Unreal Engine to build an application installation package, which includes Unreal Engine code files (libUE4.so files) and Unreal Engine resource files (main.obb.png files). Among them, Unreal Engine code files are used to support the operation of Unreal Engine, and Unreal Engine resource files are used to provide resource files for the operation of applications.
[0003] In the related art, considering that the Unreal Engine resource files include a large number of image resources, texture resources, etc., the size of the application installation package is generally reduced by compressing the Unreal Engine resource files.
[0004] However, in the above-mentioned related technologies, the size of the application installation package is reduced by compressing the Unreal Engine resource files, but the reduction in the size of the application installation package is relatively limited. Summary of the invention
[0005] The embodiment of the present application provides a method, device, equipment and storage medium for loading an Unreal Engine. The technical solution is as follows:
[0006] According to one aspect of an embodiment of the present application, a loading method for an Unreal Engine is provided, the method comprising:
[0007] Obtaining an installation package of an application and an installation package of an Unreal Engine, wherein the installation package of the Unreal Engine includes an Unreal Engine code file and an Unreal Engine resource file, wherein the Unreal Engine code file is a file required to run the Unreal Engine, and the Unreal Engine resource file is a resource file related to the application and called by the Unreal Engine at runtime, and the installation package of the application is used to support a terminal device to run the application;
[0008] Performing path extension on the first class loader on the terminal device, and using the first class loader after path extension to load the Unreal Engine code file during the running of the application, wherein the first class loader stores loading path information of the installation package of the application, and the first class loader after path extension also stores loading path information of the Unreal Engine code file, wherein the loading path information is used to represent the storage address of the file on the terminal device;
[0009] The Unreal Engine resource file is loaded by utilizing the resource calling interface in the installation package of the application.
[0010] According to one aspect of an embodiment of the present application, another loading method for Unreal Engine is provided, the method comprising:
[0011] Constructing an installation package of an application and an installation package of an Unreal Engine, wherein the installation package of the Unreal Engine includes an Unreal Engine code file and an Unreal Engine resource file, wherein the Unreal Engine code file is a file required for running the Unreal Engine, and the Unreal Engine resource file is a resource file related to the application that is called by the Unreal Engine at runtime, wherein the installation package of the application is used to support a terminal device to run the application, and the installation package of the application includes a resource calling interface, and the resource calling interface is used to load the Unreal Engine resource file;
[0012] The installation package of the application and the installation package of the Unreal Engine are sent, wherein the Unreal Engine code file is loaded through the first class loader after the path expansion on the terminal device, wherein the first class loader stores the loading path information of the installation package of the application, and the first class loader after the path expansion also stores the loading path information of the Unreal Engine code file, wherein the loading path information is used to represent the storage address of the file on the terminal device.
[0013] According to one aspect of an embodiment of the present application, a loading device of an Unreal Engine is provided, the device comprising:
[0014] An installation package acquisition module, used to acquire an installation package of an application and an installation package of an Unreal Engine, wherein the installation package of the Unreal Engine includes an Unreal Engine code file and an Unreal Engine resource file, wherein the Unreal Engine code file is a file required to run the Unreal Engine, and the Unreal Engine resource file is a resource file related to the application and called by the Unreal Engine at runtime, and the installation package of the application is used to support a terminal device to run the application;
[0015] A path extension module, used to perform path extension on the first class loader on the terminal device, and during the running process of the application, use the first class loader after the path extension to load the Unreal Engine code file, wherein the first class loader stores the loading path information of the installation package of the application, and the first class loader after the path extension also stores the loading path information of the Unreal Engine code file, and the loading path information is used to represent the storage address of the file on the terminal device;
[0016] The resource file loading module is used to load the Unreal Engine resource file by utilizing the resource calling interface in the installation package of the application.
[0017] According to one aspect of an embodiment of the present application, another Unreal Engine loading device is provided, the device comprising:
[0018] An installation package construction module, used to construct an installation package of an application and an installation package of an Unreal Engine, wherein the installation package of the Unreal Engine includes an Unreal Engine code file and an Unreal Engine resource file, wherein the Unreal Engine code file is a file required for running the Unreal Engine, and the Unreal Engine resource file is a resource file related to the application and called by the Unreal Engine at runtime, wherein the installation package of the application is used to support a terminal device to run the application, and the installation package of the application includes a resource calling interface, and the resource calling interface is used to load the Unreal Engine resource file;
[0019] The installation package sending module is used to send the installation package of the application and the installation package of the Unreal Engine. The Unreal Engine code file is loaded through the first class loader after the path expansion on the terminal device. The first class loader stores the loading path information of the installation package of the application. The first class loader after the path expansion also stores the loading path information of the Unreal Engine code file. The loading path information is used to represent the storage address of the file on the terminal device.
[0020] According to one aspect of an embodiment of the present application, a computer device is provided, comprising a processor and a memory, wherein a computer program is stored in the memory, and the computer program is loaded and executed by the processor to implement the above-mentioned Unreal Engine loading method.
[0021] According to one aspect of an embodiment of the present application, a computer-readable storage medium is provided, in which a computer program is stored. The computer program is loaded and executed by a processor to implement the above-mentioned Unreal Engine loading method.
[0022] According to one aspect of the embodiments of the present application, a computer program product is provided, the computer program product comprising a computer program, the computer program being stored in a computer-readable storage medium. A processor of a computer device reads the computer program from the computer-readable storage medium, and the processor executes the computer program, so that the computer device executes the above-mentioned Unreal Engine loading method.
[0023] The technical solution provided by the embodiments of the present application may have the following beneficial effects:
[0024] By separately setting the Unreal Engine code files and Unreal Engine resource files into the Unreal Engine installation package, the Unreal Engine related files and the application installation package are independent of each other. Since the Unreal Engine resource files account for a high proportion of the application installation package, when the Unreal Engine resource files are separated from the application installation package, the size of the application installation package is greatly reduced.
[0025] Different from the related art method of directly compressing Unreal Engine resource files, this application does not change the quality of Unreal Engine resource files, which is conducive to ensuring the running effect of the application.
[0026] Furthermore, when the installation package of the Unreal Engine and the installation package of the application are independent of each other, the first class loader is extended to dynamically load the Unreal Engine code file. The resource calling interface in the installation package of the application is used to dynamically load the Unreal Engine resource file. BRIEF DESCRIPTION OF THE DRAWINGS
[0027] Figure 1 It is a schematic diagram of an implementation environment of a solution provided by an embodiment of the present application;
[0028] Figure 2 It is a schematic diagram of a method for loading an Unreal Engine provided in the related art;
[0029] Figure 3 is a schematic diagram of a method for loading an Unreal Engine provided by an embodiment of the present application;
[0030] Figure 4 is a schematic diagram of an Unreal Engine loading method provided by another embodiment of the present application;
[0031] Figure 5 is a flow chart of a method for loading an Unreal Engine provided by an embodiment of the present application;
[0032] Figure 6 is a flowchart of an Unreal Engine loading method provided by another embodiment of the present application;
[0033] Figure 7 It is a schematic diagram of a path expansion method for a class loader provided by an embodiment of the present application;
[0034] Figure 8 is a flowchart of an Unreal Engine loading method provided by another embodiment of the present application;
[0035] Fig. 9 is a schematic diagram of a method for loading Unreal Engine resource files provided by an embodiment of the present application;
[0036] Fig.10is a flowchart of an Unreal Engine loading method provided by another embodiment of the present application;
[0037] Fig.11 is a schematic diagram of a method for loading an Unreal Engine provided by another embodiment of the present application;
[0038] Fig.12 is a block diagram of an Unreal Engine loading device provided by an embodiment of the present application;
[0039] Fig.13 is a block diagram of an Unreal Engine loading device provided by another embodiment of the present application;
[0040] Fig.14 It is a structural block diagram of a computer device provided by an embodiment of the present application. DETAILED DESCRIPTION
[0041] In order to make the objectives, technical solutions and advantages of the present application clearer, the implementation methods of the present application will be further described in detail below with reference to the accompanying drawings.
[0042] Before introducing the technical solution of the present application, some terms involved in the present application are explained. The following related explanations can be combined arbitrarily with the technical solution of the embodiment of the present application as optional solutions, and they all belong to the protection scope of the embodiment of the present application. The embodiment of the present application includes at least part of the following contents.
[0043] Unreal Engine: An engine used to create applications, including video games, virtual reality (VR), augmented reality (AR), movie special effects and simulators.
[0044] Dynamic loading: refers to the ability to freely select the files to be loaded and the loading time after the program is running, based on the pre-set code logic. Take the dynamic loading of Unreal Engine as an example: by default, the engine is packaged together with the game package, and the loading of the engine is triggered when the game starts; while dynamic loading means that the engine may not be packaged together with the game package, and the loading and running of the engine is triggered at the logic node set by the program. This can make the loading logic of the engine more flexible, and the engine does not need to be packaged together with the game package. At the same time, the ability to dynamically replace the game engine can be realized with the update logic.
[0045] Please refer to Figure 1 , which shows a schematic diagram of a solution implementation environment provided by an embodiment of the present application. The solution implementation environment may include: a terminal device 10, a server 20 and a development device 30.
[0046] The terminal device 10 includes, but is not limited to, electronic devices such as mobile phones, tablet computers, intelligent voice interaction devices, game consoles, wearable devices, multimedia playback devices, PCs, vehicle terminals, smart home appliances, etc. The terminal device 10 may be installed with a client of an application program.
[0047] In the embodiment of the present application, the above-mentioned application can be any application that can realize the loading of the Unreal Engine. Optionally, the application can be a game application, an interactive entertainment application, a social application, a simulation application, a virtual reality application, an augmented reality application, etc. Optionally, the game application also includes a first-person shooting game (First-Person Shooting Game, referred to as FPS), a multiplayer gun battle survival game, a third-person shooting game (Third-Person Shooting Game, referred to as TPS), a multiplayer online tactical competition (Multiplayer Online Battle Arena, referred to as MOBA) game, a strategy game (Simulation Game, referred to as SLG), etc., and the embodiment of the present application does not limit this. Of course, for different applications, the project file code of the corresponding application (which can also be considered as the installation package of the application) is different, and the embodiment of the present application does not limit this. Optionally, after obtaining the installation package of the above-mentioned application, the terminal device 10 installs the application and runs the client of the application.
[0048] The server 20 is used to provide background services for the client of the application in the terminal device 10. For example, the server 20 can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN (Content Delivery Network), and big data and artificial intelligence platforms, but is not limited to these.
[0049] The terminal device 10 and the server 20 can communicate with each other via a network, which can be a wired network or a wireless network.
[0050] The development device 30 is used to provide a development environment for project developers and build an installation package for the application. After the development device 30 builds the installation package of the application, the installation package of the application can be sent to the terminal device 10 or the server 20. The development device 30 includes but is not limited to mobile phones, tablet computers, intelligent voice interaction devices, game consoles, wearable devices, multimedia playback devices, PCs, vehicle terminals, smart home appliances and other electronic devices. The development device 30 and the terminal device 10 can communicate with each other through the network. The development device 30 and the server 20 can also communicate with each other through the network.
[0051] The method provided in the embodiment of the present application may be performed by a computer device. The computer device may be any electronic device that has the ability to store and process data. For example, the computer device may be Figure 1 The terminal device 10 in the embodiment may also be Figure 1 The development device 30 may also be another device other than the terminal device 10 and the development device 30.
[0052] Please refer to Figure 2 , which shows a schematic diagram of a method for loading an Unreal Engine provided in the related art. The execution subject of each step of the method can be as follows Figure 1 The terminal device 10 in the implementation environment of the solution shown, or the client of the application program running on the terminal device 10. In the following method embodiment, for the convenience of description, only the execution subject of each step is introduced and explained as "computer device".
[0053] In related technologies, such as Figure 2 As shown in 200, the solution for reducing the size of the game APK package is mainly focused on optimizing and cutting game resources, that is, by deleting some useless resources and compressing some resources to make the Unreal Engine resource file as small as possible, thereby reducing the overall package size. The Unreal Engine resource file is a resource file related to the application called by the Unreal Engine at runtime. According to the actual situation of the project, useless resources are eliminated or replaced with low-definition resources. The resource texture is compressed, similar to compressing an image, to make it smaller, but with a corresponding reduction in quality (decreased clarity).
[0054] However, this method has limited optimization. In large-scale game projects, resources are strictly managed and there are fewer useless resources. On mobile platforms, the Unreal Engine already supports various texture compression operations in the packaging process, and further compression can only sacrifice texture quality.
[0055] Please refer to Figure 3 , which shows a schematic diagram of a method for loading an Unreal Engine provided by an embodiment of the present application. The execution subject of each step of the method can be as follows Figure 1The terminal device 10 in the implementation environment of the solution shown, or the client of the application program running on the terminal device 10. In the following method embodiment, for the convenience of description, only the execution subject of each step is introduced and explained as "computer device".
[0056] In some embodiments, Figure 3 As shown in 300, on the Android platform, when a new class loader is created to load an APK file, the so file in the loaded APK file can be loaded by the newly created class loader. Prepare a dynamic APK file; create a class loader based on the dynamic APK file to load this APK file; load the so file located in the dynamic APK file based on the dynamically created class loader. Using the custom class loader created at runtime, you can load the dynamic APK, but the problem is that only the newly created class loader has the path information of the Unreal Engine code file, that is, only the newly created class loader can load the Unreal Engine code file, and the class loader created by the Android system to load the game APK still cannot load the Unreal Engine code file. Therefore, dynamically loading the Unreal Engine code file according to the above scheme will fail. The APK file here refers to the application installation file output after packaging the Android project using the Android platform development tool. The APK file has the suffix 'apk' and is essentially a zip compressed file. The Unreal Engine code file is the file required to run the Unreal Engine.
[0057] Therefore, based on the above Figure 2 as well as Figure 3 The technical solution cannot achieve the purpose of dynamically loading the Unreal Engine. As for the proposition of reducing the size of the game package, the relevant technology can only conduct in-depth exploration of the optimization points of the Unreal Engine resource file itself, and the space that can be reduced is already very limited.
[0058] Please refer to Figure 4 , which shows a schematic diagram of a method for loading an Unreal Engine provided by another embodiment of the present application. The execution subject of each step of the method can be as follows Figure 1 The terminal device 10 in the implementation environment of the solution shown, or the client of the application program running on the terminal device 10. In the following method embodiment, for the convenience of description, only the execution subject of each step is introduced and explained as "computer device".
[0059] Specifically, Figure 4As shown in 400, the computer device obtains the installation package of the application and the installation package of the Unreal Engine, where the installation package of the Unreal Engine includes the Unreal Engine resource files and the Unreal Engine code files. Correspondingly, the installation package of the application does not include the Unreal Engine resource files and the Unreal Engine code files. After obtaining the installation package of the application, the computer device determines the first class loader according to the installation path of the installation package of the application. The first class loader can also be considered as the system class loader of the computer device. When the computer device is an Android system, the first loader is the class loader provided by the Android platform.
[0060] In some embodiments, the first class loader is path-extended, and the first class loader after path extension stores the loading address of the Unreal Engine code file. During the running process of the application, the first class loader after path extension is used to load the Unreal Engine code file in the Unreal Engine installation package.
[0061] In some embodiments, the installation path of the Unreal Engine resource file on the computer device is obtained, and the Unreal Engine resource file is loaded according to the installation path through a preset resource calling interface.
[0062] Therefore, the embodiment of the present application achieves the purpose of reducing the size of the application installation package by separately extracting the Unreal Engine resource files and Unreal Engine code files from the application installation package and reconstructing the Unreal Engine installation package. Since in the related art, the Unreal Engine resource files occupy most of the size of the application installation package, when the Unreal Engine resource files are independent of the application installation package, the size of the application installation package is reduced significantly.
[0063] In addition, by extending the path of the first class loader, dynamic loading of Unreal Engine code files is achieved, and through the resource calling interface, dynamic loading of Unreal Engine resource files is achieved according to the installation path of the Unreal Engine resource files.
[0064] Please refer to Figure 5 , which shows a flow chart of a method for loading an Unreal Engine provided by an embodiment of the present application. The execution subject of each step of the method can be as follows Figure 1 The terminal device 10 in the implementation environment of the scheme shown, or the client of the application running on the terminal device 10. In the following method embodiment, for the convenience of description, only the execution subject of each step is introduced as "computer device". The method may include at least one of the following steps (510-530):
[0065] Step 510, obtain the installation package of the application and the installation package of the Unreal Engine. The installation package of the Unreal Engine includes the Unreal Engine code files and the Unreal Engine resource files. The Unreal Engine code files are the files required to run the Unreal Engine. The Unreal Engine resource files are resource files related to the application that are called by the Unreal Engine at runtime. The installation package of the application is used to support the terminal device to run the application.
[0066] In some embodiments, the installation package of the application is built by the developer through the development platform on the development device. Exemplarily, the developer writes the project code on the development platform on the development device, and obtains the installation package of the application after packaging. For specific information on how the developer obtains the installation package of the application and the installation package of the Unreal Engine through the development device, please refer to the explanation of the following embodiment, which will not be repeated here. In an embodiment of the present application, when the installation package of the application has been obtained in the terminal device, there is no need to obtain the installation package of the application again. That is, if the installation package of the application has not been updated, and the installation package of the Unreal Engine has been updated, only the installation package of the Unreal Engine can be obtained, which ensures that the installation package of the application does not need to be downloaded repeatedly, while achieving real-time update of the installation package of the Unreal Engine.
[0067] In an embodiment of the present application, the installation package of the application does not include at least one of the Unreal Engine code files and the Unreal Engine resource files. For example, the installation package of the application does not include either the Unreal Engine code files or the Unreal Engine resource files.
[0068] In some embodiments, the Unreal Engine code file is a libUE4.so file, which is one of the products of the Unreal Engine project build compilation output. In some embodiments, the Unreal Engine code file can also be considered as a file required to support the operation of the Unreal Engine, that is, the Unreal Engine code file includes all the code logic of the Unreal Engine operation. LibUE4.so file: one of the products of the Unreal Engine project build compilation output. The Unreal Engine is mainly written in C / C++ language. This part of the source code is eventually compiled into a dynamic link file (so file), named libUE4.so, and released with the game package file (APK file). This file contains all the C / C++ code logic of the Unreal Engine, and the package is relatively large, occupying about 100MB (compressed size) in the APK file. In an embodiment of the present application, the libUE4.so file can also be called the Unreal Engine code file, which is the product after the Unreal Engine is compiled, and is the entity file corresponding to the Unreal Engine code.
[0069] In some embodiments, the Unreal Engine resource file is the main.obb.png file, which is one of the products of the Unreal Engine project build and compile output. In some embodiments, the Unreal Engine resource can also be considered as a resource file related to the application that the Unreal Engine calls at runtime, that is, the Unreal Engine resource file includes all content except code logic. main.obb.png file: one of the products of the Unreal Engine project build and compile output. This file contains all the Unreal Engine game resources in the project, including pictures, videos, blueprints, special effects, etc. All content after the code is packaged into the main.obb.png file and stored in the APK as an assets file. During the Unreal Engine startup process, the main.obb.png file content is read from the APK for loading. This file occupies 90% of the APK file size. In an embodiment of the present application, the main.obb.png file can also be called an Unreal Engine resource file.
[0070] In the embodiment of the present application, the Unreal Engine resource files and the Unreal Engine code files together constitute the Unreal Engine installation package. At this time, the dynamic loading of the Unreal Engine code files is realized through the following step 520, and the dynamic loading of the Unreal Engine resource files is realized through the following step 530.
[0071] It should be understood that the Unreal Engine installation package may also include only Unreal Engine resource files or only Unreal Engine code files.
[0072] In some embodiments, when the installation package of the Unreal Engine includes only the Unreal Engine resource files, the Unreal Engine code files may be included in the installation package of the application. In this case, there is no need to perform the following step 520, and only the following step 530 is performed.
[0073] In other embodiments, when the installation package of the Unreal Engine includes only the Unreal Engine code files, the Unreal Engine resource files may be included in the installation package of the application program. In this case, there is no need to perform the following step 530, and only the following step 520 is performed.
[0074] Step 520, perform path extension on the first class loader on the terminal device. During the running of the application, the first class loader after the path extension is used to load the Unreal Engine code file. The first class loader stores the loading path information of the application installation package. The first class loader after the path extension also stores the loading path information of the Unreal Engine code file. The loading path information is used to represent the storage address of the file on the terminal device.
[0075] The class loader in the embodiment of the present application refers to the class in the Java program, from the writing of the source code (.java text file) to the final operation, the middle will pass: compile (output bytecode), load, verify, prepare, parse, initialize, and finally use these processes. And the tool responsible for loading, verifying, preparing, parsing, initializing, and finally providing the class to the program for use is called a class loader (ClassLoader and its subclasses). In the class loader implementation of the Android platform, the field of the class loader object also includes information related to the so file load path, and by modifying the so file load path information, it is possible to realize real-time newly added so file load path, so that it can be loaded into the so file obtained by dynamic download during operation.
[0076] In some embodiments, after the terminal device obtains the installation package of the application, it uses the system's own class loader to load the so file in the installation package of the application. At this time, the class loader is considered to be the first class loader. Since the installation package of the Unreal Engine is a dynamically loaded installation package, the first class loader does not include the loading path of the so file (such as the Unreal Engine code file) in the installation package of the Unreal Engine. Therefore, the first class loader needs to be path-expanded so that the first class loader after the path expansion can load the Unreal Engine code file.
[0077] In some embodiments, the installation address of the Unreal Engine installation package on the terminal device is directly obtained. According to the storage address of the Unreal Engine code file, the path extension for the first class loader is implemented. For example, the storage address of the Unreal Engine code file is directly written into the first class loader.
[0078] After the path of the first class loader is extended, the Unreal Engine code file can be loaded through the first class loader after the path extension.
[0079] Step 530: Use the resource calling interface in the installation package of the application to load the Unreal Engine resource file.
[0080] In some embodiments, the resource call interface is an interface for calling the Unreal Engine resource file. The resource call interface is preset in the installation package of the application. In some embodiments, when the developer writes the project code on the development device, the resource call interface for calling the Unreal Engine resource file is pre-written. Therefore, the installation package of the application carries the resource call interface. After the terminal device obtains the installation package of the application, the storage address of the Unreal Engine resource file is obtained. Furthermore, during the operation of the application, the Unreal Engine resource file can be obtained based on the storage address of the Unreal Engine resource file through the resource call interface.
[0081] The technical solution provided by the embodiment of the present application makes the related files of the Unreal Engine and the installation package of the application program independent of each other by separately setting the Unreal Engine code file and the Unreal Engine resource file into the installation package of the Unreal Engine. Since the proportion of the Unreal Engine resource file in the installation package of the application program is relatively high, after the Unreal Engine resource file is separated from the installation package of the application program, the volume of the installation package of the application program is greatly reduced. Different from the method of directly compressing the Unreal Engine resource file in the related art, the present application does not change the quality of the Unreal Engine resource file, which is conducive to ensuring the running effect of the application program. Furthermore, when the installation package of the Unreal Engine and the installation package of the application program are independent of each other, the dynamic loading of the Unreal Engine code file is realized by performing path extension on the first class loader. The dynamic loading of the Unreal Engine resource file is realized by utilizing the resource call interface in the installation package of the application program.
[0082] Combine the following Figure 6 and Figure 7 , an exemplary description is given of how to perform path expansion of the first class loader.
[0083] Please refer to Figure 6 , which shows a flow chart of a method for loading an Unreal Engine provided by another embodiment of the present application. The execution subject of each step of the method can be as follows Figure 1 The terminal device 10 in the implementation environment of the scheme shown, or the client of the application running on the terminal device 10. In the following method embodiment, for the convenience of description, only the execution subject of each step is introduced as "computer device". The method may include at least one of the following steps (610-660):
[0084] Step 610, obtain the installation package of the application and the installation package of the Unreal Engine. The installation package of the Unreal Engine includes the Unreal Engine code files and the Unreal Engine resource files. The Unreal Engine code files are the files required to run the Unreal Engine. The Unreal Engine resource files are resource files related to the application that are called by the Unreal Engine at runtime. The installation package of the application is used to support the terminal device to run the application.
[0085] Step 620: Obtain a first class loader according to the installation path of the installation package of the application on the terminal device. The first class loader is used to load the installation package of the application.
[0086] In some embodiments, after the terminal device obtains the installation package of the application, the application is installed. When the terminal device opens the application, the first class loader is automatically enabled. In some embodiments, the first class loader can load the Unreal Engine code file in the installation package of the application.
[0087] In some embodiments, when the application is a game application, the first class loader can be obtained through the .class object of any class in the installation package of the application.
[0088] Step 630, according to the installation path of the Unreal Engine installation package on the terminal device, obtain a second class loader, the second class loader is used to load the Unreal Engine code file, and the second class loader stores the loading path information of the Unreal Engine code file.
[0089] In some embodiments, the second class loader is also called a dynamic class loader or a custom class loader. Different from the first class loader (i.e., the class loader that comes with the device system), the second class loader is custom created based on the installation package of the Unreal Engine. In some embodiments, the second class loader can be used to load the Unreal Engine code files in the installation package of the Unreal Engine (also called a dynamic APK).
[0090] In some embodiments, the second class loader is obtained by utilizing the system interface of the terminal device according to the installation path of the Unreal Engine installation package on the terminal device.
[0091] Step 640: perform path extension on the first class loader according to the second class loader to obtain the first class loader after path extension.
[0092] In some embodiments, since the first class loader cannot load the Unreal Engine code file in the Unreal Engine installation package, the second class loader needs to be used to perform path extension on the first class loader. The specific path extension method is as follows.
[0093] In some embodiments, the loading path information stored in the second class loader is merged with the loading path information stored in the first class loader to obtain the merged loading path information; the loading path information stored in the first class loader is replaced with the merged loading path information to obtain the first class loader after path extension. Considering that the second class loader stores the loading path information of the Unreal Engine code file, the loading path information stored in the second class loader is copied, and the copy result is written into the loading path information stored in the first class loader to obtain the first class loader after path extension. The first class loader after path extension includes not only the loading path information stored in the original first class loader, but also the loading path information of the Unreal Engine code file stored in the second class loader.
[0094] In some embodiments, the loading path information stored in the second class loader is copied through a reflection operation on the loading path information stored in the second class loader; the copied loading path information is merged with the loading path information stored in the first class loader to obtain the merged loading path information; wherein the reflection operation refers to an operation used to copy the loading path information.
[0095] In some embodiments, reflection operation is a powerful programming technique. It is implemented by using the Java virtual machine's ability to dynamically load classes, access and manipulate class members at runtime. It can then check, access and modify information about program elements such as classes, methods, and fields at runtime without knowing their specific implementation in advance. Through reflection, objects can be created dynamically, methods can be called, field values can be obtained and set, and classes can even be dynamically loaded and used at runtime. Reflection technology is a native capability of the Java language and can be used in a standard Java program runtime environment.
[0096] In some embodiments, the loading path information in the first class loader is A, and the loading path information in the second class loader is B, then the loading path information in the first class loader after path expansion is A+B.
[0097] The following is a detailed description of how to perform path extension.
[0098] 1. Obtain the total path information in the second class loader through reflection operation, and obtain the total path information in the first class loader. Exemplarily, the total path information is information recording the total loading path in the class loader.
[0099] In some embodiments, the total path information is a pathList object. Exemplarily, the pathList object is a field in the class loader object on the Android platform, and its complete type is "dalvik.system.DexPathList". It records the information of the dex file (Java bytecode of the Android platform) and the loading path information of the so file. When a specified so file needs to be loaded, the program will search for the specified so file in the path recorded in the pathList. If it exists, it will be loaded, otherwise an error will be reported.
[0100] 2. Obtain the first path information and the second path information in the total path information in the second class loader object, wherein the first path information is used to represent the path information of the array type, and the second path information is used to represent the path information of the list type.
[0101] In some embodiments, the first path information is a nativeLibraryPathElements object, and the second path information is a nativeLibraryDirectories object. The nativeLibraryPathElements object and the nativeLibraryDirectories object are fields inside the pathList object, which record the loading path information of the so file; the nativeLibraryPathElements object is an array type; the nativeLibraryDirectories object is a list type.
[0102] 3. Obtain the first path information and the second path information in the total path information in the first class loader.
[0103] 4. The first path information and the second path information in the first class loader and the second class loader are merged (the array is copied and the List is added) to obtain new first path information and second path information.
[0104] 5. The new first path information and the second path information are used as the first path information and the second path information of the total path information of the first class loader to obtain the first class loader after path expansion. The first class loader after path expansion includes not only the original so file loading path information in the first class loader, but also the loading path information of the Unreal Engine resource file in the second class loader. The loading path information in the embodiment of the present application includes at least one of the nativeLibraryPathElements object and the nativeLibraryDirectories object.
[0105] When the application is a game application, based on the above operations, the class loader (first class loader) of the game APK file (application installation package) will contain the so file path information of both the game APK file and the dynamic APK file (Unreal Engine installation package), which also means that the modified class loader of the game APK file (the first class loader after the path extension) can directly load the so file located in the dynamic APK file. Therefore, based on the extension of the so loading path of the class loader, the dynamic loading of the libUE4.so file is realized.
[0106] In some embodiments, such as Figure 7700 is a schematic diagram of the path extension method for the class loader. The size of the nativeLibraryPathElements object in the game APK class loader (first class loader) produced by the device system is A1, and the size of the nativeLibraryDirectories object is A2. The size of the nativeLibraryPathElements object in the dynamic APK class loader (second class loader) created when the application is running is B1, and the size of the nativeLibraryDirectories object is B2. The first class loader and the second class loader are merged to obtain the first class loader after path extension. The size of the nativeLibraryPathElements object in the first class loader after path extension is A1+B1, and the size of the nativeLibraryDirectories object is A2+B2.
[0107] In some embodiments, the loading path information stored in the second class loader is merged with the loading path information stored in the first class loader to obtain the merged loading path information; the loading path information stored in the second class loader is replaced with the merged loading path information to obtain the second class loader after path expansion. The second class loader after path expansion includes not only the loading path information of the Unreal Engine resource files stored in the original second class loader, but also the loading path information of other so files stored in the first class loader. In some embodiments, during the running process of the application, the second class loader after path expansion is used to load the Unreal Engine code file. Of course, the second class loader after path expansion can also be used to load other so files in the installation package of the application.
[0108] Step 650: During the running of the application, the Unreal Engine code file is loaded using the first class loader after the path is expanded.
[0109] Step 660: Use the resource calling interface in the installation package of the application to load the Unreal Engine resource file.
[0110] The technical solution provided by the embodiment of the present application realizes the path extension of the first class loader through the second class loader, thereby improving the accuracy and speed of the path extension. Furthermore, by merging the loading path information stored in the first class loader and the second class loader respectively, and writing them into the first class loader, it is ensured that the first class loader after the path extension can not only load the Unreal Engine code file, but also load other so files in the installation package of the application, thereby realizing the dynamic loading of the Unreal Engine code file while ensuring the normal operation of the application.
[0111] Combine the following Figure 8 and Fig. 9 , which provides examples of how to load Unreal Engine resource files and how to obtain the Unreal Engine installation package.
[0112] Please refer to Figure 8 , which shows a flow chart of a method for loading an Unreal Engine provided by another embodiment of the present application. The execution subject of each step of the method can be as follows Figure 1 The terminal device 10 in the implementation environment of the scheme shown, or the client of the application running on the terminal device 10. In the following method embodiment, for the convenience of description, only the execution subject of each step is introduced as "computer device". The method may include at least one of the following steps (810-840):
[0113] Step 810, obtain the installation package of the application and the installation package of the Unreal Engine. The installation package of the Unreal Engine includes the Unreal Engine code files and the Unreal Engine resource files. The Unreal Engine code files are the files required to run the Unreal Engine. The Unreal Engine resource files are resource files related to the application that are called by the Unreal Engine at runtime. The installation package of the application is used to support the terminal device to run the application.
[0114] The following is an example of how to obtain the Unreal Engine installation package.
[0115] In some embodiments, step 810 includes at least one of steps 811 to 813 (not shown in the figure).
[0116] Step 811, when the application is started, obtain the current configuration information of the Unreal Engine installation package and the historical configuration information of the Unreal Engine installation package downloaded on the terminal device, the current configuration information is used to represent the information of the Unreal Engine installation package of the current version corresponding to the application, and the historical configuration information is used to represent the information of the Unreal Engine installation package downloaded on the terminal device.
[0117] In some embodiments, the configuration information includes version information and file size information; when the version information and file size information in the current configuration information and the historical configuration information are the same, it is determined that the current configuration information and the historical configuration information are consistent; when at least one of the version information and file size information in the current configuration information and the historical configuration information is different, it is determined that the current configuration information and the historical configuration information are inconsistent.
[0118] In some embodiments, after the developer creates the installation package of the Unreal Engine through the development device, the development device sends the installation package of the Unreal Engine to the server of the application through the network. That is, the server configures the installation package of the Unreal Engine and obtains the configuration information of the installation package of the Unreal Engine. The configuration information includes at least version information and file size information. In some embodiments, the version information is information describing the version of the installation package of the Unreal Engine, and the file size information is information describing the volume of the installation package of the Unreal Engine.
[0119] In some embodiments, the server configures the version information and resource address information of the installation package of the Unreal Engine. When the terminal device starts the client of the application, it sends an information acquisition request to the server of the application, and the information acquisition request is used to request the current configuration information of the installation package of the Unreal Engine. It should be noted that what is acquired at this time is the configuration information of the installation package of the Unreal Engine corresponding to the application at the current moment. The terminal device determines whether the installation package of the Unreal Engine downloaded locally is compatible with the current version of the application based on the acquired current configuration information and the historical configuration information of the installation package of the Unreal Engine downloaded locally. If it is compatible, the local installation package of the Unreal Engine will continue to be used without re-downloading. If it is determined that the installation package of the Unreal Engine downloaded locally is not compatible with the current version of the application, a new installation package of the Unreal Engine is re-downloaded from the server.
[0120] Step 812: When the current configuration information is inconsistent with the historical configuration information, obtain the Unreal Engine installation package from the application server.
[0121] Step 813: When the current configuration information is consistent with the historical configuration information, the Unreal Engine installation package downloaded on the terminal device is used.
[0122] Step 820, perform path extension on the first class loader on the terminal device. During the running of the application, the first class loader after the path extension is used to load the Unreal Engine code file. The first class loader stores the loading path information of the application installation package. The first class loader after the path extension also stores the loading path information of the Unreal Engine code file. The loading path information is used to represent the storage address of the file on the terminal device.
[0123] Step 830, obtaining the loading path information of the Unreal Engine resource file.
[0124] Step 840: If a resource calling interface exists, use the resource calling interface to load the Unreal Engine resource file according to the loading path information of the Unreal Engine resource file.
[0125] In some embodiments, the Unreal Engine resource file is obtained by using a resource calling interface according to the loading path information of the Unreal Engine resource file.
[0126] In some embodiments, in the absence of a resource calling interface, a resource file is loaded using a raw calling interface, where the resource file is a resource file other than an Unreal Engine resource file.
[0127] In some embodiments, the developer adds a new _apkResPath field (also known as the loading path field described below) and a setApkResPath interface (resource call interface) to GameActivity (project code) through a development device; at the same time, a judgment is added to the logic of obtaining APKPath (also known as the first logic code segment described below), giving priority to the resources pointed to by _apkResPath; if _apkResPath is not set, it falls back to using the getPackageResourcePath interface (original call interface). In the front-end code, the path of the dynamic Apk (also known as the Unreal Engine resource file) is set to the _apkResPath field through the setApkResPath interface to achieve resource replacement. That is, dynamic loading of Unreal Engine resource files is achieved. When the terminal device runs the application, it is first determined whether there is loading path information on the resource call interface. If so, the Unreal Engine resource file is loaded according to the loading path information of the resource call interface. If there is no loading path information at the resource call interface, it falls back to the original call interface, and the resource file is loaded using the loading path information at the original call interface. In some embodiments, such as Fig. 9 As shown in 900, before the resource loading extension, that is, in the related art, the default resource file address, that is, the original calling interface, is directly used to call the resource file. After the resource loading extension, as shown in Fig. 9 As shown in 910, by setting the loading path externally, the Unreal Engine resource file is called using the preset resource calling interface to realize the dynamic loading of the Unreal Engine resource file. In some embodiments, the getPackageResourcePath interface: an interface in the SDK provided by Android for obtaining the local path of the installed APK corresponding to the current application.
[0128] This application determines whether to re-download the Unreal Engine installation package by judging whether the locally downloaded Unreal Engine installation package is the Unreal Engine installation package that the current application is adapted to, which is conducive to real-time updating of the Unreal Engine installation package and ensuring the smooth operation of the application. If the locally downloaded Unreal Engine installation package continues to be used, the download cost is reduced and the transmission overhead is increased.
[0129] In addition, through the resource calling interface, the Unreal Engine resource file is loaded according to the loading path information of the Unreal Engine resource file, realizing the dynamic loading of the Unreal Engine resource file. In addition, in the case where there is no loading path information of the Unreal Engine resource file and the resource calling interface, it falls back to the original calling interface to call the resource file, ensuring the smooth operation of the application.
[0130] Please refer to Fig.10 , which shows a flow chart of a method for loading an Unreal Engine provided by another embodiment of the present application. The execution subject of each step of the method can be as follows Figure 1 The development device 30 in the implementation environment of the scheme shown, or the client of the application for developing the project running on the development device 30. In the following method embodiment, for the convenience of description, only the execution subject of each step is introduced as "computer device". The method may include at least one of the following steps (1010-1020):
[0131] Step 1010, build an installation package for the application and an installation package for the Unreal Engine. The installation package for the Unreal Engine includes Unreal Engine code files and Unreal Engine resource files. The Unreal Engine code files are files required to run the Unreal Engine. The Unreal Engine resource files are resource files related to the application that are called by the Unreal Engine at runtime. The installation package for the application is used to support the terminal device to run the application. The installation package for the application includes a resource calling interface, and the resource calling interface is used to load the Unreal Engine resource files.
[0132] In some embodiments, Unreal Engine code files and Unreal Engine resource files are filtered from the original application code to build an installation package of the application; and an Unreal Engine installation package is built based on the filtered Unreal Engine code files and Unreal Engine resource files.
[0133] In some embodiments, in the gradle script of the game project (that is, the original application code), add the configuration: "packagingOptions{exclude'lib / ** / libUE4.so'}" is used to filter libUE4.so (Unreal Engine code file); in the gradle script of the game project, add the configuration: "aaptOptions{ignoreAssetsPattern"! main.obb.png"}" is used to filter the main.obb.png file (Unreal Engine resource file). In this way, the "libUE4.so" and "main.obb.png" files will be ignored during the game packaging process. The game package (installation package of the application) packaged in this way is reduced by more than 90% in size compared to the previous one. After the game package is made, you need to build a dynamic APK (Unreal Engine installation package). The specific steps are as follows: add an application module to the Android project output by the game build to output the dynamic APK file; copy the libUE4.so file to the libs / arm64-v8a directory of the project; copy the main.obb.png file to the src / main / assets directory of the project; execute the build task of the build script to output the dynamic APK. After following the above steps, the output dynamic APK file contains the core files of the Unreal Engine "libUE4.so" and "main.obb.png". Among them, the gradle script is a script file written in the groovy language, which is widely used in the packaging and construction of Java projects. The official build script of the Android project is a gradle script, and the packaging configuration of the project is carried by the gradle script. The application module is a component (module) type used to build Android applications in Android Studio, the official development tool of the Android platform. In addition to the application type module, there is also a library type module. The library type module is mainly used to output component code in the form of aar for use by other library modules or application modules. The application module outputs the complete APK file.
[0134] In some embodiments, a resource calling interface is configured in a first logic code segment of the original application code, the resource calling interface is used to load the Unreal Engine resource file according to the loading path information of the Unreal Engine resource file, and the first logic code segment is a code segment for obtaining the resource file.
[0135] In some embodiments, in addition to configuring the resource call interface in the first logic code segment, a loading path field is also configured, and the loading path field is used to record the loading path information of the Unreal Engine resource file. When the terminal device obtains the loading path information, the loading path field is written. Therefore, the terminal device determines whether the loading path field has the loading path information. If it does, the resource call interface is called to load the Unreal Engine resource file. If the loading path field does not have the loading path information, it falls back to the original calling interface and loads the resource file according to the loading path information at the original calling interface.
[0136] In some embodiments, the first logic code segment also includes an original call interface, which is used to load resource files. The resource files are other resource files different from Unreal Engine resource files. The priority of the resource call interface is higher than that of the original call interface.
[0137] In the embodiment of the present application, by modifying the logic of "obtaining resource APK path" in the code (i.e., the first logical code segment), the externally set APK path information (loading path information of the Unreal Engine resource file) is introduced to provide the ability to set the resource path externally, thereby achieving the purpose of dynamically loading Unreal Engine resources. The above embodiment is referred to here and will not be repeated.
[0138] This application implements the extension of the class loader so path, so that the class loader created by the Android system can also load the libUE4.so file located in the dynamic APK file. By extending the logic of obtaining the APK path information in UE4, the Unreal Engine can load the main.obb.png file in the APK specified by the program, rather than only being able to load the main.obb.png file in the currently installed game APK file. This enables the dynamic loading of the Unreal Engine on the Android platform, thereby greatly reducing the size of the initial game package APK file.
[0139] Step 1020, sending the installation package of the application and the installation package of the Unreal Engine. The Unreal Engine code file is loaded through the first class loader after the path expansion on the terminal device. The first class loader stores the loading path information of the installation package of the application. The first class loader after the path expansion also stores the loading path information of the Unreal Engine code file. The loading path information is used to represent the storage address of the file on the terminal device.
[0140] In some embodiments, Fig.111100, which shows a schematic diagram of a method for loading an Unreal Engine provided by another embodiment of the present application. In the packaging stage, the Unreal Engine code files and Unreal Engine resource files in the game package APK (installation package of the application) are separately packaged into a dynamic APK (installation package of the Unreal Engine). In the running stage, when the game is loaded using the Android system, the first class loader and the second class loader (custom class loader) are obtained, and the loading path information in the second class loader is copied into the loading path information in the first class loader, thereby realizing the path extension of the class loader. The first class loader after the path extension is used to realize the dynamic loading of the Unreal Engine code file. The Unreal Engine resource files are loaded according to the loading path information of the Unreal Engine resource files using the resource call interface, thereby realizing the dynamic loading of the Unreal Engine resource files. That is, the present application realizes the dynamic loading of the Unreal Engine during the running period based on the extension technology of the class loader and the resource loading extension technology of the Unreal Engine, so that the installation package of the application can be very lightweight, and the dynamic update of the Unreal Engine C / C++ code and resources can also be realized.
[0141] The technical solution provided in the embodiment of the present application can be applied to applications based on Unreal Engine to reduce the size of the initial application installation package, and can also be used to dynamically update the code implementation and game resources of Unreal Engine. As shown in Table 1, the size of the application installation package changes after the dynamic loading of Unreal Engine technology described in this application is integrated.
[0142] Table 1 Changes in the size of the application installation package after integrating the dynamic loading Unreal Engine technology described in this application
[0143]
[0144] As shown in Table 1, the size of the application installation package before integration is 1573499KB (about 1.5GB); after dynamically loading the Unreal Engine, the size of the application installation package is reduced to 95882KB (about 90MB). The size of the installation package has been reduced by 93.9%, which is basically the same as the size of the installation package of ordinary application software. By significantly reducing the size of the installation package, the installation efficiency can be improved, the installation volume can be quickly expanded, the waiting time of users during the installation process can be reduced, and the network consumption and storage consumption of the terminal device during the installation of the application can be reduced.
[0145] This application uses the Unreal Engine code and resources in the installation package of the application as a dynamic APK (Unreal Engine installation package), which can be downloaded and updated separately. Table 2 shows the size of the Unreal Engine installation package.
[0146] Table 2 Unreal Engine installation package size
[0147]
[0148] The Unreal Engine installation package is dynamically loaded during the running of the application. In addition to reducing the size of the application's installation package, it also enables the dynamic update of the Unreal Engine code and resources: downloading different versions of dynamic APK files during the running of the application can realize the update of the engine code and resources.
[0149] The technical solution provided by the embodiment of the present application makes the related files of the Unreal Engine and the installation package of the application program independent of each other by separately setting the Unreal Engine code file and the Unreal Engine resource file into the installation package of the Unreal Engine. Since the proportion of the Unreal Engine resource file in the installation package of the application program is relatively high, after the Unreal Engine resource file is separated from the installation package of the application program, the volume of the installation package of the application program is greatly reduced. Different from the method of directly compressing the Unreal Engine resource file in the related art, the present application does not change the quality of the Unreal Engine resource file, which is conducive to ensuring the running effect of the application program. Furthermore, when the installation package of the Unreal Engine and the installation package of the application program are independent of each other, the dynamic loading of the Unreal Engine code file is realized by performing path extension on the first class loader. The dynamic loading of the Unreal Engine resource file is realized by utilizing the resource call interface in the installation package of the application program.
[0150] The following is an embodiment of the device of the present application, which can be used to execute the embodiment of the method of the present application. For details not disclosed in the embodiment of the device of the present application, please refer to the embodiment of the method of the present application.
[0151] Please refer to Fig.12 , which shows a block diagram of an Unreal Engine loading device provided by an embodiment of the present application. The device 1200 may include: an installation package acquisition module 1210, a path extension module 1220 and a resource file loading module 1230.
[0152] The installation package acquisition module 1210 is used to obtain the installation package of the application and the installation package of the Unreal Engine. The installation package of the Unreal Engine includes the Unreal Engine code file and the Unreal Engine resource file. The Unreal Engine code file is the file required to run the Unreal Engine. The Unreal Engine resource file is the resource file related to the application that is called by the Unreal Engine at runtime. The installation package of the application is used to support the terminal device to run the application.
[0153] The path extension module 1220 is used to perform path extension on the first class loader on the terminal device. During the running process of the application, the first class loader after the path extension is used to load the Unreal Engine code file. The first class loader stores the loading path information of the installation package of the application. The first class loader after the path extension also stores the loading path information of the Unreal Engine code file. The loading path information is used to represent the storage address of the file on the terminal device.
[0154] The resource file loading module 1230 is used to load the Unreal Engine resource file by using the resource calling interface in the installation package of the application.
[0155] In some embodiments, the path extension module 1220 is used to obtain the first class loader according to the installation path of the installation package of the application on the terminal device, and the first class loader is used to load the installation package of the application; obtain the second class loader according to the installation path of the installation package of the Unreal Engine on the terminal device, and the second class loader is used to load the Unreal Engine code file, and the loading path information of the Unreal Engine code file is stored in the second class loader; according to the second class loader, the path of the first class loader is extended to obtain the first class loader after the path extension; during the running process of the application, the Unreal Engine code file is loaded using the first class loader after the path extension.
[0156] In some embodiments, the path extension module 1220 is used to merge the loading path information stored in the second class loader with the loading path information stored in the first class loader to obtain the merged loading path information; and replace the loading path information stored in the first class loader with the merged loading path information to obtain the first class loader after the path is extended.
[0157] In some embodiments, the path extension module 1220 is used to copy the loading path information stored in the second class loader through a reflection operation on the loading path information stored in the second class loader; merge the copied loading path information with the loading path information stored in the first class loader to obtain the merged loading path information; wherein the reflection operation refers to an operation used to copy the loading path information.
[0158] In some embodiments, the resource file loading module 1230 is used to obtain the loading path information of the Unreal Engine resource file; in the case where the resource calling interface exists, the resource calling interface is used to load the Unreal Engine resource file according to the loading path information of the Unreal Engine resource file.
[0159] In some embodiments, the resource file loading module 1230 is further used to load a resource file using an original calling interface when the resource calling interface does not exist, and the resource file is a resource file other than the Unreal Engine resource file.
[0160] In some embodiments, the installation package acquisition module 1210 is used to obtain the current configuration information of the installation package of the Unreal Engine and the historical configuration information of the installation package of the Unreal Engine downloaded on the terminal device when the application is started, the current configuration information being used to represent the information of the installation package of the current version of the Unreal Engine corresponding to the application, and the historical configuration information being used to represent the information of the installation package of the Unreal Engine downloaded on the terminal device; when the current configuration information and the historical configuration information are inconsistent, obtaining the installation package of the Unreal Engine from the server of the application; when the current configuration information and the historical configuration information are consistent, using the installation package of the Unreal Engine downloaded on the terminal device.
[0161] In some embodiments, the configuration information includes version information and file size information.
[0162] In some embodiments, the installation package acquisition module 1210 is also used to determine that the current configuration information is consistent with the historical configuration information when the version information and the file size information in the current configuration information and the historical configuration information are the same; and to determine that the current configuration information is inconsistent with the historical configuration information when at least one of the version information and the file size information in the current configuration information and the historical configuration information is different.
[0163] Please refer to Fig.13 , which shows a block diagram of an Unreal Engine loading device provided by another embodiment of the present application. The device 1300 may include: an installation package building module 1310 and an installation package sending module 1320.
[0164] The installation package construction module 1310 is used to construct an installation package for the application and an installation package for the Unreal Engine. The installation package for the Unreal Engine includes an Unreal Engine code file and an Unreal Engine resource file. The Unreal Engine code file is a file required to run the Unreal Engine. The Unreal Engine resource file is a resource file related to the application that is called by the Unreal Engine at runtime. The installation package for the application is used to support the terminal device to run the application. The installation package for the application includes a resource calling interface, and the resource calling interface is used to load the Unreal Engine resource file.
[0165] The installation package sending module 1320 is used to send the installation package of the application and the installation package of the Unreal Engine. The Unreal Engine code file is loaded through the first class loader after the path expansion on the terminal device. The first class loader stores the loading path information of the installation package of the application. The first class loader after the path expansion also stores the loading path information of the Unreal Engine code file. The loading path information is used to represent the storage address of the file on the terminal device.
[0166] In some embodiments, the installation package construction module 1310 is used to filter the Unreal Engine code files and the Unreal Engine resource files from the original application code to build the installation package of the application; and to build the installation package of the Unreal Engine based on the filtered Unreal Engine code files and the Unreal Engine resource files.
[0167] In some embodiments, the installation package construction module 1310 is used to configure the resource call interface in the first logic code segment of the original application code after filtering the Unreal Engine code file and the Unreal Engine resource file, and the resource call interface is used to load the Unreal Engine resource file according to the loading path information of the Unreal Engine resource file, and the first logic code segment is a code segment for obtaining the resource file.
[0168] In some embodiments, the first logic code segment also includes an original call interface, where the original call interface is used to load a resource file, where the resource file is a resource file other than the Unreal Engine resource file, and a priority of the resource call interface is higher than a priority of the original call interface.
[0169] It should be noted that the device provided in the above embodiment, when implementing its functions, is only illustrated by the division of the above functional modules. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above. In addition, the device and method embodiments provided in the above embodiment belong to the same concept, and the specific implementation process is detailed in the method embodiment, which will not be repeated here.
[0170] Fig.14 A structural block diagram of a computer device provided by another exemplary embodiment of the present application is shown.
[0171] Typically, the computer device 1400 includes a processor 1401 and a memory 1402 .
[0172] The processor 1401 may include one or more processing cores, such as a 4-core processor, an 8-core processor, and the like. The processor 1401 may be implemented in at least one hardware form of DSP (Digital Signal Processing), FPGA (Field Programmable Gate Array), and PLA (Programmable Logic Array). The processor 1401 may also include a main processor and a coprocessor. The main processor is a processor for processing data in an awake state, also known as a CPU; the coprocessor is a low-power processor for processing data in a standby state. In some embodiments, the processor 1401 may be integrated with a GPU (Graphics Processing Unit), which is responsible for rendering and drawing the content to be displayed on the display screen. In some embodiments, the processor 1401 may also include an AI (Artificial Intelligence) processor, which is used to process computing operations related to machine learning.
[0173] The memory 1402 may include one or more computer-readable storage media, which may be tangible and non-transitory. The memory 1402 may also include high-speed random access memory, and non-volatile memory, such as one or more disk storage devices, flash memory storage devices. In some embodiments, the non-transitory computer-readable storage medium in the memory 1402 stores a computer program, which is loaded and executed by the processor 1401 to implement the above-mentioned Unreal Engine loading method.
[0174] Those skilled in the art will understand that Fig.14 The structure shown in the figure does not constitute a limitation on the computer device 1400, and the computer device 1400 may include more or less components than shown in the figure, or combine some components, or adopt a different arrangement of components.
[0175] In an exemplary embodiment, a computer-readable storage medium is further provided, in which a computer program is stored. When the computer program is executed by a processor, the loading method of the Unreal Engine is implemented.
[0176] Optionally, the computer-readable storage medium may include: ROM (Read-Only Memory), RAM (Random Access Memory), SSD (Solid State Drives) or an optical disk, etc. Among them, the random access memory may include ReRAM (Resistance Random Access Memory) and DRAM (Dynamic Random Access Memory).
[0177] In an exemplary embodiment, a computer program product is also provided, the computer program product includes a computer program, and the computer program is stored in a computer-readable storage medium. A processor of a computer device reads the computer program from the computer-readable storage medium, and the processor executes the computer program, so that the computer device executes the above-mentioned Unreal Engine loading method.
[0178] It should be noted that the relevant data collection and processing in this application should be strictly in accordance with the requirements of relevant national laws and regulations when applied in examples, and the informed consent or separate consent of the personal information subject should be obtained, and subsequent data use and processing should be carried out within the scope of authorization of laws and regulations and the personal information subject.
[0179] It should be understood that the "multiple" mentioned in this article refers to two or more. "And / or" describes the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. The character " / " generally indicates that the objects associated before and after are in an "or" relationship. In addition, the step numbers described in this article only illustrate a possible execution sequence between the steps. In some other embodiments, the above steps may not be executed in the order of the numbers, such as two steps with different numbers are executed at the same time, or two steps with different numbers are executed in the opposite order to the diagram. The embodiments of the present application are not limited to this.
[0180] The above are merely exemplary embodiments of the present application and are not intended to limit the present application. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present application shall be included in the protection scope of the present application.
Claims
1. A method for loading an Unreal Engine. It is characterized in that The method comprises: Obtaining an installation package of an application and an installation package of an Unreal Engine, wherein the installation package of the Unreal Engine includes an Unreal Engine code file and an Unreal Engine resource file, wherein the Unreal Engine code file is a file required to run the Unreal Engine, and the Unreal Engine resource file is a resource file related to the application and called by the Unreal Engine at runtime, and the installation package of the application is used to support a terminal device to run the application; Performing path extension on the first class loader on the terminal device, and using the first class loader after path extension to load the Unreal Engine code file during the running of the application, wherein the first class loader stores loading path information of the installation package of the application, and the first class loader after path extension also stores loading path information of the Unreal Engine code file, wherein the loading path information is used to represent the storage address of the file on the terminal device; The Unreal Engine resource file is loaded by utilizing the resource calling interface in the installation package of the application.
2. The method according to claim 1, It is characterized in that The step of performing path extension on the first class loader on the terminal device and, during the running of the application, using the first class loader after the path extension to load the Unreal Engine code file comprises: According to the installation path of the installation package of the application on the terminal device, obtaining the first class loader, the first class loader being used to load the installation package of the application; According to the installation path of the Unreal Engine installation package on the terminal device, a second class loader is obtained, wherein the second class loader is used to load the Unreal Engine code file, and the second class loader stores the loading path information of the Unreal Engine code file; According to the second class loader, performing path extension on the first class loader to obtain the first class loader after the path extension; During the running of the application, the Unreal Engine code file is loaded using the first class loader after the path is expanded.
3. The method according to claim 2, It is characterized in that The step of performing path extension on the first class loader according to the second class loader to obtain the first class loader after the path extension comprises: Merging the loading path information stored in the second class loader with the loading path information stored in the first class loader to obtain merged loading path information; The loading path information stored in the first class loader is replaced with the combined loading path information to obtain the first class loader after the path is expanded.
4. The method according to claim 3, It is characterized in that The step of merging the loading path information stored in the second class loader with the loading path information stored in the first class loader to obtain the merged loading path information includes: Copying the loading path information stored in the second class loader by performing a reflection operation on the loading path information stored in the second class loader; Merging the copied loading path information with the loading path information stored in the first class loader to obtain the merged loading path information; The reflection operation refers to an operation for copying the loading path information.
5. The method according to claim 1, It is characterized in that The method of using a resource calling interface in the installation package of the application to load the Unreal Engine resource file includes: Obtaining loading path information of the Unreal Engine resource file; In the case where the resource calling interface exists, the Unreal Engine resource file is loaded according to the loading path information of the Unreal Engine resource file by utilizing the resource calling interface.
6. The method according to claim 5, It is characterized in that The method further comprises: In the absence of the resource calling interface, the resource file is loaded using the original calling interface, where the resource file is a resource file other than the Unreal Engine resource file.
7. The method according to claim 1, It is characterized in that The step of obtaining the Unreal Engine installation package includes: When the application is started, obtaining current configuration information of the installation package of the Unreal Engine and historical configuration information of the installation package of the Unreal Engine that has been downloaded on the terminal device, wherein the current configuration information is used to represent information of the installation package of the current version of the Unreal Engine corresponding to the application, and the historical configuration information is used to represent information of the installation package of the Unreal Engine that has been downloaded on the terminal device; When the current configuration information is inconsistent with the historical configuration information, obtaining an installation package of the Unreal Engine from a server of the application program; When the current configuration information is consistent with the historical configuration information, the Unreal Engine installation package downloaded on the terminal device is used.
8. The method according to claim 7, It is characterized in that The configuration information includes version information and file size information; When the version information and the file size information in the current configuration information and the historical configuration information are the same, determining that the current configuration information is consistent with the historical configuration information; In a case where at least one of the version information and the file size information in the current configuration information and the historical configuration information is different, it is determined that the current configuration information and the historical configuration information are inconsistent.
9. A method for loading an Unreal Engine. It is characterized in that The method comprises: Constructing an installation package of an application and an installation package of an Unreal Engine, wherein the installation package of the Unreal Engine includes an Unreal Engine code file and an Unreal Engine resource file, wherein the Unreal Engine code file is a file required for running the Unreal Engine, and the Unreal Engine resource file is a resource file related to the application that is called by the Unreal Engine at runtime, wherein the installation package of the application is used to support a terminal device to run the application, and the installation package of the application includes a resource calling interface, and the resource calling interface is used to load the Unreal Engine resource file; The installation package of the application and the installation package of the Unreal Engine are sent, wherein the Unreal Engine code file is loaded through the first class loader after the path expansion on the terminal device, wherein the first class loader stores the loading path information of the installation package of the application, and the first class loader after the path expansion also stores the loading path information of the Unreal Engine code file, wherein the loading path information is used to represent the storage address of the file on the terminal device.
10. The method according to claim 9, It is characterized in that The installation package of the application and the installation package of the Unreal Engine are constructed, including: Filtering the Unreal Engine code files and the Unreal Engine resource files from the original application code to build an installation package for the application; An installation package of the Unreal Engine is constructed according to the Unreal Engine code files and the Unreal Engine resource files that are filtered out.
11. The method according to claim 10, It is characterized in that After filtering the Unreal Engine code files and the Unreal Engine resource files, the method further includes: The resource calling interface is configured in the first logic code segment of the original application code, the resource calling interface is used to load the Unreal Engine resource file according to the loading path information of the Unreal Engine resource file, and the first logic code segment is a code segment for obtaining the resource file.
12. The method according to claim 11, It is characterized in that The first logic code segment also includes an original call interface, which is used to load a resource file. The resource file is a resource file other than the Unreal Engine resource file. The priority of the resource call interface is higher than that of the original call interface.
13. A loading device for Unreal Engine, It is characterized in that The device comprises: An installation package acquisition module, used to acquire an installation package of an application and an installation package of an Unreal Engine, wherein the installation package of the Unreal Engine includes an Unreal Engine code file and an Unreal Engine resource file, wherein the Unreal Engine code file is a file required to run the Unreal Engine, and the Unreal Engine resource file is a resource file related to the application and called by the Unreal Engine at runtime, and the installation package of the application is used to support a terminal device to run the application; A path extension module, used to perform path extension on the first class loader on the terminal device, and during the running process of the application, use the first class loader after the path extension to load the Unreal Engine code file, wherein the first class loader stores the loading path information of the installation package of the application, and the first class loader after the path extension also stores the loading path information of the Unreal Engine code file, and the loading path information is used to represent the storage address of the file on the terminal device; The resource file loading module is used to load the Unreal Engine resource file by utilizing the resource calling interface in the installation package of the application.
14. A loading device for Unreal Engine, It is characterized in that The device comprises: An installation package construction module, used to construct an installation package of an application and an installation package of an Unreal Engine, wherein the installation package of the Unreal Engine includes an Unreal Engine code file and an Unreal Engine resource file, wherein the Unreal Engine code file is a file required for running the Unreal Engine, and the Unreal Engine resource file is a resource file related to the application and called by the Unreal Engine at runtime, wherein the installation package of the application is used to support a terminal device to run the application, and the installation package of the application includes a resource calling interface, and the resource calling interface is used to load the Unreal Engine resource file; The installation package sending module is used to send the installation package of the application and the installation package of the Unreal Engine. The Unreal Engine code file is loaded through the first class loader after the path expansion on the terminal device. The first class loader stores the loading path information of the installation package of the application. The first class loader after the path expansion also stores the loading path information of the Unreal Engine code file. The loading path information is used to represent the storage address of the file on the terminal device.
15. A computer device, It is characterized in that The computer device includes a processor and a memory, wherein a computer program is stored in the memory, and the computer program is loaded and executed by the processor to implement the Unreal Engine loading method as described in any one of claims 1 to 8 above, or to implement the Unreal Engine loading method as described in any one of claims 9 to 12 above.
16. A computer-readable storage medium, It is characterized in that The computer-readable storage medium stores a computer program, which is loaded and executed by a processor to implement the Unreal Engine loading method as described in any one of claims 1 to 8 above, or to implement the Unreal Engine loading method as described in any one of claims 9 to 12 above.
17. A computer program product, It is characterized in that The computer program product includes a computer program, which is stored in a computer-readable storage medium. The processor reads and executes the computer program from the computer-readable storage medium to implement the Unreal Engine loading method as described in any one of claims 1 to 8 above, or implements the Unreal Engine loading method as described in any one of claims 9 to 12 above.