Method for implementing game resource loading in mini-game, and related apparatus

By bridging the file system between the mini-game and the host application, memory management is optimized, and only necessary game resources are loaded into the engine heap, thus solving the mini-game memory crash problem and achieving more efficient memory usage and compatibility.

WO2025256244A1PCT designated stage Publication Date: 2025-12-18TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
PCT/CN2025/088017
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Priority Date
2024-06-13
Filing Date
2025-04-09
Publication Date
2025-12-18

AI Technical Summary

Technical Problem

When loading game resources, mini-games consume too much memory in the engine heap, leading to memory crashes, which is difficult to solve effectively with existing technology.

Method used

By bridging the file system between the mini-game and the host application, disk read/write capabilities are provided, memory management is optimized, and only necessary game resources are loaded into the engine stack, avoiding full downloads.

Benefits of technology

It reduces the memory consumption of the engine stack, avoids memory crashes in mini-games, and maintains the instant play advantage and compatibility of mini-games.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2025088017_18122025_PF_FP_ABST
    Figure CN2025088017_18122025_PF_FP_ABST
Patent Text Reader

Abstract

A method for implementing game resource loading in a mini-game, which is executed by a terminal. The method comprises: running a mini-game on the basis of a host application program, wherein the host application program runs on an operating system (S410); detecting whether the mini-game is bridged with a file system associated with the host application program, wherein the file system is used for managing a disk space corresponding to the host application program, and the disk space is used for storing a game resource package corresponding to the mini-game (S420); and in response to detecting that the mini-game is bridged with the file system, loading, by means of the file system, a game resource to be loaded in the game resource package from the disk space to an engine heap of a game engine (S430).
Need to check novelty before this filing date? Find Prior Art

Description

Method for loading game resources of small game and related device

[0001] Related applications

[0002] The present application claims priority to the Chinese patent application No. 202410758498.1, filed on June 13, 2024, and entitled "Method for loading game resources of small game and related device", the contents of which are hereby incorporated by reference in its entirety. TECHNICAL FIELD

[0003] The present application relates to the technical field of game development, in particular to a method for loading game resources of small game and related device. BACKGROUND

[0004] A small program refers to an application program that does not need to be downloaded and installed for use, with a host application program as a running carrier. A small game is a category of small programs, which has the characteristics of instant play and light experience.

[0005] In the traditional technology, the game resource package downloaded by the small game through the network is completely read into the engine heap, resulting in large memory consumption of the engine heap. The memory consumption of the engine heap is the primary culprit of the small game memory crash.

[0006] Therefore, how to reduce the memory consumption of the engine heap to avoid the small game memory crash is a technical problem to be solved by those skilled in the art. SUMMARY

[0007] To solve the above technical problems, the embodiments of the present application provide a method and device for loading game resources of small game, an electronic device, a computer readable storage medium and a computer program product, to reduce the memory consumption of the engine heap and avoid the small game memory crash.

[0008] In one aspect of the present application, a method for loading game resources of small game is provided, which is executed by a terminal, and the method comprises:

[0009] Running the small game based on a host application program, the host application program running on an operating system;

[0010] Detecting whether the small game is bridged with a file system associated with the host application program, the file system being used for managing a disk space corresponding to the host application program, the disk space being used for storing a game resource package corresponding to the small game; and

[0011] In response to detecting that the small game is bridged with the file system, loading the to-be-loaded game resource in the game resource package from the disk space to an engine heap of a game engine through the file system.

[0012] In another aspect of the embodiments of the present application, a device for implementing a mini-game to load game resources is provided, and the device comprises:

[0013] a mini-game running module configured to run the mini-game based on a host application running on an operating system;

[0014] a first detection module configured to detect whether the mini-game is bridged with a file system associated with the host application, the file system being configured to manage a disk space corresponding to the host application, the disk space being configured to store a game resource package corresponding to the mini-game; and

[0015] a first loading module configured to, in response to detecting that the mini-game is bridged with the file system, load, by the file system, to-be-loaded game resources in the game resource package from the disk space to an engine heap of a game engine.

[0016] In another aspect of the embodiments of the present application, an electronic device is provided, which comprises one or more processors, and a memory configured to store one or more programs, when the one or more programs are executed by the one or more processors, the electronic device is caused to implement the method for implementing a mini-game to load game resources as described above.

[0017] In another aspect of the embodiments of the present application, a computer readable storage medium is provided, and the computer readable storage medium stores computer readable instructions, when the computer readable instructions are executed by a processor of a computer, the computer is caused to implement the method for implementing a mini-game to load game resources as described above.

[0018] In another aspect of the embodiments of the present application, a computer program product is provided, and the computer program product comprises a computer program, when the computer program is executed by a processor, the method for implementing a mini-game to load game resources as described above is implemented.

[0019] Details of one or more embodiments of the present application are set forth in the accompanying drawings and the description below. Other features, objects, and advantages of the present application will be apparent from the description, drawings, and claims. BRIEF DESCRIPTION OF DRAWINGS

[0020] In order to more clearly illustrate the technical solutions in the embodiments of the present application or in the prior art, the drawings needed to be used in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings in the following description are only embodiments of the present application, and other drawings can be obtained by those skilled in the art without any creative effort on the basis of the disclosed drawings.

[0021] FIG. 1 is a schematic diagram of memory generated when a WebGL game loads game resources in a web page environment;

[0022] FIG. 2 is a schematic diagram of memory generated by an APP game when loading game resources;

[0023] FIG. 3 is a schematic diagram of memory generated by a mini-game when loading game resources according to an embodiment of the present application;

[0024] FIG. 4 is a flowchart of a method for loading game resources of a mini-game according to an example embodiment of the present application;

[0025] FIG. 5 is another schematic diagram of memory generated by a mini-game when loading game resources according to an embodiment of the present application;

[0026] FIG. 6 is a flowchart of another method for loading game resources of a mini-game according to an example embodiment of the present application;

[0027] FIG. 7 is a flowchart of yet another method for loading game resources of a mini-game according to an example embodiment of the present application;

[0028] FIG. 8 is a schematic diagram of a process of loading game resources of a mini-game from a developer's perspective;

[0029] FIG. 9 is a schematic diagram of a process of uninstalling game resources of a mini-game from a developer's perspective;

[0030] FIG. 10 is a block diagram of an apparatus for loading game resources of a mini-game according to an example embodiment of the present application;

[0031] FIG. 11 shows a schematic diagram of a computer system of an electronic device suitable for implementing the embodiments of the present application. DETAILED DESCRIPTION

[0032] The technical solutions in the embodiments of the present application will be described clearly and completely below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only some of the embodiments of the present application, but not all the embodiments of the present application. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative effort belong to the scope of protection of the present application.

[0033] The example embodiments will be described in detail below with reference to the drawings. Unless otherwise indicated, the same numbers on different drawings represent the same or similar elements. The implementations described in the following example embodiments are not meant to represent all implementations consistent with the present application. Rather, they are merely examples of apparatuses and methods consistent with some aspects of the present application as detailed in the appended claims.

[0034] The block diagrams illustrated in the drawings are merely functional entities, and do not necessarily have to correspond to physically independent entities. That is, the functional entities can be implemented in the form of software, or in one or more hardware modules or integrated circuits, or in different networks and / or processor devices and / or microcontroller devices.

[0035] The flowcharts illustrated in the drawings are merely exemplary illustrations, and do not necessarily include all contents and operations / steps, nor are they necessarily executed in the order described. For example, some operations / steps can be further decomposed, and some operations / steps can be combined or partially combined, so that the actual execution order can be changed according to actual conditions.

[0036] In the present application, "multiple" refers to two or more. "And / or" describes the association between the associated objects, indicating that there can be three relationships, for example, A and / or B can represent the three cases of A alone, A and B together, and B alone. The character " / " generally represents an "or" relationship between the associated objects before and after it.

[0037] The terms "first", "second", "third", and "fourth" and the like in the specification and claims of the present application and the drawings are used to distinguish different objects, and are not used to describe a specific order. The terms "include" and "have" and any variations thereof are intended to cover non-exclusive inclusion. For example, a process, method, system, product, or device that includes a series of steps or units is not limited to the listed steps or units, but can optionally include steps or units not listed, or can optionally include other steps or units inherent to the process, method, product, or device.

[0038] In the embodiments of the present application, the term "module" or "unit" refers to a computer program or a part of a computer program with a predetermined function, and works together with other related parts to achieve a predetermined target, and can be implemented entirely or partially by using software, hardware (such as a processing circuit or a memory), or a combination thereof. Similarly, one processor (or multiple processors or memories) can be used to implement one or more modules or units. In addition, each module or unit can be a part of an overall module or unit that includes the functions of the module or unit.

[0039] First of all, as mentioned earlier, a small program refers to an application that uses a host application as a running carrier and does not need to be downloaded and installed for use. A small game is a category of small programs, with the characteristics of instant play, no need to download and install, and light experience.

[0040] Mini games are classified by programming methods, and can be generally divided into JS (Java Script, an interpreted or just-in-time compiled programming language) mini games and WASM (Web Assembly, a binary instruction format that can run in a web browser) mini games. JS mini games use the JS programming language to describe their execution logic, and the game engine and game business code are all JS code. The main user of JS mini games is the Cocos game engine. WASM mini games, also known as heavy mini games, use the WASM instruction format to describe their execution logic, and the game engine and game business code are all WASM code. The main user of WASM mini games is the Unity game engine. It should be understood that WASM mini games are accompanied by some JS code, and WASM is not a programming language, but an "executable file".

[0041] Emscripten is a tool for compiling C / C++ code into JS code or WASM code. For example, a game engine uses the Emscripten tool to export a WebGL (Web Graphics Library, a technology for drawing and rendering three-dimensional graphics on a web page, which allows users to interact with it) game package that can run in a browser. Therefore, a mini game can also be understood as a WebGL game that runs based on a host application. WebGL games are usually run based on a web page.

[0042] Asset Bundle is a resource packaging technology in the Unity game engine, which allows developers to package resources (such as textures, models, scenes, audio, etc.) of a game or application into a file for dynamic loading at runtime. It can be simply understood as a compressed package of game resources.

[0043] The technical solution proposed in this application can be applied to mini games exported by the Unity game engine and dependent on a host application for running, or similar types of mini games. The application range of the technical solution proposed in this application is not limited herein.

[0044] Such mini games implement game resource loading based on resource packaging technology. It can be understood that the download and storage of game resources are implemented in the form of a compressed package of game resources. Such mini games usually provide file caching capabilities, such as XHR (XML Http Request, a built-in browser method for handling Http requests and responses) automatic caching. Based on this file caching capability, mini games can implement on-demand download of game resources, rather than full download of game resources at game startup.

[0045] It needs to be understood that the JS memory is used to run the execution logic corresponding to the JS glue layer, and the WASM memory is used to run the execution logic corresponding to the game engine and game business. Embodiments of the present application refer to the JS memory as a running memory and refer to the WASM memory as a virtual memory.

[0046] The running memory refers to the memory used to run the glue layer logic of the mini-game, that is, the JS memory. The glue layer logic runs in the memory and supports the mini-game to interact with external components (such as a network transmission component, a disk and a file system, and rendering display, etc.). The virtual memory refers to the memory used to run the game logic of the mini-game, that is, the WASM memory. The game logic includes the execution logic corresponding to the game engine and the execution logic corresponding to the game business. These logics determine the gameplay, rules, and process of the game.

[0047] The JS glue layer refers to the interface layer between JS and WebGL. It allows the JS code to call the interface of the WASM code or provides the interface of the JS code for the WASM code. Since the WASM code does not support direct interaction with external components (such as a network transmission component, a disk and a file system, and rendering display, etc.), the JS glue layer is needed to complete the interaction between the game execution logic and the external components.

[0048] Since the network download needs to be performed via the JS glue layer, the game resource package downloaded through the network is first stored in the JS memory (file A), then copied to the WASM memory (file B), and the game resource package is directly read into the engine heap (Unity Heap) from the WASM memory in its entirety through the LoadFromMemory method. However, since only part of the game resources contained in the game resource package may actually need to be loaded, this results in a large memory consumption of the engine heap, which is the primary culprit of the memory crash of the mini-game.

[0049] FIG. 1 is a memory diagram of a WebGL game when loading game resources in a web environment. In the web environment, the disk is simulated in the JS memory by the file system of the Emscripten tool, so all files need to be maintained in the JS memory, and the files that need to be stored persistently are written to the indexDB (a non-relational database running in the browser) asynchronously and regularly. As shown in FIG. 1, the game resource package downloaded through the network is first stored in the JS memory (file A), then copied to the WASM memory (file B), and then stored in the virtual disk simulated in the JS memory (file C). In this way, the game resources that need to be loaded can be read from the virtual disk to the engine heap (game resource D) through the LoadFromFile method, without the need to read the entire game resource package into the engine heap.

[0050] However, there are still memory problems to be optimized, for example, a copy of the game resource package (i.e., file C) in the JS memory occupies memory, and a copy of the game resource package (i.e., file B) in the WASM memory also occupies memory, although the copy of the game resource package is released after successfully storing file C in the simulated disk, but due to the poor performance of WASM memory recycling, it still has a negative impact on the WASM memory.

