Game cost automatic early warning and management method, system, equipment and medium
By leveraging TensorFlow reinforcement learning models and game lifecycle prediction models, combined with hybrid cloud resource pools and Service Mesh architecture, game service resources are dynamically adjusted, solving the challenges faced by traditional game companies in resource cost control and multi-cloud environment management, and achieving automated management and optimization of game costs.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-10-24
- Publication Date
- 2026-03-13
AI Technical Summary
Traditional game companies are inefficient in controlling server resource costs, struggle to identify cost waste in a timely manner, are unable to deeply analyze the complex relationship between game revenue and resources, and face difficulties in resource management in multi-cloud environments, making cost optimization impossible.
A dynamic threshold adjustment strategy is generated using a TensorFlow reinforcement learning model. Combined with a game lifecycle prediction model and a hybrid cloud resource pool, resource costs are optimized by combining Spot instances and reserved instances. A cost optimization Sidecar agent is implanted in the Service Mesh architecture to dynamically adjust the number of game service replicas and resource limits. The impact of the cost optimization scheme is evaluated using a Monte Carlo simulation algorithm.
It enables automated early warning and management of game costs, provides standardized and efficient cost optimization solutions, optimizes resource utilization, reduces resource costs in hybrid cloud environments, dynamically adjusts resource allocation, improves resource utilization efficiency, and provides scientific evidence to accurately pinpoint cost-generating stages.
Smart Images

Figure CN121660148A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of game operation technology, and in particular to a method, system, device and medium for automatic early warning and management of game costs. Background Technology
[0002] In today's fiercely competitive gaming industry, cost reduction and efficiency improvement have become key factors for game companies to enhance their competitiveness and achieve sustainable development. Traditional game companies primarily rely on experienced technical personnel to identify and cut costs in areas where server resource expenses can be controlled. However, this traditional approach has many significant drawbacks.
[0003] On the one hand, technical personnel rely on experience to conduct cost checks, making it difficult to identify cost waste issues in a timely and comprehensive manner. The game operation environment is complex and ever-changing, and the usage of server resources is constantly changing. Manual checks are not only inefficient, but also easily overlook some hidden cost waste points, making it impossible to have a comprehensive and accurate grasp of the cost situation.
[0004] On the other hand, server resource costs are closely related to game revenue, with a complex interrelationship between the two. Game revenue is influenced by various factors, such as game type, user activity, and game lifecycle stage, and server resource allocation needs to be dynamically adjusted based on these factors. Traditional manual methods struggle to deeply analyze this complex relationship and cannot formulate scientifically sound resource allocation strategies based on the actual situation of game revenue and resource metrics, thus failing to effectively optimize costs.
[0005] Furthermore, as the gaming business continues to expand and become more complex, gaming companies face the challenge of resource management in multi-cloud environments. Different cloud service providers offer computing instance resources that vary in price and performance, making it difficult to optimize resource allocation in a hybrid cloud environment using traditional manual methods. Simultaneously, in terms of game service deployment, dynamically adjusting the number of game service replicas and resource limits based on the game's lifecycle and resource requirements is also a pressing issue that needs to be addressed. Summary of the Invention
[0006] The purpose of this invention is to provide a method, system, device, and medium for automatic early warning and management of game costs, which realizes automated early warning and management of game costs, and provides game companies with a standardized and efficient cost optimization solution to solve at least one of the aforementioned problems in the prior art.
[0007] In a first aspect, the present invention provides a method for automatic early warning and management of game costs, the method specifically comprising: Collect game revenue data and Pod-level resource usage data, and input them into a reinforcement learning model based on TensorFlow to generate a dynamic threshold adjustment strategy. The dynamic threshold adjustment strategy is used to set differentiated resource allocation strategies for different game types. Acquire user activity data, input the user activity data and game revenue data into a pre-built game lifecycle prediction model, and generate a game lifecycle decay curve. Construct a hybrid cloud resource pool, and optimize resource costs by combining Spot instances and reserved instances based on dynamic threshold adjustment strategies and game lifecycle decay curves, outputting the first cost optimization solution. In the Service Mesh architecture, a cost optimization Sidecar agent is implanted to dynamically adjust the number of game service replicas and resource limits based on dynamic threshold adjustment strategies and the game lifecycle decay curve, and outputs a second cost optimization scheme. A cost impact assessment tool is constructed using the Monte Carlo simulation algorithm. Based on this tool, the probability distribution of the impact of the first or second cost optimization scheme on game revenue is evaluated.
[0008] Secondly, the present invention provides an automatic game cost early warning and management system, the system specifically comprising: The adjustment strategy module is used to collect game revenue data and Pod-level resource usage data, and input them into a reinforcement learning model based on TensorFlow to generate a dynamic threshold adjustment strategy. The dynamic threshold adjustment strategy is used to set differentiated resource allocation strategies for different game types. The game lifecycle module is used to acquire user activity data, input user activity data and game revenue data into a pre-built game lifecycle prediction model, and generate a game lifecycle decay curve. The first optimization module is used to build a hybrid cloud resource pool. Based on the dynamic threshold adjustment strategy and the game life cycle decay curve, it optimizes resource costs by combining Spot instances and reserved instances, and outputs the first cost optimization solution. The second optimization module is used to implant a cost optimization Sidecar agent into the Service Mesh architecture. It dynamically adjusts the number of game service replicas and resource limits based on the dynamic threshold adjustment strategy and the game lifecycle decay curve, and outputs a second cost optimization scheme. The impact assessment module is used to build a cost impact assessment tool using the Monte Carlo simulation algorithm, and to assess the probability distribution of the impact of the first or second cost optimization scheme on game revenue based on the impact assessment tool.
[0009] Thirdly, the present invention provides a computer device, comprising: a memory and a processor, and a computer program stored in the memory, wherein when the computer program is executed on the processor, it implements the automatic warning and management method for game costs as described in any of the above methods.
[0010] Fourthly, the present invention provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the automatic warning and management method for game costs as described in any of the above methods.
[0011] Compared with the prior art, the present invention has at least one of the following technical effects: 1. This invention enables automated early warning and management of game costs, providing game companies with a standardized and efficient cost optimization solution.
[0012] 2. This invention collects game revenue data and Pod-level resource usage data and inputs them into a reinforcement learning model based on TensorFlow. This enables the setting of differentiated resource allocation strategies for different game types, achieving efficient resource utilization and avoiding resource waste.
[0013] 3. This invention acquires user activity data and inputs it along with game revenue data into a pre-built game lifecycle prediction model to generate a game lifecycle decay curve, providing a scientific basis for resource allocation and service adjustment, and enabling advance planning of cost optimization measures.
[0014] 4. This invention constructs a hybrid cloud resource pool. Based on a dynamic threshold adjustment strategy and a game lifecycle decay curve, it effectively reduces resource costs and improves resource utilization efficiency in a hybrid cloud environment by combining Spot instances and reserved instances.
[0015] 5. This invention embeds a cost-optimized Sidecar proxy into the Service Mesh architecture, which dynamically adjusts the number of game service replicas and resource limits based on a dynamic threshold adjustment strategy and the game lifecycle decay curve, thereby achieving on-demand resource allocation and further reducing costs.
[0016] 6. This invention constructs a cost impact assessment tool using the Monte Carlo simulation algorithm to evaluate the probability distribution of the impact of cost optimization schemes on game revenue, helping companies to understand the potential impact of cost optimization in advance and make more informed decisions.
[0017] 7. This invention sets up a structured tagging system in the container orchestration platform, collects basic resource consumption data and network traffic data, and performs correlation analysis and cost calculation through a cost calculation engine. Direct resource costs and indirect network costs are jointly allocated to the corresponding initiating business modules. Combined with directed graph technology, a cost traceability view is formed, which makes it easier for enterprises to accurately locate the cost generation links and carry out targeted cost control. Attached Figure Description
[0018] To more clearly illustrate the technical solutions in the embodiments of this application, the drawings used in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0019] Figure 1 This is a flowchart illustrating an automatic early warning and management method for game costs provided in an embodiment of the present invention; Figure 2 This is a schematic diagram of the structure of an automatic game cost early warning and management system provided in an embodiment of the present invention; Figure 3 This is a schematic diagram of the structure of a computer device provided in an embodiment of the present invention. Detailed Implementation
[0020] In the following description, specific details such as particular system architectures and techniques are set forth for illustrative purposes and not for limitation, in order to provide a thorough understanding of the embodiments of this application. However, those skilled in the art will understand that this application may also be implemented in other embodiments without these specific details. In other instances, detailed descriptions of well-known systems, apparatuses, circuits, and methods have been omitted so as not to obscure the description of this application with unnecessary detail.
[0021] It should be understood that, when used in this application specification and the appended claims, the term "comprising" indicates the presence of the described features, integrals, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, integrals, steps, operations, elements, components and / or a collection thereof.
[0022] It should also be understood that the term “and / or” as used in this application specification and the appended claims means any combination of one or more of the associated listed items and all possible combinations, and includes such combinations.
[0023] As used in this application specification and the appended claims, the term "if" may be interpreted, depending on the context, as "when," "once," "in response to determination," or "in response to detection." Similarly, the phrase "if determined" or "if detected [the described condition or event]" may be interpreted, depending on the context, as meaning "once determined," "in response to determination," "once detected [the described condition or event]," or "in response to detection [the described condition or event]."
[0024] Furthermore, in the description of this application and the appended claims, the terms "first," "second," "third," etc., are used only to distinguish descriptions and should not be construed as indicating or implying relative importance.
[0025] References to "one embodiment" or "some embodiments" as described in this specification mean that one or more embodiments of this application include a specific feature, structure, or characteristic described in connection with that embodiment. Therefore, the phrases "in one embodiment," "in some embodiments," "in other embodiments," "in still other embodiments," etc., appearing in different parts of this specification do not necessarily refer to the same embodiment, but rather mean "one or more, but not all, embodiments," unless otherwise specifically emphasized. The terms "comprising," "including," "having," and variations thereof mean "including but not limited to," unless otherwise specifically emphasized.
[0026] In this application embodiment, the entity executing the process includes a terminal device. This terminal device includes, but is not limited to, devices capable of executing the methods disclosed in this application, such as servers, computers, smartphones, and tablets. Figure 1 A flowchart illustrating an embodiment of the automatic game cost warning and management method disclosed in this invention is shown below: S101: Collect game revenue data and Pod-level resource usage data, and input them into a reinforcement learning model based on TensorFlow to generate a dynamic threshold adjustment strategy. The dynamic threshold adjustment strategy is used to set differentiated resource allocation strategies for different game types.
[0027] In this embodiment, for game revenue data, key game revenue information is extracted from the database at predetermined time intervals (e.g., every minute) by connecting to the game server's database. This information includes, but is not limited to, the transaction amount of in-game virtual currency, the quantity of items purchased, and the number of times players recharge. This data reflects the game's economic activities and players' consumption behavior, and is an important basis for assessing the game's operational status and resource needs.
[0028] For Pod-level resource usage data, the monitoring interface provided by the container orchestration system can be used to obtain resource metrics such as CPU utilization, memory usage, and network bandwidth consumption for each Pod in real time. A Pod is the basic scheduling unit in container orchestration. By monitoring the resource usage of Pods, we can accurately understand the dynamic resource consumption of the game service at different container layers.
[0029] A reinforcement learning model is built based on the TensorFlow framework. A suitable reinforcement learning algorithm, such as Deep Q-Network (DQN), is chosen. This algorithm can handle high-dimensional state and action spaces, making it suitable for optimizing game resource allocation strategies. During model initialization, the network structure is defined, including an input layer, hidden layers, and an output layer. The input layer receives collected game flow data and Pod-level resource usage data, which are preprocessed and used as input features. The hidden layers employ a multi-layer fully connected neural network structure, using non-linear activation functions (such as ReLU) to extract and transform features from the input data, learning complex patterns and relationships within the data. The output layer outputs resource allocation actions tailored to different game types, such as increasing or decreasing CPU resource allocation or adjusting memory size.
[0030] A training environment was built to simulate real-world game operation scenarios. Different game types were set up as different training tasks within the training environment, each with unique revenue stream characteristics and resource demand patterns. For example, role-playing games may have longer game lifecycles and stable player spending patterns, while competitive games may have higher player activity and short-term peak resource demands. Corresponding virtual game servers and container environments were created for each game type to simulate real-world game operation scenarios, and initial resource allocation strategies were set based on historical data.
[0031] The collected game revenue data and Pod-level resource usage data were divided into training and testing sets according to time series. During training, the reinforcement learning model, acting as an agent, calculated the Q-value for different resource allocation actions based on the current game revenue data and Pod-level resource usage data (i.e., state information) through the model's network structure. The Q-value represents the expected reward obtained by taking a certain action in that state. The agent selected the optimal resource allocation action based on the Q-value and applied it to the virtual game server and container environment.
[0032] After applying resource allocation actions, the changes in game server performance metrics (such as response time and throughput) and game revenue data are observed. The reward for this action is calculated based on a pre-defined reward function. The reward function is designed to consider multiple factors, including resource cost savings, game performance assurance, and game revenue growth. For example, if a resource allocation action effectively reduces server resource costs while ensuring game server performance metrics remain within a reasonable range and game revenue data does not show a significant decline, a higher reward is given; conversely, if a resource allocation action leads to a decrease in game performance or a reduction in game revenue, a lower reward or penalty is given.
[0033] The agent updates the model's parameters based on the rewards received and adjusts the weights in the network structure using the backpropagation algorithm, enabling the model to choose better resource allocation actions in subsequent states. This training process is repeated, iteratively optimizing the model until it achieves good performance on both the training and test sets, accurately predicting the optimal resource allocation strategy for different game types.
[0034] After the reinforcement learning model is trained, it is deployed to a real game operation environment. During actual operation, real-time game revenue data and Pod-level resource usage data are continuously collected and input into the trained reinforcement learning model. Based on the input state information, the model calculates the Q-value of different resource allocation actions in real time and selects the optimal action as the current resource allocation strategy.
[0035] To generate a dynamic threshold adjustment strategy, the resource allocation strategy output by the reinforcement learning model is further processed. Based on the characteristics of different game types and historical data, a series of resource usage threshold ranges are set. When the real-time collected Pod-level resource usage data exceeds or falls below the set threshold range, the resource allocation threshold is dynamically adjusted according to the resource allocation strategy output by the reinforcement learning model.
[0036] If resource usage consistently exceeds the upper threshold, it indicates that the current resource allocation may not meet the game's needs. Based on the model's output strategy, the allocation of corresponding resources should be appropriately increased, and the upper threshold adjusted accordingly. Conversely, if resource usage consistently falls below the lower threshold, it suggests potential waste in the current resource allocation. Based on the model's output strategy, the allocation of corresponding resources should be appropriately reduced, and the lower threshold adjusted accordingly. This method generates dynamic threshold adjustment strategies for different game types, achieving differentiated resource allocation to adapt to the ever-changing resource demands during game operation, thereby optimizing server resource costs.
[0037] S102, acquire user activity data, input user activity data and game revenue data into a pre-built game lifecycle prediction model to generate a game lifecycle decay curve.
[0038] In this embodiment, by embedding a specific data collection script into the game interface, the script can collect various operational behavior data of players in real time without affecting the normal gaming experience. For example, it can record the number of times a player logs into the game each day, the duration of each login, the time spent in different functional modules within the game (such as dungeons, arenas, and the shop), and the frequency of participation in game activities.
[0039] A large amount of historical game data was collected as training samples. This historical data covers various indicators of different types of games at different operational stages, including game revenue data, user activity data, marketing data, version update data, etc. The collected historical data was cleaned and preprocessed to remove noisy data and outliers, and missing data was appropriately imputed and interpolated to ensure data quality and usability.
[0040] Choose a suitable machine learning algorithm to build a game lifecycle prediction model, such as a Long Short-Term Memory (LSTM) network. LSTM algorithms have the advantage of processing time-series data, capturing long-term dependencies in the data, making them suitable for predicting the game lifecycle—a process that changes over time. The network structure of the model includes an input layer, hidden layers, and an output layer. The input layer receives preprocessed historical game revenue data and user activity data; the hidden layers extract and transform features from the input data through a multi-layer neural network; and the output layer outputs the predicted game lifecycle.
[0041] Historical data is divided into training and test sets. The model is trained using the training set, and its parameters are continuously adjusted to minimize prediction error on the training set. During training, cross-validation is used to evaluate model performance, ensuring good generalization ability. The trained model is then validated using the test set, calculating metrics such as prediction accuracy and recall. Based on the evaluation results, the model is further optimized and adjusted until it reaches a satisfactory performance level.
[0042] After completing the collection of user activity data and the pre-construction of the game lifecycle prediction model, the real-time acquired user activity data and game revenue data are input into the pre-constructed game lifecycle prediction model according to a predetermined format and interface. During the data input process, the accuracy and timeliness of the data are ensured, and the input data is validated again to prevent inaccurate model prediction results due to data errors.
[0043] After receiving the input data, the model begins the prediction process. Based on the input user activity data and game revenue data, combined with the data patterns and rules learned during training, the model determines the current stage of the game's lifecycle and predicts its development trend in the future. Specifically, the model analyzes trends in user activity data, such as increases or decreases in new user registrations, churn rates of existing users, and fluctuations in user activity. Simultaneously, it combines this with changes in game revenue data, such as increases or decreases in daily revenue and changes in the proportion of paying users, to comprehensively assess the game's lifecycle status.
[0044] After making predictions, the model generates a game lifecycle decay curve based on the prediction results. This curve plots time on the horizontal axis and a comprehensive indicator reflecting the game's lifecycle status on the vertical axis. The comprehensive indicator can be defined according to actual circumstances; for example, it can combine user activity and game revenue data, using a weighted average method to calculate a comprehensive score. This score can intuitively reflect the game's health and development potential at its current stage.
[0045] The game lifecycle decay curve clearly illustrates the entire process of a game, from its initial rapid growth phase after launch, to its stable operation in the mature phase, and finally to its decline phase characterized by user churn and revenue reduction. The curve is smoothed using techniques to ensure continuity and accuracy, better reflecting the changing trends throughout the game's lifecycle. Furthermore, to facilitate decision-making analysis for game companies, key lifecycle nodes are marked on the curve, such as peak user growth points, peak revenue points, and points of accelerated user churn, with detailed explanations and analyses provided for each node. This offers strong support for game companies in developing appropriate operational strategies.
[0046] S103 constructs a hybrid cloud resource pool. Based on a dynamic threshold adjustment strategy and a game lifecycle decay curve, it optimizes resource costs by combining Spot instances and reserved instances, and outputs the first cost optimization solution.
[0047] In this embodiment, Spot instances are auction resources provided by cloud service providers. Their prices fluctuate in real time according to market supply and demand, and are usually relatively low, but there is a risk that they may be reclaimed by the cloud service provider. They are suitable for non-critical businesses with a high tolerance for service interruptions or businesses that can be quickly recovered. Reserved instances, on the other hand, are resources that game companies pre-order from cloud service providers for a certain period. Their prices are relatively stable, and they can guarantee the long-term availability of resources. They are suitable for critical businesses and game services with high stability requirements.
[0048] Based on the characteristics of Spot instances and reserved instances, and combined with dynamic threshold adjustment strategies and game lifecycle decay curves, a detailed resource allocation plan is developed. At different stages of the game lifecycle, the usage ratio of Spot instances and reserved instances is dynamically adjusted according to changes in user activity and game revenue.
[0049] In the early stages of a game's launch, user activity is low and game revenue is relatively small. At this time, the proportion of Spot instances used can be appropriately increased to reduce resource costs. As the game is promoted and the number of users increases, it enters a rapid growth phase, with user activity and game revenue rising rapidly. To ensure stable game operation, the proportion of reserved instances used should be gradually increased to ensure that critical business operations have sufficient stable resource support. When the game enters its mature phase, user activity and game revenue tend to stabilize. Strategies should be adjusted based on dynamic thresholds to optimize the combination of Spot instances and reserved instances, further reducing costs while maintaining performance. During the game's decline phase, user activity and game revenue gradually decrease. The use of reserved instances should be appropriately reduced, and the proportion of Spot instances increased, until the game ceases operation.
[0050] According to the established resource allocation plan, a resource pool is actually built in the hybrid cloud environment. Using the management console or API provided by the cloud service provider, the appropriate number and types of Spot instances and reserved instances are created. Network parameters and security group rules for the instances are configured to ensure normal communication between instances and compliance with the game's security requirements.
[0051] Different business modules of the game are deployed on corresponding instances. Critical business modules, such as game servers and databases, are deployed on reserved instances; non-critical business modules, such as log processing and data analysis, are deployed on Spot instances. During deployment, thorough testing and verification are conducted to ensure the game runs normally in the hybrid cloud resource pool and that all performance metrics meet requirements.
[0052] During the operation of the hybrid cloud resource pool, establish a real-time cost monitoring system. Utilize the billing interfaces provided by the cloud service provider or third-party monitoring tools to obtain real-time usage and cost information for Spot instances and reserved instances. Compare actual costs with expected costs to analyze the reasons for cost discrepancies.
[0053] Based on cost monitoring results and the actual operation of the game business, resource allocation planning is dynamically adjusted and optimized. If the price of Spot instances is found to be too high or the utilization rate of reserved instances is low within a certain period, the usage ratio of instances is adjusted in a timely manner to find a better resource combination. After continuous optimization and adjustment, the first cost optimization plan is finally output. This plan details the best combination of Spot instances and reserved instances under different game lifecycle stages, different user activity levels, and game revenue conditions, as well as the corresponding cost optimization effects and expected benefits.
[0054] S104 embeds a cost-optimized Sidecar agent into the Service Mesh architecture. Based on the dynamic threshold adjustment strategy and the game lifecycle decay curve, it dynamically adjusts the number of game service replicas and resource limits, and outputs a second cost optimization solution.
[0055] In this embodiment, a Service Mesh architecture suitable for the scale of the game business is determined. During deployment, factors such as the topology of the server cluster, network bandwidth, and communication stability between nodes must be fully considered. For example, for large-scale massively multiplayer online role-playing games (MMORPGs), the server cluster is large and the nodes are widely distributed. It is necessary to ensure that each component in the Service Mesh architecture (such as the control plane and data plane) can run efficiently and stably to ensure smooth communication between game services.
[0056] Based on the characteristics of the Service Mesh architecture and the needs of game operations, a cost optimization sidecar proxy functional module was designed. This proxy primarily features data reception, policy parsing, dynamic adjustment, and result feedback. The data reception module is responsible for obtaining relevant operational data of the game service from the Service Mesh architecture, such as the current number of game service replicas, the resource usage of each replica (CPU, memory, storage, etc.), and inter-service communication traffic. The policy parsing module performs in-depth analysis of pre-generated dynamic threshold adjustment policies and game lifecycle decay curves, transforming them into executable adjustment rules. The dynamic adjustment module dynamically adjusts the number of game service replicas and resource limits based on the parsed rules and real-time game service operational data. The result feedback module feeds back the adjusted effect information to the Service Mesh architecture's monitoring system and management platform, enabling game companies to understand the cost optimization progress in real time.
[0057] The dynamic threshold adjustment strategy and game lifecycle decay curve are integrated to seamlessly interface with the cost-optimized Sidecar agent. The dynamic threshold adjustment strategy includes differentiated resource allocation information for different game types. For example, competitive games require higher CPU and memory resources during peak user activity periods to ensure smooth gameplay, while casual games have relatively stable resource demands. The game lifecycle decay curve reflects the various stages of a game from its initial launch to its decline, along with the trends in user activity, game revenue, and other metrics at each stage.
[0058] Based on the integrated data, adjustments and optimizations were made to the cost optimization Sidecar agent to ensure that the agent accurately understands the resource requirements of different game types at different lifecycle stages and formulates reasonable dungeon quantity and resource limit adjustment plans accordingly. For example, in the early stages of a game's launch, when user activity is low, the agent can appropriately reduce the number of game service dungeons to lower resource costs; as the game is promoted and the number of users increases, entering a period of rapid growth, the agent can promptly increase the number of dungeons to meet user demand.
[0059] After developing and adapting the cost-optimized Sidecar proxy, it was integrated into the Service Mesh architecture. Specifically, based on the Service Mesh architecture's deployment method, the proxy was deployed in a containerized form alongside each game service node, running alongside the game service container. Through the Service Mesh architecture's data plane, tight integration between the proxy and the game service was achieved, ensuring the proxy could obtain real-time game service runtime data and dynamically adjust the game service accordingly.
[0060] After the cost optimization Sidecar agent was implanted and integrated into the Service Mesh architecture, it began to dynamically adjust the number of game service replicas and resource limits based on dynamic threshold adjustment strategies and the game's lifecycle decay curve. The agent monitors the game service's operational data in real time, such as user activity and resource utilization, and compares and analyzes it with the thresholds in the strategy.
[0061] When increased user activity is detected and the current number of game instances cannot meet user demand, the agent automatically increases the number of instances according to its strategy and allocates resources reasonably to ensure that new instances can be launched normally and provide services to users. Simultaneously, based on the game's lifecycle decline curve, the agent predicts the trend of user activity changes over a future period and adjusts the number of instances and resource limits in advance to avoid resource waste or shortages. For example, when the game enters its decline phase and user activity gradually decreases, the agent promptly reduces the number of instances, releasing idle resources and reducing resource costs.
[0062] The cost optimization Sidecar agent dynamically adjusts the number of game server instances and resource limits, recording relevant information and effects in real time, such as adjustment time, number of instances before and after the adjustment, resource usage, and cost changes. This information is then organized and analyzed to generate detailed reports.
[0063] Based on the report, and considering the game company's cost targets and business needs, the effectiveness of the dynamic adjustments was evaluated. If the adjustments were unsatisfactory, the dynamic threshold adjustment strategy and the game lifecycle decay curve were further optimized and adjusted, followed by another round of dynamic adjustments and evaluations until satisfactory cost optimization was achieved. Finally, the validated and optimized dynamic adjustment scheme was compiled and output as a second cost optimization scheme. This scheme details the optimal adjustment strategies for the number of game service instances and resource limits under different game lifecycle stages and user activity levels, along with the corresponding cost optimization effects and expected benefits.
[0064] S105: Construct a cost impact assessment tool using the Monte Carlo simulation algorithm, and evaluate the probability distribution of the impact of the first or second cost optimization scheme on game revenue based on the impact assessment tool.
[0065] In this embodiment, key factors affecting game revenue are identified. For the first cost optimization scheme, key factors may include the ratio of Spot instances to reserved instances, the rationality of resource allocation, and the extent of cost optimization. For example, if the usage ratio of Spot instances is too high, although it may reduce costs, the unreliability of instances may lead to a decline in game service quality, thereby affecting game revenue. For the second cost optimization scheme, key factors may involve the frequency of adjusting the number of game service replicas, the extent of resource limit adjustments, and the degree of matching with the game lifecycle stage. For example, during peak periods of game user activity, if the number of replicas is not adjusted in a timely manner or resource limits are too tight, it will lead to excessively long user waiting times, affecting user experience and game revenue.
[0066] By employing statistical methods such as correlation analysis and regression analysis, the relationship between each key factor and game revenue is quantified, and the influence weight of each factor on game revenue is determined. For example, regression analysis can yield the regression coefficient for each key factor, and the magnitude of the regression coefficient reflects the degree of influence of that factor on game revenue.
[0067] Based on identified key factors and their weighted impact on game revenue, a Monte Carlo simulation model is constructed. In the model, a probability distribution is defined for each key factor. For factors with clear statistical characteristics, such as fluctuations in server resource costs, suitable probability distributions, such as normal or Poisson distributions, can be fitted using historical data. For factors significantly influenced by market conditions and user behavior, such as changes in user activity, their probability distributions can be estimated using expert experience or market research data.
[0068] When building the model, it is also necessary to consider the correlation between key factors. For example, there may be a certain correlation between the combination ratio of Spot instances and reserved instances and the rationality of resource allocation; when the combination ratio changes, the rationality of resource allocation will also be affected. A correlation matrix is established to describe the relationships between the factors, and this correlation is considered in the Monte Carlo simulation to improve the accuracy of the simulation results.
[0069] Extensive simulation experiments were conducted using the pre-constructed Monte Carlo simulation model. In each simulation, a set of data was randomly generated based on the probability distribution of each key factor, representing a possible game operation scenario. This set of data was input into the simulation model, and combined with the specific implementation of either the first or second cost optimization scheme, the game revenue value under that scenario was calculated. Multiple simulation experiments were repeated to obtain a sufficient amount of game revenue sample data. The results of each simulation are influenced by the randomly generated key factor data, thus reflecting the changes in game revenue under different scenarios.
[0070] Statistical analysis was performed on a large amount of simulated game revenue sample data. A probability distribution chart of the game revenue was plotted to visually display the probability of game revenue occurring within different value ranges. By calculating statistics such as the mean, variance, and standard deviation of the sample data, the central tendency and dispersion of the game revenue were understood.
[0071] Based on probability distribution charts and statistics, assess the probability distribution of the impact of the first or second cost optimization scheme on game revenue. For example, if the probability distribution chart shows a higher probability of game revenue falling within a certain higher value range, it indicates that the cost optimization scheme has a positive effect on game revenue; conversely, if the probability of game revenue falling within a lower value range is higher, further analysis is needed to determine the reasons and adjust and optimize the cost optimization scheme accordingly. Furthermore, by comparing the probability distributions under different cost optimization schemes, it is possible to intuitively determine which scheme has a more favorable impact on game revenue, providing a scientific basis for game companies' decision-making.
[0072] In some embodiments, step S101 above, which involves collecting game revenue data and Pod-level resource usage data and inputting them into a TensorFlow-based reinforcement learning model to generate a dynamic threshold adjustment strategy, specifically includes: Collect historical game revenue data and historical Pod-level resource usage data, perform spatiotemporal alignment and integration of historical game revenue data and historical Pod-level resource usage data, and introduce game type identifiers to construct state feature vectors; A deep Q-network model is built based on the TensorFlow framework, using state feature vectors as the state space and resource allocation adjustment actions as the action space, and a reward function with resource utilization efficiency and game revenue stability as the core indicators is pre-set. The deep Q-network model learns the mapping relationship between the state space, action space and reward function through iterative training, and obtains a policy network for outputting actions that maximize cumulative reward. The real-time collected current game revenue data and current Pod-level resource usage data, combined with the game type, are input into the trained policy network to generate a dynamic threshold adjustment policy.
[0073] In this embodiment, since game revenue data and Pod-level resource usage data may come from different data sources, their timestamp accuracy and recording frequency may differ. Therefore, it is necessary to unify the time standard and align the two types of data with the same time granularity, for example, by integrating all data into a time dimension based on hours. Simultaneously, considering the spatial distribution of different game servers or Pods, spatial integration of the data is also necessary to ensure that the data accurately reflects the operational status of the entire game system.
[0074] To differentiate resource usage and revenue characteristics across different game types, a game type identifier is introduced. A unique identifier code is assigned to each game type and added to the corresponding historical game revenue data and historical Pod-level resource usage data. After this processing, the processed historical game revenue data and historical Pod-level resource usage data are combined to construct a state feature vector. This state feature vector should contain sufficient information to describe the game system's operational state at a specific moment, such as the current total game revenue, the revenue share of different game types, and the average resource utilization rate of each Pod.
[0075] A deep Q-network model was built based on the TensorFlow framework. A deep Q-network is a reinforcement learning model that combines deep neural networks and the Q-learning algorithm, capable of handling high-dimensional state and action spaces. In this model, state feature vectors are used as the state space, which should comprehensively and accurately reflect the current state of the game system so that the model can make reasonable decisions based on the state.
[0076] Define resource allocation adjustment actions as the action space. These actions can include increasing or decreasing the number of Pods for a specific game type, or adjusting the resource allocation ratio of Pods (e.g., increasing CPU resource allocation, decreasing memory resource allocation, etc.). The design of the action space should consider feasibility and rationality in actual game operation, avoiding overly complex or impractical actions.
[0077] A pre-defined reward function is used, with resource utilization efficiency and game revenue stability as the core metrics. Resource utilization efficiency is measured by calculating the ratio of a Pod's resource usage to its allocated resources; higher efficiency results in a larger reward. Game revenue stability is assessed by analyzing fluctuations in game revenue over a given period; smaller fluctuations result in a larger reward. The reward function should guide the model to learn resource allocation adjustment strategies that maximize resource utilization efficiency while ensuring stable game revenue.
[0078] The state feature vector, defined action space, and reward function are input into the deep Q-network model to begin the iterative training process. In each iteration, the model selects an action from the action space based on the current state feature vector, executes it, and obtains the corresponding reward value. Simultaneously, the model records the current state, the executed action, the reward obtained, and information about the next state, forming an experience data point in the experience replay buffer.
[0079] To improve the training efficiency and stability of the model, an experience replay mechanism is employed. During training, a batch of experience data is randomly sampled from the experience replay buffer for learning, instead of using only the experience data at the current time step. This breaks the temporal correlation between data points and prevents the model from getting trapped in local optima.
[0080] Deep Q-network models learn the mapping relationship between the state space, action space, and reward function through continuous iterative training. During training, the model gradually adjusts its parameters to maximize the cumulative reward when selecting actions. After multiple iterations, the model obtains a policy network that outputs actions that maximize the cumulative reward. This policy network can quickly and accurately output the optimal resource allocation to adjust actions based on the input state feature vector.
[0081] During actual game operation, real-time game revenue data and current Pod-level resource usage data are collected. Similarly, this real-time data is spatiotemporally aligned and integrated, and combined with game type identifiers to construct the current state feature vector.
[0082] The constructed current state feature vector is input into the trained policy network. Based on the input state feature vector, the policy network generates a dynamic threshold adjustment policy through internal calculation and inference. This dynamic threshold adjustment policy sets differentiated resource allocation strategies for different game types. For example, for game types with high user activity and rapid revenue growth, the number of corresponding Pods and resource allocation are appropriately increased; for game types with declining user activity and reduced revenue, resource allocation is reduced to lower costs.
[0083] By continuously collecting data in real time and inputting it into the strategy network to generate dynamic threshold adjustment strategies, game companies can dynamically and rationally adjust server resource allocation based on the real-time operating status of the game system, thereby achieving the goal of reducing costs and increasing efficiency, and enhancing the game's competitiveness and sustainable development capabilities.
[0084] In some embodiments, step S102 above, which involves inputting user activity data and game revenue data into a pre-built game lifecycle prediction model to generate a game lifecycle decay curve, specifically includes: Acquire time-series data of multiple historical game projects that have completed their lifecycles. The time-series data includes user activity data and game revenue data within a specific time window after the game's launch. Supervised training of the LSTM network using time-series data is used to generate a game lifecycle prediction model; Input the current user activity data and game revenue data of the game to be predicted into the trained game life cycle prediction model, and output the game life cycle decay curve.
[0085] In this embodiment, for each historical game project, user activity data and game revenue data are collected within a specific time window after its launch. User activity data may include metrics such as daily active users (DAU), weekly active users (WAU), monthly active users (MAU), user online time, and user login frequency. These data reflect users' participation and engagement in the game. Game revenue data includes daily recharge amount, weekly recharge amount, monthly recharge amount, and revenue from different paid items, reflecting the game's economic performance. Simultaneously, relevant information for each historical game project is recorded, such as game type (role-playing, strategy, casual, etc.), launch date, operating platform, and target user group. This information will serve as auxiliary features to help improve prediction accuracy during subsequent model training. All collected time-series data and related information for all historical game projects are organized and stored to establish a dedicated dataset.
[0086] An LSTM (Long Short-Term Memory) model is built using deep learning frameworks such as TensorFlow or PyTorch. LSTM networks are a special type of recurrent neural network that effectively handles long-term dependencies in time-series data, making them suitable for time-series problems such as predicting game lifecycles. The established dataset is divided into training and testing sets. The training set is input into the LSTM network for supervised training. During training, user activity data and game revenue data at each time step, along with their corresponding features, are used as input. The game lifecycle state at the next time step (e.g., growth phase, maturity phase, decline phase, etc., or represented by specific numerical values such as the expected change in user activity or game revenue) is used as the label.
[0087] LSTM networks learn the mapping relationship between input data and labels by continuously adjusting their parameters. Backpropagation and gradient descent algorithms are used to update the network's weights and biases, gradually reducing the prediction error on the training set. During training, appropriate training epochs and learning rates are set to avoid overfitting or underfitting. The trained model is evaluated using a test set, and performance is measured by metrics such as accuracy, recall, and mean squared error (MSE). If the model's performance is unsatisfactory, the network structure can be adjusted, training data increased, or training parameters optimized, and training can be retrained until a satisfactory game lifecycle prediction model is obtained.
[0088] When a new game is identified for prediction, its current user activity data and game revenue data are collected in real time. Data preprocessing and feature engineering are then performed to generate feature vectors in the same format as the training data. The processed feature vectors of the game to be predicted are then input into the trained game lifecycle prediction model. Based on the input feature vectors and the learned mapping relationships, the model outputs predicted lifecycle states for the game at various future time steps.
[0089] Based on the model's predicted values, a game lifecycle decay curve is plotted. With time on the horizontal axis and key metrics such as user activity or game revenue on the vertical axis, the predicted metric values at various time points are connected to form a continuous curve. This curve visually illustrates the lifecycle trend of the game from its current state over time, including the growth, stabilization, and decline of user activity and game revenue. Game companies can use this decay curve to develop corresponding operational strategies in advance, such as releasing new versions or conducting promotional activities before the game's decline phase, to extend the game's lifecycle and improve its economic benefits.
[0090] In some embodiments, step S103 above, which involves constructing a hybrid cloud resource pool, optimizing resource costs by combining Spot instances and reserved instances based on a dynamic threshold adjustment strategy and a game lifecycle decay curve, and outputting a first cost optimization scheme, specifically includes: Construct a hybrid cloud resource management abstraction layer to uniformly manage computing instance resources from multiple cloud service providers, forming a hybrid cloud resource pool; Based on the dynamic threshold adjustment strategy, the resource demand benchmark is determined. The stable and fluctuating parts of the load are predicted by combining the game life cycle decay curve. The resource allocation strategy is a combination of reserving instances for the stable demand part and using Spot instances for the fluctuating demand part. Based on the resource allocation strategy, and combined with the hybrid cloud resource pool to perform resource allocation operations, the first cost optimization solution is output.
[0091] In this embodiment, based on research into the interfaces of various cloud service providers, a hybrid cloud resource management abstraction layer is constructed using software programming techniques (such as Python combined with relevant cloud service SDKs). This abstraction layer, acting as a unified interface layer, shields the differences between different cloud service providers, providing standardized resource management interfaces for upper-layer applications. Specifically, the abstraction layer needs to implement basic operation interfaces such as resource querying, creation, startup, stopping, and release, and be able to handle the specific requirements of different cloud service providers in areas such as identity authentication, access control, and billing models.
[0092] Through a hybrid cloud resource management abstraction layer, connections are established with multiple cloud service providers, and their API interfaces are invoked to bring the computing instance resources of each cloud service provider under unified management. These computing instance resources include virtual machine instances and container instances with different configurations. During the management process, each computing instance resource is identified and classified, and key information such as its cloud service provider, instance type, specifications, availability zone, and price is recorded. After integration, a hybrid cloud resource pool is formed, which aggregates rich computing resources from multiple cloud service providers.
[0093] Resource demand baselines are determined based on a dynamic threshold adjustment strategy. This strategy dynamically adjusts server resource allocation according to changes in real-time game performance metrics such as user activity and game revenue. The dynamic threshold adjustment strategy is analyzed to extract resource demand values at different times and under different game states, serving as a basic reference for resource requirements.
[0094] This method combines the game's lifecycle decay curve to predict the stable and fluctuating portions of the load. The game's lifecycle decay curve reflects the changing trends of key indicators such as user activity and game revenue throughout the game's lifecycle, from launch to decline. By analyzing this curve, the stability of the game's load at different stages can be determined. For example, in the game's mature stage, user activity and game revenue are relatively stable, and load fluctuations are small; while in the early stages of launch and the decline stage, load fluctuations are larger.
[0095] Based on the above analysis, a resource allocation strategy is formulated. For the stable load demand, i.e., resource demands that remain relatively stable over a longer period, reserved instances are used for allocation. Reserved instances typically offer advantages such as preferential pricing and resource guarantees, making them suitable for meeting stable business needs and reducing long-term usage costs. For the fluctuating load demand, i.e., resource demands that frequently fluctuate with changes in the game's running status, Spot instances are used for allocation. Spot instances are relatively inexpensive, but may be reclaimed by the cloud service provider at any time. However, due to their price advantage, they can effectively reduce costs when handling fluctuating loads, and the risk of instance reclamation can be mitigated through reasonable scheduling strategies.
[0096] Based on the established resource allocation strategy, the system interacts with the hybrid cloud resource pool through the hybrid cloud resource management abstraction layer to perform resource allocation operations. Specifically, for stable demand, according to the specifications and quantity requirements of reserved instances, a suitable cloud service provider and availability zone are selected from the hybrid cloud resource pool. The corresponding cloud service provider's API interface is then called to create reserved instances, which are then allocated to the game application. When creating reserved instances, factors such as the instance's geographical location and network bandwidth need to be considered to ensure that the game's performance requirements are met.
[0097] For fluctuating demand, the game load changes are monitored in real time. When an increase in load is detected, the hybrid cloud resource management abstraction layer queries the hybrid cloud resource pool for available Spot instances and selects the optimal Spot instance for creation and allocation based on factors such as price and performance. When the load decreases, excess Spot instances are released promptly to avoid resource waste. When handling Spot instances, an instance reclamation early warning mechanism needs to be established. Upon receiving an instance reclamation notification from the cloud service provider, the service can be quickly migrated to other available instances to ensure the normal operation of the game.
[0098] During resource allocation, detailed records are kept of the usage of each instance, including instance type, usage time, and cost. Based on this data and the billing models of different cloud service providers, the total cost of using a combination of reserved and Spot instances is calculated. Simultaneously, the cost is compared with the cost of traditionally using only reserved or on-demand instances to evaluate the cost optimization effect. Finally, the resource allocation strategy, instance usage, cost calculation results, and cost optimization evaluation are compiled and output as the first cost optimization solution, providing a decision-making basis for game companies' resource management and cost control.
[0099] In some embodiments, step S104 above, which involves embedding a cost-optimized Sidecar proxy in the Service Mesh architecture to dynamically adjust the number of game service replicas and resource limits based on a dynamic threshold adjustment strategy and a game lifecycle decay curve, and outputting a second cost optimization scheme, specifically includes: To optimize the development cost of the Sidecar proxy, the cost-optimized Sidecar proxy and the game business container are deployed together in the same Pod of the Service Mesh architecture. Based on the cost optimization Sidecar agent, the latest dynamic threshold adjustment strategy and game lifecycle decay curve are continuously obtained. The dynamic threshold adjustment strategy is used to determine whether the current resource configuration is too high or too low. Combined with the game lifecycle decay curve and the stage of the game, the current cost optimization priority is determined, and several adjustment decisions are output to adjust the number of game service instances and resource limits. Based on the adjustment decision, determine the number of associated replicas or update the resource limit field of the Pod to generate a second cost optimization scheme.
[0100] In this embodiment, the core functionality of the cost optimization sidecar agent is determined. It needs to have the ability to communicate efficiently with the game service container, and to obtain real-time information on the game service's operational status, such as CPU utilization, memory usage, and network traffic. Simultaneously, it needs to be able to interact with external policy management modules to obtain the latest dynamic threshold adjustment policies and game lifecycle decay curves. Furthermore, it needs to have the ability to adjust the number of game service replicas and resource limits, for example, by calling the Kubernetes API (assuming the Service Mesh architecture is built on Kubernetes) to scale replicas up and down and update resource limits.
[0101] The developed, cost-optimized sidecar proxy and the game application container are deployed together in the same Pod within a Service Mesh architecture. During deployment, relevant network and resource parameters need to be configured to ensure proper communication between the sidecar proxy and the game application container, and to prevent negative impacts on each other's performance. For example, CPU and memory resources should be allocated appropriately to avoid resource contention that could lead to performance degradation.
[0102] After the cost optimization Sidecar agent is deployed, it starts running continuously and obtains the latest dynamic threshold adjustment strategies and game lifecycle decay curves in real time.
[0103] The cost optimization Sidecar agent uses the acquired dynamic threshold adjustment strategy to assess the resource configuration of the current game service in real time. It collects the runtime status information of the game service container and compares it with the thresholds set in the dynamic threshold adjustment strategy. If the current CPU utilization is consistently below the set lower threshold and memory usage is also low, it indicates that the current resource configuration may be too high, resulting in resource waste. Conversely, if the CPU utilization is consistently above the set upper threshold, or memory usage is close to saturation, it indicates that the current resource configuration may be insufficient, requiring additional resources to ensure the game's normal operation.
[0104] Simultaneously, by analyzing the game's lifecycle decay curve, the current stage of the game can be determined. For example, in the early stages of a game's launch, user growth is rapid, and load fluctuates significantly. At this time, cost optimization may have a relatively low priority, and the focus should be on ensuring the game's performance and stability. In the mature stage of a game, user activity and game revenue are relatively stable, and load changes are small. At this time, more emphasis can be placed on cost optimization, and resource allocation can be adjusted appropriately to reduce costs. In the declining stage of a game, the number of users gradually decreases, and the load continues to decline. At this time, cost optimization efforts can be further intensified, and unnecessary resources can be reduced.
[0105] Based on the above analysis, the cost optimization Sidecar agent outputs several adjustment decisions for adjusting the number of game service instances and resource limits. For example, if it is determined that the current resource allocation is too high and the game is in its mature stage, the adjustment decision might be to reduce the number of game service instances or lower the resource limit for each instance; if it is determined that the current resource allocation is insufficient and the game is in its early stages of launch, the adjustment decision might be to increase the number of game service instances or increase the resource limit for each instance.
[0106] The cost optimization sidecar agent passes the adjustment decisions to the relevant resource management modules (such as Kubernetes Controller Manager). Based on the adjustment decisions, the resource management modules determine the number of associated replicas or update the resource limit fields of the Pod.
[0107] If the adjustment decision is to reduce the number of game service replicas, the resource management module will send instructions to the nodes in the cluster by calling the Kubernetes API to terminate the corresponding number of game service container instances, thereby reducing the number of replicas. When terminating instances, a certain strategy will be followed, such as prioritizing the termination of instances with lower load or longer running time, to minimize the impact on the game service.
[0108] If the adjustment decision is to increase the number of game service replicas, the resource management module will select appropriate nodes to create new game service container instances based on the current cluster resource usage and add them to the game service to expand the number of replicas.
[0109] If the adjustment decision is to update the resource limit fields of the Pod, the resource management module will modify the resource limit parameters in the Pod's definition file, such as the CPU and memory limit values, and apply the modified definition file to the cluster to make the new resource limits effective.
[0110] After adjusting the number of instances and resource limits, the resource management module meticulously records the entire adjustment process and results, including the adjustment time, the decision-making process, and the instance count and resource limits before and after the adjustment. Based on this information, a second cost optimization plan is generated. This plan not only includes specific adjustment measures but also evaluates and predicts the cost optimization effect, such as the expected cost savings and the impact on game service performance, providing game companies with comprehensive decision-making support for resource management and cost control.
[0111] In some embodiments, step S105 above, specifically assessing the probability distribution of the impact of the first cost optimization scheme or the second cost optimization scheme on game revenue using an impact assessment tool, includes: The cost optimization parameters of the first cost optimization scheme or the second cost optimization scheme, as well as a set of key evaluation variables and their corresponding uncertainty probability distributions, are input into the cost impact assessment tool. The key evaluation variables include the revenue loss coefficient that may be caused by the reduction of unit resources and the sensitivity of player churn rate to resource changes. In the cost impact assessment tool, the Monte Carlo simulation process is initialized by performing a large number of simulation iterations, and in each iteration, a set of variable values are randomly generated for the key assessment variables according to the corresponding probability distribution. In each simulation iteration, randomly generated variable values and cost optimization parameters are input into a preset impact calculation model to calculate the corresponding game revenue impact value under that iteration. After all simulation iterations are completed, statistical analysis is performed on the game revenue impact values calculated from all iterations to generate a distribution report representing the probability of different impact outcomes.
[0112] In this embodiment, key cost optimization parameters are extracted from either the first or second cost optimization scheme. For the first cost optimization scheme, these parameters include the combination ratio of reserved instances and Spot instances, and the specific values of resource allocation at different stages; for the second cost optimization scheme, the parameters involve the adjustment range of the number of game service replicas, changes in Pod resource limits, etc.
[0113] Identify a set of key evaluation variables, such as the revenue loss coefficient resulting from a reduction in unit resources and the sensitivity of player churn rate to resource changes. The revenue loss coefficient reflects the percentage decrease in game revenue that might result from a reduction in a certain amount of resources (such as CPU and memory). This coefficient needs to be estimated in conjunction with the game's business characteristics and historical data. For example, by analyzing the relationship between resource adjustments and revenue changes over a past period, we can calculate the average percentage decrease in game revenue for every 10% reduction in CPU resources. The sensitivity of player churn rate to resource changes indicates the degree to which resource changes affect players' willingness to leave the game, and can be obtained through player surveys and data analysis. For instance, by conducting questionnaires with players, we can understand their retention intentions when resource performance degrades (such as game lag), and then assess the relationship between player churn rate and resource changes.
[0114] For each key evaluation variable, determine the corresponding uncertainty probability distribution. Because these variables are influenced by multiple factors, their values have a certain degree of uncertainty. For example, the revenue loss coefficient that may result from a reduction in unit resources may be affected by factors such as game version updates and changes in the market competition environment, and its value may follow a normal distribution, a uniform distribution, etc. The technical team needs to combine historical data, expert experience, and market research results to select an appropriate probability distribution type for each variable and determine the distribution parameters, such as mean and variance.
[0115] The prepared cost optimization parameters and key evaluation variables, along with their probability distributions, are input into the cost impact assessment tool. This tool is typically a software system or platform with simulation capabilities, enabling the execution of Monte Carlo simulation algorithms.
[0116] In the cost impact assessment tool, initialize the Monte Carlo simulation process. Set the total number of simulation iterations; more iterations result in more accurate simulations, but also increase computation time. Generally, choose an appropriate number of iterations, such as 10,000 or more, based on actual needs and available computing resources. Simultaneously, create an independent computing environment for each simulation iteration to ensure data independence between iterations and avoid mutual interference. Initialize the random number generator to prepare for generating random variable values based on probability distributions in each iteration. The seed for the random number generator can be set based on system time or other random factors to ensure the randomness of each simulation.
[0117] In each simulation iteration, the cost impact assessment tool uses a random number generator to randomly generate a set of variable values for each key assessment variable based on the probability distribution of uncertainty corresponding to the key assessment variables. For example, if the flow loss coefficient that may result from a reduction in unit resources follows a normal distribution, the tool will generate a random value that conforms to the probability density function of the normal distribution and the set parameters as the value of the variable in the current iteration.
[0118] The randomly generated variable values, along with the cost optimization parameters extracted from the cost optimization scheme, are input into the preset impact calculation model. The impact calculation model is a mathematical model established based on the game's business logic and cost-revenue relationship. It comprehensively considers the impact of cost optimization parameters and key evaluation variables to calculate the corresponding game revenue impact value for this iteration. For example, the model might calculate the change in game revenue after this resource adjustment based on factors such as the proportion of resource reduction, the revenue loss coefficient caused by unit resource reduction, and the sensitivity of player churn rate to resource changes.
[0119] The cost impact assessment tool records the game revenue impact value calculated in each iteration and stores it in a specified data structure.
[0120] After completing all simulation iterations, the cost impact assessment tool performs statistical analysis on the game revenue impact values calculated in all iterations. It calculates the statistical characteristics of the game revenue impact values, such as mean, variance, and standard deviation. These statistical characteristics reflect the central tendency and dispersion of the game revenue impact.
[0121] Based on the range of game revenue impact values, the values are divided into several intervals, and the frequency of occurrence of the game revenue impact value within each interval is counted. For example, the game revenue impact value is divided into intervals such as -10% to -5%, -5% to 0%, 0 to 5%, and 5% to 10%, and the proportion of iterations within each interval to the total number of iterations is counted.
[0122] Based on the statistical analysis results, a distribution report is generated to represent the probability of different impact outcomes. The distribution report can be presented in the form of charts (such as histograms, probability density function graphs, etc.) and tables, intuitively showing the distribution of game revenue impact values across different intervals and the corresponding probability for each interval. Through the distribution report, game company decision-makers can clearly understand the potential impact and probability of cost optimization measures on game revenue, thus providing a scientific basis for deciding whether to implement cost optimization measures.
[0123] In some embodiments, the method further includes, in steps S101 to S105 above: In the container orchestration platform, a structured tagging system is set up for Pods that deploy game microservices. The structured tagging system includes game project identifiers and game module identifiers. The monitoring agent collects basic resource consumption data for each Pod, synchronously collects network traffic data between services, and associates the structured tags corresponding to each Pod with each piece of basic resource consumption data and each piece of network traffic data collected. A cost calculation engine is built. By querying a pre-built cost allocation rule library, it performs correlation analysis and cost calculation on tagged basic resource consumption data and network traffic data, and allocates direct resource costs and indirect network costs to the corresponding initiating business modules. Combined with directed graph technology, a cost traceability view is formed.
[0124] In this embodiment, a structured tagging system specification is established within the container orchestration platform (taking Kubernetes as an example). This specification clarifies the naming rules and hierarchical structure of game project identifiers and game module identifiers. For example, game project identifiers can adopt the format "project name-version number", such as "XX mobile game-V1.2"; game module identifiers are further subdivided according to the game's functional modules, such as "login module", "battle module", "store module", etc.
[0125] When deploying Pods for game microservices, follow the established tagging system specifications and set corresponding structured tags for each Pod using Kubernetes YAML configuration files or command-line tools. In the YAML configuration file, add the game project identifier and game module identifier to the `labels` subfield under the `metadata` field.
[0126] Deploy monitoring agents (such as Prometheus' Node Exporter and cAdvisor) in the container orchestration platform. These agents are responsible for collecting basic resource consumption data for each Pod in real time, including CPU utilization, memory usage, and disk I / O. Simultaneously, utilize network monitoring tools (such as Calico's Flowlog-Enabler or Weave Scope) to collect network traffic data between services, including the number of packets sent and received, and network bandwidth usage.
[0127] After collecting data, the monitoring agent associates the structured tags (game project identifier and game module identifier) corresponding to each Pod with each piece of basic resource consumption data and each piece of network traffic data collected. Taking Prometheus as an example, the tag information is stored as metadata for the metrics during data storage.
[0128] Build a cost allocation rule base. The cost allocation rule base includes direct resource cost allocation rules and indirect network cost allocation rules.
[0129] For direct resource cost allocation rules, different cost allocation ratios for resources (CPU, memory, disk, etc.) are established based on the game project's budget and resource usage. For example, for the "Legendary Mobile Game - V1.2" project, the cost allocation ratio for CPU resources is set at X yuan per core per hour, and the cost allocation ratio for memory resources is set at Y yuan per GB per hour. Simultaneously, considering the resource consumption characteristics and importance of different game modules, the resource cost allocation for each module is fine-tuned. For example, the combat module has higher requirements for CPU and memory, so its resource cost allocation ratio can be appropriately increased.
[0130] The rules for allocating indirect network costs are formulated based on the network traffic interactions between game modules. Network traffic data between game modules is analyzed to determine the frequency and volume of each module's role as a network traffic initiator and receiver. For example, the login module primarily receives login requests from players, resulting in relatively low network traffic; while the combat module frequently interacts with other modules, leading to higher network traffic. Based on these analyses, network cost allocation rules are developed, such as distributing network costs to each initiating business module according to the proportion of network traffic.
[0131] Develop a cost calculation engine that can query the cost allocation rule base, process tagged data, and perform cost calculations. The engine periodically queries tagged basic resource consumption data and network traffic data from a monitoring system (such as Prometheus) and performs correlation analysis and cost calculations based on the rules in the retrieved cost allocation rule base.
[0132] When calculating direct resource costs, the cost calculation engine uses the basic resource consumption data of each Pod and the corresponding resource cost allocation ratio to calculate the direct resource cost of each game module. For example, for a Pod in the "login module", the direct resource cost of that Pod is calculated based on its CPU utilization and memory usage, combined with the cost allocation ratio of CPU and memory. Then, the direct resource costs of all Pods under the same game module are summed to obtain the total direct resource cost of that game module.
[0133] When calculating indirect network costs, the cost calculation engine allocates network costs to each initiating business module based on network traffic data and network cost allocation rules. For example, based on the network traffic ratio between the combat module and other modules, network costs are allocated to the combat module proportionally.
[0134] The cost calculation engine allocates the calculated direct resource costs and indirect network costs to the corresponding initiating business modules, and then uses directed graph technology to form a cost sourcing view. Nodes in the directed graph represent game modules, edges represent resource calls and network interactions between modules, and edge weights represent the proportion of resource consumption or network traffic. The cost sourcing view provides a clear view of the cost sources and destinations for each game module, as well as the cost relationships with other modules, offering strong decision support for cost control and optimization in game projects. For example, if the cost of a certain game module is found to be too high, the cost sourcing view can quickly pinpoint whether it's due to excessive resource consumption or frequent network interactions, allowing for appropriate optimization measures to be taken.
[0135] Reference Figure 2 An embodiment of the present invention provides a game cost automatic early warning and management system 2, wherein the system 2 specifically includes: The adjustment strategy module 201 is used to collect game revenue data and Pod-level resource usage data, and input them into a reinforcement learning model based on TensorFlow to generate a dynamic threshold adjustment strategy. The dynamic threshold adjustment strategy is used to set differentiated resource allocation strategies for different game types. The game lifecycle module 202 is used to acquire user activity data, input user activity data and game revenue data into a pre-built game lifecycle prediction model, and generate a game lifecycle decay curve. The first optimization module 203 is used to build a hybrid cloud resource pool. Based on the dynamic threshold adjustment strategy and the game life cycle decay curve, it optimizes resource costs by combining Spot instances and reserved instances, and outputs the first cost optimization scheme. The second optimization module 204 is used to implant a cost optimization Sidecar agent into the Service Mesh architecture, dynamically adjust the number of game service replicas and resource limits according to the dynamic threshold adjustment strategy and the game life cycle decay curve, and output the second cost optimization scheme. The impact assessment module 205 is used to construct a cost impact assessment tool through a Monte Carlo simulation algorithm, and to assess the probability distribution of the impact of the first cost optimization scheme or the second cost optimization scheme on the game revenue based on the impact assessment tool.
[0136] It is understandable that, such as Figure 1 The content shown in the embodiments of the automatic game cost warning and management method is applicable to the embodiments of this automatic game cost warning and management system. The specific functions implemented by the embodiments of this automatic game cost warning and management system are the same as those shown in the figure. Figure 1 The illustrated method for automatic game cost warning and management is the same as that provided, and achieves the same beneficial effects. Figure 1 The beneficial effects achieved by the illustrated embodiment of the automatic game cost warning and management method are the same.
[0137] It should be noted that the information interaction and execution process between the above systems are based on the same concept as the method embodiments of the present invention. For details on their specific functions and technical effects, please refer to the method embodiments section, which will not be repeated here.
[0138] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the above-described division of functional units and modules is merely an example. In practical applications, the above functions can be assigned to 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 embodiments can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit. Furthermore, the specific names of the functional units and modules are only for easy differentiation and are not intended to limit the scope of protection of this application. The specific working process of the units and modules in the above system can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.
[0139] Reference Figure 3The present invention also provides a computer device 3, including: a memory 302 and a processor 301, and a computer program 303 stored on the memory 302. When the computer program 303 is executed on the processor 301, it implements the automatic warning and management method for game costs as described in any of the above methods.
[0140] The computer device 3 may be a desktop computer, laptop, handheld computer, or cloud server, etc. The computer device 3 may include, but is not limited to, a processor 301 and a memory 302. Those skilled in the art will understand that... Figure 3 The computer device 3 is merely an example and does not constitute a limitation on the computer device 3. It may include more or fewer components than shown in the figure, or combine certain components, or different components, such as input / output devices, network access devices, etc.
[0141] The processor 301 may be a Central Processing Unit (CPU), or it may be other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), 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.
[0142] In some embodiments, the memory 302 may be an internal storage unit of the computer device 3, such as a hard disk or memory of the computer device 3. In other embodiments, the memory 302 may be an external storage device of the computer device 3, such as a plug-in hard disk, smart media card (SMC), secure digital (SD) card, flash card, etc., equipped on the computer device 3. Furthermore, the memory 302 may include both internal and external storage units of the computer device 3. The memory 302 is used to store the operating system, applications, boot loader, data, and other programs, such as the program code of the computer program. The memory 302 can also be used to temporarily store data that has been output or will be output.
[0143] This invention also provides a computer-readable storage medium storing a computer program thereon, which, when executed by a processor, implements the automatic game cost warning and management method as described in any of the above methods.
[0144] In this embodiment, if the integrated unit is implemented as 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, all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a computer-readable storage medium, and when executed by a processor, it can implement the steps of the various method embodiments described above. The computer program includes computer program code, which can be in the form of source code, object code, executable files, or certain intermediate forms. The computer-readable medium can include at least: any entity or device capable of carrying computer program code to a photographing device / terminal device, a recording medium, a computer memory, a read-only memory (ROM), a random access memory (RAM), an electrical carrier signal, a telecommunication signal, and a software distribution medium. Examples include USB flash drives, portable hard drives, magnetic disks, or optical disks. In some jurisdictions, according to legislation and patent practice, computer-readable media cannot be electrical carrier signals or telecommunication signals.
[0145] In the above embodiments, the descriptions of each embodiment have different focuses. For parts that are not described in detail or recorded in a certain embodiment, please refer to the relevant descriptions of other embodiments.
[0146] Those skilled in the art will recognize that the units and algorithm steps of the various examples 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 implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0147] In the embodiments disclosed in this 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 merely illustrative. For instance, the division of modules or units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the displayed or discussed mutual coupling or direct coupling or communication connection may be through some interfaces; the indirect coupling or communication connection between devices or units may be electrical, mechanical, or other forms.
[0148] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
Claims
1. A method for automatic early warning and management of game costs, characterized in that, The method specifically includes: Collect game revenue data and Pod-level resource usage data, and input them into a reinforcement learning model based on TensorFlow to generate a dynamic threshold adjustment strategy. The dynamic threshold adjustment strategy is used to set differentiated resource allocation strategies for different game types. Acquire user activity data, input the user activity data and game revenue data into a pre-built game lifecycle prediction model, and generate a game lifecycle decay curve. Construct a hybrid cloud resource pool, and optimize resource costs by combining Spot instances and reserved instances based on dynamic threshold adjustment strategies and game lifecycle decay curves, outputting the first cost optimization solution. In the Service Mesh architecture, a cost optimization Sidecar agent is implanted to dynamically adjust the number of game service replicas and resource limits based on dynamic threshold adjustment strategies and the game lifecycle decay curve, and outputs a second cost optimization scheme. A cost impact assessment tool is constructed using the Monte Carlo simulation algorithm. Based on this tool, the probability distribution of the impact of the first or second cost optimization scheme on game revenue is evaluated.
2. The method according to claim 1, characterized in that, The process involves collecting game revenue data and Pod-level resource usage data, and inputting this data into a TensorFlow-based reinforcement learning model to generate a dynamic threshold adjustment strategy. Specifically, this includes: Collect historical game revenue data and historical Pod-level resource usage data, perform spatiotemporal alignment and integration of historical game revenue data and historical Pod-level resource usage data, and introduce game type identifiers to construct state feature vectors; A deep Q-network model is built based on the TensorFlow framework, using state feature vectors as the state space and resource allocation adjustment actions as the action space, and a reward function with resource utilization efficiency and game revenue stability as the core indicators is pre-set. The deep Q-network model learns the mapping relationship between the state space, action space and reward function through iterative training, and obtains a policy network for outputting actions that maximize cumulative reward. The real-time collected current game revenue data and current Pod-level resource usage data, combined with the game type, are input into the trained policy network to generate a dynamic threshold adjustment policy.
3. The method according to claim 1, characterized in that, The step of inputting user activity data and game revenue data into a pre-built game lifecycle prediction model to generate a game lifecycle decay curve specifically includes: Acquire time-series data of multiple historical game projects that have completed their lifecycles. The time-series data includes user activity data and game revenue data within a specific time window after the game's launch. Supervised training of the LSTM network using time-series data is used to generate a game lifecycle prediction model; Input the current user activity data and game revenue data of the game to be predicted into the trained game life cycle prediction model, and output the game life cycle decay curve.
4. The method according to claim 1, characterized in that, The construction of a hybrid cloud resource pool, based on a dynamic threshold adjustment strategy and the game's lifecycle decay curve, optimizes resource costs by combining Spot instances and reserved instances, outputting a first cost optimization solution, specifically including: Construct a hybrid cloud resource management abstraction layer to uniformly manage computing instance resources from multiple cloud service providers, forming a hybrid cloud resource pool; Based on the dynamic threshold adjustment strategy, the resource demand benchmark is determined. The stable and fluctuating parts of the load are predicted by combining the game life cycle decay curve. The resource allocation strategy is a combination of reserving instances for the stable demand part and using Spot instances for the fluctuating demand part. Based on the resource allocation strategy, and combined with the hybrid cloud resource pool to perform resource allocation operations, the first cost optimization solution is output.
5. The method according to claim 1, characterized in that, The aforementioned method involves embedding a cost-optimized sidecar proxy into the Service Mesh architecture. This proxy dynamically adjusts the number of game service replicas and resource limits based on a dynamic threshold adjustment strategy and the game's lifecycle decay curve, outputting a second cost-optimization scheme. Specifically, this includes: To optimize the development cost of the Sidecar proxy, the cost-optimized Sidecar proxy and the game business container are deployed together in the same Pod of the Service Mesh architecture. Based on the cost optimization Sidecar agent, the latest dynamic threshold adjustment strategy and game lifecycle decay curve are continuously obtained. The dynamic threshold adjustment strategy is used to determine whether the current resource configuration is too high or too low. Combined with the game lifecycle decay curve and the stage of the game, the current cost optimization priority is determined, and several adjustment decisions are output to adjust the number of game service instances and resource limits. Based on the adjustment decision, determine the number of associated replicas or update the resource limit field of the Pod to generate a second cost optimization scheme.
6. The method according to claim 1, characterized in that, The process of evaluating the probability distribution of the impact of the first or second cost optimization scheme on game revenue using an impact assessment tool specifically includes: The cost optimization parameters of the first cost optimization scheme or the second cost optimization scheme, as well as a set of key evaluation variables and their corresponding uncertainty probability distributions, are input into the cost impact assessment tool. The key evaluation variables include the revenue loss coefficient that may be caused by the reduction of unit resources and the sensitivity of player churn rate to resource changes. In the cost impact assessment tool, the Monte Carlo simulation process is initialized by performing a large number of simulation iterations, and in each iteration, a set of variable values are randomly generated for the key assessment variables according to the corresponding probability distribution. In each simulation iteration, randomly generated variable values and cost optimization parameters are input into a preset impact calculation model to calculate the corresponding game revenue impact value under that iteration. After all simulation iterations are completed, statistical analysis is performed on the game revenue impact values calculated from all iterations to generate a distribution report representing the probability of different impact outcomes.
7. The method according to any one of claims 1 to 6, characterized in that, The method further includes: In the container orchestration platform, a structured tagging system is set up for Pods that deploy game microservices. The structured tagging system includes game project identifiers and game module identifiers. The monitoring agent collects basic resource consumption data for each Pod, synchronously collects network traffic data between services, and associates the structured tags corresponding to each Pod with each piece of basic resource consumption data and each piece of network traffic data collected. A cost calculation engine is built. By querying a pre-built cost allocation rule library, it performs correlation analysis and cost calculation on tagged basic resource consumption data and network traffic data, and allocates direct resource costs and indirect network costs to the corresponding initiating business modules. Combined with directed graph technology, a cost traceability view is formed.
8. A game cost automatic early warning and management system, characterized in that, The system specifically includes: The adjustment strategy module is used to collect game revenue data and Pod-level resource usage data, and input them into a reinforcement learning model based on TensorFlow to generate a dynamic threshold adjustment strategy. The dynamic threshold adjustment strategy is used to set differentiated resource allocation strategies for different game types. The game lifecycle module is used to acquire user activity data, input user activity data and game revenue data into a pre-built game lifecycle prediction model, and generate a game lifecycle decay curve. The first optimization module is used to build a hybrid cloud resource pool. Based on the dynamic threshold adjustment strategy and the game life cycle decay curve, it optimizes resource costs by combining Spot instances and reserved instances, and outputs the first cost optimization solution. The second optimization module is used to implant a cost optimization Sidecar agent into the Service Mesh architecture. It dynamically adjusts the number of game service replicas and resource limits based on the dynamic threshold adjustment strategy and the game lifecycle decay curve, and outputs a second cost optimization scheme. The impact assessment module is used to build a cost impact assessment tool using the Monte Carlo simulation algorithm, and to assess the probability distribution of the impact of the first or second cost optimization scheme on game revenue based on the impact assessment tool.
9. A computer device, characterized in that, include: The memory and processor, and the computer program stored in the memory, when the computer program is executed on the processor, implement the automatic warning and management method for game costs as described in any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that, It stores a computer program, which, when executed by a processor, implements the automatic warning and management method for game costs as described in any one of claims 1 to 7.