Game resource management method and device
By introducing reference counting and time priority algorithms in game resource management, calculating and sorting the loading priority of resources, the problem of unreasonable resource management in the existing technology is solved, and the running performance of the game is significantly improved.
Patent Information
- Application Number
- CN202311118005.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-08-31
- Publication Date
- 2025-02-28
AI Technical Summary
The existing game resource management methods fail to effectively consider the frequency of resource usage and recent usage time, resulting in unreasonable priority settings for resource loading, affecting the game's running performance.
The game memory is managed using reference counting and time priority algorithms. By recording the usage and recent use time of each resource to be managed, its priority level is calculated, and the resource is sorted and loaded according to the priority level when loading.
It effectively improves the running performance of the game, ensures the rationality and efficiency of resource loading, and reduces the frequency and impact of memory garbage collection.
Smart Images

Figure CN119524428A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of Internet technology, and in particular to a game resource management method and a game resource management device. Background Art
[0002] In the related technology, the interactivity and real-time nature of the game require that resources can be loaded immediately when needed. At the same time, limited hardware resources also need to be released as soon as possible when not in use. However, the existing resource management methods generally only use simple usage counting, which does not take into account the frequency of resource usage and the time of recent usage, resulting in unreasonable priority setting of resource loading, thereby causing poor game performance. Summary of the invention
[0003] The present application aims to solve at least one of the technical problems in the above-mentioned technology to a certain extent. To this end, one purpose of the present application is to propose a game resource management method, which manages the game memory through reference counting and time priority algorithm, thereby effectively improving the running performance of the game.
[0004] The second objective of this application is to provide a game resource management device.
[0005] To achieve the above-mentioned objectives, the first aspect of the present application proposes a game resource management method, comprising the following steps: obtaining multiple resources to be managed; recording the usage and the most recent usage time of each of the multiple resources to be managed, so as to obtain the priority level between each of the resources to be managed according to the usage and the most recent usage time of each of the resources to be managed; when loading resources, loading the multiple resources to be managed according to the priority level between each of the resources to be managed.
[0006] According to the game resource management method of the embodiment of the present application, first, multiple resources to be managed are obtained; then, the usage and the most recent usage time of each of the multiple resources to be managed are recorded, so as to obtain the priority level between each resource to be managed according to the usage and the most recent usage time of each resource to be managed; finally, when loading resources, the multiple resources to be managed are loaded according to the priority level between each resource to be managed; thus, the game memory is managed through reference counting and time priority algorithm, thereby effectively improving the running performance of the game.
[0007] In addition, the game resource management method proposed in the above embodiment of the present application may also have the following additional technical features:
[0008] Optionally, the usage and most recent usage time of each of the multiple resources to be managed are recorded, including: during game operation, if a certain resource to be managed is used, the corresponding usage is increased by 1, and the corresponding usage time is recorded; if a certain resource to be managed is no longer used, the corresponding usage is reduced by 1.
[0009] Optionally, the priority level of each resource to be managed is calculated according to the following formula:
[0010]
[0011] Among them, P i Indicates the priority corresponding to the i-th resource to be managed; Q i represents the usage of the i-th resource to be managed; C t Indicates the current time; L t Indicates the last usage time of the i-th resource to be managed.
[0012] Optionally, after recording the usage and most recent usage time of each of the multiple resources to be managed, it also includes: during game operation, if the usage of a certain resource to be managed is 0, and it is judged based on the usage time that it has not been used for more than a first threshold time, then uninstalling the certain resource to be managed.
[0013] Optionally, when loading resources, the multiple resources to be managed are loaded according to the priority level between each resource to be managed, including: pre-building a preloading model; obtaining historical player behavior data, and using the historical player behavior data to train the preloading model; using the trained preloading model to predict a resource demand at regular intervals, so as to load the corresponding resources in advance according to the priority level based on the resource demand.
[0014] To achieve the above-mentioned purpose, the second aspect of the present application proposes a game resource management device, including: an acquisition module, used to acquire multiple resources to be managed; a recording module, used to record the usage and the most recent usage time of each resource to be managed in the multiple resources to be managed, so as to obtain the priority level between each resource to be managed according to the usage and the most recent usage time of each resource to be managed; a loading module, used to load the multiple resources to be managed according to the priority level between each resource to be managed when loading resources.
[0015] According to the game resource management device of the embodiment of the present application, multiple resources to be managed are acquired through an acquisition module; the recording module records the usage and the most recent usage time of each of the multiple resources to be managed, so as to obtain the priority level between each resource to be managed according to the usage and the most recent usage time of each resource to be managed; when loading resources, the loading module loads the multiple resources to be managed according to the priority level between each resource to be managed; thus, the game memory is managed through reference counting and time priority algorithm, thereby effectively improving the running performance of the game.
[0016] In addition, the game resource management device proposed in the above embodiment of the present application may also have the following additional technical features:
[0017] Optionally, the recording module is also used for, during the game operation, if a certain resource to be managed is used, then the corresponding usage amount is increased by 1, and the corresponding usage time is recorded; if a certain resource to be managed is no longer used, then the corresponding usage amount is reduced by 1.
[0018] Optionally, the priority level of each resource to be managed is calculated according to the following formula:
[0019]
[0020] Among them, P i Indicates the priority corresponding to the i-th resource to be managed; Q i represents the usage of the i-th resource to be managed; C t Indicates the current time; L t Indicates the last usage time of the i-th resource to be managed.
[0021] Optionally, after recording the usage and most recent usage time of each of the multiple resources to be managed, it also includes: during game operation, if the usage of a certain resource to be managed is 0, and it is judged based on the usage time that it has not been used for more than a first threshold time, then uninstalling the certain resource to be managed.
[0022] Optionally, the loading module is also used to pre-build a preloading model; obtain historical player behavior data, and use the historical player behavior data to train the preloading model; use the trained preloading model to predict a resource demand at regular intervals, so as to load corresponding resources in advance according to the priority level based on the resource demand. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] Figure 1 is a flowchart of a method for managing game resources according to an embodiment of the present application;
[0024] Figure 24 is a block diagram of a game resource management device according to an embodiment of the present application. DETAILED DESCRIPTION
[0025] Embodiments of the present application are described in detail below, and examples of the embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are intended to be used to explain the present application, and should not be construed as limiting the present application.
[0026] In order to better understand the above technical solution, exemplary embodiments of the present application will be described in more detail below with reference to the accompanying drawings. Although exemplary embodiments of the present application are shown in the accompanying drawings, it should be understood that the present application can be implemented in various forms and should not be limited by the embodiments described herein. On the contrary, these embodiments are provided in order to enable a more thorough understanding of the present application and to fully convey the scope of the present application to those skilled in the art.
[0027] In order to better understand the above technical solution, the above technical solution will be described in detail below in conjunction with the accompanying drawings and specific implementation methods.
[0028] Figure 1 Schematic diagram of the process of the game resource management method according to the embodiment of the present application; Figure 1 As shown, the game resource management method of the embodiment of the present application includes the following steps:
[0029] S101, obtaining multiple resources to be managed.
[0030] As an embodiment, the resources to be managed may be 3D models, textures, and sound files in the game.
[0031] S102, recording the usage amount and the most recent usage time of each resource to be managed among the multiple resources to be managed, so as to obtain the priority level among each resource to be managed according to the usage amount and the most recent usage time of each resource to be managed.
[0032] As an embodiment, the usage and most recent usage time of each resource to be managed among multiple resources to be managed are recorded, including: during the game operation, if a resource to be managed is used, the corresponding usage is increased by 1, and the corresponding usage time is recorded; if a resource to be managed is no longer used, the corresponding usage is reduced by 1.
[0033] That is to say, if a resource to be managed is used by a client, the usage corresponding to the resource to be managed is increased by 1, and the corresponding usage time is recorded; if a resource to be managed is abandoned by a client, the corresponding usage is reduced by 1. The usage represents the usage status of the corresponding resource to be managed, that is, how many clients are currently using it.
[0034] As an embodiment, the priority level of each resource to be managed is calculated according to the following formula:
[0035]
[0036] Among them, P i Indicates the priority corresponding to the i-th resource to be managed; Q i represents the usage of the i-th resource to be managed; C t Indicates the current time; L t Indicates the last usage time of the i-th resource to be managed.
[0037] That is to say, the priority of each resource to be managed is calculated by the above formula. Whenever a resource needs to be loaded, it is sorted according to its priority, and resources with high priority are loaded first. In this way, frequently used resources and recently used resources can be loaded faster, effectively improving the game's running performance.
[0038] As an embodiment, after recording the usage and most recent usage time of each of the multiple resources to be managed, it also includes: during the game running, if the usage of a certain resource to be managed is 0, and it is judged based on the usage time that it has not been used for more than a first threshold time, then uninstalling the certain resource to be managed.
[0039] It should be noted that in many games, when resources are not used for a long time or memory space is insufficient, memory garbage collection (GC) will be triggered; GC will consume a lot of CPU resources, causing the game to freeze briefly; so if the usage of a resource to be managed is 0, it means that the resource to be managed is not currently in use, and when it has not been used for a certain period of time, the resource to be managed is uninstalled to reduce the freeze caused by memory garbage collection.
[0040] S103, when loading resources, multiple resources to be managed are loaded according to the priority level of each resource to be managed.
[0041] As an embodiment, when loading resources, multiple resources to be managed are loaded according to the priority level between each resource to be managed, including: pre-building a pre-loading model; obtaining historical player behavior data, and using the historical player behavior data to train the pre-loading model; using the trained pre-loading model to predict a resource demand at regular intervals, so as to load the corresponding resources in advance according to the priority level based on the resource demand.
[0042] In other words, based on the player's gaming behavior preferences, resources are loaded on demand in advance to improve game performance and further reduce the lag caused by memory garbage collection.
[0043] It should be noted that a prediction model is trained by collecting players' behavioral data; this model uses a prediction algorithm based on historical data, such as regression analysis or neural network; the prediction model generates a resource demand forecast at regular intervals, and then loads these resources in advance; during peak periods of resource usage, a large number of resource requests can be avoided by preloading, thereby reducing the frequency and impact of memory garbage collection.
[0044] To summarize, according to the game resource management method of the embodiment of the present application, first, multiple resources to be managed are obtained; then, the usage and the most recent usage time of each of the multiple resources to be managed are recorded, so as to obtain the priority level between each resource to be managed according to the usage and the most recent usage time of each resource to be managed; finally, when loading resources, the multiple resources to be managed are loaded according to the priority level between each resource to be managed; thus, through the above-mentioned resource management and preloading, the use of memory is effectively controlled; especially during the peak period of resource demand, a large number of resource loading requests can be avoided, further reducing the impact of memory garbage collection, and effectively improving the player's gaming experience.
[0045] Figure 2 FIG. 1 is a block diagram of a game resource management device according to an embodiment of the present application. Figure 2 As shown, the game resource management device includes: an acquisition module 10, a recording module 20 and a loading module 20;
[0046] Among them, the acquisition module 10 acquires multiple resources to be managed; the recording module 20 records the usage and the most recent usage time of each resource to be managed in the multiple resources to be managed, so as to obtain the priority level between each resource to be managed according to the usage and the most recent usage time of each resource to be managed; the loading module 30 loads multiple resources to be managed according to the priority level between each resource to be managed when loading resources.
[0047] As an embodiment, the recording module 10 is also used for, during the game operation, if a certain resource to be managed is used, the corresponding usage amount is increased by 1, and the corresponding usage time is recorded; if a certain resource to be managed is no longer used, the corresponding usage amount is reduced by 1.
[0048] As an embodiment, the priority level of each resource to be managed is calculated according to the following formula:
[0049]
[0050] Among them, P i Indicates the priority corresponding to the i-th resource to be managed; Q i represents the usage of the i-th resource to be managed; C t Indicates the current time; L t Indicates the last usage time of the i-th resource to be managed.
[0051] As an embodiment, after recording the usage and most recent usage time of each of the multiple resources to be managed, it also includes: during the game running, if the usage of a certain resource to be managed is 0, and it is judged based on the usage time that it has not been used for more than a first threshold time, then uninstall the certain resource to be managed.
[0052] As an embodiment, the loading module 30 is also used to pre-build a preloading model; obtain historical player behavior data, and use the historical player behavior data to train the preloading model; use the trained preloading model to predict a resource demand at regular intervals, so as to load the corresponding resources in advance according to the priority level based on the resource demand.
[0053] It should be noted that the above explanations of the embodiment of the game resource management method are also applicable to the game resource management device of this embodiment, and will not be repeated here.
[0054] In summary, according to the game resource management device of the embodiment of the present application, a plurality of resources to be managed are acquired through an acquisition module; a recording module records the usage and the most recent usage time of each of the plurality of resources to be managed, so as to obtain the priority level between each resource to be managed according to the usage and the most recent usage time of each resource to be managed; when loading resources, the loading module loads the plurality of resources to be managed according to the priority level between each resource to be managed; thus, the game memory is managed through reference counting and time priority algorithm, thereby effectively improving the running performance of the game.
[0055] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented in one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that include computer-usable program code.
[0056] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0057] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0058] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process in the computer or other programmable device. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0059] It should be noted that in the claims, any reference signs placed between brackets shall not be construed as limiting the claims. The word "comprising" does not exclude the presence of components or steps not listed in the claims. The word "a" or "an" preceding a component does not exclude the presence of a plurality of such components. The present application may be implemented by means of hardware comprising several different components and by means of a suitably programmed computer. In a unit claim enumerating several means, several of these means may be embodied by the same item of hardware. The use of the words first, second, and third etc. does not indicate any order. These words may be interpreted as names.
[0060] Although the preferred embodiments of the present application have been described, those skilled in the art may make other changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications falling within the scope of the present application.
[0061] Obviously, those skilled in the art can make various changes and modifications to the present application without departing from the spirit and scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is also intended to include these modifications and variations.
[0062] In the description of the present application, it should be understood that the terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of the feature. In the description of the present application, "plurality" means two or more, unless otherwise clearly and specifically defined.
[0063] In this application, unless otherwise clearly specified and limited, the terms "installed", "connected", "connected", "fixed" and the like should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection or an indirect connection through an intermediate medium, it can be the internal connection of two elements or the interaction relationship between two elements. For ordinary technicians in this field, the specific meanings of the above terms in this application can be understood according to specific circumstances.
[0064] In the present application, unless otherwise clearly specified and limited, a first feature being “above” or “below” a second feature may mean that the first and second features are in direct contact, or the first and second features are in indirect contact through an intermediate medium. Moreover, a first feature being “above”, “above”, and “above” a second feature may mean that the first feature is directly above or obliquely above the second feature, or simply means that the first feature is higher in level than the second feature. A first feature being “below”, “below”, and “below” a second feature may mean that the first feature is directly below or obliquely below the second feature, or simply means that the first feature is lower in level than the second feature.
[0065] In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "example", "specific example", or "some examples" etc. means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present application. In this specification, the schematic representation of the above terms should not be understood as necessarily being directed to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or more embodiments or examples in a suitable manner. In addition, those skilled in the art may combine and combine the different embodiments or examples described in this specification and the features of the different embodiments or examples, unless they are contradictory.
[0066] Although the embodiments of the present application have been shown and described above, it can be understood that the above embodiments are exemplary and cannot be understood as limitations on the present application. Ordinary technicians in this field can change, modify, replace and modify the above embodiments within the scope of the present application.
Claims
1. A game resource management method, characterized in that: The following steps are involved: Get multiple resources to be managed; Recording the usage amount and the most recent usage time of each of the multiple resources to be managed, so as to obtain the priority level between each of the resources to be managed according to the usage amount and the most recent usage time of each of the resources to be managed; When loading resources, the multiple resources to be managed are loaded according to the priority level among each of the resources to be managed.
2. The game resource management method according to claim 1, characterized in that: The usage and most recent usage time of each of the multiple resources to be managed are recorded, including: during game operation, if a certain resource to be managed is used, the corresponding usage is increased by 1, and the corresponding usage time is recorded; if a certain resource to be managed is no longer used, the corresponding usage is reduced by 1.
3. The game resource management method according to claim 2, characterized in that: The priority level of each resource to be managed is calculated according to the following formula: Among them, P i Indicates the priority corresponding to the i-th resource to be managed; Q i represents the usage of the i-th resource to be managed; C t Indicates the current time; L t Indicates the last usage time of the i-th resource to be managed.
4. The game resource management method according to claim 3, characterized in that: After recording the usage amount and the most recent usage time of each of the multiple resources to be managed, the method further includes: During game operation, if the usage of a resource to be managed is 0, and it is determined based on usage time that the resource has not been used for more than a first threshold time, the resource to be managed is uninstalled.
5. The game resource management method according to claim 4, characterized in that: When loading resources, the multiple resources to be managed are loaded according to the priority level between each of the resources to be managed, including: Pre-built pre-loaded models; Acquire historical player behavior data, and use the historical player behavior data to train the preloaded model; The trained preloading model is used to predict a resource demand at regular intervals, so as to load the corresponding resources in advance according to the priority level based on the resource demand.
6. A game resource management device, characterized in that: include: An acquisition module is used to acquire multiple resources to be managed; A recording module, used for recording the usage and the most recent usage time of each of the plurality of resources to be managed, so as to obtain the priority level between each of the resources to be managed according to the usage and the most recent usage time of each of the resources to be managed; The loading module is used to load the multiple resources to be managed according to the priority level among each of the resources to be managed when loading resources.
7. The game resource management device according to claim 6, characterized in that: The recording module is also used for, during the game operation, if a certain resource to be managed is used, the corresponding usage amount is increased by 1, and the corresponding usage time is recorded; if a certain resource to be managed is no longer used, the corresponding usage amount is reduced by 1.
8. The game resource management device according to claim 7, characterized in that: The priority level of each resource to be managed is calculated according to the following formula: Among them, P i Indicates the priority corresponding to the i-th resource to be managed; Q i represents the usage of the i-th resource to be managed; C t Indicates the current time; L t Indicates the last usage time of the i-th resource to be managed.
9. The game resource management device according to claim 8, characterized in that: After recording the usage amount and the most recent usage time of each of the multiple resources to be managed, the method further includes: During game operation, if the usage of a resource to be managed is 0, and it is determined based on usage time that the resource has not been used for more than a first threshold time, the resource to be managed is uninstalled.
10. The game resource management device according to claim 9, characterized in that: The loading module is also used to pre-build a pre-loading model; obtain historical player behavior data, and use the historical player behavior data to train the pre-loading model; use the trained pre-loading model to predict a resource demand at regular intervals, so as to load the corresponding resources in advance according to the priority level based on the resource demand.