[0051] FIG. 2 is a schematic diagram of the memory generated when the APP game loads game resources. Generally, the game resources of the APP game are checked for updates at game startup, all game resources (file B) are downloaded from the network first, then stored in the disk (file C), and then the actual game resources (game resource D) to be loaded are read from the disk through the LoadFromFile method. As can be seen, since the APP game has disk capability, the game resource package is stored in the disk, and will not be stored in the disk simulated by the JS memory to occupy memory, like the WebGL game.

[0052] Based on the memory generated when the different types of games shown in FIGS. 2-3 load game resources, the inventors of the present application thought that although the browser environment does not have disk capability, the host application relied on by the small game has disk read-write capability, therefore, by bridging the file system of the small game and the host application, specifically, by modifying the file system interface of the game engine to bridge to the file system of the host application, the small game can read only the game resources to be loaded into the engine heap, rather than reading the complete game resource package, and store the game resource package to the disk like the APP game, without occupying the JS memory; combined with the file cache capability of the small game, it can avoid full download of the game resource package at game startup like the APP game, but download when used, and write to the cache asynchronously, retaining the advantage of the small game of playing as soon as it is clicked.

[0053] Therefore, the embodiments of the present application provide a method for bridging the file system of a small game and the host application on which the small game depends, to provide the small game with disk read-write capability, thereby optimizing the memory problem of the small game.

[0054] FIG. 3 is a memory diagram generated when the small game loads game resources according to an embodiment of the present application. As can be seen, the game resource package downloaded from the network by the small game is first stored in the JS memory, and then written asynchronously to the disk space corresponding to the host application, so that the small game does not produce an extra copy of the game resource package in the virtual disk simulated by the JS memory, thereby occupying extra memory. Moreover, when loading specific game resources, the small game reads the specific game resources from the disk space to the engine heap of the WASM memory, instead of loading the entire game resource package into the engine heap, thereby reducing the memory consumption of the engine heap and avoiding the problem of memory crash of the small game. Compared with the WebGL game, the WASM memory also does not store the complete game resource package, thereby also embodying the optimization of the small game memory according to an embodiment of the present application.

[0055] The embodiments of the present application will be described in detail below.

[0056] First, referring to FIG. 4, FIG. 4 is a flowchart of a method for implementing small game loading game resources according to an example embodiment of the present application. It should be noted that the small game is exported by the game engine, so the game package of the small game contains game engine code and game business code. Moreover, the small game is run based on the host application, and the host application runs on the operating system of the terminal, so the host application has the disk read-write capability.

[0057] As shown in FIG. 4, in an example embodiment, the method for implementing small game loading game resources includes S410-S440, which are described in detail as follows:

[0058] S410, run the small game based on the host application, and the host application runs on the operating system.

[0059] The host application provides a small program running environment, specifically provides resources required for small program running, such as public libraries and some interfaces. The small game, as a kind of small program, is a small program with game logic. The small game does not run on the operating system, but runs on the host application, and the host application runs on the operating system.

[0060] The public library refers to a collection of shared code and resources provided by the host application for the small program running environment, which contains general functions and tools required for small program running, and provides necessary support for the running of small programs such as the small game. The interface refers to a collection of methods and functions that can be called by the host application for the small program running environment. The small program can interact with the host application through these interfaces to obtain the required resources and services to realize its own functions.

[0061] S420, detect whether the small game is associated with the file system bridge of the host application.

[0062] Firstly, it is explained that the file system associated with the host application is used to manage the disk space corresponding to the host application, for example, to provide the ability to add, delete or modify the disk.

[0063] The disk space corresponding to the host application is used to store the game resource package corresponding to the mini-game. Specifically, the embodiment bridges the file system associated with the mini-game and the host application, so that the mini-game also has the ability to read and write the disk, stores the game resource package downloaded from the network on the disk, and reads the specific game resource needed from the disk into the engine heap through the LoadFromFile method, without the need to read the entire game resource package into the engine heap.

[0064] The bridging method of the file system associated with the mini-game and the host application can be to modify the file system interface of the game engine during the development stage of the mini-game, so as to bridge to the file system interface of the host application. If WeChat mini-game is taken as an example, its dependent running host application is WeChat, denoted as WX, then the UnityWebRequestAssetBundle.GetAssetBundle interface of the game engine can be modified into WXAssetBundle.GetAssetBundle, the DownloadHandlerAssetBundle interface can be modified into DownloadHandlerWXAssetBundle, and the Unload interface can be modified into WXUnload. It can be understood that the modified file system interface of the game engine is a method that can use the WeChat file system.

[0065] The embodiment detects whether the mini-game is bridged to the file system associated with the host application, and selects a specific way to load the game resource according to the detection result. If the detection result is that the mini-game has been bridged to the file system associated with the host application, S430 is executed to read the game resource to be loaded from the disk space corresponding to the host application through the file system associated with the host application, without the need to load the entire game resource package in which the game resource to be loaded is located into the engine heap, thereby reducing the memory consumption of the engine heap and avoiding the problem of memory crash of the mini-game. If the detection result is that the mini-game has not been bridged to the file system associated with the host application, S440 is executed to load the game resource package from the virtual memory (i.e. WASM memory), thereby enabling the mini-game to also run in a normal browser environment, increasing the compatibility of the mini-game.

[0066] In some exemplary embodiments, whether the mini-game is bridged with the file system associated with the host application can be determined by detecting whether the value of the preset identifier is the preset value. During the initialization process of the mini-game, the file system associated with the host application is detected. If the file system associated with the host application is detected, the preset identifier is set to the preset value, for example, true. Therefore, when the preset identifier is detected to be the preset value, it can be determined that the mini-game is bridged with the file system associated with the host application, and otherwise, it is determined that the mini-game is not bridged with the file system associated with the host application.

[0067] In S430, the game resource package in the game resource to be loaded is loaded from the disk space to the engine heap of the game engine through the file system.

[0068] In the case where it is confirmed that the mini-game is bridged with the file system associated with the host application, since the disk space corresponding to the host application is used to store the game resource package, the specific game resource, i.e., the game resource to be loaded, is loaded by the mini-game from the disk space corresponding to the host application through the file system associated with the host application. The game resource to be loaded can also be understood as the game resource required by the mini-game during the running process.

[0069] The game resource package stored in the disk space is obtained by downloading the game resource package. Since the network download is implemented through the glue layer code of the mini-game, the downloaded game resource package is stored in the running memory of the mini-game, and then stored in the disk space.

