CN111569431B - Game engine resource processing method, electronic device and computer readable storage medium - Google Patents

Game engine resource processing method, electronic device and computer readable storage medium Download PDF

Info

Publication number
CN111569431B
CN111569431B CN201910120451.1A CN201910120451A CN111569431B CN 111569431 B CN111569431 B CN 111569431B CN 201910120451 A CN201910120451 A CN 201910120451A CN 111569431 B CN111569431 B CN 111569431B
Authority
CN
China
Prior art keywords
resource
game
module
resources
pipeline
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201910120451.1A
Other languages
Chinese (zh)
Other versions
CN111569431A (en
Inventor
王浩
凌华彬
林顺
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Xiamen Yaji Software Co Ltd
Original Assignee
Xiamen Yaji Software Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Xiamen Yaji Software Co Ltd filed Critical Xiamen Yaji Software Co Ltd
Priority to CN201910120451.1A priority Critical patent/CN111569431B/en
Publication of CN111569431A publication Critical patent/CN111569431A/en
Application granted granted Critical
Publication of CN111569431B publication Critical patent/CN111569431B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • AHUMAN NECESSITIES
    • A63SPORTS; GAMES; AMUSEMENTS
    • A63FCARD, BOARD, OR ROULETTE GAMES; INDOOR GAMES USING SMALL MOVING PLAYING BODIES; VIDEO GAMES; GAMES NOT OTHERWISE PROVIDED FOR
    • A63F13/00Video games, i.e. games using an electronically generated display having two or more dimensions
    • A63F13/70Game security or game management aspects
    • AHUMAN NECESSITIES
    • A63SPORTS; GAMES; AMUSEMENTS
    • A63FCARD, BOARD, OR ROULETTE GAMES; INDOOR GAMES USING SMALL MOVING PLAYING BODIES; VIDEO GAMES; GAMES NOT OTHERWISE PROVIDED FOR
    • A63F13/00Video games, i.e. games using an electronically generated display having two or more dimensions
    • A63F13/70Game security or game management aspects
    • A63F13/77Game security or game management aspects involving data related to game devices or game servers, e.g. configuration data, software version or amount of memory
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Abstract

The application relates to the technical field of data processing, and discloses a game engine resource processing method, electronic equipment and a computer readable storage medium, wherein the game engine resource processing method comprises the following steps: receiving an acquisition request aiming at any game resource of any running platform through a first preset interface of a game engine; then based on the acquisition request, acquiring any game resource through a resource management system of the game engine, wherein the resource management system comprises at least one of the first preset interface, the resource, a resource manager, a resource loader and a resource registry; any game resource that is retrieved is then returned. According to the method, the resource loader is adapted to different game running platforms, and corresponding game resources are obtained from the different game running platforms, so that efficient and flexible management of resources in different formats of each large game running platform is realized, and the requirement for the expansibility of a resource management system and the requirement for rapidly loading a large number of resources of different game running platforms are met.

Description

Game engine resource processing method, electronic device and computer readable storage medium
Technical Field
The present application relates to the field of data processing technologies, and in particular, to a game engine resource processing method, an electronic device, and a computer-readable storage medium.
Background
In recent years, with the increasing demand for game entertainment and the development of game engine technology, various games have appeared like bamboo shoots in the spring after rain. At present, along with the development of software and hardware technologies and the continuous increase of market demands, the scale of games is also continuously increased, and the span is very large from an initial 8-bit computer to a large-scale scene game which occupies dozens of GB (Gigabyte) storage spaces now and now; moreover, the number of various software and hardware platforms supporting games is also increasing, and platforms such as end games, hand games, page games, mini games, various game hosts and the like are also increasing day by day; in addition, the technology related to game development is also changed day by day, and a great amount of novel graphic libraries, physical libraries, audio libraries and the like used for developing various games are emerged; the conditions of large industrial scale, multiple platforms, complex technology and the like in the current game industry are represented.
In the game development process, a large number of resources such as characters, images, sound effects, fonts, models, animations, grids, scripts and the like can be generated and used, various formats are derived from various different resources, and the performances of each format on each game running platform are different; and as the game industry further develops, many companies propose support and commercialization schemes for respective games, which have proliferated the number of various resource files. However, the inventors of the present application found in the concrete implementation: for the research and development of game engines, in order to meet the requirements of various game running platforms and the requirement of releasing games to the various game running platforms, resources of all the game running platforms must be compatible at the same time, so that the problems of excessive resource quantity, disordered management, difficulty and the like occur in the research and development process of the game engines; in addition, the existing game resource management system has the problems of a large number of code duplications, disordered architecture, a plurality of defects, poor expansibility, poor flexibility, poor performance and the like. Therefore, a new technical solution is needed to ensure the consistency of the expression of huge amount of resources on different game running platforms.
Disclosure of Invention
The purpose of the present application is to solve at least one of the above technical drawbacks, and to provide the following solutions:
in a first aspect, a game engine resource processing method is provided, including:
receiving an acquisition request aiming at any game resource of any running platform through a first preset interface of a game engine;
based on the acquisition request, acquiring any game resource through a resource management system of the game engine, wherein the resource management system comprises a first preset interface, a resource manager, a resource loader and a resource registry;
and returning any acquired game resource.
Specifically, the resource manager is used for caching existing game resources, processing game resource release and determining a game resource release strategy according to the type of the game resources;
the resource loader is used for loading various game resources based on the pipelined loading pipeline;
the resource registry is used for storing relevant information of game resources, and the relevant information comprises at least one item of identification information, hash values and conversion information from resource paths to actual paths.
Furthermore, the resource loader comprises a loading queue module, a cyclic reference detection module, a pipeline scheduling module, a loading pipeline module, a resource dependence analysis module and an error processing module;
the loading queue module is used for storing each game resource item being loaded and/or game resource items to be loaded;
the circular reference detection module is used for detecting whether the dependency relationship among the game resources has circular dependency or not and performing fracture processing on the circular dependency when the circular dependency exists;
the pipeline scheduling module is used for executing at least one of the following: controlling splicing of each pipeline, controlling data inflow and data outflow among pipelines, scheduling parallel processing of each pipeline, and scheduling callback processing of each pipeline;
the loading pipeline module is used for processing at least one of dynamic splicing, deleting, adding and shifting of the pipeline;
the resource dependence analysis module is used for analyzing the related resources dependent on the game resources after deserialization and loading the related resources obtained by analysis;
and the error processing module is used for recording abnormal information in the loading process of the game resources and returning the abnormal information.
Further, the loading pipeline module comprises a resource identifier analysis pipeline, a resource MD5 analysis pipeline, a platform adaptation pipeline, a resource downloading pipeline and a resource loading pipeline;
the resource identification analysis pipeline is used for converting the game resource identification information into global unique identification information of the game resource and converting the global unique identification information into an actual path of the game resource;
the resource MD5 analysis pipeline is used for acquiring a version path of the game resource by adding the hash value of the game resource to the actual path of the game resource;
the platform adaptation pipeline is used for matching corresponding Application Programming Interfaces (APIs) according to different game running platforms;
the resource downloading pipeline is used for determining a corresponding downloader for downloading the game resources according to the types of the game resources;
the resource loading pipeline is used for determining a corresponding loader for loading the game resources according to the types of the game resources.
Further, the resource manager comprises a resource strategy module, a resource acquisition module, a resource cache module and a resource release module;
the resource strategy module is used for determining different management strategies aiming at different game resources;
the resource acquisition module is used for determining whether game resources exist by inquiring the resource cache module, returning the game resources when the game resources exist, and loading the game resources through the resource loader when the game resources do not exist;
the resource caching module is used for caching all resources used in the game so as to multiplex public game resources;
the resource release module is used for determining to release the game resources or release the related resources depending on the game resources according to the selection of the user.
Further, the resource registry comprises a resource path processing module, a resource information module, a resource identifier mapping table module and a resource MD5 mapping table module;
the resource path processing module is used for converting the global unique identification information of the game resource into the path information of the game resource;
the resource information module is used for storing at least one of the following: the type of the game resource, the relative path of the game resource, the name of the game resource, the identification information of the game resource, and an identification indicating whether the game resource is a child resource;
the resource identification mapping table module is used for mapping the identification information of the game resource with the global unique identification information of the game resource;
the resource MD5 mapping table module is used for mapping the global unique identification information of the game resource with the hash value of the game resource so as to inquire the version information of the game resource.
Further, acquiring any game resource through the resource management system comprises:
step a, calling a second preset interface of a resource registry through a first preset interface, and inquiring relevant information of any game resource through the resource registry to acquire identification information of any game resource;
and b, calling a third preset interface of the resource manager according to the identification information of any game resource, and acquiring any game resource through the resource manager.
Further, acquiring any game resource through the resource manager includes:
inquiring game resources cached in a resource caching module of a resource manager, and determining whether any game resource is included in the cached game resources;
if any game resource is included, returning any game resource;
if the game machine does not comprise any game resource, the fourth preset interface of the resource loader is called through the resource manager, and any game resource is loaded through the resource loader.
Further, loading any game resource through the resource loader comprises:
judging whether the loading queue module is loading any game resource;
if any game resource is being loaded, registering a corresponding callback function, and returning any loaded game resource through the callback function;
if any game resource is not loaded, adding a resource item for loading any game resource in the loading queue module, and loading any game resource based on the resource item.
Further, the loading processing of any game resource based on the resource item includes:
detecting whether cyclic dependency exists on the resource item through a cyclic reference detection module;
if the cyclic dependence exists, performing fracture processing on the cyclic dependence, and loading any game resource;
if no circular dependence exists, the assembly line scheduling module is used for scheduling the assembly line of the resource item, so that the relevant data of any game resource flows into the scheduled assembly line, and the loading assembly line module is used for loading any game resource based on the scheduled assembly line.
Further, loading any game resource based on the scheduled pipeline through the loading pipeline module comprises:
calling a second preset interface through a resource identification analysis pipeline, and converting the identification information of any game resource into an actual path of any game resource;
calling a second preset interface through a resource MD5 analysis pipeline, and adding the hash value of any game resource into an actual path to obtain a version path of any game resource;
determining an API (application program interface) adapted to any running platform through a platform adaptation pipeline based on the version path;
determining a downloader for downloading any game resource according to the type of any game resource through a resource downloading pipeline based on the API, and downloading any game resource through the downloader;
and determining a loader for loading any game resource according to the type of any game resource through a resource downloading pipeline based on the API, and loading any game resource through the loader.
Further, after loading any game resource based on the scheduled pipeline through the loading pipeline module, the method further comprises the following steps:
analyzing the related resources depended on by any game resource through a resource dependence analysis module, and judging whether any game resource is depended on according to the analysis result;
if the dependency exists, circularly executing the step b;
if the game resource is not dependent on the game resource, a third preset interface of the resource manager is called, the management strategy of any game resource is determined through a resource strategy module of the resource manager, and any game resource is cached through a resource cache module of the resource manager, so that any game resource is returned.
In a second aspect, there is provided a game engine resource processing apparatus, including:
the game system comprises a receiving module, a processing module and a processing module, wherein the receiving module is used for receiving an acquisition request aiming at any game resource of any running platform through a first preset interface of a game engine;
the acquisition module is used for acquiring any game resource through a resource management system of the game engine based on the acquisition request, and the resource management system comprises at least one of a first preset interface, a resource manager, a resource loader and a resource registry;
and the returning module is used for returning any acquired game resource.
Specifically, the resource manager is used for caching existing game resources, processing game resource release and determining a game resource release strategy according to the type of the game resources;
the resource loader is used for loading various game resources based on the pipelined loading pipeline;
the resource registry is used for storing the relevant information of the game resources, and the relevant information comprises identification information, a hash value and conversion information from the resource path to the actual path.
Furthermore, the resource loader comprises a loading queue module, a cyclic reference detection module, a pipeline scheduling module, a loading pipeline module, a resource dependence analysis module and an error processing module;
the loading queue module is used for storing each game resource item being loaded and/or game resource items to be loaded;
the circular reference detection module is used for detecting whether the dependency relationship among the game resources has circular dependency or not and performing fracture processing on the circular dependency when the circular dependency exists;
the pipeline scheduling module is used for executing at least one of the following: controlling splicing of each pipeline, controlling data inflow and data outflow among pipelines, scheduling parallel processing of each pipeline, and scheduling callback processing of each pipeline;
the loading pipeline module is used for carrying out at least one of dynamic splicing, deletion, addition and displacement processing on the pipeline;
the resource dependence analysis module is used for analyzing the related resources dependent on the game resources after deserialization and loading the related resources obtained by analysis;
and the error processing module is used for recording abnormal information in the loading process of the game resources and returning the abnormal information.
Further, the loading pipeline module comprises a resource identifier analysis pipeline, a resource MD5 analysis pipeline, a platform adaptation pipeline, a resource downloading pipeline and a resource loading pipeline;
the resource identification analysis pipeline is used for converting the game resource identification information into global unique identification information of the game resource and converting the global unique identification information into an actual path of the game resource;
the resource MD5 analysis pipeline is used for acquiring a version path of the game resource by adding the hash value of the game resource to the actual path of the game resource;
the platform adaptation pipeline is used for matching corresponding Application Programming Interfaces (APIs) according to different game running platforms;
the resource downloading pipeline is used for determining a corresponding downloader for downloading the game resources according to the types of the game resources;
the resource loading pipeline is used for determining a corresponding loader for loading the game resources according to the types of the game resources.
Further, the resource manager comprises a resource strategy module, a resource acquisition module, a resource cache module and a resource release module;
the resource strategy module is used for determining different management strategies aiming at different game resources;
the resource acquisition module is used for determining whether game resources exist by inquiring the resource cache module, returning the game resources when the game resources exist, and loading the game resources through the resource loader when the game resources do not exist;
the resource caching module is used for caching all resources used in the game so as to multiplex public game resources;
the resource release module is used for determining to release the game resources or release the related resources depending on the game resources according to the selection of the user.
Further, the resource registry comprises a resource path processing module, a resource information module, a resource identifier mapping table module and a resource MD5 mapping table module;
the resource path processing module is used for converting the global unique identification information of the game resource into the path information of the game resource;
the resource information module is used for storing at least one of the following: the type of the game resource, the relative path of the game resource, the name of the game resource, the identification information of the game resource, and the identification indicating whether the game resource is a sub-resource;
the resource identification mapping table module is used for mapping the identification information of the game resource with the global unique identification information of the game resource;
the resource MD5 mapping table module is used for mapping the global unique identification information of the game resource and the hash value of the game resource so as to inquire the version information of the game resource.
Further, the acquisition module comprises a first processing submodule and a second processing submodule;
the first processing submodule is used for calling a second preset interface of the resource registry through the first preset interface and inquiring the relevant information of any game resource through the resource registry so as to acquire the identification information of any game resource;
and the second processing submodule is used for calling a third preset interface of the resource manager according to the identification information of any game resource and acquiring any game resource through the resource manager.
Further, the second processing submodule comprises a query unit and a first result processing unit;
the query unit is used for querying the game resources cached in the resource caching module of the resource manager and determining whether any game resource is included in the cached game resources;
the first result processing unit is used for returning any game resource when any game resource is included; and when any game resource is not included, the fourth preset interface of the resource loader is called through the resource manager, and any game resource is loaded through the resource loader.
Further, the first result processing unit is specifically configured to determine whether the load queue module is loading any game resource; when any game resource is being loaded, the corresponding callback function is registered, and any game resource which is loaded is returned through the callback function; and when any game resource is not loaded, adding a resource item for loading any game resource in the loading queue module, and loading any game resource based on the resource item.
Further, the first result processing unit is specifically configured to detect, by the circular reference detection module, whether a circular dependency exists on the resource item; when the cyclic dependence exists, performing fracture processing on the cyclic dependence, and loading any game resource; and when the circular dependence does not exist, the assembly line scheduling module is used for scheduling the assembly line of the resource item, so that the relevant data of any game resource flows into the scheduled assembly line, and the loading assembly line module is used for loading any game resource based on the scheduled assembly line.
Furthermore, the first result processing unit is specifically configured to invoke a second preset interface through the resource identifier resolution pipeline, and convert the identifier information of any game resource into an actual path of any game resource; the resource MD5 analysis pipeline is used for calling a second preset interface, and the hash value of any game resource is added into the actual path to obtain the version path of any game resource; the API is used for determining to be adapted to any running platform through the platform adaptation pipeline based on the version path; the downloader is used for determining to download any game resource through the resource downloading pipeline based on the API according to the type of any game resource, and downloading any game resource through the downloader; and the loader is used for determining to load any game resource according to the type of any game resource through the resource downloading pipeline based on the API, and loading any game resource through the loader.
Further, the second processing submodule further comprises a second result processing unit;
the second result processing unit is used for analyzing the related resources depended by any game resource through the resource dependence analysis module and judging whether any game resource depends on the second result processing unit according to the analysis result; and when there is a dependency, circularly executing the actions of the second processing submodule; and when the dependency does not exist, calling a third preset interface of the resource manager, determining a management strategy of any game resource through a resource strategy module of the resource manager, and caching any game resource through a resource caching module of the resource manager so as to return any game resource.
In a third aspect, an electronic device is provided, which includes a memory, a processor, and a computer program stored on the memory and executable on the processor, and when the processor executes the computer program, the game engine resource processing method is implemented.
In a fourth aspect, a computer-readable storage medium is provided, on which a computer program is stored, which when executed by a processor, implements the game engine resource processing method described above.
According to the game engine resource processing method provided by the embodiment of the application, the acquisition request of any game resource of any running platform is received through the first preset interface of the resource management system of the game engine, and any game resource is acquired through the resource management system based on the acquisition request, wherein the resource management system comprises the first preset interface, the resource manager, the resource loader and the resource registry, so that different game running platforms, such as iOS (apple operating system), android (Android operating system), windows (Microsoft Windows operating system) and the like, can be adapted through the resource loader, and corresponding game resources are acquired from the different game running platforms, therefore, the application layer and the engine subsystem on the upper layer of the game engine can acquire game development resources of different game running platforms by using the first preset interface provided by the resource manager, efficient and flexible management of resources with different formats of each large game running platform is realized, and the expansibility requirement on the resource management system and the requirement for rapidly loading a large number of resources of different game running platforms are met.
Additional aspects and advantages of the present application will be set forth in part in the description which follows and, in part, will be obvious from the description, or may be learned by practice of the present application.
Drawings
The above and/or additional aspects and advantages of the present application will become apparent and readily appreciated from the following description of the embodiments, taken in conjunction with the accompanying drawings of which:
FIG. 1 is a schematic flow chart illustrating a method for processing game engine resources according to an embodiment of the present disclosure;
FIG. 2 is a system architecture diagram of a game engine according to an embodiment of the present application;
FIG. 3 is a schematic structural diagram of a resource management system of a game engine according to an embodiment of the present application;
FIG. 4 is a diagram illustrating a basic process of acquiring game resources according to an embodiment of the present application;
FIG. 5 is a schematic diagram of a basic structure of a game engine resource processing apparatus according to an embodiment of the present application;
FIG. 6 is a detailed structural diagram of a game engine resource processing apparatus according to an embodiment of the present application;
fig. 7 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
Detailed Description
Reference will now be made in detail to embodiments of the present application, examples of which are illustrated in the accompanying drawings, wherein like or similar reference numerals refer to the same or similar elements or elements having the same or similar function throughout. The embodiments described below with reference to the accompanying drawings are exemplary only for explaining the present application and are not construed as limiting the present application.
As used herein, the singular forms "a", "an", "the" and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise. It will be further understood that the terms "comprises" and/or "comprising," when used in this specification, specify the presence of stated features, integers, steps, operations, elements, and/or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and/or groups thereof. It will be understood that when an element is referred to as being "connected" or "coupled" to another element, it can be directly connected or coupled to the other element or intervening elements may also be present. Further, "connected" or "coupled" as used herein may include wirelessly connected or wirelessly coupled. As used herein, the term "and/or" includes all or any element and all combinations of one or more of the associated listed items.
To make the objects, technical solutions and advantages of the present application more clear, embodiments of the present application will be described in further detail below with reference to the accompanying drawings.
The following describes the technical solution of the present application and how to solve the above technical problems in detail by specific embodiments. The following several specific embodiments may be combined with each other, and details of the same or similar concepts or processes may not be repeated in some embodiments. Embodiments of the present application will be described below with reference to the accompanying drawings.
Example one
An embodiment of the present application provides a game engine resource processing method, as shown in fig. 1, including:
step S110, an acquisition request for any game resource of any running platform is received through a first preset interface of the game engine.
Specifically, when an application layer and an engine subsystem on an upper layer of a game engine initiate an acquisition request for any game resource of any running platform, a terminal device receives the acquisition request through a first preset interface of the game engine, the first preset interface is a unified interface of a resource management system of the game engine, and the terminal device can be a smart phone, an iPad, a desktop computer, a notebook computer and the like.
The application layer of the game engine includes plug-ins, user components, game capabilities, editors, and the like, and the engine subsystem of the game engine includes a scene manager, an animation system, an audio system, a rendering system, and the like, as shown in fig. 2.
Step S120, based on the obtaining request, obtaining any game resource through a resource management system of the game engine, wherein the resource management system comprises a first preset interface, a resource manager, a resource loader and a resource registry.
Specifically, after receiving the acquisition request, the first preset interface of the resource management system of the game engine may acquire the any game resource based on the acquisition request. The resource management system comprises a first preset interface, resources, a resource manager, a resource loader and a resource registry. In other words, the resource management system is split into modules, so that the resource management system includes an upper unified interface (i.e., the first preset interface), a resource manager, a resource loader, a resource registry, and the like, as shown in fig. 2. The resource management system can adapt to different game running platforms through the resource loader, for example, iOS (apple operating system), android (Android operating system), windows (microsoft operating system), and the like, and obtain corresponding game resources from the resource loader, so that the application layer and the engine subsystem on the upper layer of the game engine can obtain the game resources of different game running platforms through the first preset interface provided by the resource manager.
Further, as shown in fig. 2, the system architecture of the game engine includes a platform adaptation and target running platform in addition to an application layer, an engine subsystem, and a resource management system, wherein in the whole game engine, the resource management system is at the bottom of the game engine and is the basis of each subsystem of the engine and the application layer.
And step S130, returning any acquired game resource.
Specifically, after acquiring the any game resource, the resource management system returns the acquired any game resource to the upper layer of the game engine.
Compared with the prior art, the game engine resource processing method provided by the embodiment of the application receives an acquisition request of any game resource of any running platform through a first preset interface of a resource management system of a game engine, and acquires any game resource through the resource management system based on the acquisition request, wherein the resource management system comprises the first preset interface, resources, a resource manager, a resource loader and a resource registry, so that the resource loader can be adapted to different game running platforms, such as an iOS (apple operating system), an Android (Android operating system), a Windows (Microsoft operating system) and the like, and acquires corresponding game resources from the different game running platforms, an application layer and an engine subsystem on the upper layer of the game engine can acquire game development resources of different game running platforms by using the first preset interface provided by the resource manager, high efficiency and flexible management of different format resources of each large game running platform are realized, and the expansibility requirement of the resource management system and the requirement for rapidly loading a large number of resources of different game running platforms are met.
The embodiment of the present application provides another possible implementation manner, where:
the resource manager is used for caching the existing game resources, processing the release of the game resources and determining the release strategy of the game resources according to the types of the game resources, and the game resources can be ensured not to be repeatedly loaded by caching the existing game resources.
The resource loader is used for loading various game resources based on a loading pipeline of the pipelining, namely the resource loader is designed based on the pipelining, so that the loading pipeline based on the pipelining can support rapid expansion and adapt to various requirements.
The resource registry is used for storing the relevant information of the game resources, the relevant information comprises at least one item of identification information, hash value and conversion information from the resource path to the actual path, and the resource registry can also provide an external interface for inquiring the relevant information of the game resources.
The first preset interface of the resource management system is a uniform interface provided by the resource management system to an upper layer for each part of the game engine to call, and comprises interfaces for acquiring, querying, loading, releasing and the like of a series of game resources.
Specifically, as shown in fig. 3, the resource loader based on the pipelined design includes a load queue module, a circular reference detection module, a pipeline scheduling module, a load pipeline module, a resource dependency analysis module, and an error processing module, where details and functions of each module are as follows:
the loading queue module is used for storing each game resource item being loaded and/or game resource items to be loaded, so as to control the work of dependence and the like among the game resource items.
The circular reference detection module is used for detecting whether the dependency relationship among the game resources has circular dependency or not, and performing fracture processing on the circular dependency when the circular dependency exists, which is equivalent to the problem of detecting whether the dependency relationship among the game resources has a ring or not.
The cyclic dependence refers to cyclic reciprocal dependence, for example, A depends on B, B depends on C, and C depends on A again, and the dependence forms a ring, namely A- > B- > C- > A. The loop dependency causes that when A is loaded, B must be loaded first, C must be loaded first, and C must be loaded first, so that A cannot be completed forever, and an infinite loop is formed. The problem with the loop is referred to as loop dependence.
Since a loop dependency causes an infinite loop, a place in a loop of a dependency relationship must be found to be broken, such as a- > B- > C- > a, which is a loop, and this time, the dependency relationship of B dependency C needs to be broken to become a- > B and C- > a, which is stopped when B is loaded, so that the loop is broken (i.e., the loop dependency). The operation mode for performing the fracture treatment on the cyclic dependence is as follows: when a sub-resource is loaded, firstly, whether the sub-resource is an ancestor resource of the sub-resource is searched, if yes, the sub-resource is not loaded any more, and the loading of the current resource is directly finished.
The pipeline scheduling module can be used for controlling splicing of all pipelines, controlling data inflow and data outflow among pipelines, scheduling parallel processing of all pipelines, scheduling callback processing of all pipelines and the like.
The loading pipeline module is used for processing at least one of dynamic splicing, deleting, adding and shifting of the pipeline, the whole loading pipeline is designed based on pipelining, and the pipeline can be dynamically spliced, deleted, added and shifted, so that the function customized by a user is realized.
The resource dependence analysis module is used for analyzing the related resources depended by the game resources after deserialization, loading the related resources obtained by analysis, namely analyzing other resources depended by the game resources, and carrying out loading work of the dependent resources.
Among them, deserialization and serialization are a pair of opposite concepts. Serialization refers to the process of saving the running object state in a tightly ordered form, which can be saved in any medium that can store data, such as database, hard disk, etc. Deserializing refers to reading the data file saved after the serialization, and parsing and restoring the data file to the state of running at the time.
The error processing module is used for recording abnormal information in the loading process of the game resources and returning the abnormal information, namely detecting whether the resource is abnormal or not in the loading process, recording the abnormal information when the abnormal information occurs and returning the abnormal information in the callback.
Further, as shown in fig. 3, the loading pipeline module includes a resource identifier parsing pipeline, a resource MD5 parsing pipeline, a platform adaptation pipeline, a resource downloading pipeline, and a resource loading pipeline, where details and functions of each pipeline are as follows:
the resource identification resolution pipeline is used for converting identification information (such as ID) of the game resource into global unique identification information of the game resource and converting the global unique identification information into an actual path (such as a real path address) of the game resource.
The resource MD5 parsing pipeline is used for acquiring a version path of the game resource by adding the hash value of the game resource to an actual path of the game resource.
The platform adaptation pipeline is used for matching corresponding Application Programming Interfaces (APIs) according to different game running platforms, namely performing adaptation work of the corresponding APIs according to different target game running platforms.
The resource downloading pipeline is used for determining a corresponding downloader for downloading the game resources according to the types of the game resources, namely selecting the corresponding downloader for downloading the resources according to the types of the game resources.
The resource loading pipeline is used for determining a corresponding loader for loading the game resources according to the types of the game resources, namely selecting the corresponding loader for loading the resources according to the types of the game resources, and comprises the operations of analyzing and deserializing the resources.
It should be noted that, the resource loader performs a pipelined design on the loading flow, each pipeline is responsible for one of the transactions, there is no direct relationship in the business between the pipelines, and the pipelines are connected in series to form a loading pipeline. After any resource request enters the assembly line, the resource request can be converted into a corresponding resource, the adaptation of each game running platform and the processing of a plurality of game resource formats are put into a plurality of different pipelines to work, so that the problem of mutual interference is avoided, the logic becomes clearer and more conforms to the design idea of an object, the development and maintenance difficulty is greatly reduced, and the working efficiency is improved. In addition, each pipeline is hot-pluggable and can be modified in sequence, and a user can add, delete and modify each pipeline according to specific requirements, so that the flexibility of game development is greatly improved. Meanwhile, in the foreseeable future, new standards can be adapted by adding, deleting and modifying pipelines, so that the expansibility of the resource management system is greatly improved. In addition, because the work among all pipelines is not related to each other, the parallel processing can be carried out through a producer model and a consumer model, so that the parallel efficiency is greatly utilized, and the time for loading resources is greatly reduced.
The new standard may refer to a new graphics library, or a new version of an existing graphics library, opengl, directx, vulkan, or a new JavaScript standard, ES7, or the like, or a new game platform, such as a wechat mini-game, a hundred-degree mini-game, or the like, may be calculated as the new standard.
The embodiment of the present application provides another possible implementation manner, where as shown in fig. 3, a resource manager in a resource management system may be further divided into a plurality of sub-modules, and details and functions of each sub-module are as follows:
the resource strategy module is used for determining different management strategies aiming at different game resources, namely different strategies are used for management aiming at different resources, for example, for internal resources of an engine and resources under a resource path which needs to be used by a user for a long time, manual control of the user is adopted, and the engine does not release work; and if the resources are not needed completely, the resources are automatically released when the scenes are switched.
The resource obtaining module is used for determining whether game resources exist by inquiring the resource cache module, returning the game resources when the game resources exist, and loading the game resources through the resource loader when the game resources do not exist.
The resource cache module is used for caching all resources used in the game so as to multiplex public game resources and ensure that the game resources are not repeatedly loaded.
The resource release module is used for determining to release the game resources or release the related resources depending on the game resources according to the user selection, namely releasing the game resources or releasing all other resources depending on the resources according to the user selection, analyzing and constructing all the related resources, and removing the object from the cache.
In addition, as shown in fig. 3, the resource registry in the resource management system can be further divided into a plurality of sub-modules, and the detailed contents and functions of each sub-module are as follows:
the resource path processing module is used for converting the global unique identification information of the game resource into the path information of the game resource.
The resource information module is used for storing at least one of the following: the type of game resource, the relative path of the game resource, the name of the game resource, identification information of the game resource, an identification indicating whether the game resource is a child resource.
The resource identification mapping table module is used for mapping the identification information of the game resource with the global unique identification information of the game resource.
The resource MD5 mapping table module is used for mapping the global unique identification information of the game resource with the hash value of the game resource so as to inquire the version information of the game resource.
Another possible implementation manner is provided in the embodiment of the present application, the acquiring any game resource through the resource management system in step S120 specifically includes: step a, calling a second preset interface of a resource registry through a first preset interface, and inquiring relevant information of any game resource through the resource registry to acquire identification information of any game resource; and b, calling a third preset interface of the resource manager according to the identification information of any game resource, and acquiring any game resource through the resource manager.
Specifically, the acquiring of the any game resource by the resource manager includes:
inquiring game resources cached in a resource caching module of a resource manager, and determining whether any game resource is included in the cached game resources;
if any game resource is included, returning to the any game resource;
if the game machine does not comprise any game resource, the fourth preset interface of the resource loader is called through the resource manager, and the game resource is loaded through the resource loader.
Specifically, loading any game resource through the resource loader includes:
judging whether the loading queue module is loading any game resource;
if any game resource is being loaded, registering a corresponding callback function, and returning any loaded game resource through the callback function;
if any game resource is not loaded, adding a resource item for loading any game resource in the loading queue module, and loading any game resource based on the resource item.
Specifically, the loading processing of any game resource based on the resource item includes:
detecting whether cyclic dependency exists on the resource item through a cyclic reference detection module;
if the cyclic dependence exists, performing fracture processing on the cyclic dependence, and loading any game resource;
if the circular dependence does not exist, the assembly line scheduling module is used for scheduling the assembly line of the resource item, so that the relevant data of any game resource flows into the scheduled assembly line, and the loading assembly line module is used for loading any game resource based on the scheduled assembly line.
Specifically, the loading of any game resource based on the scheduled pipeline by the loading pipeline module includes:
calling the second preset interface through a resource identification analysis pipeline, and converting the identification information of any game resource into an actual path of any game resource;
calling the second preset interface through a resource MD5 analysis pipeline, and adding the hash value of any game resource into an actual path to obtain a version path of any game resource;
determining an API (application program interface) adapted to any running platform through a platform adaptation pipeline based on the version path;
determining a downloader for downloading any game resource according to the type of any game resource through a resource downloading pipeline based on the API, and downloading any game resource through the downloader;
and determining a loader for loading any game resource according to the type of any game resource through a resource downloading pipeline based on the API, and loading any game resource through the loader.
Specifically, after any game resource is loaded based on the scheduled pipeline through the loading pipeline module, the method further includes:
analyzing related resources depended by any game resource through a resource dependence analysis module, and judging whether any game resource depends on the resources according to an analysis result;
if the dependency exists, circularly executing the step b;
if the game resource is not dependent on the game resource, a third preset interface of the resource manager is called, the management strategy of any game resource is determined through a resource strategy module of the resource manager, and any game resource is cached through a resource cache module of the resource manager to return any game resource.
Fig. 4 shows a basic process of acquiring any game resource through the resource management system in this implementation manner, where the basic process includes several sub-processes as shown below:
1. an upper layer (for example, an application layer, an engine subsystem) of the game engine initiates an acquisition request for acquiring any game resource of any running platform, and accordingly, a first preset interface (i.e., a uniform interface in fig. 4) of a resource management system of the game engine receives the acquisition request;
2. a second preset interface of the resource registry (i.e., the interface of the resource registry in fig. 4) is called through the first preset interface, and related information of any game resource is queried in the resource registry to obtain identification information (e.g., ID) of any game resource, and a third preset interface of the resource manager (i.e., the interface of the resource manager in fig. 4) is called according to the identification information of any game resource, and any game resource is obtained through the resource manager.
3. The interface of the resource manager calls the resource acquisition module to acquire any game resource required by the user.
4. The resource obtaining module inquires any game resource through the resource cache module, judges whether any game resource exists in the resource cache module, if so, directly returns any game resource, and if not, calls a fourth preset interface (namely the interface of the resource loader in fig. 4) of the resource loader and loads any game resource through the resource loader;
5. the interface of the resource loader judges whether any game resource is being loaded in the loading queue module, if any game resource is being loaded, a callback function is registered so as to return any game resource which is loaded through the callback function, otherwise, a resource item used for loading any game resource is newly added in the loading queue module, and any game resource is loaded based on the resource item;
6. performing dependence loop detection on the resource item through a loop reference detection module, if loop dependence is found, directly completing the resource item, performing fracture processing on a loop of the loop dependence, and otherwise, continuously loading any game resource;
7. the assembly line scheduling module is used for scheduling the assembly line of the resource items so as to enable the relevant data of any game resource to flow into the scheduled assembly line;
8. calling an interface of a resource registry through a resource identifier analysis pipeline, and converting the identifier information of any game resource into an actual path of any game resource;
9. analyzing an interface of a pipeline calling resource registry through a resource MD5, and adding the version hash value of any game resource to the actual path of any game resource to obtain the version path of any game resource;
10. according to different game running platforms, the API of the game running platform of any game resource is adapted through a platform adaptation pipeline;
11. selecting a resource downloader to download any game resource according to the type or format of the game resource;
12. selecting a resource loader to load any game resource according to the type or format of any game resource;
13. analyzing the dependence of any game resource through a resource dependence analysis module, namely analyzing the related resource which is depended by any game resource;
14. judging whether any game resource has dependence according to the analysis result, if yes, returning to the step 3 for continuous execution, otherwise, executing the following step 15;
15. calling an interface of a resource manager, and setting a resource management strategy through a resource strategy module of the resource manager;
16. caching any game resource through a resource caching module of the resource manager;
17. and returning any game resource.
The game engine resource processing method of the embodiment of the application realizes the processes of module splitting, pipeline abstraction, platform format adaptation and parallel resource loading for the resource management system, the links in the loading process are abstracted into independent pipelines, all the pipelines are combined into a loading production line, and the pipelines in the loading production line work in parallel. Wherein, not only the pipeline can be freely combined and expanded to adapt to a plurality of game running platforms, but also multi-format adaptation can be carried out in a single pipeline. In addition, the loaded resources are cached, so that the resource reuse is facilitated. Therefore, the efficient and flexible management of the resources in different formats of each large platform is realized, and the requirements of the resource management system on good expansibility and rapid loading of a large number of resources of different platforms are met.
Example two
Fig. 5 is a schematic structural diagram of a game resource engine processing apparatus according to an embodiment of the present disclosure, and as shown in fig. 5, the apparatus 50 may include a receiving module 51, an obtaining module 52, and a returning module 53; wherein:
the receiving module 51 is configured to receive an acquisition request for any game resource of any running platform through a first preset interface of the game engine;
the obtaining module 52 is configured to obtain any game resource through a resource management system of the game engine based on the obtaining request, where the resource management system includes a first preset interface, a resource manager, a resource loader, and a resource registry;
the returning module 53 is used for returning any acquired game resource.
Specifically, the resource manager is used for caching the existing game resources, processing the release of the game resources and determining a game resource release strategy according to the type of the game resources;
the resource loader is used for loading various game resources based on the pipelined loading pipeline;
the resource registry is used for storing relevant information of game resources, and the relevant information comprises at least one item of identification information, hash values and conversion information from resource paths to actual paths.
Furthermore, the resource loader comprises a loading queue module, a cyclic reference detection module, a pipeline scheduling module, a loading pipeline module, a resource dependence analysis module and an error processing module;
the loading queue module is used for storing each game resource item which is being loaded and/or game resource items to be loaded;
the circular reference detection module is used for detecting whether the dependency relationship among the game resources has circular dependency or not and performing fracture processing on the circular dependency when the circular dependency exists;
the pipeline scheduling module is used for executing at least one of the following: controlling splicing of each pipeline, controlling data inflow and data outflow among pipelines, scheduling parallel processing of each pipeline, and scheduling callback processing of each pipeline;
the loading pipeline module is used for processing at least one of dynamic splicing, deleting, adding and shifting of the pipeline;
the resource dependence analysis module is used for analyzing the related resources depended by the game resources after deserialization and loading the related resources obtained by analysis;
and the error processing module is used for recording abnormal information in the loading process of the game resources and returning the abnormal information.
Furthermore, the loading pipeline module comprises a resource identifier analysis pipeline, a resource MD5 analysis pipeline, a platform adaptation pipeline, a resource downloading pipeline and a resource loading pipeline;
the resource identification analysis pipeline is used for converting the game resource identification information into global unique identification information of the game resource and converting the global unique identification information into an actual path of the game resource;
the resource MD5 analysis pipeline is used for acquiring a version path of the game resource by adding the hash value of the game resource to the actual path of the game resource;
the platform adaptation pipeline is used for matching corresponding Application Programming Interfaces (API) according to different game running platforms;
the resource downloading pipeline is used for determining a corresponding downloader for downloading the game resources according to the types of the game resources;
the resource loading pipeline is used for determining a corresponding loader for loading the game resources according to the types of the game resources.
Further, the resource manager comprises a resource strategy module, a resource acquisition module, a resource cache module and a resource release module;
the resource strategy module is used for determining different management strategies aiming at different game resources;
the resource acquisition module is used for determining whether game resources exist by inquiring the resource cache module, returning the game resources when the game resources exist, and loading the game resources through the resource loader when the game resources do not exist;
the resource caching module is used for caching all resources used in the game so as to multiplex public game resources;
the resource release module is used for determining to release the game resources or release the related resources depended on by the game resources according to the selection of the user.
Further, the resource registry comprises a resource path processing module, a resource information module, a resource identifier mapping table module and a resource MD5 mapping table module;
the resource path processing module is used for converting the global unique identification information of the game resource into the path information of the game resource;
the resource information module is used for storing at least one of the following: the type of the game resource, the relative path of the game resource, the name of the game resource, the identification information of the game resource, and an identification indicating whether the game resource is a child resource;
the resource identification mapping table module is used for mapping the identification information of the game resource with the global unique identification information of the game resource;
the resource MD5 mapping table module is used for mapping the global unique identification information of the game resource with the hash value of the game resource so as to inquire the version information of the game resource.
Further, the obtaining module 52 includes a first processing sub-module 521 and a second processing sub-module 522, as shown in fig. 6, wherein:
the first processing submodule 521 is configured to call a second preset interface of the resource registry through the first preset interface, and query the relevant information of any game resource through the resource registry to obtain the identification information of any game resource;
the second processing sub-module 522 is configured to invoke a third preset interface of the resource manager according to the identification information of any game resource, and obtain any game resource through the resource manager.
Further, the second processing sub-module 522 includes a query unit 5221 and a first result processing unit 5222, as shown in fig. 6, wherein:
the query unit 5221 is configured to query game resources cached in the resource cache module of the resource manager, and determine whether any game resource is included in the cached game resources;
the first result processing unit 5222 is used to return any game resource when any game resource is included; and when any game resource is not included, the fourth preset interface of the resource loader is called through the resource manager, and any game resource is loaded through the resource loader.
Further, the first result processing unit 5222 is specifically configured to determine whether the load queue module is loading any game resource; the system comprises a callback function, a memory and a controller, wherein the callback function is used for registering corresponding callback functions when any game resource is being loaded and returning any loaded game resource through the callback function; and when any game resource is not loaded, adding a resource item for loading any game resource in the loading queue module, and loading any game resource based on the resource item.
Further, the first result processing unit 5222 is specifically configured to detect whether a cyclic dependency exists on a resource item through a cyclic reference detection module; when the cyclic dependence exists, performing fracture processing on the cyclic dependence, and loading any game resource; and when the circular dependence does not exist, the assembly line scheduling module is used for scheduling the assembly line of the resource item, so that the relevant data of any game resource flows into the scheduled assembly line, and the loading assembly line module is used for loading any game resource based on the scheduled assembly line.
Further, the first result processing unit 5222 is specifically configured to invoke a second preset interface through the resource identifier parsing pipeline, and convert the identifier information of any game resource into an actual path of any game resource; the resource MD5 analysis pipeline is used for calling a second preset interface, and the hash value of any game resource is added into the actual path to obtain the version path of any game resource; the API is used for determining to be adapted to any running platform through the platform adaptation pipeline based on the version path; the downloader is used for determining to download any game resource according to the type of any game resource through the resource downloading pipeline based on the API, and downloading any game resource through the downloader; and the loader is used for determining to load any game resource according to the type of any game resource through the resource downloading pipeline based on the API, and loading any game resource through the loader.
Further, the second processing submodule 522 further includes a second result processing unit 5223, as shown in fig. 6, wherein:
the second result processing unit 5223 is configured to analyze, by the resource dependency analysis module, the related resources that any game resource depends on, and determine whether any game resource depends on according to the analysis result; and when there is a dependency, circularly executing the actions of the second processing submodule; and when the dependency does not exist, calling a third preset interface of the resource manager, determining a management strategy of any game resource through a resource strategy module of the resource manager, and caching any game resource through a resource caching module of the resource manager so as to return any game resource.
Compared with the prior art, the device provided by the embodiment of the application receives an acquisition request for any game resource of any running platform through the first preset interface of the resource management system of the game engine, and acquires any game resource through the resource management system based on the acquisition request, wherein the resource management system comprises the first preset interface, resources, a resource manager, a resource loader and a resource registry, so that different game running platforms, such as an iOS (apple operating system), an Android (Android operating system), a Windows (Microsoft operating system) and the like, can be adapted through the resource loader, and corresponding game resources are acquired from the different game running platforms, therefore, an application layer and an engine subsystem on the upper layer of the game engine can acquire game development resources of different game running platforms through the first preset interface provided by the resource manager, efficient and flexible management of resources in different formats of each large game running platform is realized, and the expansibility requirement for the resource management system and the requirement for rapidly loading a large number of resources of different game running platforms are met.
EXAMPLE III
An embodiment of the present application provides an electronic device, as shown in fig. 7, an electronic device 700 shown in fig. 7 includes: a processor 701 and a memory 703. Wherein the processor 701 is coupled to the memory 703, such as via a bus 702. Further, the electronic device 700 may also include a transceiver 704. It should be noted that the transceiver 704 is not limited to one in practical applications, and the structure of the electronic device 700 is not limited to the embodiment of the present application.
The processor 701 is applied to the embodiment of the present application, and is used to implement the functions of the receiving module, the obtaining module, and the returning module shown in fig. 5 or fig. 6.
The processor 701 may be a CPU, general purpose processor, DSP, ASIC, FPGA or other programmable logic device, transistor logic device, hardware component, or any combination thereof. Which may implement or perform the various illustrative logical blocks, modules, and circuits described in connection with the disclosure. The processor 701 may also be a combination of computing functions, e.g., comprising one or more microprocessors, DSPs, and combinations of microprocessors, and the like.
Bus 702 may include a path that transfers information between the above components. The bus 702 may be a PCI bus or EISA bus, etc. The bus 702 may be divided into an address bus, a data bus, a control bus, and the like. For ease of illustration, only one thick line is shown in FIG. 7, but that does not indicate only one bus or one type of bus.
The memory 703 may be, but is not limited to, ROM or other type of static storage device that can store static information and instructions, RAM or other type of dynamic storage device that can store information and instructions, EEPROM, CD-ROM or other optical disk storage, optical disk storage (including compact disk, laser disk, optical disk, digital versatile disk, blu-ray disk, etc.), magnetic disk storage media or other magnetic storage devices, or any other medium that can be used to carry or store desired program code in the form of instructions or data structures and that can be accessed by a computer.
The memory 703 is used for storing application program codes for executing the present invention, and is controlled by the processor 701. The processor 701 is configured to execute application code stored in the memory 703 to implement the actions of the game resource engine processing device provided by the embodiment shown in fig. 5 or fig. 6.
The electronic device provided by the embodiment of the application comprises a memory, a processor and a computer program which is stored on the memory and can run on the processor, and when the processor executes the program, compared with the prior art, the electronic device can realize that: the method comprises the steps of receiving an acquisition request aiming at any game resource of any running platform through a first preset interface of a resource management system of a game engine, and acquiring any game resource through the resource management system based on the acquisition request, wherein the resource management system comprises at least one of the first preset interface, resources, a resource manager, a resource loader and a resource registry, so that different game running platforms such as iOS (apple operating system), android (Android operating system), windows (Microsoft operating system) and the like can be adapted through the resource loader, and corresponding game resources can be acquired from the resource loader, therefore, an application layer and an engine subsystem on the upper layer of the game engine can acquire game development resources of different game running platforms by utilizing the first preset interface provided by the resource manager, efficient and flexible management of resources of different formats of each large game running platform is realized, and the requirement for expansibility of the resource management system and the requirement for rapidly loading a large number of resources of different game running platforms are met.
The embodiment of the present application provides a computer-readable storage medium, on which a computer program is stored, and the computer program, when executed by a processor, implements the method shown in the first embodiment. Compared with the prior art, the method comprises the steps of receiving an acquisition request aiming at any game resource of any running platform through a first preset interface of a resource management system of a game engine, and acquiring any game resource through the resource management system based on the acquisition request, wherein the resource management system comprises at least one of the first preset interface, resources, a resource manager, a resource loader and a resource registry, so that the resource loader can be adapted to different game running platforms, such as iOS (apple operating system), android (Android operating system), windows (Microsoft operating system) and the like, and corresponding game resources are acquired from the different game running platforms, therefore, an application layer and an engine subsystem on the upper layer of the game engine can acquire game development resources of different game running platforms by utilizing the first preset interface provided by the resource manager, efficient and flexible management of different formats of resources of each large game running platform is realized, and the expansibility requirement on the resource management system and the requirement for rapidly loading a large number of resources of different game running platforms are met.
The computer-readable storage medium provided by the embodiment of the application is suitable for any embodiment of the method. And will not be described in detail herein.
It should be understood that, although the steps in the flowcharts of the figures are shown in order as indicated by the arrows, the steps are not necessarily performed in order as indicated by the arrows. The steps are not performed in the exact order shown and may be performed in other orders unless explicitly stated herein. Moreover, at least a portion of the steps in the flow chart of the figure may include multiple sub-steps or multiple stages, which are not necessarily performed at the same time, but may be performed at different times, which are not necessarily performed in sequence, but may be performed alternately or alternately with other steps or at least a portion of the sub-steps or stages of other steps.
The foregoing is only a partial embodiment of the present application, and it should be noted that, for those skilled in the art, several modifications and decorations can be made without departing from the principle of the present application, and these modifications and decorations should also be regarded as the protection scope of the present application.

Claims (15)

1. A game engine resource processing method is characterized by comprising the following steps:
receiving an acquisition request aiming at any game resource of any running platform through a first preset interface of a game engine;
based on the acquisition request, acquiring any game resource through a resource management system of a game engine, wherein the resource management system comprises the first preset interface, a resource manager, a resource loader and a resource registry;
returning any acquired game resource;
the resource loader comprises a cyclic reference detection module and a resource dependency analysis module;
the circular reference detection module is used for detecting whether the dependency relationship among the game resources has circular dependency or not and performing fracture processing on the circular dependency when the circular dependency exists;
and the resource dependence analysis module is used for analyzing the related resources depended by the game resources after deserialization and loading the related resources obtained by analysis.
2. The method of claim 1, wherein the resource manager is configured to cache existing game resources, handle game resource release, and determine a game resource release policy based on a game resource type;
the resource loader is used for loading various game resources based on a pipelined loading pipeline;
the resource registry is used for storing relevant information of game resources, and the relevant information comprises at least one item of identification information, a hash value and conversion information from a resource path to an actual path.
3. The method of claim 1 or 2, wherein the resource loader further comprises a load queue module, a pipeline scheduling module, a load pipeline module, and an error handling module;
the loading queue module is used for storing each game resource item being loaded and/or game resource items to be loaded;
the pipeline scheduling module is used for executing at least one of the following: controlling splicing of each pipeline, controlling data inflow and data outflow among pipelines, scheduling parallel processing of each pipeline, and scheduling callback processing of each pipeline;
the loading pipeline module is used for processing at least one of dynamic splicing, deleting, adding and shifting of the pipeline;
and the error processing module is used for recording abnormal information in the loading process of the game resources and returning the abnormal information.
4. The method of claim 3, wherein the loading pipeline module comprises a resource identifier resolution pipeline, a resource MD5 resolution pipeline, a platform adaptation pipeline, a resource download pipeline, and a resource loading pipeline;
the resource identification analysis pipeline is used for converting game resource identification information into global unique identification information of game resources and converting the global unique identification information into an actual path of the game resources;
the resource MD5 analysis pipeline is used for acquiring a version path of the game resource by adding the hash value of the game resource to the actual path of the game resource;
the platform adaptation pipeline is used for matching corresponding Application Programming Interfaces (APIs) according to different game running platforms;
the resource downloading pipeline is used for determining a corresponding downloader for downloading the game resources according to the types of the game resources;
the resource loading pipeline is used for determining a corresponding loader for loading the game resources according to the types of the game resources.
5. The method according to claim 1 or 2, wherein the resource manager comprises a resource policy module, a resource acquisition module, a resource caching module and a resource release module;
the resource strategy module is used for determining different management strategies aiming at different game resources;
the resource acquisition module is used for determining whether game resources exist by inquiring the resource cache module, returning the game resources when the game resources exist, and loading the game resources through the resource loader when the game resources do not exist;
the resource caching module is used for caching all resources used in the game;
the resource release module is used for determining to release the game resources or release the related resources depending on the game resources according to the selection of the user.
6. The method according to claim 1 or 2, wherein the resource registry comprises a resource path processing module, a resource information module, a resource identifier mapping table module and a resource MD5 mapping table module;
the resource path processing module is used for converting the global unique identification information of the game resource into the path information of the game resource;
the resource information module is configured to store at least one of: the type of the game resource, the relative path of the game resource, the name of the game resource, the identification information of the game resource, and an identification indicating whether the game resource is a child resource;
the resource identification mapping table module is used for mapping the identification information of the game resource with the global unique identification information of the game resource;
the resource MD5 mapping table module is used for mapping the global unique identification information of the game resource with the hash value of the game resource so as to inquire the version information of the game resource.
7. The method of claim 1 or 2, wherein obtaining the any game resource through a resource management system comprises:
step a, calling a second preset interface of the resource registry through the first preset interface, and inquiring relevant information of any game resource through the resource registry to acquire identification information of any game resource;
and b, calling a third preset interface of the resource manager according to the identification information of any game resource, and acquiring any game resource through the resource manager.
8. The method of claim 7, wherein obtaining, by the resource manager, the any game resource comprises:
inquiring game resources cached in a resource caching module of the resource manager, and determining whether any game resource is included in the cached game resources;
if the any game resource is included, returning the any game resource;
if the game resource does not comprise any game resource, a fourth preset interface of a resource loader is called through the resource manager, and any game resource is loaded through the resource loader.
9. The method of claim 8, wherein loading the any game resource by the resource loader comprises:
judging whether the loading queue module is loading any game resource;
if any game resource is being loaded, registering a corresponding callback function, and returning any loaded game resource through the callback function;
if the game resource is not loaded, adding a resource item for loading the game resource in the loading queue module, and loading any game resource based on the resource item.
10. The method of claim 9, wherein loading any game resource based on the resource item comprises:
detecting whether the resource item has cyclic dependency through a cyclic reference detection module;
if the cyclic dependence exists, performing fracture processing on the cyclic dependence, and loading any game resource;
if the circular dependence does not exist, the assembly line scheduling module is used for scheduling the assembly line of the resource item, so that the relevant data of any game resource flows into the scheduled assembly line, and the loading assembly line module is used for loading any game resource based on the scheduled assembly line.
11. The method of claim 10, wherein loading the any game resource based on the scheduled pipeline by a load pipeline module comprises:
calling the second preset interface through a resource identification analysis pipeline, and converting the identification information of any game resource into an actual path of any game resource;
calling the second preset interface through a resource MD5 analysis pipeline, and adding the hash value of any game resource into the actual path to obtain a version path of any game resource;
determining, by a platform adaptation pipeline, an API adapted to the any one of the operating platforms based on the version path;
determining a downloader for downloading any game resource according to the type of any game resource through a resource downloading pipeline based on the API, and downloading any game resource through the downloader;
and based on the API, determining a loader for loading any game resource through a resource downloading pipeline according to the type of any game resource, and loading any game resource through the loader.
12. The method of claim 10, further comprising, after loading the any game resource based on the scheduled pipeline by a load pipeline module:
analyzing the related resources which are depended by any game resource through a resource dependence analysis module, and judging whether any game resource is depended or not according to the analysis result;
if the dependency exists, circularly executing the step b;
if the dependency does not exist, a third preset interface of the resource manager is called, the management strategy of any game resource is determined through a resource strategy module of the resource manager, and any game resource is cached through a resource cache module of the resource manager, so that any game resource is returned.
13. A game engine resource processing apparatus, comprising:
the game system comprises a receiving module, a processing module and a processing module, wherein the receiving module is used for receiving an acquisition request aiming at any game resource of any running platform through a first preset interface of a game engine;
an obtaining module, configured to obtain any game resource through a resource management system of a game engine based on the obtaining request, where the resource management system includes the first preset interface, a resource manager, a resource loader, and a resource registry;
the return module is used for returning any acquired game resource;
the resource loader comprises a cyclic reference detection module and a resource dependency analysis module;
the circular reference detection module is used for detecting whether the dependency relationship among the game resources has circular dependency or not and performing fracture processing on the circular dependency when the circular dependency exists;
and the resource dependence analysis module is used for analyzing the related resources depended on by the game resources after deserialization and loading the related resources obtained by analysis.
14. An electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, wherein the processor implements the game engine resource processing method of any one of claims 1 to 12 when executing the program.
15. A computer-readable storage medium, characterized in that the computer-readable storage medium has stored thereon a computer program which, when executed by a processor, implements the game engine resource processing method of any one of claims 1 to 12.
CN201910120451.1A 2019-02-18 2019-02-18 Game engine resource processing method, electronic device and computer readable storage medium Active CN111569431B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910120451.1A CN111569431B (en) 2019-02-18 2019-02-18 Game engine resource processing method, electronic device and computer readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910120451.1A CN111569431B (en) 2019-02-18 2019-02-18 Game engine resource processing method, electronic device and computer readable storage medium

Publications (2)

Publication Number Publication Date
CN111569431A CN111569431A (en) 2020-08-25
CN111569431B true CN111569431B (en) 2023-03-14

Family

ID=72122404

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910120451.1A Active CN111569431B (en) 2019-02-18 2019-02-18 Game engine resource processing method, electronic device and computer readable storage medium

Country Status (1)

Country Link
CN (1) CN111569431B (en)

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2022027600A1 (en) * 2020-08-07 2022-02-10 厦门雅基软件有限公司 Game engine resource processing method and apparatus, and electronic device and computer-readable storage medium
CN112199126A (en) * 2020-09-25 2021-01-08 北京商询科技有限公司 Dynamic loading method and device based on Unity engine and computer equipment
CN112870724A (en) * 2021-03-11 2021-06-01 网易(杭州)网络有限公司 Resource management method, device, storage medium and electronic equipment
CN114647411A (en) * 2022-04-02 2022-06-21 北京思明启创科技有限公司 Programming interface loading method and device, electronic equipment and storage medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101833465A (en) * 2010-04-23 2010-09-15 中国科学院声学研究所 Embedded system supporting dynamic loading operation of application programs
CN105005473A (en) * 2015-06-29 2015-10-28 乐道互动(天津)科技有限公司 Game engine system for developing 3D game
CN106502746A (en) * 2016-11-02 2017-03-15 网易(杭州)网络有限公司 The packaging method and device of application program
CN107851106A (en) * 2015-05-01 2018-03-27 微软技术许可有限责任公司 It is the resource scaling of the automatic requirement drive serviced for relational database
CN108888951A (en) * 2018-06-25 2018-11-27 网易(杭州)网络有限公司 Game resource treating method and apparatus

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10421017B2 (en) * 2015-12-04 2019-09-24 Sony Interactive Entertainment America Llc Balancing multiple team based games

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101833465A (en) * 2010-04-23 2010-09-15 中国科学院声学研究所 Embedded system supporting dynamic loading operation of application programs
CN107851106A (en) * 2015-05-01 2018-03-27 微软技术许可有限责任公司 It is the resource scaling of the automatic requirement drive serviced for relational database
CN105005473A (en) * 2015-06-29 2015-10-28 乐道互动(天津)科技有限公司 Game engine system for developing 3D game
CN106502746A (en) * 2016-11-02 2017-03-15 网易(杭州)网络有限公司 The packaging method and device of application program
CN108888951A (en) * 2018-06-25 2018-11-27 网易(杭州)网络有限公司 Game resource treating method and apparatus

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
Nebula3 资源管理系统;JefferyZhou;《https://www.cnblogs.com/jefferyzhou/archive/2012/09/24/2700295.html》;20120924;第1-8页 *

Also Published As

Publication number Publication date
CN111569431A (en) 2020-08-25

Similar Documents

Publication Publication Date Title
CN111569431B (en) Game engine resource processing method, electronic device and computer readable storage medium
US9678767B2 (en) Unified extensible firmware interface (UEFI) driver and protocol
CN110321131B (en) Service component packaging method, system and server
CN106713469B (en) Dynamic loading method, device and system for distributed container
WO2020177429A1 (en) Method and apparatus for embedding codes in application, and electronic device
CN113885935A (en) Resource packaging method and device, electronic equipment and computer readable storage medium
CN112988281A (en) Application starting method and device
KR101117165B1 (en) Web platform unit for mobile terminal connectioned web-application program in heterogeneous operating system
CN113138768B (en) Application package generation method and device, electronic equipment and readable storage medium
CN112612489B (en) Method and device for constructing upgrade package of software and electronic equipment
CN112214250A (en) Application program assembly loading method and device
CN113448650A (en) Live broadcast function plug-in loading method, device, equipment and storage medium
CN115357257B (en) Installation file generation method, system, computing device and storage medium
CN107402749B (en) Method and device for realizing picture loading library
CN116483477A (en) API calling method and device
WO2022027600A1 (en) Game engine resource processing method and apparatus, and electronic device and computer-readable storage medium
CN112860412B (en) Service data processing method and device, electronic equipment and storage medium
CN114443306A (en) Resource processing method and device, electronic equipment and computer readable storage medium
CN111142972B (en) Method, apparatus, system, and medium for extending functions of application program
CN114090070A (en) Application program installation package file processing method and electronic equipment
CN112988460B (en) Data backup method and device for virtual machine
US11762760B1 (en) Scalable test workflow service
US20230205494A1 (en) Resource file loading method, apparatus, electronic device and storage medium
CN116382771A (en) Method and device for upgrading multiple applications of container cloud and electronic equipment
CN115794143A (en) Client upgrading method and device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant