Game resource processing method, system and equipment for H5 micro terminal and medium
By applying machine learning algorithms to intelligently classify and mark resource in H5 micro-end games, combining hash value comparison and rsync algorithm for resource updates, and using segmented loading technology, the challenges of H5 micro-end games in resource loading and cache management are solved, significantly improving the game's startup speed and fluency and improving user experience.
Patent Information
- Application Number
- CN202411634148.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-15
- Publication Date
- 2025-03-28
AI Technical Summary
H5 micro-end games face many challenges in resource loading and cache management, including long-term startup and scene switching times, repeated loading of the same resources, and lack of dynamic adjustment and optimization cache strategies.
Through machine learning algorithms, game resources are intelligently classified and marked, cache policies and cache space allocation are dynamically adjusted, hash value comparison and rsync incremental synchronization algorithm are used to update resources, and segmented loading technology is used when the game starts and switches scenes, giving priority to loading key resources and visible area resources.
It significantly reduces the number of resource downloads and network requests, improves the game startup speed and smooth operation, realizes intelligent dynamic updates and personalized loading of game resources, and effectively improves the user's gaming experience.
Smart Images

Figure CN119701324A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of game resource processing technology, and in particular to a game resource processing method, system, device and medium for H5 micro-terminal. Background Art
[0002] H5 micro-end games, as a lightweight game format based on HTML5 technology, have rapidly risen in the game market in recent years due to their cross-platform and easy-to-spread features. However, H5 micro-end games face many challenges in resource loading and cache management.
[0003] Traditional H5 micro-end games usually need to reload all game resources when starting or switching scenes, regardless of whether these resources have been loaded or changed. This practice not only prolongs the game startup time and scene switching time, but also increases the consumption of network bandwidth, seriously affecting the user experience. In fact, during the game running process, many resources (such as background images, character models, etc.) will not change in multiple games, and only some resources (such as event props, update patches, etc.) need to be updated regularly. However, the existing loading method fails to effectively distinguish which resources need to be updated and which resources can be reused, resulting in a large number of repeated loading of the same resources.
[0004] In addition, the lack of an effective resource caching mechanism is also a major problem facing current H5 micro-end games. Existing caching strategies are often too simple and lack the ability to dynamically adjust and optimize. For example, some games may use a simple LRU (Least Recently Used) caching algorithm, but this algorithm does not take into account factors such as resource access frequency, update frequency, and user behavior, and therefore cannot maximize cache efficiency and hit rate. Summary of the invention
[0005] The purpose of the present invention is to provide a game resource processing method, system, device and medium for H5 micro-terminal, which significantly reduces the amount of resource downloads and the number of network requests, improves the game startup speed and running smoothness, realizes the intelligent dynamic update and personalized loading of H5 micro-terminal game resources, and effectively improves the user's gaming experience, so as to solve at least one of the above-mentioned prior art problems.
[0006] In a first aspect, the present invention provides a method for processing game resources for an H5 micro-terminal, the method specifically comprising:
[0007] According to the update frequency and resource attributes of the game resources, a machine learning algorithm is used to intelligently classify and mark the game resources to obtain a resource update list;
[0008] For each resource in the resource update list, determine whether to update the resource by comparing the hash value of the resource with the hash value in the local cache;
[0009] During the game running process, the cache strategy and cache space allocation are dynamically adjusted according to the access frequency and cache hit rate of each resource;
[0010] When the game starts and switches scenes, segmented loading technology is used according to the preloading priority and display order of each resource, with priority given to loading key resources and visible area resources.
[0011] In a second aspect, the present invention provides a game resource processing system for an H5 micro-terminal, the system specifically comprising:
[0012] A first processing module, configured to intelligently classify and mark the game resources using a machine learning algorithm according to the update frequency and resource attributes of the game resources, and obtain a resource update list;
[0013] The second processing module is used to determine whether to update each resource in the resource update list by comparing the hash value of the resource with the hash value in the local cache;
[0014] The third processing module is used to dynamically adjust the cache strategy and cache space allocation according to the access frequency and cache hit rate of each resource during the game operation;
[0015] The fourth processing module is used to preferentially load key resources and visible area resources by adopting segmented loading technology according to the preloading priority and display order of each resource when the game is started and the scene is switched.
[0016] In a third aspect, the present invention provides a computer device comprising: a memory and a processor and a computer program stored in the memory. When the computer program is executed on the processor, a game resource processing method for an H5 micro terminal as described in any one of the above methods is implemented.
[0017] In a fourth aspect, the present invention provides a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, the game resource processing method for an H5 micro terminal as described in any one of the above methods is implemented.
[0018] Compared with the prior art, the present invention has at least one of the following technical effects:
[0019] 1. The present invention significantly reduces the amount of resource downloads and the number of network requests, improves the game startup speed and running smoothness, realizes the intelligent dynamic update and personalized loading of H5 micro-terminal game resources, and effectively improves the user's gaming experience.
[0020] 2. The present invention uses machine learning algorithms to intelligently classify and mark game resources, thereby achieving accurate management and efficient updating of resources, reducing unnecessary resource loading, and improving the speed of game startup and scene switching.
[0021] 3. The present invention utilizes hash value comparison and rsync incremental synchronization algorithm to ensure accurate updating of resources, avoid repeated loading of unchanged resources, and save network bandwidth and user device resources.
[0022] 4. The present invention dynamically adjusts cache strategy and space allocation according to resource access frequency and cache hit rate, thereby improving cache hit rate and resource utilization efficiency, and further accelerating the response speed of the game.
[0023] 5. The present invention adopts segmented loading technology to preferentially load key resources and visible area resources, thereby improving user experience and reducing user waiting time.
[0024] 6. The present invention divides game resources into static game resources and dynamic game resources, and adopts different cache mechanisms according to their characteristics, thereby improving the pertinence and effectiveness of the cache.
[0025] 7. Based on the resource loading efficiency evaluation model, the present invention dynamically determines a personalized game resource loading plan for each user, thereby improving the pertinence and efficiency of resource loading. According to the user's feedback data on the loading plan, the reinforcement learning algorithm is used to dynamically adjust the loading plan, continuously optimize the resource loading strategy, and improve the user experience. BRIEF DESCRIPTION OF THE DRAWINGS
[0026] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0027] Figure 1 It is a flowchart of a method for processing game resources for an H5 micro-terminal provided by the first embodiment of the present invention;
[0028] Figure 2 It is a flowchart of a method for processing game resources for an H5 micro-terminal provided by the second embodiment of the present invention;
[0029] Figure 3 It is a flowchart of a method for processing game resources for an H5 micro-terminal provided by the third embodiment of the present invention;
[0030] Figure 44 is a flowchart of a method for processing game resources for an H5 micro-terminal provided by a fourth embodiment of the present invention;
[0031] Figure 5 It is a flowchart of a method for processing game resources for an H5 micro-terminal provided by the fifth embodiment of the present invention;
[0032] Figure 6 1 is a flowchart of a method for processing game resources for an H5 micro-terminal provided by a sixth embodiment of the present invention;
[0033] Figure 7 1 is a flowchart of a method for processing game resources for an H5 micro-terminal provided in the seventh embodiment of the present invention;
[0034] Figure 8 It is a structural diagram of a game resource processing system for an H5 micro-terminal provided by an embodiment of the present invention;
[0035] Fig. 9 It is a structural schematic diagram of a computer device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0036] In the following description, specific details such as specific system structures, technologies, etc. are provided for the purpose of illustration rather than limitation, so as to provide a thorough understanding of the embodiments of the present application. However, it should be clear to those skilled in the art that the present application may also be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, circuits, and methods are omitted to prevent unnecessary details from obstructing the description of the present application.
[0037] It should be understood that when used in the present specification and the appended claims, the term "comprising" indicates the presence of described features, integers, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, integers, steps, operations, elements, components and / or combinations thereof.
[0038] It should also be understood that the term “and / or” used in the specification and appended claims refers to any and all possible combinations of one or more of the associated listed items, and includes these combinations.
[0039] As used in the specification and appended claims of this application, the term "if" can be interpreted as "when" or "uponce" or "in response to determining" or "in response to detecting", depending on the context. Similarly, the phrase "if it is determined" or "if [described condition or event] is detected" can be interpreted as meaning "uponce it is determined" or "in response to determining" or "uponce [described condition or event] is detected" or "in response to detecting [described condition or event]", depending on the context.
[0040] In addition, in the description of the present application specification and the appended claims, the terms "first", "second", "third", etc. are only used to distinguish the descriptions and cannot be understood as indicating or implying relative importance.
[0041] References to "one embodiment" or "some embodiments" etc. described in the specification of this application mean that one or more embodiments of the present application include specific features, structures or characteristics described in conjunction with the embodiment. Therefore, the statements "in one embodiment", "in some embodiments", "in some other embodiments", "in some other embodiments", etc. that appear in different places in this specification do not necessarily refer to the same embodiment, but mean "one or more but not all embodiments", unless otherwise specifically emphasized in other ways. The terms "including", "comprising", "having" and their variations all mean "including but not limited to", unless otherwise specifically emphasized in other ways.
[0042] In the embodiment of the present application, the execution subject of the process includes a terminal device, which includes but is not limited to: a server, a computer, a smart phone, a tablet computer, and other devices capable of executing the method disclosed in the present application. Figure 1 A flowchart of a method for processing game resources for an H5 micro-terminal disclosed in an embodiment of the present invention is shown, and the details are as follows:
[0043] S101, intelligently classify and mark the game resources using a machine learning algorithm according to the update frequency and resource attributes of the game resources to obtain a resource update list.
[0044] In this embodiment, game resource data is collected, including game name, publishing company, release time, operating system list, game classification, game description, update frequency, etc. According to the update frequency of game resources, update frequency features are extracted, such as "high frequency update", "medium frequency update", "low frequency update" or "no update", etc. According to the attributes of game resources, other relevant features are extracted, such as game type (such as shooting, strategy, leisure, etc.), game platform (such as Android, IOS, etc.), game release time, etc. Select a suitable machine learning algorithm, such as decision tree, support vector machine (SVM), naive Bayes classifier, etc., use the game resource data with known classification as the training set, train the machine learning model, input the game resource data to be classified into the trained machine learning model, perform intelligent classification, and mark the game resources according to the classification results, such as "high frequency update strategy game", "low frequency update leisure game", etc. According to the classification and marking results, generate a game resource update list.
[0045] In this embodiment, the accuracy of classification can be greatly improved by intelligently classifying and marking game resources through machine learning algorithms. Compared with traditional manual classification methods, machine learning algorithms can process large amounts of data more quickly and reduce human errors. The generated game resource update list can help game developers quickly understand the update status of game resources, thereby managing game resources more effectively. For example, developers can adjust the update strategy of game content according to the update frequency.
[0046] S102: for each resource in the resource update list, determine whether to update the resource by comparing the hash value of the resource with the hash value in the local cache.
[0047] In this embodiment, for each resource in the resource update list, the hash value of its current version is first calculated. This is usually done by reading the binary data of the resource and then applying a hash function (such as MD5, SHA-1, SHA-256, etc.). The hash value is a fixed-length string that uniquely represents the current state of the resource.
[0048] At the same time, the hash values corresponding to each resource are retrieved from the local cache. These hash values were stored when the resource was last downloaded or updated.
[0049] Compare the calculated current hash value of the resource with the hash value in the local cache. If the two are the same, it means that the resource has not changed since the last download or update, so there is no need to download it again. If the hash values are different, it means that the resource has been updated or changed, and it needs to be marked as pending update and prepare to download the latest version.
[0050] For resources marked as pending updates, download the latest version from the server and update the hash value in the local cache. While updating resources, you can clean up old versions of resources as needed to free up storage space.
[0051] In this embodiment, by comparing the hash values, it is possible to avoid downloading unchanged resources, thereby significantly reducing the amount of network data transmission, increasing the download speed, and reducing the server load. By avoiding downloading duplicate resources, local storage space can be saved, which is particularly important for devices with limited storage capacity.
[0052] S103, during the running of the game, dynamically adjust the cache strategy and cache space allocation according to the access frequency and cache hit rate of each resource.
[0053] In this embodiment, during the game running process, the access frequency data of each resource is collected in real time. This can be achieved by embedding monitoring logic in the game code or using professional performance monitoring tools. At the same time, the cache hit rate is calculated and monitored, that is, the proportion of successfully finding the required data in the cache. This can be calculated by comparing the number of cache accesses and the total number of accesses.
[0054] Based on the collected access frequency data, resources are classified into different access levels, such as "high-frequency access", "medium-frequency access" and "low-frequency access". For high-frequency access resources, increase their storage priority in the cache and allocate more cache space to ensure that these resources can be accessed quickly. For medium-frequency access resources, maintain their appropriate storage in the cache and adjust cache space allocation as needed. For low-frequency access resources, consider removing them from the cache or lowering their storage priority to free up cache space for more frequently accessed resources.
[0055] Set an upper limit for the cache space to prevent the cache from growing indefinitely and causing memory exhaustion. When the cache space reaches the upper limit, dynamically remove or replace the resources in the cache based on the access frequency and cache hit rate of the resources. Advanced cache replacement algorithms, such as LRU (Least Recently Used) and LFU (Least Frequently Used), can be used to optimize the use of cache space. At the same time, regularly evaluate the effectiveness of the cache strategy and make adjustments based on feedback from game performance and user experience. Introduce machine learning algorithms to predict the access frequency and cache hit rate of resources, so as to more intelligently adjust the cache strategy and space allocation.
[0056] In this embodiment, by dynamically adjusting the cache strategy and space allocation, it is possible to ensure that frequently accessed resources can be accessed quickly, thereby reducing delays and freezes during game operation. Allocating cache space based on resource access frequency and cache hit rate can more effectively utilize limited memory resources and avoid waste and memory exhaustion.
[0057] S104, when the game is started and the scene is switched, segmented loading technology is used according to the preloading priority and display order of each resource, and key resources and visible area resources are loaded first.
[0058] In this embodiment, during the game development phase, all resources in the game are classified, such as character models, scene maps, sound effects, animations, etc. A preloading priority is set for each resource based on the importance and frequency of use of the resource. For example, resources that need to be displayed immediately when the game starts (such as the main menu background and character models) are set to a high priority; while some resources that are used only in the later stages of the game (such as props for specific levels and background music) are set to a low priority.
[0059] Game resources are divided into different loading segments according to the structure of the game scene and the player's game process. Each loading segment contains a set of resources that need to be loaded at a specific time point or scene. When formulating a segmented loading strategy, give priority to key resources and visible area resources. These resources include elements that players need to see immediately when starting the game or switching scenes, such as characters, scene backgrounds, important props, etc.
[0060] When the game starts or switches scenes, use segmented loading technology to load resources according to the preloading priority and display order of resources. Prioritize loading high-priority and visible area resources to ensure that players can immediately see key elements when the game starts or switches scenes. For low-priority resources, they can be loaded asynchronously in the background of the game to reduce the impact on the player's gaming experience. During the resource loading process, provide players with feedback on the loading progress, such as loading bars, percentage displays, etc. This helps improve the player's waiting experience and let them know which resources the game is loading. Based on player feedback and data analysis of loading time, continuously optimize loading strategies and resource allocation to improve loading speed and user experience.
[0061] In this embodiment, by optimizing the segmented loading technology and the order of resource loading, the loading time when the game is started and the scene is switched can be significantly reduced. Prioritize the loading of key resources and visible area resources to ensure that players can immediately see key elements when the game is started or the scene is switched, thereby improving the user experience. By optimizing the resource loading strategy, the freeze and delay phenomenon during game operation can be reduced, and the fluency and stability of the game can be improved.
[0062] In some embodiments, in the above step S101, Figure 2 As shown, according to the update frequency and resource attributes of the game resources, the machine learning algorithm is used to intelligently classify and mark the game resources to obtain a resource update list, which specifically includes:
[0063] S1011, obtaining historical game resource data, extracting attribute features of the historical game resource data using regular expressions and text parsing technology, and constructing a resource feature vector, wherein the resource feature vector includes resource type, update time, and usage frequency;
[0064] S1012, based on the resource feature vector, using a support vector machine algorithm to perform modeling training, selecting a Gaussian kernel function, using a grid search and cross-validation method to optimize the penalty coefficient and kernel function parameters, and generating a resource classification model;
[0065] S1013: Classify and mark the game resources based on the resource classification model to obtain a resource update list.
[0066] In this embodiment, historical game resource data is exported from the database of the game server, and the data contains various detailed information of the game resources, such as resource name, type, update time, usage record, etc. The exported data is converted into text format to facilitate processing using regular expressions and text parsing technology. For resource type, a regular expression is used to match the word after the type field; for update time, a regular expression is used to match the timestamp; for usage frequency, a regular expression is used to match the number after the frequency field. The extracted resource type (encoded as an integer or one-hot encoding), update time (converted to timestamp format) and usage frequency (retained as an integer) are combined into a resource feature vector.
[0067] All the extracted resource feature vectors are used as training data, and the support vector machine (SVM) algorithm is used for modeling. The Gaussian kernel function (RBF Kernel) is selected, and the penalty coefficient (C) and kernel function parameter (gamma) are optimized using the grid search (Grid Search) and cross-validation (Cross-Validation) methods. Among them, the grid search range is: C from 0.1 to 100, the step size is 10, gamma from 0.001 to 1, logarithmic scale, and cross-validation is: 5-fold cross-validation.
[0068] The newly acquired game resource data is used to extract feature vectors in the same way, and the trained resource classification model is used to classify and label the new resource feature vectors. Based on the classification results, a resource update list containing resource type, update time and classification label is generated.
[0069] In this embodiment, regular expressions and text parsing technology are used to achieve automatic extraction of historical game resource data, greatly reducing manual intervention while ensuring the accuracy of data extraction. Grid search and cross-validation methods are used to optimize the parameters of the SVM model, improving the classification accuracy and generalization ability of the model. Through the resource classification model, game resources can be effectively classified and managed, and resource update lists can be quickly generated, providing strong support for game development and operation.
[0070] In some embodiments, in the above step S102, Figure 3 As shown, for each resource in the resource update list, determining whether to update the resource is performed by comparing the hash value of the resource with the hash value in the local cache, which specifically includes:
[0071] S1021, traverse each resource in the resource update list, calculate the current MD5 hash value of each resource, and compare the current MD5 hash value of the resource with the MD5 hash value of the corresponding resource stored in the local cache;
[0072] S1022, if the two MD5 hash values are inconsistent, the resource is marked as pending update, and the latest hash value of the resource is updated to the local cache;
[0073] S1023, using the rsync incremental synchronization algorithm, by comparing the difference between the local resource of the resource and the server resource of the resource, determine the content to be updated of the resource, and update the content to be updated.
[0074] In this embodiment, first obtain the resource update list provided by the server, which contains the identification information of all resources that need to be updated, and then traverse this list and perform subsequent steps for each resource. For each resource, calculate its current MD5 hash value. The MD5 hash algorithm can calculate input data of any length as a 128-bit hash value, which is unique when the input data remains unchanged. Then, compare the calculated MD5 hash value with the MD5 hash value of the corresponding resource stored in the local cache. If the two hash values are inconsistent, it means that the resource has been updated on the server, and we need to mark it as pending update and update the hash value in the local cache to the latest hash value.
[0075] For resources marked as pending updates, the rsync incremental synchronization algorithm is used to update them. The rsync algorithm compares the differences between local resources and server resources and only transmits the different parts, thereby achieving efficient incremental updates. During the transmission process, rsync uses checksums (such as rolling checksums and MD5 strong checksums) to ensure the accuracy of the transmitted data. After the update is completed, the resources in the local cache will be consistent with the resources on the server.
[0076] In this embodiment, by comparing the MD5 hash value and the rsync incremental synchronization algorithm, the entire resource file can be avoided from being transmitted, and only the changed parts are transmitted, thereby greatly improving the update efficiency. Since only the changed parts are transmitted, the network bandwidth can be significantly reduced and the use of local storage space can be saved. By comparing the MD5 hash value and the verification mechanism of the rsync algorithm, we can ensure that the resources in the local cache are consistent with the resources on the server side, avoiding the problem of data inconsistency.
[0077] In some embodiments, in the above step S103, Figure 4 As shown, the cache strategy and cache space allocation are dynamically adjusted according to the access frequency and cache hit rate of each resource, specifically including:
[0078] S1031, obtaining game resource access log data, and obtaining the access frequency of each resource by performing statistical analysis on the game resource access log data to form a resource access frequency analysis result;
[0079] S1032, according to the resource access frequency analysis result, marking the resources whose access frequency exceeds a preset access frequency threshold as high-frequency access resources;
[0080] S1033, sorting each frequently accessed resource by priority according to the access frequency to form a frequently accessed resource list;
[0081] S1034, by real-time monitoring of the cache hit rate of each resource, marking the resource whose cache hit rate is lower than a preset cache hit rate threshold as a low cache hit rate resource;
[0082] S1035: Based on the high-frequency access resource list, allocate the idle cache space of each low cache hit rate resource to each high-frequency access resource in sequence.
[0083] In this embodiment, the game server records and collects resource access log data over a period of time, including resource ID, access time, number of accesses, etc. Use data analysis tools (such as Python's pandas library) to perform statistical analysis on the log data and calculate the access frequency of each resource. Output the resource access frequency analysis results, including the number of accesses and access frequency (such as the number of accesses per second) of each resource. According to the resource access frequency analysis results, set a preset access frequency threshold (such as the number of accesses per second is greater than 100). Mark resources whose access frequency exceeds the threshold as high-frequency access resources. Sort all high-frequency access resources according to the size of the access frequency. Output a list of high-frequency access resources, and the resources in the list are arranged from high to low according to the access frequency.
[0084] The game server monitors the cache hit rate of each resource in real time, that is, the ratio of the total number of cache hit requests to the total number of requests. Set a preset cache hit rate threshold (such as 80%). Mark resources with cache hit rates below the threshold as low cache hit rate resources. Based on the list of frequently accessed resources, check the cache status of each frequently accessed resource in the order in the list (that is, the access frequency is from high to low). For each frequently accessed resource, if its cache hit rate is also lower than the preset threshold, try to allocate spare cache space to it from other low cache hit rate resources or unused cache space. After the allocation is completed, update the cache configuration to ensure that frequently accessed resources have enough cache space to improve their cache hit rate.
[0085] In this embodiment, by marking and prioritizing high-frequency access resources, the game server can respond to players' resource requests more quickly, reduce waiting time, and improve game fluency. Real-time monitoring of cache hit rate and dynamic adjustment of cache space allocation can ensure that limited cache resources are used more reasonably, avoiding cache waste and frequent cache replacement. By optimizing resource access and cache usage, the game can reduce jamming and delays and enhance the overall gaming experience of players. By improving resource access efficiency and optimizing cache usage, game operators can reduce server load and network bandwidth usage, thereby reducing operating costs.
[0086] In some embodiments, Figure 5 As shown, before the above step S104, the following steps are also included:
[0087] S1041, based on the dependency relationship of the game resources, using a graph theory algorithm to establish a resource dependency graph for each resource;
[0088] S1042, obtaining demand information for game startup and scene switching, and grouping resources using a K-means clustering algorithm according to the demand information to obtain multiple resource groups;
[0089] S1043: In each resource group, determine the preloading priority and display order of each resource according to the resource dependency graph.
[0090] In this embodiment, the dependencies of game resources are first sorted out, including direct dependencies and indirect dependencies, and then a graph theory algorithm (such as a directed acyclic graph DAG) is used to establish a resource dependency graph for each resource. In the graph, nodes represent resources and edges represent dependencies between resources. Through the resource dependency graph, you can clearly see which resources need to be loaded first and which resources can be loaded later. Next, obtain the demand information for game startup and scene switching, including which resources are required, which resources are optional, which resources are frequently accessed, and so on. Based on the demand information, the K-means clustering algorithm is used to group resources. The algorithm divides resources into multiple resource groups according to the attributes of the resources (such as size, type, access frequency, etc.). The resources in each resource group have similar attributes, which is convenient for subsequent resource loading and management.
[0091] In each resource group, the preloading priority of each resource is determined according to the resource dependency graph. For resources that need to be loaded first, such as character models and scene maps that must be loaded when the game starts, a higher preloading priority is given. At the same time, the loading order of resources is determined according to the display order of resources (such as the animation order when the character enters the scene, the order in which items appear in the scene, etc.). Through reasonable preloading priority and display order, it can be ensured that the game can quickly load the required resources when starting and switching scenes, improving the smoothness of the game and the player's experience.
[0092] In this embodiment, through the resource dependency graph and K-means clustering algorithm, the game development team can more accurately determine which resources are necessary and which resources can be loaded first, thereby reducing unnecessary resource loading time and improving the game startup speed. When switching scenes, according to the resource dependency graph and preloading priority, the game can quickly load the required resources, avoiding the jamming and delay caused by resource loading, and improving the smoothness of scene switching. By optimizing the resource loading strategy, the game can respond to the player's operations more quickly, reducing waiting time and improving the overall game experience.
[0093] In some embodiments, reference Figure 6 , the method further comprises:
[0094] S201, dividing the game resources into static game resources and dynamic game resources according to update characteristic information of the game resources;
[0095] S202, using a browser cache mechanism to cache the static game resources in a local database of the user, and using CDN content distribution network technology to cache the dynamic game resources on a node server closest to the user.
[0096] In this embodiment, all static game resources and all dynamic game resources are identified, including static game resources such as character model files (.obj or .fbx format), scene map images (.png or .jpg format), sound effect files (.mp3 or .wav format), etc., and dynamic game resources such as real-time player interaction data, game logic operation results, etc.
[0097] According to the update frequency and size of these static resources, formulate corresponding caching strategies. For resources with low update frequency, such as character models and scene maps, set a longer cache time; for resources with high update frequency, such as sound effect files, set a shorter cache time or adopt a version number control strategy. In the game client, the browser cache mechanism is implemented through programming. When the player loads the game for the first time, the game client will request these static resources from the server and establish a cache in the local database. In the subsequent game process, when the player needs these resources again, the game client will first check the cache in the local database. If the cache exists and has not expired, the resources will be read directly from the cache without requesting the server again.
[0098] Deploy these dynamic resources to the CDN node server. During the game, when players need to interact in real time or obtain game logic operation results, the game client will request these dynamic resources from the CDN node server. CDN will select the nearest node server to distribute resources to players based on the player's geographical location and network conditions, thereby greatly reducing game loading time and delay.
[0099] In this embodiment, the loading speed of game resources is significantly improved by combining the browser cache mechanism with CDN content distribution network technology. After the player loads the game for the first time, the required static and dynamic resources can be obtained more quickly in the subsequent game process, thereby reducing the waiting time.
[0100] CDN reduces the load on the source server by caching game resources to node servers around the world. This sharing mechanism improves server stability, especially when the game releases new updates or holds large-scale online events, and can effectively prevent server crashes caused by a surge in traffic.
[0101] Fast and stable loading and response not only reduce the lag in the game, but also enhance the player's satisfaction and stickiness to the game. Players can experience the game content more smoothly and enjoy a better gaming experience.
[0102] By reducing server load and network bandwidth requirements, game developers can reduce operating costs. At the same time, the elasticity and scalability of CDN ensure that games can cope with the ever-changing network environment and user needs, reducing the costs caused by technology upgrades and expansions.
[0103] In some embodiments, reference Figure 7 , the method further comprises:
[0104] S301, collecting resource loading data and corresponding game behavior information and user device information during game operation;
[0105] S302, constructing a resource loading efficiency evaluation model through a machine learning algorithm according to the resource loading status data, the game behavior information and the user device information;
[0106] S303, dynamically determining a personalized game resource loading solution for each user when loading game resources based on the resource loading efficiency evaluation model;
[0107] S304, obtaining feedback data of each user on the game resource loading scheme, and dynamically adjusting the game resource loading scheme using a reinforcement learning algorithm according to the feedback data.
[0108] In this embodiment, the resource loading data during the game operation is collected through the game client and server, including resource loading time, loading success rate, loading failure reason, etc. At the same time, the player's game behavior information is also collected, such as game time, game level, in-game consumption, etc. In addition, the user's device information is also recorded, such as device model, operating system version, network status, etc.
[0109] This data is input into machine learning algorithms, such as random forests and gradient boosting trees, for feature extraction and model training. Through model training, a model that can evaluate resource loading efficiency is obtained. The model can predict the impact of different resource loading schemes on the player's gaming experience based on the player's gaming behavior, device information, and resource loading data.
[0110] During the game, based on the player's real-time data, a personalized game resource loading plan is dynamically determined for each player through the resource loading efficiency evaluation model. For example, for players using old devices, they may choose to load lower-resolution game resources to reduce loading time; while for players using high-performance devices, they may choose to load higher-quality game resources to improve the gaming experience.
[0111] Furthermore, players' feedback data on the game resource loading scheme is collected, such as satisfaction with loading speed, game fluency, etc. Based on these feedback data, the game resource loading scheme is dynamically adjusted using a reinforcement learning algorithm. The reinforcement learning algorithm finds the resource loading scheme that can maximize player satisfaction through continuous trial and error and optimization. Specifically, first, a series of feedback indicators that can reflect user satisfaction with the game resource loading scheme need to be defined, which may include loading speed, loading success rate, number of game freezes, game screen quality, etc. The collected feedback data is cleaned to remove invalid, repeated or abnormal data. Features related to the game resource loading scheme are extracted from the cleaned data, such as user device type, network status, game behavior pattern, etc. Then, the extracted features are used as the state space of the reinforcement learning model, and the state space should be able to fully reflect the current game environment and user status. Define the actions that the reinforcement learning model can perform, that is, different game resource loading schemes, which may include different resource loading orders, resource compression strategies, resource priorities, etc. Design a reward function to evaluate the effect of the model performing different actions in different states. The reward function should be able to reflect the user's satisfaction with the game resource loading scheme, such as improved loading speed, reduced freezes, etc. Next, a platform simulating the game running environment is built to simulate user feedback on the game resource loading plan during the training process. In the simulation environment, the reinforcement learning model is iteratively trained through continuous trial and error and optimization. In each iteration, the model selects an action based on the current state and evaluates the effect of the action based on the reward function. Through continuous learning and adjustment, the model gradually finds a resource loading plan that can maximize user satisfaction. The trained reinforcement learning model is deployed to the game server for real-time evaluation and adjustment of the game resource loading plan. During the game, the server dynamically adjusts the game resource loading plan based on the user's real-time data and model evaluation results. When the user's device status, network status or game behavior changes, the model can quickly adjust the loading strategy to adapt to the new environment.
[0112] In this embodiment, through personalized game resource loading schemes, the platform can provide the most suitable gaming experience for different players according to their needs and equipment conditions, which can not only reduce loading time, but also improve the quality and fluency of the game screen. By dynamically adjusting the game resource loading scheme, the platform can more effectively utilize server and network resources, which can not only reduce unnecessary bandwidth consumption, but also reduce the load pressure of the server, thereby reducing operating costs. Personalized game resource loading schemes and continuously optimized game experience can enhance player satisfaction and loyalty, help the platform attract more new users and maintain the activity of existing users. By adopting advanced machine learning algorithms and reinforcement learning algorithms, the platform can continuously learn and optimize the game resource loading scheme, which provides strong technical support for game innovation and helps the platform launch more competitive game products.
[0113] Reference Figure 8 An embodiment of the present invention provides a game resource processing system 8 for an H5 micro-terminal, and the system 8 specifically includes:
[0114] The first processing module 801 is used to intelligently classify and mark the game resources according to the update frequency and resource attributes of the game resources using a machine learning algorithm to obtain a resource update list;
[0115] The second processing module 802 is used to determine whether to update each resource in the resource update list by comparing the hash value of the resource with the hash value in the local cache;
[0116] The third processing module 803 is used to dynamically adjust the cache strategy and cache space allocation according to the access frequency and cache hit rate of each resource during the game operation;
[0117] The fourth processing module 804 is used to preferentially load key resources and visible area resources by adopting segmented loading technology according to the preloading priority and display order of each resource when the game is started and the scene is switched.
[0118] It is understandable that if Figure 1 The contents of the game resource processing method embodiment for H5 micro-terminal shown in the figure are all applicable to the game resource processing system embodiment for H5 micro-terminal. The functions specifically implemented by the game resource processing system embodiment for H5 micro-terminal are similar to those in the embodiment shown in the figure. Figure 1 The game resource processing method embodiment for H5 micro-terminal shown is the same as that of the embodiment, and the beneficial effects achieved are the same as those of the embodiment. Figure 1 The beneficial effects achieved by the game resource processing method embodiment shown for the H5 micro terminal are also the same.
[0119] It should be noted that the information interaction, execution process and other contents between the above-mentioned systems are based on the same concept as the embodiment of the method of the present invention. Their specific functions and technical effects can be found in the method embodiment part and will not be repeated here.
[0120] Those skilled in the art can clearly understand that, for the convenience and simplicity of description, only the division of the above-mentioned functional units and modules is used as an example for illustration. In practical applications, the above-mentioned function allocation can be completed by different functional units and modules as needed, that is, the internal structure of the system can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiment can be integrated in a processing unit, or each unit can exist physically separately, or two or more units can be integrated in one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of software functional units. In addition, the specific names of the functional units and modules are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of this application. The specific working process of the units and modules in the above-mentioned system can refer to the corresponding process in the aforementioned method embodiment, which will not be repeated here.
[0121] Reference Fig. 9 The embodiment of the present invention further provides a computer device 9, comprising: a memory 902 and a processor 901 and a computer program 903 stored in the memory 902. When the computer program 903 is executed on the processor 901, a game resource processing method for an H5 micro terminal as described in any one of the above methods is implemented.
[0122] The computer device 9 may be a computing device such as a desktop computer, a notebook, a PDA, or a cloud server. The computer device 9 may include, but is not limited to, a processor 901 and a memory 902. Those skilled in the art will appreciate that Fig. 9 It is only an example of the computer device 9 and does not constitute a limitation on the computer device 9. It may include more or fewer components than shown in the figure, or a combination of certain components, or different components. For example, it may also include input and output devices, network access devices, etc.
[0123] The processor 901 may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor, etc.
[0124] In some embodiments, the memory 902 may be an internal storage unit of the computer device 9, such as a hard disk or memory of the computer device 9. In other embodiments, the memory 902 may also be an external storage device of the computer device 9, such as a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), etc. equipped on the computer device 9. Further, the memory 902 may also include both an internal storage unit of the computer device 9 and an external storage device. The memory 902 is used to store an operating system, an application program, a boot loader (Boot Loader), data, and other programs, such as the program code of the computer program, etc. The memory 902 may also be used to temporarily store data that has been output or is to be output.
[0125] An embodiment of the present invention also provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the game resource processing method for an H5 micro terminal as described in any of the above methods is implemented.
[0126] In this embodiment, if the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the present application implements all or part of the processes in the above-mentioned embodiment method, which can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a computer-readable storage medium. When the computer program is executed by the processor, the steps of the above-mentioned various method embodiments can be implemented. Among them, the computer program includes computer program code, and the computer program code can be in source code form, object code form, executable file or some intermediate form. The computer-readable medium can at least include: any entity or device that can carry the computer program code to the camera / terminal device, recording medium, computer memory, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), electric carrier signal, telecommunication signal and software distribution medium. For example, a USB flash drive, a mobile hard disk, a disk or an optical disk. In some jurisdictions, according to legislation and patent practice, computer-readable media cannot be electric carrier signals and telecommunication signals.
[0127] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described or recorded in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0128] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0129] In the embodiments disclosed in the present application, it should be understood that the disclosed devices / terminal equipment and methods can be implemented in other ways. For example, the device / terminal equipment embodiments described above are only schematic. For example, the division of the modules or units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0130] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
Claims
1. A method for processing game resources for H5 micro-terminal, characterized in that: The method specifically comprises: According to the update frequency and resource attributes of the game resources, a machine learning algorithm is used to intelligently classify and mark the game resources to obtain a resource update list; For each resource in the resource update list, determine whether to update the resource by comparing the hash value of the resource with the hash value in the local cache; During the game running process, the cache strategy and cache space allocation are dynamically adjusted according to the access frequency and cache hit rate of each resource; When the game starts and switches scenes, segmented loading technology is used according to the preloading priority and display order of each resource, with priority given to loading key resources and visible area resources.
2. The method according to claim 1, characterized in that According to the update frequency and resource attributes of the game resources, the game resources are intelligently classified and marked using a machine learning algorithm to obtain a resource update list, which specifically includes: Acquire historical game resource data, extract attribute features of the historical game resource data using regular expressions and text parsing technology, and construct a resource feature vector, wherein the resource feature vector includes resource type, update time, and usage frequency; Based on the resource feature vector, a support vector machine algorithm is used for modeling training, a Gaussian kernel function is selected, and a grid search and cross-validation method is used to optimize the penalty coefficient and kernel function parameters to generate a resource classification model; Based on the resource classification model, the game resources are classified and marked to obtain a resource update list.
3. The method according to claim 1, characterized in that: For each resource in the resource update list, determining whether to update the resource by comparing the hash value of the resource with the hash value in the local cache specifically includes: Traverse each resource in the resource update list, calculate the current MD5 hash value of each resource, and compare the current MD5 hash value of the resource with the MD5 hash value of the corresponding resource stored in the local cache; If the two MD5 hash values are inconsistent, the resource is marked as pending update, and the latest hash value of the resource is updated to the local cache; The rsync incremental synchronization algorithm is adopted to determine the content to be updated of the resource by comparing the difference between the local resource of the resource and the server resource of the resource, and then update the content to be updated.
4. The method according to claim 1, characterized in that The method of dynamically adjusting the cache strategy and cache space allocation according to the access frequency and cache hit rate of each resource specifically includes: Obtaining game resource access log data, and obtaining the access frequency of each resource by performing statistical analysis on the game resource access log data to form a resource access frequency analysis result; According to the resource access frequency analysis result, resources whose access frequency exceeds a preset access frequency threshold are marked as high-frequency access resources; Prioritize each frequently accessed resource according to its access frequency to form a frequently accessed resource list; By real-time monitoring of the cache hit rate of each resource, resources whose cache hit rate is lower than a preset cache hit rate threshold are marked as low cache hit rate resources; Based on the high-frequency access resource list, the idle cache space of each low cache hit rate resource is allocated to each high-frequency access resource in sequence.
5. The method according to claim 1, characterized in that According to the preloading priority and display order of each resource, the segmented loading technology is adopted to preferentially load key resources and visible area resources, and the previous steps also include: According to the dependency relationship of game resources, use graph theory algorithm to build resource dependency graph for each resource; Obtaining demand information for game startup and scene switching, and grouping resources using a K-means clustering algorithm based on the demand information to obtain multiple resource groups; In each resource group, the preloading priority and display order of each resource are determined according to the resource dependency graph.
6. The method according to any one of claims 1 to 5, characterized in that The method further comprises: According to the update characteristic information of the game resources, the game resources are divided into static game resources and dynamic game resources; The browser cache mechanism is used to cache the static game resources in the user's local database, and the CDN content distribution network technology is used to cache the dynamic game resources on the node server closest to the user.
7. The method according to any one of claims 1 to 5, characterized in that The method further comprises: Collect resource loading data and corresponding game behavior information and user device information during game operation; Constructing a resource loading efficiency evaluation model through a machine learning algorithm according to the resource loading status data, the game behavior information and the user device information; Based on the resource loading efficiency evaluation model, a personalized game resource loading solution is dynamically determined for each user when loading game resources; Obtain feedback data from each user on the game resource loading scheme, and dynamically adjust the game resource loading scheme using a reinforcement learning algorithm based on the feedback data.
8. A game resource processing system for H5 micro-terminal, characterized in that: The system specifically comprises: A first processing module, configured to intelligently classify and mark the game resources using a machine learning algorithm according to the update frequency and resource attributes of the game resources, and obtain a resource update list; The second processing module is used to determine whether to update each resource in the resource update list by comparing the hash value of the resource with the hash value in the local cache; The third processing module is used to dynamically adjust the cache strategy and cache space allocation according to the access frequency and cache hit rate of each resource during the game operation; The fourth processing module is used to preferentially load key resources and visible area resources by adopting segmented loading technology according to the preloading priority and display order of each resource when the game is started and the scene is switched.
9. A computer device, characterized in that: include: A memory and a processor and a computer program stored in the memory, when the computer program is executed on the processor, implements the game resource processing method for the H5 micro terminal as described in any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that: A computer program is stored thereon, and when the computer program is executed by the processor, the game resource processing method for the H5 micro terminal is implemented as described in any one of claims 1 to 7.
Citation Information
Cited By
Game resource optimization method and device based on predictive algorithm and storage medium
CN120037661A
Multi-player voice game performance optimization method and device based on dynamic resource management
CN120045337A
Cache optimization method and device for tenant configuration modification, equipment and storage medium
CN121277845A