[0070] The embodiment does not need to load the game resource package in which the game resource to be loaded is located to the engine heap, but loads the resource index information corresponding to the game resource package to the engine heap, and loads the specific game resource according to the resource index information. For example, the game resource to be loaded is read from the disk to the engine heap through the LoadFromFile method, and the entire game resource package does not need to be read to the engine heap, so as to realize the loading of the game resource.

[0071] The resource index information refers to the information used to indicate the position of the specific game resource in the game resource package, and the format thereof can be a resource index table or other forms, which can help the game engine to determine the position of the game resource to be loaded in the game resource package according to the information, so as to realize the loading of the specific game resource.

[0072] As an exemplary embodiment, when a game resource to be loaded is required to be loaded, the game engine determines the position of the game resource to be loaded in the game resource package according to the resource index information, and then reads the content of the corresponding position in the game resource package through the file system, so as to read the specific game resource to be loaded. It should be understood that, since the glue layer logic runs in the running memory, the process of reading the game resource to be loaded from the disk space actually occurs in the running memory, and therefore the memory diagram of the small game when loading the game resource can be obtained as shown in FIG. 5. The glue layer logic refers to the logic running in the small game running memory (JS memory), which is used to support the interaction between the small game and external components (such as network transmission components, disk and file system, rendering display, etc.), and is a bridge between the game execution logic and external components.

[0073] As another exemplary embodiment, the game resource package can also be read from the disk space to the running memory through the file system; the resource index information corresponding to the game resource package loaded in the virtual memory is determined; according to the resource index information, the game resource to be loaded in the game resource package is read from the running memory and loaded into the engine heap of the game engine; the virtual memory is used to run the game logic of the small game, and the memory condition is as shown in FIG. 5.

[0074] It can be understood that the running memory of the small game is used to run the glue layer logic of the small game, and the running memory is also the JS memory; the virtual memory of the small game is used to run the game logic of the small game. The game logic refers to the execution logic corresponding to the game engine and the execution logic corresponding to the game business contained in the small game, which determines the gameplay, rules, process, etc. of the game, and runs in the virtual memory (WASM memory) of the small game.

[0075] S440, loading the corresponding game resource package from the virtual memory contained in the running memory of the small game into the engine heap of the game engine.

[0076] In the case where it is detected that the small game is not associated with the file system bridge of the host application, the corresponding game resource package is loaded from the virtual memory contained in the running memory of the small game. Exemplarily, the game resource package is filled into the DownloadHandler of UnityWebRequest, and then loaded into the engine heap through the LoadFromMemory method, so as to load the corresponding game resource package from the virtual memory.

[0077] It should be further noted that, since the network download is implemented through the glue layer code of the small game, the game resource package obtained by the small game downloading the game resource package is stored in the running memory of the small game, and then copied from the running memory to the virtual memory.

[0078] Thus, in the technical solution provided in the embodiment, on one hand, the disk read-write capability is provided for the small game in the bridging mode of the small game and the file system associated with the host application program on which the small game depends, the small game loads specific game resources from the disk space through the file system, and the whole game resource package does not need to be read into the engine heap, thereby reducing the memory consumption of the engine heap and avoiding the problem of memory crash of the small game; on the other hand, the small game can also run in the ordinary browser environment, and the compatibility of the small game is increased.

[0079] As shown in FIG. 6, in another exemplary embodiment, on the basis of the embodiment shown in FIG. 4, the method for the small game to load game resources further includes S610-S630, which are described in detail as follows:

[0080] S610, in response to detecting that the small game is bridged with the file system, it is queried whether the game resource package containing the to-be-loaded game resource is cached in the running memory.

[0081] The embodiment considers that in some high-performance mode operating system environments, the small game runs in an independent process, such as a WebContent process, and the small game needs to perform cross-process communication to interact with the host application program, and if the game resource is read from the disk space corresponding to the host application program every time the game resource is loaded, high resource consumption will be caused.

[0082] To solve this problem, the application maintains a cache of game resource packages in the glue layer, so that when a large amount of game resources in a game resource package are read in a short time, only one cross-process communication is needed. Cross-process communication refers to the process of information exchange and data transmission between the small game and the host application program when the small game runs in an independent process (such as a WebContent process) in a high-performance mode operating system environment. Since the memory spaces of different processes are isolated from each other, cross-process communication needs to be implemented by a specific mechanism and method.

[0083] The glue layer caches the game resource package, that is, the game resource package is cached in the JS memory. Thus, the embodiment queries whether the game resource package corresponding to the to-be-loaded game resource is cached in the running memory, and if the query result is yes, it indicates that the game resource package containing the to-be-loaded game resource has been previously read into the running memory for caching, and thus S620 is executed to load the to-be-loaded game resource from the running memory according to the resource index information loaded in the virtual memory.

[0084] If the query result is no, it indicates that the corresponding game resource package is not cached in the running memory, and thus S630 is executed to read the game resource package from the disk space to the running memory through the file system associated with the host application, and then S610 is continued to be executed to query the game resource package containing the to-be-loaded game resource from the running memory.

[0085] S620, loading the to-be-loaded game resource from the running memory according to the resource index information loaded in the virtual memory.

[0086] Since the corresponding game resource package is cached in the running memory, the to-be-loaded game resource can be loaded from the running memory according to the resource index information loaded in the virtual memory, thereby avoiding loading through the disk space each time the game resource is loaded.

[0087] S630, loading the to-be-loaded game resource in the game resource package from the disk space to the engine heap of the game engine through the file system.

[0088] Since the corresponding game resource package is not cached in the running memory, the game resource package needs to be read from the disk space to the running memory for caching, and then the game resource package containing the to-be-loaded game resource can be queried from the running memory, and the to-be-loaded game resource can be loaded from the running memory according to the resource index information loaded in the virtual memory.

[0089] The technical scheme provided by the embodiment determines that the small game has been bridged with the file system of the host application, and in the case of loading the game resource, whether the corresponding game resource package is cached in the running memory is queried first, if yes, the to-be-loaded game resource is read from the running memory according to the resource index information loaded in the virtual memory, thereby loading the specific game resource, and if no, the corresponding game resource package is read from the disk space to the running memory for caching through the file system. Therefore, it is not necessary to read from the disk space each time the game resource is loaded, the small game reads the game resource contained in a game resource package only once for cross-process communication, and the resource consumption can be reduced.

[0090] In another example embodiment, the storage state of the game resource package cached in the running memory can also be periodically detected, the game resource package with the idle state is determined, the idle state represents that the game resource package has not been read in a specified time period, and the game resource package with the idle state is cleared.

[0091] The storage state refers to the storage condition of the game resource package in the running memory, including the idle state and the like. By periodically detecting the storage state of the game resource package cached in the running memory, it can be determined which game resource package has not been read in a specified time period, so as to perform the cleaning operation and optimize the use of the running memory.

[0092] The idle game resource package is a game resource package that is not read within a specified time period. By periodically cleaning the game resource package that is not read within the specified time period, the memory consumption in the running memory can be reduced, and the memory consumption required for loading the game resource of the small game is optimized to a certain extent.

[0093] As shown in FIG. 7, in another exemplary embodiment, on the basis of the embodiment shown in FIG. 4, the method for loading the game resource of the small game further includes S710-S720, which are described in detail as follows:

[0094] S710, in response to the game resource loading request, registering the network address in the game engine, the network address being used to indicate the source of the game resource to be loaded.

[0095] It can be understood that the game resource loading request is generated when the game resource needs to be loaded, and the network address used to indicate the source of the game resource to be loaded, that is, the url for providing the game resource package download. The small game registers the corresponding network address in the game engine in response to the game resource loading request.

[0096] S720, registering the network address and the disk path in the glue layer.

[0097] After the network address is registered in the game engine, the glue layer is notified to register the network address and the corresponding disk path, the disk path being used to indicate the storage location of the game resource package in the disk space. The glue layer can obtain the disk path through the file system associated with the host application, and the file system manages the disk path. By performing the registration process as described above, the initialization of the game resource loading is realized, and after the initialization is completed, the specific game resource loading process, that is, the process shown in S410-S440, can be performed, thereby ensuring the logical perfection of the game resource loading process. In addition, it should be noted that the game resource loading process provided by the embodiments of the present application can be provided to the small game developers in the form of a software development kit (Software Development Kit, SDK). That is, the small game developers can directly use the software development kit in the process of exporting the game package of the small game, so that the small game executes the process as described in the above embodiments in the running process.

[0098] The disk path refers to the path information used to indicate the storage location of the game resource package in the disk space. After the network address is registered in the game engine, the glue layer is notified to register the network address and the corresponding disk path, and the glue layer can obtain the disk path through the file system associated with the host application, and the file system manages the disk path.

[0099] The software development kit refers to a set of tools and interfaces provided for small game developers, which is provided to developers in a specific form (such as WXAssetBundle in the embodiments of the present application) for use. The developers can directly use the kit in the process of exporting the game package of the small game, so that the small game performs the game resource loading and unloading processes and the like recorded in the embodiments of the present application at runtime.

[0100] During the running of the small game, when a request for calling a resource loading interface provided by the software development kit is received, the request is determined as a game resource loading request, and then a process of loading game resources is started. The resource loading interface refers to an interface provided by the software development kit for triggering the game resource loading process. When a request for calling the interface is received, the small game determines the request as a game resource loading request, and then starts the process of loading game resources.

[0101] In some example embodiments, the small game also detects whether the glue layer has registered the corresponding network address and disk path during the process of loading game resources.

[0102] If it is detected that the glue layer has registered the network address and the disk path, and it is detected that the small game is associated with the file system bridge of the host application, it indicates that the to-be-loaded resource needs to be loaded from the disk space corresponding to the host application, and therefore the corresponding step content of S430 is performed.

[0103] If it is detected that the glue layer has not registered the network address and the disk path, but it is detected that the small game is associated with the file system bridge of the host application, it indicates that the small game has target files that are not loaded using the SDK, and therefore the target files are loaded from the simulated disk contained in the running memory, so that the small game is compatible with loading ordinary files while having the game resource package loaded using the SDK.

[0104] The simulated disk refers to a disk space simulated in the running memory of the small game, which is used to store files such as game resource packages. In some cases, such as when it is detected that the glue layer has not registered the network address and the disk path, but the small game is associated with the file system bridge of the host application, the small game loads the target files from the simulated disk contained in the running memory.

[0105] The target file refers to a file that needs to be loaded by the small game during the running process. When it is detected that the glue layer has not registered the network address and the disk path, but the small game is associated with the file system bridge of the host application, the small game loads these target files from the simulated disk contained in the running memory.

[0106] If it is detected that the glue layer has registered a network address and a disk path, but it is not detected that the mini-game and the host application associated file system bridge, it indicates that the mini-game is running in an environment such as a browser, for example, the mini-game is debugged or tested in a PC (Personal Computer) browser, and therefore it is also necessary to ensure that the mini-game can run in a browser environment even if the SDK is used, and therefore the corresponding step content of S440 is executed.

[0107] When receiving a request for indicating calling a resource uninstallation interface provided by a software development kit, the game resource package of the mini-game stored in the disk space is cleaned up by the file system, thereby optimizing the disk space. It should be noted that the game resource package of the mini-game stored in the disk space cannot be cleaned up before the resource uninstallation.

[0108] Please refer to FIG. 8 and FIG. 9, FIG. 8 is a flowchart of loading game resources of a WeChat mini-game from the perspective of a developer, and FIG. 9 is a flowchart of uninstalling game resources of a WeChat mini-game from the perspective of a developer.

[0109] The resource uninstallation interface refers to an interface provided by a software development kit for triggering a game resource uninstallation process. When receiving a request for indicating calling the interface, the mini-game will clean up the game resource package of the mini-game stored in the disk space by the file system, thereby optimizing the disk space.

[0110] Still taking the WeChat mini-game as an example, the software development kit provided by the embodiment of the present application is referred to as WXAssetBundle, the resource loading interface is GetAssetBundle, and the resource uninstallation interface is WXUnload. When the GetAssetBundle interface is called, the game resource loading request is received, and therefore the specific game resource loading process is executed. When the WXUnload interface is called, the game resource uninstallation request is received, and therefore the specific game resource uninstallation process is executed.

[0111] Referring to the game resource loading process shown in FIG. 8, it can be seen that the embodiments of the present application do not construct new AssetBundle and Request types, but instead wrap a registration logic layer outside the original UnityWebRequest to implement the WXAssetBundle SDK that is easy to migrate. In this way, the developer only needs to use the WXAssetBundle SDK when loading the AssetBundle (game resource package), without the need to modify the asynchronous handle type, game resource loading method, etc., thereby minimizing the development cost of the developer. In the specific loading process, whether the WeChat file system is available is checked to determine the actual running logic. If the WeChat file system environment is not available, it is determined that the file content callback needs to be filled, the complete AssetBundle content is filled into the DownloadHandler of the UnityWebRequest, and then the LoadFromMemory method is used to load the content into the UnityHeap memory, so that the exported small game package is still compatible with the browser WebGL environment. If the WeChat file system environment is available, it is determined that the file content does not need to be filled, and the LoadFromFile method is used to load the game resource to be loaded into the UnityHeap memory.

[0112] The asynchronous handle type refers to a data type used to process asynchronous operations in game development, which can monitor and manage the state and result of asynchronous tasks. In the present application, the WXAssetBundle SDK that is easy to migrate is implemented by wrapping a registration logic layer outside the original UnityWebRequest, so that the developer does not need to modify the asynchronous handle type, thereby reducing the development cost.

[0113] Referring to the game resource unloading process shown in FIG. 9, when the WXUnload interface is called, the specific game resource unloading process is executed to clean up the cached game resource package in the JS memory and clean up the disk path corresponding to the small game in the WeChat disk. In this way, the unloading capability of the game resource package is realized without using a new data type.

[0114] FIG. 10 is a block diagram of an apparatus for implementing a small game to load game resources according to an example embodiment of the present application. The apparatus includes:

[0115] The small game running module 1010 is configured to run the small game based on the host application, wherein the host application runs on the operating system.

[0116] The first detection module 1020 is configured to detect whether the small game is associated with a file system bridge of the host application, wherein the file system is used to manage a disk space corresponding to the host application, and the disk space is used to store a game resource package corresponding to the small game.

[0117] The first loading module 1030 is configured to load the to-be-loaded game resource in the game resource package from the disk space to an engine heap of the game engine through the file system when the first detection module 1020 detects that the mini-game is associated with the file system bridge.

[0118] In another exemplary embodiment, the apparatus further includes:

[0119] The first downloading module is configured to download the game resource package, store the downloaded game resource package in a running memory, and store the downloaded game resource package in a disk space.

[0120] In another exemplary embodiment, the first loading module 1030 is further configured to perform the following steps:

[0121] read the game resource package from the disk space to a running memory, the running memory being used for running a glue layer logic of the mini-game; the glue layer logic being used for supporting interaction between the mini-game and external components;

[0122] read the to-be-loaded game resource from the running memory according to resource index information corresponding to the game resource package loaded in a virtual memory, the virtual memory being used for running a game logic of the mini-game.

[0123] In another exemplary embodiment, the first loading module 1030 is further configured to, in response to detecting that the mini-game is associated with the file system bridge, query whether a game resource package containing the to-be-loaded game resource is cached in the running memory; in response to querying that the game resource package is not cached, perform the step of reading the game resource package from the disk space to the running memory through the file system; and in response to querying that the game resource package is cached, load the to-be-loaded game resource from the running memory according to the resource index information loaded in the virtual memory.

[0124] In another exemplary embodiment, the first loading module 1030 is further configured to periodically detect storage states of game resource packages cached in the running memory; determine a game resource package with an idle state, the idle state representing that the game resource package has not been read for a specified time period; and clear the game resource package with the idle state.

[0125] In another exemplary embodiment, the apparatus further includes:

[0126] The second loading module is configured to load a game resource package containing the to-be-loaded game resource from a virtual memory contained in a running memory of the mini-game when it is detected that the mini-game is not associated with the file system bridge.

[0127] In another exemplary embodiment, the apparatus further comprises:

[0128] The second downloading module is configured to download the game resource package, store the downloaded game resource package in the running memory, and copy the downloaded game resource package to the virtual memory.

[0129] In another exemplary embodiment, the first detecting module 1020 is further configured to detect whether a value of a preset identifier is a preset value; during an initialization process of the mini-game, if a file system associated with the host application program is detected, the preset identifier is set as the preset value; and in response to detecting that the value of the preset identifier is the preset value, it is determined that the mini-game has bridged with the file system associated with the host application program.

[0130] In another exemplary embodiment, the apparatus further comprises a registering module, which is configured to, in response to the game resource loading request, register a network address in the game engine, the network address being used to indicate a source of the to-be-loaded game resource; and register the network address and a disk path in the glue layer, the disk path being used to indicate a storage location of the game resource package in a disk space, and the glue layer obtaining the disk path through a file system.

[0131] In another exemplary embodiment, the apparatus further comprises:

[0132] The second detecting module is configured to detect whether the glue layer has registered the corresponding network address and disk path; in response to detecting that the registration has been performed, perform the step of loading the to-be-loaded game resource in the game resource package from the disk space to the engine heap of the game engine through the file system; and in response to detecting that the registration has not been performed, load the target file from the simulated disk included in the running memory.

[0133] In another exemplary embodiment, when a request for calling a resource loading interface provided by a software development kit is received, the request is determined as the game resource loading request.

[0134] In another exemplary embodiment, the apparatus further comprises an uninstalling module, which is configured to, when a request for calling a resource uninstalling interface provided by a software development kit is received, clean up the game resource package corresponding to the mini-game in the disk space through the file system.

[0135] It should be noted that the apparatus for loading game resources of a mini-game provided in the above embodiments and the method for loading game resources of a mini-game provided in the above embodiments belong to the same concept, and the specific manner in which each module and unit performs operations has been described in the method embodiments in detail, which will not be repeated here. The apparatus for loading game resources of a mini-game provided in the above embodiments can be divided into different functional modules to complete the above-described all or part of functions according to the needs in actual application, that is, the internal structure of the apparatus is divided into different functional modules to complete the above-described all or part of functions, and this is not limited herein.

[0136] Embodiments of the present application also provide an electronic device, comprising: one or more processors; a memory for storing one or more programs, when the one or more programs are executed by the one or more processors, the electronic device implements the method for loading game resources of a mini-game provided in each of the above embodiments.

[0137] FIG. 11 shows a structural schematic diagram of a computer system of an electronic device suitable for implementing embodiments of the present application. It should be noted that the computer system 1100 of the electronic device shown in FIG. 11 is only an example, and should not bring any limitation to the functions and use range of the embodiments of the present application.

[0138] As shown in FIG. 11, the computer system 1100 includes a central processing unit (CPU) 1101, which can perform various appropriate actions and processes according to programs stored in a read-only memory (ROM) 1102 or programs loaded from a storage portion 1108 to a random access memory (RAM) 1103, such as performing the methods described in the above embodiments. In the RAM 1103, various programs and data required for system operation are also stored. The CPU 1101, the ROM 1102, and the RAM 1103 are connected to each other through a bus 1104. An input / output (I / O) interface 1105 is also connected to the bus 1104.

[0139] The following components are connected to the I / O interface 1105: an input part 1106 including a keyboard, a mouse, etc.; an output part 1107 including a display such as a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), etc., and a speaker, etc.; a storage part 1108 including a hard disk, etc.; and a communication part 1109 including a network interface card such as a LAN (Local Area Network) card, a modem, etc. The communication part 1109 performs communication processing via a network such as the Internet. A drive 1110 is also connected to the I / O interface 1105 as necessary. A removable media 1111 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc. is attached to the drive 1110 as necessary, so that a computer program read out therefrom is installed in the storage part 1108 as necessary.

[0140] In particular, the processes described above with reference to the flow charts can be implemented as computer software programs in accordance with the embodiments of the present application. For example, the embodiments of the present application include a computer program product comprising a computer program carried on a computer readable medium, the computer program containing a computer program for executing the methods shown in the flow charts. In such embodiments, the computer program can be downloaded and installed from a network via the communication part 1109, and / or installed from the removable media 1111. When the computer program is executed by the central processing unit (CPU) 1101, various functions defined in the system of the present application are performed.

[0141] It should be noted that the computer readable medium shown in the embodiments of the present application can be a computer readable signal medium or a computer readable storage medium or any combination of the two. More specific examples of the computer readable storage medium can include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM), a flash memory, an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any appropriate combination of the foregoing. The computer program contained in the computer readable medium can be transmitted using any appropriate medium, including but not limited to wireless, wired, or the like, or any appropriate combination of the foregoing.

[0142] The flowcharts and block diagrams in the attached drawings illustrate the possible implementation architecture, function and operation of the system, method and computer program product according to various embodiments of the present application. In the flowcharts or block diagrams, each block can represent a module, a program segment or a part of code, which contains one or more executable instructions for implementing the specified logic function. It should also be noted that in some alternative implementations, the functions noted in the blocks can occur in different order from that shown in the attached drawings. For example, two blocks that are shown in succession can actually be executed in parallel, and they can also be executed in reverse order, depending on the function involved. It should also be noted that each block in the flowcharts or block diagrams, and the combination of blocks in the flowcharts or block diagrams, can be implemented by a dedicated hardware-based system that performs the specified function or operation, or can be implemented by a combination of dedicated hardware and computer instructions.

[0143] The units involved in the embodiments of the present application can be implemented in software or in hardware, and the described units can also be arranged in a processor. In some cases, the names of the units do not constitute a limitation on the units themselves.

[0144] Another aspect of the present application also provides a computer readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the method for loading game resources for a mini-game as described above. The computer readable storage medium can be included in the electronic device described in the above embodiments, or can exist separately and not be assembled into the electronic device.

[0145] Another aspect of the present application also provides a computer program product or computer program, which includes computer instructions stored in a computer readable storage medium. A processor of a computer device reads the computer instructions from the computer readable storage medium, and the processor executes the computer instructions, so that the computer device executes the method for loading game resources for a mini-game provided in each of the above embodiments.

[0146] To sum up, the application provides a method, device, electronic equipment, computer readable storage medium and computer program product for realizing small game loading game resources. The small game is run based on a host application, the host application runs on an operating system, and whether the small game is associated with a file system bridge is detected. If the bridge is detected, the game resource package is loaded from the disk space to the engine heap of the game engine through the file system. In this way, the disk read-write capability is provided for the small game, the specific game resource can be loaded from the disk space, the entire game resource package does not need to be read into the engine heap, the memory consumption of the engine heap is reduced, and the problem of memory crash of the small game is avoided.

[0147] Further, on the basis of the above, the game resource package is also downloaded, the downloaded game resource package is stored in the running memory, the running memory is used for running the glue layer logic of the small game, the glue layer logic is used for supporting the small game to interact with external components, and the downloaded game resource package is stored in the disk space. This enables the game resource package to be stored in order, provides a basis for subsequent loading of game resources from the disk space, and guarantees the continuity of the game resource loading process.

[0148] Further, when the game resource in the game resource package is loaded from the disk space to the engine heap of the game engine through the file system, the game resource package is first read from the disk space to the running memory through the file system, the resource index information corresponding to the loaded game resource package in the virtual memory is determined, the game resource in the game resource package is read from the running memory according to the resource index information, and loaded to the engine heap of the game engine. This way uses the resource index information to accurately locate the game resource to be loaded, improves the accuracy and efficiency of the game resource loading.

[0149] Further, when it is detected that the small game is bridged with the file system, it is queried whether the game resource package containing the game resource to be loaded is cached in the running memory. If not, the step of reading the game resource package from the disk space to the running memory through the file system is performed. If it is cached, the game resource to be loaded is loaded from the running memory according to the resource index information loaded in the virtual memory. In this way, it can be avoided that the game resource is read from the disk space every time, the number of cross-process communications is reduced, and the resource consumption is reduced.

[0150] Further, the storage state of the game resource package cached in the running memory is periodically detected, the game resource package with the idle state is determined, the idle state represents that the game resource package has not been read in a specified time period, and the game resource package with the idle state is cleared. This helps to optimize the use of the running memory, reduces unnecessary memory occupation, and improves the utilization rate of the memory resource.

[0151] Further, if it is detected that the mini-game is not bridged with the file system, a game resource package containing the game resource to be loaded is loaded from the virtual memory contained in the running memory of the mini-game. This ensures that the mini-game can normally load game resources in different environments, and increases the compatibility of the mini-game.

[0152] Further, the game resource package is downloaded, the downloaded game resource package is stored in the running memory, and the downloaded game resource package is copied to the virtual memory. This provides a prerequisite for loading game resources from the virtual memory when the mini-game is not bridged with the file system, and ensures normal loading of game resources.

[0153] Further, when detecting whether the mini-game is bridged with the file system associated with the host application, it is detected whether the value of the preset identifier is the preset value. During the initialization process of the mini-game, if the file system associated with the host application is detected, the preset identifier is set to the preset value. In response to detecting that the value of the preset identifier is the preset value, it is determined that the mini-game is bridged with the file system associated with the host application. This detection method is simple and efficient, and can accurately determine the bridging state of the mini-game and the file system, providing a basis for subsequent selection of game resource loading methods.

[0154] Further, in response to the game resource loading request, a network address is registered in the game engine, the network address is used to indicate the source of the game resource to be loaded, and the network address and the disk path are registered in the glue layer, the disk path is used to indicate the storage location of the game resource package in the disk space, and the glue layer obtains the disk path through the file system. This implements the initialization of game resource loading and perfects the logic of the game resource loading process.

[0155] Further, it is detected whether the corresponding network address and disk path have been registered in the glue layer. If it is detected that they have been registered, the step of loading the game resource to be loaded in the game resource package from the disk space to the engine heap of the game engine through the file system is performed. If it is detected that they have not been registered, the target file is loaded from the simulated disk contained in the running memory. This enables the mini-game to load ordinary files while using the game resource package loaded by the SDK, thereby improving the adaptability of the mini-game.

[0156] Further, when receiving a request for indicating calling a resource loading interface provided by the software development kit, the request is determined as a game resource loading request. This clearly defines the triggering condition of the game resource loading request and standardizes the process of game resource loading.

[0157] Further, when receiving a request for indicating calling a resource loading interface provided by the software development kit, the request is determined as a game resource loading request. This clearly defines the triggering condition of the game resource loading request and standardizes the process of game resource loading.

[0157] Further, when receiving a request for indicating calling a resource loading interface provided by the software development kit, the request is determined as a game resource loading request. This clearly defines the triggering condition of the game resource loading request and standardizes the process of game resource loading.

[0158] It can be understood that in the specific embodiments of the present application, data related to file systems, game resources, game resource packs, memories, etc. are involved. When the above embodiments are applied to specific products or technologies, the user's permission or consent needs to be obtained, and the collection, use and processing of related data need to comply with relevant laws, regulations and standards of relevant countries and regions.

[0159] The technical features of the above embodiments can be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described, but as long as the combinations of the technical features do not exist contradictory, they should be considered as the scope of the description.

[0160] The above embodiments only express several implementation manners of the present application, and the description is more specific and detailed, but it should not be understood as a limitation on the scope of the patent. It should be pointed out that for ordinary skilled persons in the art, without departing from the concept of the present application, a number of modifications and improvements can be made, which are all within the protection scope of the present application. Therefore, the protection scope of the patent of the present application should be subject to the appended claims.

Claims

1. A method for loading game resources for a mini-game, implemented by a terminal, the method comprising: running the mini-game based on a host application, the host application running on an operating system; detecting whether the mini-game is bridged with a file system associated with the host application, the file system being used to manage a disk space corresponding to the host application, the disk space being used to store a game resource package corresponding to the mini-game; and in response to detecting that the mini-game is bridged with the file system, loading, by the file system, to-be-loaded game resources in the game resource package from the disk space to an engine heap of a game engine. 2.The method of claim 1, further comprising: downloading a game resource package and storing the downloaded game resource package in a running memory, the running memory being used to run a glue layer logic of the mini-game; the glue layer logic being used to support the mini-game to interact with external components; storing the downloaded game resource package in the disk space. 3.The method of claim 1 or 2, wherein the loading, by the file system, to-be-loaded game resources in the game resource package from the disk space to the engine heap of the game engine comprises: reading, by the file system, the game resource package from the disk space to a running memory; determining resource index information corresponding to the game resource package loaded in a virtual memory, the virtual memory being used to run a game logic of the mini-game; and according to the resource index information, reading the to-be-loaded game resources in the game resource package from the running memory and loading to the engine heap of the game engine. 4.The method of claim 3, further comprising: in response to detecting that the mini-game is bridged with the file system, querying whether a game resource package containing the to-be-loaded game resources is cached in the running memory; in response to querying that the game resource package is not cached, performing the step of reading, by the file system, the game resource package from the disk space to the running memory; in response to querying that the game resource package is cached, loading the to-be-loaded game resources from the running memory according to the resource index information loaded in the virtual memory. 5.The method of claim 4, further comprising: periodically detecting storage states of game resource packages cached in the running memory; determining game resource packages with an idle state, the idle state representing that the game resource packages have not been read for a specified period of time; and clearing the game resource packages with the idle state. 6.The method of any one of claims 1 to 5, further comprising: if it is detected that the mini-game is not bridged with the file system, loading a game resource package containing the to-be-loaded game resources from a virtual memory included in a running memory of the mini-game. 7.The method of claim 6, further comprising: downloading the game resource package and storing the downloaded game resource package in the running memory; and copying the downloaded game resource package to the virtual memory. ​ 8. The method of any one of claims 1-7, wherein the detecting whether the mini-game is bridged with the file system associated with the host application comprises: detecting whether a value of a preset identifier is a preset value; setting the preset identifier to the preset value during an initialization process of the mini-game if the file system associated with the host application is detected; and determining that the mini-game is bridged with the file system associated with the host application in response to detecting that the value of the preset identifier is the preset value.

9. The method of any one of claims 1-8, further comprising: registering a network address in the game engine in response to a game resource loading request, the network address being used to indicate a source of a game resource to be loaded; and registering the network address and a disk path in a glue layer, the disk path being used to indicate a storage location of a game resource package in a disk space, the glue layer obtaining the disk path through the file system.

10. The method of claim 9, further comprising: detecting whether the glue layer has registered a corresponding network address and disk path; performing a step of loading a game resource to be loaded in the game resource package from the disk space to an engine heap of the game engine through the file system in response to detecting that the registration has been performed; and loading a target file from an emulated disk included in a running memory in response to detecting that the registration has not been performed.

11. The method of claim 9, further comprising: determining that a request received is the game resource loading request when the request is used to indicate a call to a resource loading interface provided by a software development kit.

12. The method of claim 1 or 11, further comprising: cleaning up the game resource package corresponding to the mini-game in the disk space through the file system in response to receiving a request used to indicate a call to a resource unloading interface provided by a software development kit.

13. An apparatus for loading game resources of a mini-game, the apparatus comprising: a mini-game running module configured to run the mini-game based on a host application, the host application being run on an operating system; a first detecting module configured to detect whether the mini-game is bridged with a file system associated with the host application, the file system being configured to manage a disk space corresponding to the host application, the disk space being configured to store a game resource package corresponding to the mini-game; and a first loading module configured to load a game resource to be loaded in the game resource package from the disk space to an engine heap of a game engine through the file system in response to detecting that the mini-game is bridged with the file system.

14. An electronic device, comprising: one or more processors; and memory storing one or more programs, when executed by the one or more processors, cause the electronic device to implement a method for loading game resources of a mini-game as claimed in any one of claims 1-12. ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ 15. A computer readable storage medium having stored thereon computer readable instructions which, when executed by a processor of a computer, cause the computer to perform the method of any one of claims 1-12 for implementing loading of game resources for a mini-game.

16. A computer program product comprising a computer program which, when executed by a processor, implements the method of any one of claims 1-12 for implementing loading of game resources for a mini-game.

Citation Information

Patent Citations

  • Method and device for uploading resource files by game engine, and computer

    CN102799456A

  • H5 mini game resource caching method

    CN110090436A

  • Small game application starting method and related device

    CN114327675A

  • Method for loading game resources in small game and related device

    CN118312245A

  • Game Engine Resource Processing Method And Apparatus, And Electronic Device And Computer-Readable Storage Medium

    US20230214272A1