A game stage target difficulty adjusting method based on player preference alignment
By unifying the modeling of player behavior sequences and level conditions, and optimizing difficulty adjustment using preference alignment strategy models and reward models, the problem of difficulty in distinguishing player preference boundaries and stage rhythm in existing technologies is solved, achieving stability and personalized adaptation of dynamic difficulty adjustment.
Patent Information
- Application Number
- CN202611463125.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-09-20
- Publication Date
- 2026-11-27
AI Technical Summary
Existing technologies struggle to differentiate players' tolerance boundaries for difficulty changes in games, leading to inaccurate difficulty adjustments, increased churn rates, and frequent manual reverts. They also fail to effectively learn player preference boundaries and the pace of stage goals.
By establishing a candidate adjustment action set, action mapping table, behavior sequence field table, level parameter table, and stage target state table, a unified input representation is generated. The player preference alignment strategy model and reward model are used for supervised fine-tuning and direct preference optimization. The preference score and experience score of the candidate adjustment action are calculated, and the legality screening and conservative adjustment judgment are performed to determine the target adjustment action.
It enables dynamic difficulty adjustment based on player preferences, reduces churn rate and frequency of manual callbacks, and improves the personalized adaptation of the game experience and the stability of the stage rhythm.
Smart Images

Figure CN123167499A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of game development technology, specifically relating to a method for dynamically adjusting the difficulty of game stage objectives. Background Technology
[0002] Online difficulty adjustment has long relied on fixed completion rate thresholds or game design configuration tables, compressing complex subjective experiences into low-dimensional statistics such as whether a level is cleared and average win rate. This makes it difficult to distinguish between boundary conditions like "clearing the level but having a poor experience" and "failing but still wanting to continue." Existing reactive adjustment schemes lack long-sequence causal modeling, making it difficult to identify players' acceptance boundaries for difficulty changes at points such as stage transitions, resource depletion precursors, continuous attacks, and boss mechanics. Adjustments tend to fluctuate between insufficient warm-up and over-adjustment, leading to increased churn, frequent manual re-adjustments, and repeated manual adjustments before new levels are released. Therefore, an online difficulty adjustment method is needed that unifies the modeling of player behavior sequences, level conditions, and stage progression status, and directly learns the boundaries of player preferences.
[0003] In summary, existing technologies suffer from the following shortcomings: First, compressing player subjective experience into low-dimensional explicit indicators makes it difficult to learn preference boundaries and learn the relative relationship between better and worse adjustment actions from behavioral context. Second, state representation lacks long-sequence causal context, making it difficult to model the rhythm of stage goals and effectively distinguish the boundary regions of "high challenge but high engagement" and "high challenge and high churn." Third, optimization objectives mostly remain at reactive adjustments, lacking a joint alignment mechanism that integrates satisfaction, frustration, continue rate, and stage goal completion stability into the same training objective. Therefore, frequent callback rules and parameter tables still require manual planning. There is an urgent need in this field for a method that can uniformly model player behavior sequences, level conditions, and stage goal states, directly learn player preference boundaries, and consider the stability of stage rhythm while adjusting the difficulty of game stage goals. Summary of the Invention
[0004] The purpose of this invention is to provide a method for adjusting the difficulty of game stage goals based on player preference alignment, thereby addressing the problems of existing technologies that simplify player experience to low-dimensional explicit indicators, lack long-sequence context modeling, and struggle to balance stage goal pacing with subjective experience, leading to difficulty adjustment mismatch, increased churn risk, and increased manual parameter tuning costs. To achieve the above objective, this invention provides a method for adjusting the difficulty of game stage goals based on player preference alignment, comprising: Step S1: Establish the candidate adjustment action set, action mapping table, behavior sequence field table, checkpoint parameter table, stage target state table, manual approval sample index, and preference sample pair index; Step S2: Based on the behavior sequence field table, level parameter table, and stage target state table, generate a unified input representation for the player behavior sequence, level parameters, and stage target state, and perform boundary sample mining on the index based on the preference samples to obtain preference training samples; Step S3: Based on the manually approved sample index and preference training samples, supervised fine-tuning, reward modeling and direct preference optimization are performed on the player preference alignment strategy model and reward model. Stage goal constraint training is performed based on the stage goal completion probability and stage rhythm category to obtain the trained player preference alignment strategy model and reward model. Step S4: Read the current player's recent behavior window, current level parameters, and current stage target state; generate a context representation based on the trained player preference alignment strategy model; and calculate the preference score of each candidate adjustment action based on the candidate adjustment action set. Step S5: Calculate the experience score and future bounce risk of each candidate adjustment action based on the preference score and reward model, perform legality screening and conservative adjustment judgment on the candidate adjustment actions, determine the target adjustment action, and output the game stage target difficulty adjustment parameters corresponding to the target adjustment action based on the action mapping table.
[0005] Preferably, establishing the candidate adjustment action set, action mapping table, behavior sequence field table, level parameter table, stage target state table, human-approved sample index, and preference sample pair index includes: reading the difficulty control items that can be adjusted online, and organizing each difficulty control item into the candidate adjustment action set; establishing a one-to-one corresponding action mapping table for each candidate adjustment action in the candidate adjustment action set, and recording the action's action phase, maximum allowed trigger frequency, and action mutual exclusion relationship in the action mapping table; organizing player time sequence logs according to a fixed time order, and establishing the behavior sequence field table containing operation events, hit events, displacement changes, resource changes, skill release intervals, target advancement information, stagnation duration, and checkpoint rollback information; establishing the level parameter table storing static level conditions and the stage target state table storing the current stage advancement state; extracting human-approved adjustment records from historical adjustment records to obtain the human-approved sample index, and relatively comparing the subsequent results corresponding to multiple candidate adjustment actions in the same player group, adjacent level environment, and similar stage advancement state to obtain the preference sample pair index.
[0006] Preferably, the boundary sample mining based on the preference samples to obtain preference training samples includes: within a preset statistical window after the action takes effect, calculating the replay rate difference, stage retention rate difference, active continuation rate difference, negative feedback rate difference, and post-game evaluation difference of each candidate adjustment action relative to the benchmark action; multiplying the replay rate difference, stage retention rate difference, active continuation rate difference, negative feedback rate difference, and post-game evaluation difference with the corresponding preset joint judgment weights, and summing the multiplication results to obtain the joint judgment score of each candidate adjustment action; under the same state context, when the difference in the joint judgment score of two candidate adjustment actions is not less than a preset preference judgment threshold, the one with the higher score is recorded as the preferred action, and the one with the lower score is recorded as the poor action; filtering boundary samples from segments that are cleared but have low subjective evaluation, segments that are not cleared but have high continued participation, and segments that fail briefly but retry multiple times, and constructing comparison pairs of preferred actions and poor actions between the boundary samples under the same state context to obtain the preference training samples.
[0007] Preferably, generating a unified input representation for player behavior sequences, level parameters, and stage target states includes: resampling and aligning the player behavior sequences according to timestamps, performing embedding mapping on discrete behavior fields, performing segmented scaling on continuous behavior fields according to preset segmentation rules, and performing one-hot encoding on Boolean behavior fields to obtain a single-step input representation; organizing the single-step input representation according to time order to obtain a behavior sequence input, and filling missing steps with preset no-operation markers and corresponding mask bits; generating event markers based on stage boundary events, boss mechanism trigger events, supply scarcity events, and checkpoint rollback events, and inserting the event markers into corresponding time steps; projecting the level parameters and stage target states into condition markers respectively, and jointly encoding the condition markers with the behavior sequence input and event markers to obtain the unified input representation.
[0008] Preferably, the process of supervised fine-tuning, reward modeling, and direct preference optimization includes: supervising fine-tuning the player preference alignment strategy model based on the manually approved sample index, enabling the player preference alignment strategy model to learn the basic strategy distribution corresponding to manually approved adjustment actions; constructing the reward model based on the preference training samples, which receives player behavior sequences, level parameters, stage target states, and candidate adjustment actions; generating satisfaction sub-labels, frustration sub-labels, and retention sub-labels respectively, and synthesizing the satisfaction sub-labels, frustration sub-labels, and retention sub-labels according to their corresponding preset reward synthesis weights to obtain a comprehensive reward label; performing pairwise comparison training on the reward model based on the comprehensive reward label and the preference training samples, so that the experience score of the reward model for the output of the preferred action is higher than the experience score for the output of the poor action; using the supervised fine-tuned basic strategy distribution as a reference strategy, and performing direct preference optimization on the player preference alignment strategy model based on the relative probability interval between the preferred action and the poor action under the current strategy and the reference strategy, to obtain the parameters of the player preference alignment strategy model and the reward model.
[0009] Preferably, the stage goal constraint training based on the stage goal completion probability and stage rhythm category to obtain the trained player preference alignment strategy model and reward model includes: predicting the stage goal completion probability and stage rhythm category based on the context representation after terminal aggregation and candidate adjustment action embedding; generating the true stage rhythm category based on the standard time consumption ratio, resource suppression window ratio, mechanism density, checkpoint backoff frequency, and stagnation duration between sub-goals; calculating the stage goal constraint loss based on the deviation between the predicted stage goal completion probability and the target completion probability benchmark, and the classification error between the predicted stage rhythm category and the true stage rhythm category; weighting and summing the stage goal constraint loss with the supervised fine-tuning loss, the reward model loss, and the direct preference optimization loss to obtain the total training loss; and updating the player preference alignment strategy model and reward model based on the total training loss to obtain the trained player preference alignment strategy model and reward model.
[0010] Preferably, calculating the preference score of each candidate adjustment action based on the candidate adjustment action set includes: reading the current player's recent behavior window, and generating online input according to the field rules consistent with the training phase, in conjunction with the current level parameters and the current stage target state; inputting the online input into the trained player preference alignment strategy model to obtain the original score corresponding to each candidate adjustment action; performing temperature scaling on the original score to obtain the preference score of each candidate adjustment action; when online inference fails, calling the action distribution generated by the most recent successful inference as the alternative distribution for the current cycle, and switching to the pre-stored static safety action when consecutive inference failures reach a preset condition.
[0011] Preferably, the process of performing legality screening and conservative adjustment judgment on candidate adjustment actions to determine the target adjustment action includes: filtering the candidate adjustment actions based on the remaining time, remaining resources, script enforcement mechanism, core rhythm restrictions of the leader stage, survival safety restrictions, and adjustment frequency restrictions to obtain legal candidate actions; calculating the experience score and future bounce risk of each legal candidate action based on the reward model, and calculating the adjustment range distance of each legal candidate action relative to the currently effective action; screening out a safe candidate action subset from the legal candidate actions whose future bounce risk is not higher than a preset risk threshold; when the safe candidate action subset is not empty, calculating a comprehensive conservative score based on the preference score, experience score, and adjustment range distance of each candidate adjustment action relative to the currently effective action, and selecting the candidate adjustment action with the largest comprehensive conservative score as the target adjustment action; when the safe candidate action subset is empty, selecting the candidate adjustment action with the smallest future bounce risk and the smallest adjustment range distance from the legal candidate actions as the target adjustment action.
[0012] Preferably, the output of game stage target difficulty adjustment parameters corresponding to the target adjustment action based on the action mapping table includes: converting the target adjustment action into game stage target difficulty adjustment parameters executable by the game engine according to the action mapping table, wherein the game stage target difficulty adjustment parameters include enemy number adjustment items, enemy behavior intensity adjustment items, supply refresh rhythm adjustment items, mission time limit adjustment items, prompt trigger adjustment items, and checkpoint location adjustment items; sending an update instruction containing the game stage target difficulty adjustment parameters to the game logic server, and carrying the action version number, effective timestamp, and rollback identifier in the update instruction; continuously receiving stage target progress results, changes in failure count, changes in persist rate, post-game feedback, and exit status within a preset observation window after the game stage target difficulty adjustment parameters take effect, forming a feedback collection record; and updating the manual approval candidate record and preference sample candidate record based on the feedback collection record.
[0013] The present invention also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and running on the processor, wherein the processor executes the computer program to implement the steps of the above method.
[0014] This invention transforms difficulty adjustment from fixed threshold correction to trainable ranking decisions based on relative preferences by unifying the representation of behavior sequences, level conditions, and stage progress states, thus shortening the repeated manual adjustment cycle before new levels are launched. Through joint training of preference sample pairs, reward models, and direct preference optimization, the model learns the acceptable difficulty boundaries for players from superior and inferior action pairs in the same context, distinguishing between two boundary conditions: "failure but willing to continue" and "passing but not satisfied," thereby reducing in-game churn and the frequency of manual callbacks.
[0015] By constraining the probability of completing stage goals and rhythm categories, filtering for legality, and determining conservative adjustments, candidate actions are narrowed down based on script enforcement mechanisms, survival safety, and adjustment frequency before the action is implemented. Substitutions are then performed at high-risk actions outside the distribution, thereby improving personalized adaptation while maintaining stable stage rhythm and online adjustment safety. Attached Figure Description
[0016] To more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings used in the following description of the embodiments will be briefly introduced. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0017] Figure 1 The following is an overall flowchart of a game stage target difficulty adjustment method based on player preference alignment provided in an embodiment of the present invention.
[0018] Figure 2 This is a flowchart of the steps for establishing the action dictionary and generating preference samples in an embodiment of the present invention.
[0019] Figure 3 This is a flowchart of the sequence encoding and boundary sample mining steps in an embodiment of the present invention.
[0020] Figure 4 This is a flowchart of the direct preference optimization fine-tuning steps in an embodiment of the present invention.
[0021] Figure 5 This is a flowchart of the steps for calculating preference scores and outputting difficulty parameters in an embodiment of the present invention.
[0022] Figure 6 This is a schematic diagram of the system operating environment provided by the present invention, which can be applied to a method for adjusting the difficulty of game stage objectives based on player preference alignment. Detailed Implementation
[0023] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will now be described in further detail with reference to the accompanying drawings.
[0024] The technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments.
[0025] Example 1: Overall Flow of a Game Stage Target Difficulty Adjustment Method Based on Player Preference Alignment
[0026] like Figure 6As shown in the figure, the game stage target difficulty adjustment method based on player preference alignment provided in this embodiment is executed by a game server device. The game server device can be a single server or a server cluster, and it includes at least a processor, memory, log caching component, model inference component, and difficulty parameter distribution component. During online deployment, the adjustment command takes effect at the boundary of the stage adjustment cycle. After the processor distributes the action, it synchronously updates the identifier version number to the client. If the client does not confirm within one network round-trip cycle, the previous effective action is maintained until the next adjustment cycle. In multi-player concurrent scenarios, the log caching component establishes independent context cache slots according to player identifiers, and the condition tag cache is reused according to the level version number. When online inference times out, the model service is unavailable, or the candidate action set is empty, the processor rolls back to the pre-stored static safety action or the most recently verified effective adjustment action to ensure the continuity of the level process.
[0027] like Figure 1 As shown, this embodiment includes the following steps:
[0028] Step S1: Establish a candidate adjustment action set, action mapping table, behavior sequence field table, checkpoint parameter table, stage target state table, manually approved sample index, and preference sample pair index.
[0029] Step S2: Based on the behavior sequence field table, level parameter table, and stage target state table, generate a unified input representation for the player behavior sequence, level parameters, and stage target state, and perform boundary sample mining on the index based on the preference samples to obtain preference training samples.
[0030] Step S3: Based on the manually approved sample index and preference training samples, supervised fine-tuning, reward modeling and direct preference optimization are performed on the player preference alignment strategy model and reward model. Stage goal constraint training is performed based on the stage goal completion probability and stage rhythm category to obtain the trained player preference alignment strategy model and reward model.
[0031] Step S4: Read the current player's recent behavior window, current level parameters, and current stage target state; generate a context representation based on the trained player preference alignment strategy model; and calculate the preference score of each candidate adjustment action based on the candidate adjustment action set.
[0032] Step S5: Calculate the experience score and future bounce risk of each candidate adjustment action based on the preference score and reward model, perform legality screening and conservative adjustment judgment on the candidate adjustment actions, determine the target adjustment action, and output the game stage target difficulty adjustment parameters corresponding to the target adjustment action based on the action mapping table.
[0033] In this embodiment, the core policy model employs a Player Preference Alignment Transformer (PPAT). This model uses a decoder-only converter with rotational position encoding as the backbone of the behavior sequence encoding, encoding the player's most recent few moves into a temporal semantic representation. Level parameters and stage target states are then projected onto a multilayer perceptron as conditional labels, which, along with the behavior sequence representation, are input into the policy head, outputting preference scores for candidate adjustment actions. The training phase employs a three-level alignment process: supervised fine-tuning, reward model training, and direct preference optimization. Quantized low-rank adaptive parameter efficiency layers are inserted into the attention and feedforward layers to reduce memory usage and facilitate version iteration. After this structural processing, player behavior, level conditions, and stage progression states can be jointly modeled within a unified representation space, providing a consistent input basis for subsequent action preference scoring.
[0034] In this embodiment, the preferred PPAT structure is a 4-layer decoder-only converter block, with each layer including 8 attention heads, a single head dimension of 32, and a total hidden dimension of [missing information]. The feedforward layer has a median dimension of 1024; layer normalization is applied to the inputs of the attention and feedforward sublayers; the policy head uses a structure of "terminal aggregation vector + two-layer perceptron + action linear classification layer", where the first fully connected layer has an output dimension of 256 and uses Gaussian error linear units as the activation function, and the second layer has an output dimension of the number of candidate actions. The level parameter branch and the stage goal state branch each employ a two-layer multilayer perceptron (MLP), with the dimensions of each layer sequentially changing from "input dimension → 128 → 256". Bounded rectified linear units are used as the activation function. The parameters of the two branches are not shared to avoid mutual contamination between static level information and dynamic goal progression information. The reward model and the policy model share the behavior encoding backbone but use independent output heads; the stage goal completion probability and stage rhythm category are output by the policy model with an attached constraint head. This network structure constitutes the concrete implementation basis for the aforementioned player preference-aligned policy model and reward model.
[0035] Step S1 as follows Figure 2 As shown, a candidate adjustment action set, action mapping table, behavior sequence field table, checkpoint parameter table, stage target state table, artificially approved sample index, and preference sample pair index are established.
[0036] Step S101: Establish action dictionary and parameter mapping
[0037] Read the difficulty control items that can be adjusted online, and organize each difficulty control item into the candidate adjustment action set; establish a one-to-one corresponding action mapping table for each candidate adjustment action in the candidate adjustment action set, and record the action action stage, maximum allowed trigger frequency and action mutual exclusion relationship in the action mapping table.
[0038] In this embodiment, the processor reads the difficulty control items that can be adjusted online under the current game category from the memory, forming a set of candidate adjustment actions. Each candidate adjustment action corresponds to a set of parameter combinations that can be directly executed by the game engine, rather than abstract labels. The parameter combinations may include at least one of the following: enemy number adjustment, enemy behavior intensity adjustment (e.g., enemy attack aggression adjustment), supply refresh rate adjustment, mission time limit adjustment, prompt trigger adjustment, and checkpoint location adjustment.
[0039] To ensure consistency of action definitions between the training and online phases, the processor establishes a fixed action mapping table for each action. This mapping table includes at least the action number, action phase, parameter field set, maximum allowed trigger frequency, and mutually exclusive action number set. The action phase limits an action to be effective only during normal combat, boss battles, or tutorial release phases; the maximum allowed trigger frequency limits the number of times the same action can be triggered within multiple consecutive adjustment cycles; and the action mutual exclusion relationship prevents two actions that would disrupt the design rhythm from being selected together.
[0040] In this embodiment, the engineering meaning of the number of candidate adjustment actions is the number of discrete difficulty adjustment strategies that can be switched online in a single level version. This parameter can be determined jointly by planning configuration and offline gray-scale verification; in practical engineering applications, its typical value is The value can be configured between 4 and 12 depending on the game category. In this embodiment, this value is used to balance action expression capability and online reasoning latency.
[0041] As an optional implementation, a single record in the action mapping table can adopt the following field structure: Action Number, Applicable Level Version Number, Applicable Stage Tag, Enemy Count Adjustment Value, Enemy Behavior Intensity Adjustment Item, Supply Refresh Delay Adjustment Value, Mission Time Limit Adjustment Value, Hint Trigger Threshold Adjustment Value, Checkpoint Advance Distance, Maximum Consecutive Trigger Count, Freeze Period Count, and Mutually Exclusive Action Set. With this field organization, subsequent action filtering and parameter issuance can directly call the same mapping table without repeatedly interpreting action semantics. The above field organization thus implements the aforementioned action mapping table.
[0042] Step S102: Create a behavior and state data table
[0043] Player time-series logs are organized according to a fixed time order, and a behavior sequence field table is established, which includes operation events, hit events, displacement changes, resource changes, skill release intervals, target advancement information, stagnation duration, and checkpoint rollback information; a level parameter table is established to store static level conditions, and a stage target status table is established to store the current stage advancement status.
[0044] Specifically, to achieve the above objectives, the processor first reads the time-series records indexed by player identifier from the log system and organizes them in ascending order according to the server timestamp. The single-step fields in the behavior sequence field table include at least: operation event, hit event, displacement change, resource change, skill release interval, target advancement information, stagnation duration, and checkpoint rollback information. Among these fields, operation events can be further subdivided into normal attacks, skill releases, dodges, interactions, and movement initiation; hit events characterize the damage received or the number of hits per unit of time; displacement changes characterize the intensity of changes in character displacement speed and direction; resource changes characterize the percentage change in health, ammunition, mana, or healing resources; skill release interval describes the time interval between consecutive skill actions; target advancement information characterizes the increment of the phase target completion percentage; stagnation duration characterizes the duration during which the player has not effectively advanced the target for a relatively long period; and checkpoint rollback information records whether the player has rolled back to a checkpoint and the number of times.
[0045] In this embodiment, the engineering meaning of the preset behavior field dimension is the total dimension of the fields used to characterize the player's state in a single time step. This parameter can be obtained through log field pruning, field importance analysis, and offline verification; its typical value is... In practical engineering, the level complexity can typically be configured between 12 and 32. The preset level parameter dimensions are used to measure the number of fields representing static level condition characteristics, and can be obtained through field filtering in the level configuration table; their typical values are... The preset stage target state dimension is used to measure the number of fields for dynamic progress state characteristics, and can be obtained through the design of stage target monitoring fields; its typical value is... The quantization values mentioned above are all used to ensure that the model input structure remains consistent during both the training and online phases.
[0046] In this embodiment, the behavior sequence tensor can be represented as: ,in This represents the batch sample size. The length of the behavior window. For a single step, the field dimension is used; the level parameter matrix can be represented as... The stage target state matrix can be represented as follows: Here This indicates the length of the historical steps window contained in each sample. The batch size of samples during training or inference. and These correspond to the number of static conditions and dynamic state fields, respectively. After being organized into tensors as described above, the behavior, level, and stage states can be uniformly fed into the subsequent encoding network.
[0047] Step S103: Establish the index of manually approved samples and the index of preferred sample pairs.
[0048] The manual planning approval adjustment records are extracted from the historical adjustment records to obtain the manual approval sample index. The subsequent results corresponding to multiple candidate adjustment actions are compared relatively in the same player group, adjacent level environment and similar stage progress state to obtain the preference sample pair index.
[0049] In practical engineering applications, this step involves the following process: First, the processor extracts manually confirmed and valid adjustment records from historical operation versions and establishes a manually approved sample index in the form of "context identifier + action number + result fragment index." Then, within the same player group, adjacent level environments, and similar progress stages, the processor collects the subsequent results corresponding to multiple candidate adjustment actions, constructing a pairwise comparison relationship between preferred and inferior actions. Here, the same player group can be stratified according to ability level, payment tier, historical completion rate, or proficiency; adjacent level environments can be defined by the same chapter, the same enemy template group, or the same boss mechanism type; similar progress stages can be filtered by remaining time, percentage of health, remaining resources, and similar progress.
[0050] To ensure consistent comparison criteria, this step introduces a preset statistical window, which represents the observation interval used for statistical result feedback after the action takes effect. It is typically determined based on the action's impact time and cross-stage interference control. In this embodiment, the specific value of the preset statistical window is "the union of the remaining duration of this stage and the subsequent 120-second extension window"; if the total stage duration is less than 120 seconds, the complete stage end window is used. This window length can be obtained through offline calibration using historical replay statistics, ensuring that the action feedback statistics cover the main impacts without excessively mixing in subsequent stage interference.
[0051] In this embodiment, the processor calculates a preference judgment score for each action within the statistical window to address the technical sub-problem of multiple outcome indicators having different dimensions and being difficult to directly compare. The score is jointly determined by the difference in replay rate after the action takes effect, the difference in stage retention rate, the difference in active continuation rate, the difference in negative feedback rate, and the difference in post-game evaluation. Their calculation relationship is as follows: ,in, Indicates candidate actions The joint judgment score; This represents the difference in replay rate relative to the baseline action within the same context; This represents the difference in retention rates between stages; This represents the difference in the active continue rate; This represents the difference in negative feedback rates; This represents the difference between the post-game evaluation mean and the mean. to This represents the corresponding joint judgment weight. The above differences are all derived from statistics of subsequent action results under the same version, same ability level, and similar context. Since a higher negative feedback rate indicates a worse experience, this item is included as a subtraction term. This formula pertains to the implementation calculation relationship, and its output result... This will be used to generate indexes of preferred and poorer actions.
[0052] In this embodiment, the engineering meaning of the preset joint judgment weight is the relative contribution coefficient of different feedback indicators in the judgment of the merits of actions. This parameter can be calibrated by the predictive contribution of historical samples in offline verification at five-fold discount to the subsequent continuous participation rate; its typical value is: , , , , If migrating to a new product category with a significantly different baseline for dwell time, recalibration can be performed within that category.
[0053] Within the same state context, the processor uses the aforementioned joint decision score to determine the merits of actions. To distinguish between statistical fluctuations and true preference differences, this step introduces a preset preference decision threshold, which is used to determine whether the difference in the joint decision scores of two actions is sufficient to constitute a valid preference pair. In this embodiment, as a specific engineering example, the preset preference decision threshold can range from 0.05 to 0.15, and is preferably 0.08 in this embodiment. This value is obtained by balancing the false label rate and sample coverage rate during offline verification. When two actions satisfy... At that time, I recorded To optimize actions, This is considered a poor action; if the difference is less than the threshold, then no preferred sample pair is constructed to suppress false preference labels caused by excessively narrow boundaries.
[0054] To address situations where joint judgment scores are close but stage stability differs significantly, this step further introduces a preset completion stability difference threshold, which measures the significant difference in completion stability between two actions at the stage target. In this embodiment, the specific value of the preset completion stability difference threshold is... The score can be determined offline by comparing the percentage of stable completions for actions in the same context. When the difference in the joint score of two actions is less than the preset preference threshold, but the difference in completion stability exceeds the threshold, the one with higher completion stability for the stage goal will be given priority; if there is still a conflict, the decision will be made in the order of active continuation rate, negative feedback rate, and post-game evaluation.
[0055] In scenarios with scarce samples, to avoid statistical distortion caused by low-sample actions, the preset minimum effective sample size in this embodiment is used to measure whether a single action has a statistical basis for forming preference pairs. This can be set offline through in-version sample variance analysis, and its typical value is [value missing]. When the number of valid samples corresponding to a certain action is less than the specified value, it is only retained as a regular context sample and does not participate in the generation of preference sample pairs. The above-mentioned index generation, threshold determination, and conflict resolution process constitute the aforementioned manually approved sample index and preference sample pair index.
[0056] Step S2 as follows Figure 3 As shown, based on the behavior sequence field table, level parameter table, and stage target state table, a unified input representation is generated for the player behavior sequence, level parameters, and stage target state. Boundary sample mining is then performed on the index based on the preference samples to obtain preference training samples.
[0057] Step S201: Generate behavioral sequence input
[0058] The player behavior sequence is resampled and aligned according to the timestamp, and embedding mapping is performed on discrete behavior fields. Continuous behavior fields are segmented and scaled according to a preset segmentation rule, and Boolean behavior fields are one-hot encoded to obtain a single-step input representation. The single-step input representation is organized in chronological order to obtain the behavior sequence input, and a preset no-operation flag and corresponding mask bit are filled in for missing steps. Event flags are generated based on stage boundary events, boss mechanism trigger events, supply scarcity events, and checkpoint rollback events, and the event flags are inserted into the corresponding time steps.
[0059] In this embodiment, the processor timestamps the most recent data according to the server timestamp. Player behavior is resampled and aligned. The preset behavior window length is defined as the number of recent historical operation steps referenced in an online decision, which can be determined offline by statistically analyzing the effective number of operations typically covered by a significant combat rhythm transition; in this embodiment, its typical value is... In practical engineering applications, the density of the game can usually be reasonably configured between 32 and 128.
[0060] For discrete behavior fields, the processor uses an embedding layer for mapping. For example, the operation type field can be first encoded as a category index and then mapped to a low-dimensional dense vector; in this embodiment, the embedding dimension of a single discrete field can be 8. For continuous behavior fields, the processor performs segmented scaling according to predefined real business scale segmentation rules, rather than directly performing unconstrained continuous normalization. The purpose of this processing is to preserve the business semantic boundaries such as "low intensity, medium intensity, high intensity, and abnormal intensity," while improving the comparability between different level versions. For Boolean fields, the processor uses one-hot encoding to represent true and false states. The above discrete, continuous, and Boolean fields are concatenated to form a single-step input representation, which is then organized into a behavior sequence input in chronological order.
[0061] To prevent missing records from being mistaken for low-intensity operations, this step introduces a preset no-operation flag, which represents a step with no valid player action or a missing log entry. This flag can be obtained by defining a dedicated category index during the log preprocessing stage; in this embodiment, the aforementioned preset no-operation flag is implemented using a separately reserved discrete placeholder, and a corresponding mask bit is generated simultaneously. As an example, the preset no-operation flag can be set to a reserved number 0 or a negative number placeholder, independent of all real operation type numbers. If there is no operation record for a step, the no-operation flag is filled in and the mask bit is set to 1, used to distinguish between real low-frequency operations and missing log entries in subsequent attention calculations.
[0062] To ensure that fields with different dimensions remain ordered after segmentation, the preset segmentation rule in this embodiment is used to divide numerical intervals according to business dimensions and perform linear order-preserving compression within each segment. This rule can be obtained through historical log distribution statistics and planned business thresholds. In this embodiment, displacement velocity is based on... meters per second meters per second meters per second and not less than Meters per second are represented in four segments; skill release intervals are segmented into less than 3 seconds, 3 to 8 seconds, 8 to 15 seconds, and greater than 15 seconds; resource changes are segmented into single-step resource decreases exceeding 20%, decreases of 5% to 20%, and changes within... Within, rising by 5% to 20%, and rising by more than 20% are segmented; the amount of advancement is divided into 0, , The pause duration is divided into segments of 0 to 2 seconds, 2 to 6 seconds, 6 to 12 seconds, and greater than 12 seconds. The boundaries of these segments can be obtained by jointly calibrating the historical operation distribution and the upper limit of the physical design within the same gameplay category.
[0063] For extreme values exceeding the upper bound of the training statistics, the processor truncates them to the highest segment boundary. For obvious outliers, such as displacement speeds exceeding 1.5 times the theoretical maximum value for the same role or resource changes exceeding twice the upper limit obtainable in a single step, the processor records the field as an outlier placeholder and adds an additional outlier flag. This can suppress interference from external plugins, incorrect log writes, or network jitter data on the model.
[0064] In terms of event modeling, the processor generates specialized event markers based on stage boundary events, boss mechanism trigger events, supply scarcity events, and checkpoint rollback events. Stage boundary events indicate that the current time step is within a predefined stage switching window; boss mechanism trigger events indicate entering a specific boss mechanism segment; supply scarcity events indicate that remaining resources are consistently low and accompanied by negative net consumption; and checkpoint rollback events indicate that the player has been rolled back to the most recent checkpoint. To highlight the characteristics of stage objectives, the preset resource depletion precursor condition in this embodiment is used to determine whether the resource gap constitutes a significant risk. Its engineering meaning is a combination of low resources and continuous net consumption, which can be calibrated offline through historical resource distribution in the same stage; its typical value is "remaining resources are lower than 35% of the median value in the same historical stage, and the net resource consumption has been continuously negative for the last 20 seconds." After inserting event markers into the corresponding time step, the model can retain stronger identification capabilities near key business turning points. The above-mentioned behavioral field processing, missing markers, and event encoding processes constitute the aforementioned behavioral sequence input.
[0065] Step S202: Generate conditional tags and perform joint encoding
[0066] The level parameters and stage target states are projected as condition tags respectively, and the condition tags are jointly encoded with the behavior sequence input and event tags to obtain the unified input representation.
[0067] In this embodiment, the processor inputs the level parameter matrix and the stage target state matrix into two independent multilayer perceptron branches, respectively. The level parameter branch receives static or slowly changing constraint information, such as wave structure, basic enemy template, cover ratio, resource point density, basic time limit, boss mechanism type, and checkpoint layout. The stage target state branch receives rapidly changing current context, such as remaining time, percentage of completed sub-objectives, percentage of health points, remaining resources, consecutive hit density, recent advance speed, consecutive failure count, and current stage boundary position. Both branches output conditional label vectors consistent with the hidden dimensions, which are then concatenated to the beginning of the behavior sequence for self-attention calculation.
[0068] As a specific implementation method, the specific execution logic of the above process is as follows: the behavior side uses a decoder-only converter with rotational position encoding to process a length of... The operation sequence is encoded to obtain the context representation sequence. ,in The dimension of the hidden layer is [dimensional value]; the two conditional label vectors output by the level parameter branch and the stage objective state branch are both [dimensional value]. The conditional and behavioral labels are then concatenated with the head of the behavior sequence after being added with linear gating coefficients. If event markers exist within the current window, these event markers are also inserted into the input sequence as vectors of the same dimension. The total input length after combining the conditional and behavioral labels is... If the insertion phase event is specifically marked, then the total input length is... ,in This represents the number of event markers within the current window. This allows the level context and goal progression context to directly participate in action preference modeling.
[0069] In this embodiment, the engineering meaning of the preset hidden layer dimension is the semantic vector length of a single label in the unified representation space. This parameter can be obtained by a trade-off between inference latency and preference ranking accuracy; its typical value is... In practical engineering applications, the configuration can usually be reasonably set between 128 and 512 depending on the hardware resources.
[0070] To enhance the stage objective constraint information, the processor preferably adds a stage boundary indicator bit and a resource depletion precursor indicator bit to the condition marker header. The stage boundary indicator bit indicates whether the current time step is within a predefined stage switching window; when the remaining resources are lower than 35% of the median value of the same historical stage and the net resource consumption has been continuously negative for the last 20 seconds, the resource depletion precursor indicator bit is set to 1, indicating whether the current state is at risk of amplified resource gap. After this processing, data from different sources are mapped to a unified processing scale, and subsequent models can perform state fusion within the same numerical space. The above-described multilayer perceptron projection, conditional stitching, and joint encoding processes achieve the aforementioned unified input representation.
[0071] Step S203: Perform boundary sample mining
[0072] Within a preset statistical window after an action takes effect, the replay rate difference, stage retention rate difference, active continuation rate difference, negative feedback rate difference, and post-game evaluation difference of each candidate adjustment action relative to the baseline action are calculated respectively. These differences are then multiplied by their corresponding preset joint judgment weights, and the results are summed to obtain the joint judgment score for each candidate adjustment action. Under the same state context, when the difference in the joint judgment scores of two candidate adjustment actions is not less than a preset preference judgment threshold, the action with the higher score is designated as the preferred action, and the action with the lower score is designated as the poorer action. Boundary samples are selected from segments that are cleared but have low subjective evaluations, segments that are not cleared but have high continued participation, and segments that fail briefly but retry multiple times. Comparison pairs of preferred and poorer actions are constructed between these boundary samples under the same state context to obtain the preference training samples.
[0073] Furthermore, in the application scenario of this invention, after obtaining the aforementioned preference sample pair index, the processor will perform boundary sample mining based on the preference sample pair index, that is, focus on screening boundary conditions from three types of samples: "passed but gave a bad review", "failed but highly engaged", and "short-term failure but continuous retry". Compared with random negative samples, these boundary samples are closer in terms of state statistics, but will show obvious bifurcation in subsequent satisfaction, retention and willingness to continue, thus more closely approximating the decision boundary of "challenging and discouraging".
[0074] To differentiate boundary categories, this step introduces several preset judgment parameters. In this embodiment, the preset high participation continue rate threshold is the lower bound of the probability of still being willing to try after failure, which can be obtained offline by the upper quantile inflection point of the continue willingness distribution; its typical value is 0.65. The preset high churn continue rate threshold is used to measure the upper bound of the probability of significantly insufficient continue willingness after failure, which can be determined by the lower quantile inflection point of the continue willingness distribution; its typical value is 0.35. The preset negative feedback increase threshold is used to define the significant increase in negative feedback relative to the average of players at the same level, which can be obtained by statistical analysis of the negative feedback fluctuation range within the version; its typical value is 15%. The preset consecutive failure number interval is used to identify typical boundary conditions, which is the range of consecutive attempts but not yet completely abandoned, and can be statistically calibrated based on the average duration of a single attempt and the churn inflection point; in this embodiment, this interval typically ranges from 2 to 4 times.
[0075] In this embodiment, when a sample meets the condition that "the probability of continuing to enter the same level in the next two attempts is not less than 0.65 even though the stage is not completed," it is marked as high challenge and acceptable. When a sample meets the condition that "the probability of continuing to enter the same level in the next two attempts is not higher than 0.35 even though the stage is not completed, and the negative feedback rate is not less than 15% higher than the average of players at the same level," it is marked as high challenge and high churn. When a sample meets the condition that "the stage is completed, but the post-game evaluation is more than 0.8 points lower than the average of players at the same level and skill level," it is marked as low evaluation upon completion. The "more than 0.8 points lower" here can be obtained through offline manual annotation consistency verification under the five-point scoring system, and is used to identify segments that are completed in form but have a poor experience.
[0076] To avoid misjudging differences in mechanisms as preferences, this step introduces a preset upper limit for state distance. This limit constrains the distance between the two compared boundary segments after concatenating the behavior statistics vector, stage state vector, and checkpoint condition vector to not exceed an allowable range. This distance can be calculated offline using Mahalanobis distance, and the upper limit is set based on the distribution of similar samples within the training set. As an example, the preset upper limit for state distance can be taken as the 75th to 90th percentile of the state distance distribution of similar samples within the training set; in this embodiment, the 80th percentile is preferred. Difficult negative sample pairs are only constructed when the state distance of the candidate segments does not exceed this upper limit.
[0077] In this embodiment, the preset boundary sample ratio is used to control the proportion of boundary samples in a single training batch to prevent the model from being overly biased towards extreme samples. This ratio can be obtained by a trade-off between the accuracy of the validation set ranking and the stability of the normal scenario, with a typical value of 32% and an actual batch upper limit not exceeding 40%. The above-mentioned classification determination, state distance filtering, and ratio control process constitute the aforementioned boundary sample mining.
[0078] Step S3 as follows Figure 4 As shown, based on the artificially recognized sample index and preference training samples, supervised fine-tuning, reward modeling and direct preference optimization are performed on the player preference alignment strategy model and reward model. Stage goal constraint training is performed based on the stage goal completion probability and stage rhythm category to obtain the trained player preference alignment strategy model and reward model.
[0079] Step S301: Perform supervised fine-tuning
[0080] Based on the artificially approved sample index, supervised fine-tuning is performed on the player preference alignment strategy model, enabling the player preference alignment strategy model to learn the basic policy distribution corresponding to the artificially approved adjustment actions.
[0081] In this embodiment, the processor first uses manually planned and approved adjustment records to supervise and fine-tune the strategy model, enabling the model to have a basic, usable action distribution. This step allows the model to learn the operational action boundaries from planning experience, avoiding action distribution divergence in the early stages of preference optimization.
[0082] To describe the training objective corresponding to this step, after reading the manually approved samples, the processor calculates the supervised fine-tuning loss between the conditional probability distribution of candidate actions output by the policy model and the manually approved action labels. This loss is used to address the technical sub-problem of "how to allow the model to inherit acceptable human adjustment experience first," and its calculation relationship is as follows: ,in, This indicates the loss from monitoring and fine-tuning. Represents the cross-entropy loss function; The parameter is The strategy model in player behavior Level parameters and stage target status Under the condition, for candidate actions The conditional probability distribution of the output; This indicates manually planned and approved target adjustment actions. Here... , and These data are derived from the behavior, level, and stage state data in the aforementioned unified input representation. This formula pertains to the computational relationship, and its output loss value is incorporated into the subsequent total training loss.
[0083] In this embodiment, the preset supervised fine-tuning learning rate is used to measure the parameter update step size in the supervised fine-tuning stage, and can be obtained through offline scanning of training stability and convergence speed; its typical value is... The preset batch size, in engineering terms, refers to the number of samples used in a single gradient update, which can be determined based on memory budget and throughput constraints; its typical value is 128. The preset number of training rounds represents the number of times the manually approved samples are fully traversed, and can be obtained based on the convergence trend of the validation set loss; its typical value is 5 rounds.
[0084] Regarding boundary condition handling, when a training sample lacks a manually approved action label, the processor does not calculate the supervised fine-tuning loss for that sample, but only participates in reward model training and preference optimization; when the number of manually approved samples in a batch is zero, the supervised fine-tuning loss for that batch is recorded as 0 to ensure the continuity of the training process. The above supervised fine-tuning training logic realizes the aforementioned basic policy distribution learning.
[0085] Step S302: Train the reward model
[0086] Based on the preference training samples, a reward model is constructed that receives player behavior sequences, level parameters, stage target states, and candidate adjustment actions. Satisfaction sub-labels, frustration sub-labels, and retention sub-labels are generated respectively, and the satisfaction sub-labels, frustration sub-labels, and retention sub-labels are synthesized according to their corresponding preset reward synthesis weights to obtain a comprehensive reward label. Based on the comprehensive reward label and the preference training samples, the reward model is subjected to pairwise comparison training, so that the experience score of the reward model for the output of the preferred action is higher than the experience score for the output of the poor action.
[0087] In this embodiment, the processor establishes a reward model. This model is used to predict the overall reward, which comprises player satisfaction, frustration, and post-game retention probability, given a specific context and moderating actions. The reward model shares the behavioral encoding backbone with the policy model but uses an independent output head to reduce parameter overhead and maintain consistency in context representation. The reward model receives inputs including player behavior sequences, level parameters, stage target states, and candidate moderating action embeddings, and outputs results such as experience scores and future bounce risk.
[0088] The satisfaction sub-label is generated by stratifying post-game ratings, proactive continuation behavior, and the proportion of positive text feedback within each version. The frustration sub-label is generated by consecutive hit density, exiting after consecutive failures, negative text feedback, and short-term farewell behavior. The retention sub-label is generated by the subsequent two-minute stay, re-entry in the same stage, and return to the next day stage. All three types of sub-labels use intra-version segment labeling to preserve relative order relationships without relying on cross-version absolute values.
[0089] To unify the three sub-labels into a single trainable objective, this step introduces a preset reward synthesis weight, which represents the relative contribution of satisfaction, frustration, and retention to the overall reward. This weight can be calibrated using a grid search on the historical training set, with the objective of "whether the stage continues to advance within a predetermined time after the action takes effect." In this embodiment, a typical value for the preset reward synthesis weight is... , , Therefore, the calculation relationship for the comprehensive reward tags is as follows: ,in, Indicates a comprehensive reward label; Indicates a sub-label for satisfaction level; Indicates frustration level; Indicates the retention of sub-tags; , , These represent the reward composition weights for the three sub-labels. Since increased frustration means a worse experience, the weights are combined using a subtractive approach. The combined reward label output by this formula will be used for subsequent pairwise comparison training.
[0090] In pairwise comparison training, the processor compares the scores of best and worst actions within the same context to address the technical sub-problem that "subjective experience is difficult to quantify absolutely but can be relatively ranked." The corresponding reward model loss is: ,in, This represents the loss of the reward model; Represents the Sigmoid function; The parameter is The reward model for optimal action The rating; Indicates poorer actions The scoring is as follows. This formula requires the model to output a higher experience score for better actions within the same context, and the output result is included in the subsequent total training loss.
[0091] In this embodiment, the preset reward model learning rate is used to measure the update speed of the reward model parameters, and can be determined by the validation set ranking consistency rate and training stability; its typical value is... The preset reward difference cutoff interval is used to prevent excessively large reward differences from causing numerical overflow, and can be set offline through the intermediate statistical range during training; its typical value is... .when and When identical configurations occur due to log scarcity, the processor skips the sample pair; when the reward difference exceeds the aforementioned range, it is truncated before the Sigmoid operation is performed.
[0092] The generation and synthesis process of the aforementioned satisfaction sub-label, frustration sub-label, and retention sub-label constitutes the aforementioned comprehensive reward label; while the pairwise comparison training process enables the aforementioned reward model to output a higher experience score for the better action than the worse action.
[0093] Step S303: Perform direct preference optimization and add stage objective constraints.
[0094] Using the supervised fine-tuning of the base policy distribution as a reference policy, and based on the relative probability interval between the preferred and inferior actions under the current and reference policies, direct preference optimization is performed on the player preference alignment policy model to obtain the parameters of the player preference alignment policy model and the reward model. Based on the context representation after terminal aggregation and the embedding of candidate adjustment actions, the probability of completing the stage goal and the stage rhythm category are predicted. Based on the standard time consumption ratio, resource suppression window ratio, mechanism density, checkpoint backoff frequency, and stagnation duration between sub-goals, the true stage rhythm category is generated. Based on the deviation between the predicted stage goal completion probability and the target completion probability benchmark, and the classification error between the predicted stage rhythm category and the true stage rhythm category, the stage goal constraint loss is calculated. The stage goal constraint loss is weighted and summed with the supervised fine-tuning loss, the reward model loss, and the direct preference optimization loss to obtain the total training loss. Based on the total training loss, the player preference alignment policy model and the reward model are updated to obtain the trained player preference alignment policy model and reward model.
[0095] In this embodiment, the processor uses the supervised fine-tuned base policy as a reference policy to perform direct preference optimization on the current policy. The purpose of this step is to, while preserving the operability of the base policy, directly expand the probability interval between preferred and less desirable actions based on preference samples, thereby approximating the adjustment direction that players are more willing to accept.
[0096] To address the sub-problem of "how to quantify the deviation of the current policy from the reference policy regarding the preferred action," the processor calculates the direct preference optimization loss, the relationship of which is as follows:
[0097] ,
[0098] in, This represents the direct preference optimization loss; This represents the preset preference interval amplification factor; Indicates the current strategy; Indicates a reference strategy; and These represent the log probabilities of the current strategy for the preferred and poorest actions, respectively. and and represent the logarithmic probabilities of the reference policy for the corresponding actions. This formula requires the current policy to further widen the probability gap between the preferred and poorer actions relative to the reference policy, and the output result is included in the total training loss.
[0099] In this embodiment, the engineering meaning of the preset preference interval amplification factor is the strength of the separation effect of the preference pair on the strategy distribution, which can be obtained by a trade-off scan of the "satisfaction improvement" and "strategy drift" in the verification set; its typical value is When the log probability of a candidate action is too small, causing numerical underflow, the processor performs a maximum value shift before SoftMax; when there is only one valid candidate action in a certain context, the direct preference optimization loss for that sample is not calculated.
[0100] Regarding stage objective constraints, the processor predicts the stage objective completion probability and stage rhythm category based on the concatenated vector of the context representation after end-point aggregation and the candidate adjustment action embedding. The stage objective completion probability is obtained by a 1D output head through a Sigmoid transformation; the stage rhythm category is determined by the output category distribution of a multi-class classifier. The actual stage rhythm category is generated by the proportion of standard time consumption, the proportion of resource suppression window, the mechanism density, the frequency of checkpoint rollback, and the stagnation duration between sub-objectives. In this embodiment, the rhythm category may include "early suppression," "balanced middle," and "high-pressure convergence," etc. If used for platform jump hybrid levels, it can also be mapped to "teaching release," "stable advancement," and "high-pressure convergence."
[0101] To quantify the business constraint that "experience optimization must not disrupt the level rhythm," this step introduces a stage objective constraint loss, the calculation relationship of which is as follows:
[0102] ,
[0103] in, This indicates the loss due to stage target constraints; This indicates the probability of achieving the stage target predicted by the model. This represents the baseline probability of achieving the objective. Represents the square of the L2 norm; This represents the preset stage label weight coefficient; This represents the distribution of stage rhythm categories predicted by the model; This represents the rhythm category label for the actual stage. The first term of this formula is used to constrain the completion probability from deviating from the target baseline, and the second term is used to constrain the rhythm category from deviating from the design intent. The output of this formula is incorporated into the total training loss.
[0104] In this embodiment, the preset target completion probability benchmark is used to represent the expected completion probability of a certain stage target in the design, which can be calibrated offline through the design target of medium difficulty level in historical versions; in the boss battle implementation scenario, its typical value is 0.58. The preset stage label weight coefficient is used to measure the importance of rhythm category error relative to the completion probability deviation, which can be obtained through stage stability and satisfaction balance verification; its typical value is When a new level lacks sufficient rhythm label samples, the processor only retains the completion probability constraint; when the completion probability comes from a small sample estimate, a smoothing term is added to the calculation. Prevent extreme distribution of jitter.
[0105] Finally, the processor performs a weighted summation of the supervised fine-tuning loss, reward model loss, direct preference optimization loss, and stage objective constraint loss to obtain the total training loss. This step unifies the four objectives of "basic operability, experience ranking, preference separation, and stage pacing maintenance," and their calculation relationships are as follows: ,in, Indicates the total training loss; This represents the preset loss weights of the reward model; This represents the pre-defined direct preference optimization loss weights; This represents the pre-defined stage target constraint loss weight. The four loss factors together determine the direction of parameter updates for the policy model and reward model.
[0106] In this embodiment, the preset reward model loss weight is set to 0.40, the preset direct preference optimization loss weight is set to 1.00, and the preset stage goal constraint loss weight is set to 0.70. These parameters can be calibrated offline using a joint validation standard comprised of preference ranking accuracy, stage stable completion rate, online action switching frequency, and illegal action trigger rate. When a certain type of loss is incalculable due to missing samples, only the calculable items are summed, and the batch weights are recalibrated according to the number of valid items to avoid training interruption. The aforementioned direct preference optimization, stage goal constraint, and total loss update process constitute the trained player preference alignment strategy model and reward model described above.
[0107] As an optional implementation, the query matrix and numerical matrix inserted into each layer's self-attention by the low-rank adaptive layer, as well as the first linear transformation matrix of the feedforward layer, are quantized. The basic weights are quantized using 4-bit grouping, with a typical group size of 64 and a typical low-rank increment rank of 8. Only the low-rank matrix and layer normalization parameters are updated; the remaining basic parameters are frozen. In this embodiment, the preset low-rank dimension refers to the rank of the low-rank increment matrix, which is determined by constraints imposed by the single-card memory budget and verification accuracy; its typical value is 8. After this processing, longer behavior windows and higher frequency version iterations can be supported under the same hardware resources.
[0108] Step S4 as follows Figure 5 As shown, the system reads the current player's recent behavior window, current level parameters, and current stage target state, generates a context representation based on the trained player preference alignment strategy model, and calculates the preference score of each candidate adjustment action according to the candidate adjustment action set.
[0109] Step S401: Generate online input and raw scores
[0110] Read the current player's recent behavior window and, in conjunction with the current level parameters and the current stage target state, generate online input according to the field rules consistent with the training stage; input the online input into the trained player preference alignment strategy model to obtain the original scores corresponding to each candidate adjustment action; when online reasoning fails, call the action distribution generated by the most recent successful reasoning as the alternative distribution for the current cycle, and switch to the pre-stored static safety action when consecutive reasoning failures reach the preset conditions.
[0111] In this embodiment, the processor reads the current player's most recent log from the real-time log cache. Using walking as a window, and combining the current level parameters and the current stage's target state, online input is generated according to the same field rules as steps S201 and S202, and then fed into the trained player preference alignment converter. This ensures consistency in data caliber between the training and online stages, avoiding inference bias caused by field definition drift. The model outputs the raw score for each candidate action, which reflects the relative preference trend of each action in the current context, but has not yet been converted into a probability distribution.
[0112] To ensure online service continuity, this step introduces a preset continuous inference failure condition, which is used to determine whether the system should degrade from the most recent successful inference distribution to a pre-stored static safety action. This condition can be determined jointly through service stability testing and level continuity requirements. As a specific engineering example, the range of the continuous failure period in the preset condition for continuous inference failure can be 2 to 5 adjustment periods, and in this embodiment, 2 consecutive adjustment periods are preferred. If the model service timeout in this period exceeds the preset timeout threshold, the action distribution of the previous period is used and an inference degradation event is recorded; if the continuous failure meets the aforementioned condition, the system switches to the pre-stored static safety action.
[0113] In this embodiment, the adjustment period is used to specify how often the server performs an online difficulty determination. To balance log refresh granularity, minimum interval for engine parameter activation, and smoothness of player experience, the preset adjustment period in this embodiment is typically set to 5 seconds. In actual engineering applications, it can usually be configured reasonably between 3 and 8 seconds depending on the gameplay rhythm. This period can be obtained through offline calibration using gray-scale server replay statistics.
[0114] Step S402: Temperature scaling and validity screening
[0115] Temperature scaling is applied to the original scores to obtain preference scores for each candidate adjustment action. The candidate adjustment actions are then filtered based on the remaining time, remaining resources, script enforcement mechanism, core rhythm restrictions of the boss phase, survival safety restrictions, and adjustment frequency restrictions to obtain legal candidate actions.
[0116] In this embodiment, the processor converts the raw scores output by the policy model into preference scores to address the technical sub-problem of "how to form a smooth and comparable preference distribution among multiple candidate actions." This step uses temperature scaling for smoothing, and its calculation relationship is as follows: ,in, Indicates the first Preference scores for each candidate modulatory action; Indicates the first The original output scores corresponding to each candidate adjustment action; This indicates the preset temperature parameter; This represents the total number of candidate adjustment actions. The input to this formula comes from the raw score output in step S401, and the output is a normalized preference distribution, which will be used for subsequent legality screening and conservative adjustment determination.
[0117] In this embodiment, the preset temperature parameter has the engineering meaning of a smoothing coefficient that controls the sharpness of the action distribution, and can be calibrated offline by jointly constraining the online action switching frequency and preference accuracy; its typical value is... When all original scores are equal, the preference score degenerates into a uniform distribution; when only one action remains after the candidate set is filtered by constraints, the preference score for that action is directly set to 1.
[0118] Subsequently, the processor filters actions according to a legal action filtering rule table. This rule table constrains actions to meet the following conditions: remaining time in the current stage, remaining resources, script enforcement mechanisms, core rhythm restrictions of the boss stage, survival safety restrictions, and adjustment frequency restrictions. As an example, the rule table may include at least the following: Rule R1: If the current stage is a boss battle or a key story battle, a single action is not allowed to simultaneously satisfy "enemy behavior intensity decreased by one level or more" and "supply refresh delay shortened by more than 20%"; Rule R2: If the remaining time is less than a preset proportion of the total stage time, action combinations that significantly prolong the process are not allowed; Rule R3: If the player's current health percentage is lower than the preset health safety threshold and the continuous hit density is among the highest in the same level, actions that increase difficulty are not allowed; Rule R4: If the cumulative change of the same adjustment item exceeds the preset upper limit within several consecutive adjustment cycles, the adjustment item is frozen in subsequent cycles; Rule R5: If the current stage is a tutorial release stage, actions that hide hints or enhance the character are not allowed; Rule R6: If an action conflicts with the enforcement mechanism in the current level's script, it is directly judged as illegal.
[0119] In this embodiment, the preset life safety threshold is used to measure whether the player is currently in a high survival risk state, and can be determined based on historical near-death situation statistics and the design safety boundary; its typical value is 10% of the player's life value. The preset remaining time percentage threshold is used to determine whether a phase is nearing its end, and can be set according to the phase design rhythm boundary; its typical value is 15%. The preset cumulative change limit for adjustment is used to limit the total change of the same adjustment item within a continuous cycle, and can be set offline according to the engine parameter smoothness requirements and player feel stability. As an example, the preset cumulative change limit for adjustment can be set to no more than two discrete levels cumulatively for the same adjustment item within two consecutive adjustment cycles, or the cumulative change of consecutive numerical adjustment items not exceeding 20% of the baseline value. The rule priority is executed in the order of "script enforcement mechanism restriction > boss phase core rhythm restriction > survival safety restriction > adjustment frequency restriction > normal experience restriction". The above temperature scaling and rule filtering process constitutes the aforementioned preference score calculation and legal candidate action generation.
[0120] Step S5 as follows Figure 5 As shown, based on the preference score and reward model, the experience score and future bounce risk of each candidate adjustment action are calculated. The legality screening and conservative adjustment judgment are performed on the candidate adjustment actions to determine the target adjustment action. Based on the action mapping table, the game stage target difficulty adjustment parameters corresponding to the target adjustment action are output.
[0121] Step S403: Conservative Adjustment Judgment
[0122] Based on the reward model, the experience score and future bounce risk of each legitimate candidate action are calculated, and the adjustment range distance of each legitimate candidate action relative to the currently effective action is calculated. A subset of safe candidate actions with a future bounce risk not exceeding a preset risk threshold is selected from the legitimate candidate actions. When the subset of safe candidate actions is not empty, a comprehensive conservative score is calculated based on the preference score, experience score, and adjustment range distance of each candidate action relative to the currently effective action, and the candidate action with the largest comprehensive conservative score is selected as the target action. When the subset of safe candidate actions is empty, the candidate action with the smallest future bounce risk and the smallest adjustment range distance is selected from the legitimate candidate actions as the target action.
[0123] In this embodiment, the processor calculates the experience score and future exit risk output by the reward model for each legitimate candidate action. The future exit risk represents the conditional probability estimate of leaving the current stage or exiting the game within the next 120 seconds after the action takes effect. This risk is output by the reward model with an attached risk header and is predicted together with the context representation and action embedding.
[0124] To avoid high churn risk associated with highly favored actions, this step introduces a preset risk threshold. This threshold represents the acceptable future risk level for an action, and can be obtained offline by calibrating the risk distribution of effective adjustment samples from the three most recent stable operating versions of the same game category within the past 90 days. In this embodiment, the typical value of the preset risk threshold is 0.22. The calibration method is as follows: first, calculate the 75th quantile of the risk distribution within different versions, and then calculate the weighted average of the quantile values across multiple versions to obtain the final threshold. If migrating to other game categories, the threshold is recalculated based on samples within that category.
[0125] When the subset of safe candidate actions is not empty, the processor calculates a comprehensive conservative score based on preference score, experience score, and adjustment range distance to address the technical sub-problem of "how to avoid excessive jumps among multiple safe actions." The corresponding calculation relationship is as follows:
[0126] ,
[0127] in, This indicates the target action selected under conservative adjustment. This represents a subset of safe candidate actions that satisfy risk constraints; Indicates action preference score; This represents the overall reward or experience score output by the reward model; This indicates the adjustment range of the action relative to the currently active action; and These are the weighting coefficients. The input to this formula comes from the preference scores and reward model output from step S402, and the output is the final target adjustment action.
[0128] In this embodiment, the preset conservative preference weight is used to balance the contributions of preference scores and reward model experience scores, and can be calibrated through joint verification of satisfaction improvement and action smoothness; its typical value is... The preset amplitude penalty weight is used to suppress excessive adjustment ranges relative to the current action, and can be obtained based on the player's motion stability and the safety boundary of parameter changes; its typical value is... When the subset of safe candidate actions is empty, the processor selects the action with the lowest future exit risk and the smallest adjustment range from the legal candidate actions, ensuring that the most robust adjustment method is prioritized even under high-risk conditions. The above screening logic constitutes the aforementioned conservative adjustment determination.
[0129] Step S501: Output game engine parameters
[0130] The target adjustment action is converted into game stage target difficulty adjustment parameters executable by the game engine according to the action mapping table. The game stage target difficulty adjustment parameters include enemy number adjustment, enemy behavior intensity adjustment, supply refresh rhythm adjustment, mission time limit adjustment, prompt trigger adjustment, and checkpoint location adjustment. An update instruction containing the game stage target difficulty adjustment parameters is sent to the game logic server, and the update instruction carries the action version number, effective timestamp, and rollback identifier.
[0131] In this embodiment, the processor converts the target adjustment action into a parameter set that the game logic server can directly execute based on the action mapping table. This parameter set may include enemy number adjustment values, enemy behavior intensity adjustment items, supply refresh delay, mission time limit scaling, prompt trigger threshold, and checkpoint advance distance, etc. After action mapping, the processor generates update instructions and sends them to the game logic server, which then drives the relevant level logic components to make the parameters take effect.
[0132] In one optional implementation, the update instruction frame includes at least: an action number, a player number, a level version number, a stage number, an action version number, an effective timestamp, a rollback flag, a set of parameter fields, and an integrity verification field. The game logic server can determine whether the current update overwrites the old version action based on the action version number, and determine whether the update instruction is within the allowed execution window based on the effective timestamp; if the integrity verification fails, the current parameter writing is rejected and the parameters of the previous version are retained. This instruction frame structure can reduce the impact of network out-of-order delivery, duplicate delivery, or rollback failures on the level flow.
[0133] Step S502: Collect feedback and update the sample pool
[0134] Within a preset observation window after the game stage target difficulty adjustment parameters take effect, the progress of the stage target, changes in the number of failures, changes in the continue rate, post-game feedback, and exit status are continuously received, forming a feedback collection record; the candidate records for manual approval and the candidate records for preference samples are updated based on the feedback collection record.
[0135] In this embodiment, the processor continuously receives the progress of the stage objective, changes in the number of failures, changes in the sustain rate, post-game feedback, and exit status within the observation window after the action takes effect, and forms a structured feedback retrieval record. This record does not change the actions already output in this instance, but only serves as the data source for the next round of offline training and index updates.
[0136] To cover a complete intra-game short feedback cycle, this step introduces a preset observation window. In engineering terms, this refers to the continuous monitoring time used to evaluate the true impact of an action after it takes effect. It can be calibrated offline based on the action's impact manifestation time and stage crosstalk control. In this embodiment, the typical value of the preset observation window is 60 seconds; if the average stage duration of a level is significantly longer than 300 seconds, it can be extended to 90 seconds. This observation window length can cover the impact of most adjustment items on advancement speed and exit behavior within 30 to 50 seconds, while reducing the intrusion of strong interference factors in the next stage.
[0137] After the retrieval records are formed, the processor updates the manually approved candidate records and the preferred sample candidate records based on the result fragments. The manually approved candidate records are used for subsequent review by planned sampling and supplementation of supervised fine-tuning samples; the preferred sample candidate records are used to reconstruct preferred and poor action pairs with other action result fragments in similar contexts. At this point, training, online inference, and feedback flow form a complete closed loop.
[0138] As a supplementary note, when performing offline load testing and grayscale replay statistics under the same hardware environment, the quantized low-rank adaptive scheme, compared to full parameter fine-tuning, reduced memory usage from 21.6GB to 8.9GB and increased single-batch training throughput from 132 samples per second to 241 samples per second. After reusing the candidate action mapping table and conditional tag cache in the online stage, the inference latency for a single stage adjustment can be reduced from 18.4ms to 9.7ms. These results are the average of three repeated offline load tests and grayscale replay statistics under the conditions of a single A100 card environment, batch size of 128, sequence length of 64, and number of actions of 6. After this processing, the system can support real-time intra-system stage adjustment without sacrificing the integrity of the decision chain.
[0139] Example 2: End-to-end difficulty adjustment of stage combat objectives in a story-driven adventure game
[0140] This embodiment targets a mid-stage combat level in a third-person story-driven action game. The level includes a stage objective: players must defeat two waves of regular enemies within 180 seconds, followed by a mini-boss battle in the final 45 seconds. Existing fixed completion rate threshold schemes typically reduce the number of enemies and enemy health multipliers uniformly when the completion rate of the test group falls below 42%. However, this scheme fails to differentiate between "highly skilled players who complete the level but have a poor experience" and "average players who fail on the first run but have a strong desire to replay."
[0141] In this embodiment, the game server's processor performs an online judgment once every 5 seconds, with each stage adjustment cycle. Offline training uses 96,000 historical in-game segment samples, including 18,400 manually approved samples, 52,000 preference sample pairs, and 16,700 boundary sample pairs. These 96,000 samples are derived from the combined data of gray-scale server logs and offline replay samples from the same story chapter in the two most stable operating versions, with the statistical window covering 42 days after the version's launch; preference sample pairs are constructed only within the version and among players of similar skill levels. Training, validation, and test samples are divided in an 8:1:1 ratio, and the main result is the mean of three repeated training iterations.
[0142] In this embodiment, the preset behavior window length is specifically set to 64; the preset behavior field dimension is specifically set to 18; the preset level parameter dimension is specifically set to 12; the preset stage target state dimension is specifically set to 10; the preset hidden layer dimension is specifically set to 256; and the preset number of candidate actions is specifically set to 6. The above parameters are set based on the following criteria: a significant combat rhythm transition typically covers 40 to 70 effective operations; the log field dimension needs to cover core behaviors without excessive redundancy; level static conditions and stage dynamic states can be effectively represented by 12 and 10 fields respectively in this scenario; the hidden layer dimension of 256 achieves a good balance between inference latency and sorting accuracy; and the number of actions of 6 can cover commonly used adjustment directions and facilitates online judgment.
[0143] During step S101, the processor establishes six candidate adjustment actions: Action 1: enemy count unchanged, enemy health multiplier 1.00, supply refresh delay 12 seconds; Action 2: enemy count decreased by 1, enemy health multiplier 0.92, supply refresh delay 10 seconds; Action 3: enemy count unchanged, enemy behavior intensity adjustment item decreased by one level, supply refresh delay 10 seconds; Action 4: enemy count increased by 1, enemy health multiplier 1.08, supply refresh delay 14 seconds; Action 5: mission time limit increased by 15 seconds, checkpoint moved forward 6 meters; Action 6: prompt trigger threshold lowered and an additional weakness prompt displayed. Actions 4 and 5 are mutually exclusive in extremely low health conditions; Actions 2 and 3 are allowed to be triggered consecutively, but after two consecutive triggers, a freeze period is entered.
[0144] During step S102, the processor establishes a current level parameter table, including 12 items such as the current wave number, enemy basic attack template, level terrain cover ratio, number of resource points, and basic mission time limit; and establishes a stage target status table, including 10 items such as remaining time, number of defeated enemies, current health percentage, resource reserves, progress speed in the last 30 seconds, and consecutive failure count. A stage boundary event is defined as the 45-second window before the boss appears after the second wave of normal enemies is cleared; a supply scarcity event is defined as resource reserves falling below 35% of the historical median value for this stage of the level.
[0145] During step S103, the processor reads the planning confirmation record from the historical version, such as "In mid-battle when the player's health is below 25% and the progress has stalled in the last 20 seconds, prioritize action 2." Simultaneously, preference sample pairs are constructed. Taking a training pair as an example, in similar contexts, action 2 has a post-game active continuation rate of 0.74, a negative feedback rate of 0.12, and a stage retention rate of 0.69; action 4 has a post-game active continuation rate of 0.48, a negative feedback rate of 0.27, and a stage retention rate of 0.53. This is calculated by combining the post-game evaluation difference and the replay rate difference. If the difference is less than 0.08, the pair is recorded as the preferred action and the worse action pair; if the difference is less than 0.08, the pair is not written into the preference training set.
[0146] During step S201, the processor receives the player's most recent 64 action logs. Example segments include: 14 melee attacks, 6 dodges, 9 hits taken, 2 healing item uses, average skill release interval of 7.8 seconds, average displacement speed of 3.2 meters per second, and target advance of only 8% in the last 15 seconds. Discrete fields are mapped to an 8-dimensional representation via an embedding layer, while continuous fields are segmented, scaled, and concatenated according to the same rules used during training, forming an 18-dimensional input for each step. The final input size is... If no operation is recorded for a certain step, a preset empty operation flag is entered and the mask bit is set to 1. For that player, one resource scarcity event flag and one stage boundary event flag are inserted simultaneously in the most recent window.
[0147] In step S202, the processor maps the 12-dimensional level parameters and the 10-dimensional stage target state to two 256-dimensional conditional labels, and inputs them along with a 64-step action sequence into the player preference alignment converter. At this point, the model input length is 66 basic labels; if two event labels are included, the input length is 68 labels, and the hidden dimension is 256. The processor outputs the aggregated context representation at the end and obtains the raw scores of the six candidate actions through the policy head. This component value is derived from a single level segment record in the offline validation sample and is used to illustrate the action sequencing process.
[0148] During step S203, the processor additionally filters out boundary samples in the training set that are close to this type of context, such as sample pairs that "failed but retried more than three times". This is to help the model learn not to prematurely classify such players as those requiring significant difficulty reduction. The preset boundary sample selection rules in this embodiment are as follows: segments with no less than 2 consecutive failures but an active continue rate of no less than 0.65 are given priority to enter the boundary pair set; segments with no less than 2 consecutive failures, an active continue rate of no more than 0.35, and a negative feedback rate that is at least 15% higher than the mean are given priority as difficult negative samples.
[0149] During step S301, the processor performs supervised fine-tuning. The specific value of the preset supervised fine-tuning learning rate is... The preset batch size is 128; the preset training rounds are 5 rounds. In this example, the manually approved action label corresponds to action 2, which is preferred in this context, so this sample participates in the supervised fine-tuning loss calculation.
[0150] During step S302, the processor trains the reward model. The specific value of the learning rate of the preset reward model is... The specific value of the preset reward difference cutoff interval is... For the aforementioned preference pair, the reward model outputs a score of 1.42 for action 2 and a score of -0.37 for action 4, thus satisfying the condition that the score for the preferred action is higher than that for the poorer action. This set of scores comes from the single-sample output of the offline validation batch. The corresponding comprehensive reward label is synthesized from three sub-labels: satisfaction, frustration, and retention, in a ratio of 0.40:0.30:0.30.
[0151] During step S303, the processor performs direct preference optimization. The specific value of the preset preference interval amplification coefficient is 0.35; the specific value of the preset reward model loss weight is 0.40; the specific value of the preset direct preference optimization loss weight is 1.00; the specific value of the preset stage target constraint loss weight is 0.70; and the specific value of the preset stage label weight coefficient is 0.60. In this embodiment, the business meaning of the sum of the four losses is: first, inheriting the basic adjustment experience acceptable to humans; then, learning the action direction more acceptable to players through relative superiority and inferiority; subsequently, directly widening the output probability of the preferred action and the inferior action; and finally, pulling the stage target completion probability and rhythm category back to the planning set range. For this embodiment, the true rhythm label is "balanced mid-section," and the completion probability is output by the completion probability prediction head.
[0152] During step S401, the processor performs online inference for the player's current segment. If the model service timeout exceeds 20ms in this cycle, the action distribution from the previous cycle is used and an inference degradation event is recorded. The 20ms upper limit can be set offline based on server latency budget and in-game real-time requirements.
[0153] During step S402, the processor uses a temperature parameter of 0.85 to convert the six raw scores into preference scores, resulting in... It is evident that Action 2 has the highest preference score. The current stage is the transition period from the second wave of combat to the boss fight, and the constraint rules do not allow the simultaneous triggering of "Extended Time Limit" and "Significant Supply Enhancement"; in this example, Action 5 is legal but has a low score. Since the player's health percentage is not lower than 10%, Action 4 is not filtered out due to the survival safety rules, but its score is significantly lower.
[0154] During step S403, the processor invokes the reward model to predict the future risk of each action. Action 2 has a predicted satisfaction value of 0.73, a predicted frustration value of 0.28, and a future bounce risk of 0.17; Action 3 has a predicted satisfaction value of 0.69, a predicted frustration value of 0.25, and a future bounce risk of 0.15. The preset risk threshold is specifically set to 0.22. Since the risk of Action 2 does not exceed this threshold, Action 2 is ultimately output. If the risk of Action 2 exceeds 0.22, the processor will select the second-best action from the safe action subset according to the comprehensive conservative score rule, instead of simply selecting the action with the second-highest preference score.
[0155] During step S501, the processor maps action 2 to specific game parameters: enemy count decreases by 1, enemy health multiplier is adjusted to 0.92, supply refresh delay is adjusted to 10 seconds, and this is sent to the game logic server to take effect. The instruction also includes an action version number and an effective timestamp for client synchronization confirmation.
[0156] During step S502, the processor retrieves the results within a subsequent 60-second observation window. The preset observation window is set to 60 seconds. The player then successfully entered the boss fight, completing the phase in 171 seconds. After the round, the player chose to continue to the next level without submitting negative feedback. This result fragment is written back to the training sample pool.
[0157] In a statistical analysis of 10,000 replays, compared to a fixed completion rate threshold scheme, this embodiment increased the active continuation rate after a stage from 61.3% to 71.8%, reduced the exit rate after three consecutive failures from 28.6% to 16.9%, reduced the average number of manual parameter tuning rounds before a new level was launched from 7.2 rounds to 3.1 rounds, and reduced the single inference latency from 18.4ms to 9.7ms. These results are the average of three independent replay experiments. The replay logs are from real-world gray-scale server records, and the inference latency is from stress test records under the same hardware environment. This embodiment demonstrates that by jointly training preference sample pairs, reward models, and direct preference optimization, and by specifically encoding stage boundary events, resource depletion precursors, and progression stagnation patterns, it is possible to reduce misadjustments of fixed thresholds and improve both user experience metrics and engineering deployment metrics.
[0158] Subsequently, based on the above calculation and processing results, the processor continues to execute the subsequent steps as described in Example 1, completing operations such as updating feedback collection records, supplementing candidate records for manual approval, and updating candidate records for preference samples. The specific execution logic is the same as in Example 1, and will not be repeated here.
[0159] Example 3: Joint Constraints on Experience Optimization and Phase Pace During Boss Battle Phase
[0160] This example focuses on the objectives of the boss battle phase. This boss battle requires players to complete three stages of defense-breaking mechanics within 240 seconds. If optimization is based solely on satisfaction feedback, the model can easily boost ratings quickly by combining adjustments such as increasing supplies, extending the time limit, and reducing enemy behavior intensity. However, this would cause the boss battle to lose its oppressive rhythm and disrupt the main storyline design.
[0161] The basic network structure of this embodiment is consistent with that of Embodiment 1, except that the training objective has stronger stage rhythm constraints. The training set contains 41,000 boss battle segments and 23,600 preference sample pairs. The specific value of the preset objective completion probability benchmark is 0.58, which comes from the planner's objective design for the medium difficulty level of the boss battle; the preset stage rhythm labels are divided into three categories, with their specific meanings being "suppressive early stage", "balanced mid-stage", and "high-pressure conclusion". The 41,000 samples are derived from the combined data of gray-scale replay samples and offline replay samples of the boss battles in the same chapter from the last two versions, and the statistical window is 30 days after the version is launched.
[0162] When executing step S103, the processor's constructed preferences focus more on the player's reaction after the break defense rhythm. For example, under the same health range and resource level, action A extends the mission time limit by 20 seconds and adds two resupply opportunities, while action B only provides a weakness hint once before the second break defense. Historical data shows that action A has higher satisfaction, but it will significantly shift the completion time distribution to the right. Therefore, it is not considered the preferred action when the joint judgment score difference is less than the threshold or the stage stability deteriorates significantly.
[0163] During step S303, the processor prioritizes the use of stage objective constraint loss. For a batch of validation samples, the predicted stage completion probability is 0.61, the baseline target completion probability is 0.58, and the predicted stage rhythm category matches the true label. Therefore, the stage objective constraint loss for this sample remains low. Conversely, if an action, while having high satisfaction, pushes the completion probability to 0.82 and the rhythm category shifts from "high-pressure convergence" to "balanced mid-section," the stage objective constraint loss increases significantly, and training will suppress such actions. The rhythm label here is automatically coarsely labeled by the standard time ratio of the three-stage defense breach, the suppression window length, and the mechanism density, and then validated through planned sampling.
[0164] During steps S402 and S403, the processor's preference scores for candidate actions output by a certain boss-fighting player are respectively... Action 5, which involves increasing the task time limit and moving the checkpoint forward, has the highest preference score, but the reward model also predicts that this action will deviate the rhythm label to the "balanced middle" and violate the core rhythm constraints of the boss phase. After filtering based on phase constraints, the processor ultimately selects Action 2, which slightly reduces the enemy behavior intensity adjustment item and shortens the supply refresh delay, thereby preserving the core rhythm of the boss battle. If both Action 2 and Action 3 are safe, the selection is based on a comprehensive conservative score rather than the principle of minimum pure risk.
[0165] In a statistical analysis of 6,000 boss battle replays, compared to a preference strategy without stage objective constraints, this embodiment reduced the standard deviation of stage objective completion rate from 0.118 to 0.067; increased the percentage of stable completions within the target range from 68.4% to 82.9%; and improved post-game satisfaction from 4.11 to 4.18. These results are derived from three repeated replays from the same log pool, with satisfaction calculated as the average of the five-point post-game rating. This embodiment demonstrates that by transforming "rhythm maintenance" into a trainable constraint through a completion probability prediction head and a rhythm classification head, and combining this with conservative adjustment rules, the stability of objective completion can be improved without sacrificing satisfaction.
[0166] Subsequently, based on the above calculation and processing results, the processor continues to execute the subsequent steps as described in Embodiment 1, completing operations such as target action mapping, update instruction issuance, and feedback recycling. Its specific execution logic is consistent with Embodiment 1, and will not be repeated here.
[0167] Example 4: Boundary Sample Mining Enhances Challenging and Discouraging Boundary Recognition
[0168] This example addresses a hybrid platforming and light combat level. In such levels, player failures are complex, stemming from both operational errors and insufficient objective hints. If only random negative samples are used during training, the model may incorrectly learn "challenging but worthwhile" level segments as those requiring immediate difficulty reduction.
[0169] This embodiment uses 58,000 mixed level fragments to construct 31,400 pairs of preference samples. Unlike Embodiment 2, this embodiment focuses on comparing whether hard negative sample mining is enabled. The preset boundary sample ratio is specifically set to 32% in this embodiment. This ratio was obtained through validation set scanning: below 20% provides limited improvement in boundary recognition, and above 40% reduces the ranking stability in typical scenarios.
[0170] During step S203, the processor filters boundary samples according to the following rules: If a player, under similar resource conditions, fails 2 to 4 times consecutively but has a continue rate higher than 0.65 and the negative feedback after the game does not increase significantly, the segment is marked as high-challenge acceptable; if a player fails 2 to 4 times consecutively and has a continue rate lower than 0.35, while the negative feedback increases significantly, the segment is marked as high-challenge high-churn. The processor prioritizes constructing superior / inferior action pairs between these two types of segments. If the difference between the two sample states is too large, difficult negative sample pairs are not constructed to avoid mistaking differences in different level mechanisms as differences in preferences.
[0171] After performing steps S302 and S303, the preference ranking results output by the model on the boundary validation set are more stable. For a set of samples, the preference difference between action 3 and action 6 using the random negative sample scheme is only 0.04, while the hard negative sample mining scheme widens this difference to 0.19, which is more conducive to making stability judgments in the online stage. This difference comes from a single representative sample in the boundary validation batch.
[0172] In a statistical analysis of 8,000 boundary segment replays, compared to a preference training scheme without hard negative sample mining, this embodiment improved the preference ranking accuracy on the boundary sample set from 74.2% to 83.6%; the proportion of falsely triggered over-difficulty actions decreased from 19.5% to 11.2%; and the post-stage persistence rate increased from 63.7% to 69.1%. These results are derived from three repeated replays from the same boundary log pool. This embodiment demonstrates that boundary sample mining can enhance the model's ability to identify the "challenge" and "discouragement" boundaries, reducing the probability of incorrectly classifying willing-to-fight failures as immediate difficulty reduction situations.
[0173] Subsequently, based on the above calculation and processing results, the processor continues to execute the subsequent steps as described in Example 1, completing operations such as online action determination, parameter mapping, feedback collection, and closed-loop update of training samples. Its specific execution logic is the same as that in Example 1, and will not be repeated here.
[0174] Example 5: An electronic device
[0175] like Figure 6 As shown, this embodiment provides an electronic device, including a memory, a processor, a communication interface, and a computer program stored in the memory and running on the processor.
[0176] The memory stores behavior log cache data, level parameter tables, stage target state tables, action mapping tables, manually approved sample indexes, preference sample pair indexes, trained player preference alignment strategy model parameters, reward model parameters, and program instructions required to execute the aforementioned methods. The processor calls the computer program to execute the steps of the game stage target difficulty adjustment method based on player preference alignment described in any one of Embodiments 1 to 4. The communication interface is used for data interaction with the client, logging system, configuration system, and game logic server.
[0177] In one specific hardware deployment method, the electronic device can be a single server, a virtualized cloud server node, or a server cluster consisting of multiple inference nodes. The processor can be a general-purpose central processing unit, a graphics processing unit, or a combination of both; the memory can include volatile memory and non-volatile memory. When executing the computer program, the processor can perform operations such as establishing a set of candidate adjustment actions, generating a unified input representation, training the policy model and reward model, inferring online preference scores, determining conservative adjustment, issuing parameter instructions, and updating feedback collection records. After this hardware architecture is deployed, it can directly support the online execution of intra-game stage target difficulty adjustment.
[0178] The preferred embodiments of the present invention disclosed above are merely illustrative of the invention. These preferred embodiments do not exhaustively describe all details, nor do they limit the invention to the specific implementations described. As those skilled in the art will understand, many modifications and variations can be made based on the content of this specification. This specification selects and specifically describes these embodiments to better explain the principles and practical applications of the invention, thereby enabling those skilled in the art to better understand and utilize the invention. The invention is limited only by the claims and their full scope and equivalents.
Claims
1. A method for adjusting the difficulty of game stage objectives based on player preference alignment, characterized in that, include: Step S1: Establish the candidate adjustment action set, action mapping table, behavior sequence field table, checkpoint parameter table, stage target state table, manual approval sample index, and preference sample pair index; Step S2: Based on the behavior sequence field table, level parameter table, and stage target state table, generate a unified input representation for the player behavior sequence, level parameters, and stage target state, and perform boundary sample mining on the index based on the preference samples to obtain preference training samples; Step S3: Based on the manually approved sample index and preference training samples, supervised fine-tuning, reward modeling and direct preference optimization are performed on the player preference alignment strategy model and reward model. Stage goal constraint training is performed based on the stage goal completion probability and stage rhythm category to obtain the trained player preference alignment strategy model and reward model. Step S4: Read the current player's recent behavior window, current level parameters, and current stage target state; generate a context representation based on the trained player preference alignment strategy model; and calculate the preference score of each candidate adjustment action based on the candidate adjustment action set. Step S5: Calculate the experience score and future bounce risk of each candidate adjustment action based on the preference score and reward model, perform legality screening and conservative adjustment judgment on the candidate adjustment actions, determine the target adjustment action, and output the game stage target difficulty adjustment parameters corresponding to the target adjustment action based on the action mapping table.
2. The method for adjusting the difficulty of game stage objectives based on player preference alignment according to claim 1, characterized in that, The system establishes a candidate adjustment action set, action mapping table, behavior sequence field table, checkpoint parameter table, stage target state table, manually approved sample index, and preference sample pair index, including: Read the difficulty control items that can be adjusted online, and organize each difficulty control item into the candidate adjustment action set; Establish a one-to-one action mapping table for each candidate adjustment action in the candidate adjustment action set, and record the action action stage, maximum allowed trigger frequency and action mutual exclusion relationship in the action mapping table; Player time sequence logs are organized according to a fixed time order, and a behavior sequence field table is established, which includes operation events, hit events, displacement changes, resource changes, skill release intervals, target advancement information, stagnation duration, and checkpoint rollback information. Establish a checkpoint parameter table to store static checkpoint conditions and a stage target state table to store the current stage's progress status; The manual planning approval adjustment records are extracted from the historical adjustment records to obtain the manual approval sample index. The subsequent results corresponding to multiple candidate adjustment actions are compared relatively in the same player group, adjacent level environment and similar stage progress state to obtain the preference sample pair index.
3. The method for adjusting the difficulty of game stage objectives based on player preference alignment according to claim 1, characterized in that, Based on the preference samples, boundary sample mining is performed on the index to obtain preference training samples, including: Within the preset statistics window after the action takes effect, calculate the replay rate difference, stage retention rate difference, active continuation rate difference, negative feedback rate difference, and post-game evaluation difference for each candidate adjustment action relative to the baseline action. The replay rate difference, stage retention rate difference, active continuation rate difference, negative feedback rate difference, and post-game evaluation difference are multiplied by their respective preset joint judgment weights, and the multiplication results are summed to obtain the joint judgment score of each candidate adjustment action. In the same state context, when the difference in the joint judgment score of two candidate adjustment actions is not less than the preset preference judgment threshold, the one with the higher score is recorded as the preferred action and the one with the lower score is recorded as the poor action. Boundary samples are selected from segments that pass the level but have low subjective evaluations, segments that fail the level but have high continued participation, and segments that fail briefly but retry multiple times. Comparison pairs of preferred actions and poor actions are constructed between the boundary samples in the same state context to obtain the preference training samples.
4. The method for adjusting the difficulty of game stage objectives based on player preference alignment according to claim 1, characterized in that, Generating a unified input representation for player behavior sequences, level parameters, and stage objective states includes: The player behavior sequence is resampled and aligned according to the timestamp, and embedding mapping is performed on discrete behavior fields. Continuous behavior fields are segmented and scaled according to preset segmentation rules, and Boolean behavior fields are one-hot encoded to obtain a single-step input representation. The single-step input representation is organized in chronological order to obtain the action sequence input, and a preset no-operation flag and corresponding mask bit are filled in for missing steps; Event markers are generated based on phase boundary events, leader mechanism trigger events, supply scarcity events, and checkpoint rollback events, and the event markers are inserted into the corresponding time steps; The level parameters and stage target states are projected as condition tags respectively, and the condition tags are jointly encoded with the behavior sequence input and event tags to obtain the unified input representation.
5. The method for adjusting the difficulty of game stage objectives based on player preference alignment according to claim 1, characterized in that, Execution supervision fine-tuning, reward modeling, and direct preference optimization include: Based on the artificially recognized sample index, supervised fine-tuning is performed on the player preference alignment strategy model, enabling the player preference alignment strategy model to learn the basic strategy distribution corresponding to the artificially recognized adjustment action; Based on the aforementioned preference training samples, a reward model is constructed that receives player behavior sequences, level parameters, stage target states, and candidate adjustment actions. Satisfaction sub-tags, frustration sub-tags, and retention sub-tags are generated separately, and the satisfaction sub-tags, frustration sub-tags, and retention sub-tags are combined according to the corresponding preset reward synthesis weights to obtain a comprehensive reward tag; Based on the comprehensive reward label and preference training samples, the reward model is trained in pairs, so that the reward model gives a higher experience score for the output of the preferred action than for the output of the poor action. Using the supervised fine-tuned base policy distribution as a reference policy, and based on the relative probability interval between the preferred and poor actions under the current and reference policies, direct preference optimization is performed on the player preference alignment policy model to obtain the parameters of the player preference alignment policy model and the reward model.
6. The method for adjusting the difficulty of game stage objectives based on player preference alignment according to claim 5, characterized in that, Based on the probability of completing stage goals and the stage rhythm category, stage goal constraint training is performed to obtain the trained player preference alignment strategy model and reward model, which include: Based on the context representation after end-aggregation and the candidate adjustment action embedding, the probability of completion of the stage objective and the stage rhythm category are predicted; Based on the proportion of standard time consumption, the proportion of resource suppression window, the density of mechanisms, the frequency of checkpoint rollback, and the stagnation time between sub-objectives, a real stage rhythm category is generated; The stage target constraint loss is calculated based on the deviation between the predicted stage target completion probability and the target completion probability benchmark, and the classification error between the predicted stage rhythm category and the actual stage rhythm category. The total training loss is obtained by weighted summing the stage objective constraint loss, supervised fine-tuning loss, reward model loss, and direct preference optimization loss. The player preference alignment strategy model and reward model are updated based on the total training loss to obtain the trained player preference alignment strategy model and reward model.
7. The method for adjusting the difficulty of game stage objectives based on player preference alignment according to claim 1, characterized in that, The preference score for each candidate adjustment action is calculated based on the set of candidate adjustment actions, including: Read the current player's recent behavior window, and combine it with the current level parameters and the current stage target state to generate online input according to the field rules consistent with the training stage; The online input is fed into the trained player preference alignment strategy model to obtain the original scores corresponding to each candidate adjustment action; Temperature scaling is applied to the original scores to obtain the preference scores for each candidate adjustment action; When online inference fails, the action distribution generated by the most recent successful inference is used as the alternative distribution for the current cycle, and when consecutive inference failures reach a preset condition, the system switches to a pre-stored static safety action.
8. The method for adjusting the difficulty of game stage objectives based on player preference alignment according to claim 1, characterized in that, The candidate adjustment actions are screened for legality and conservative adjustment are determined to identify the target adjustment actions, including: By combining the remaining time, remaining resources, script enforcement mechanism, core rhythm restrictions of the boss phase, survival safety restrictions, and adjustment frequency restrictions, the candidate adjustment actions are filtered to obtain legal candidate actions; Based on the reward model, the experience score and future bounce risk of each legitimate candidate action are calculated, and the adjustment range distance of each legitimate candidate action relative to the currently effective action is calculated. Select a subset of safe candidate actions from the legal candidate actions, whose future exit risk is no higher than a preset risk threshold; When the subset of safety candidate actions is not empty, a comprehensive conservative score is calculated based on the preference score, experience score, and the adjustment range distance of each candidate adjustment action relative to the currently effective action, and the candidate adjustment action with the largest comprehensive conservative score is selected as the target adjustment action. When the subset of safe candidate actions is empty, the candidate adjustment action with the lowest risk of future exit and the smallest adjustment range distance is selected from the legal candidate actions as the target adjustment action.
9. The method for adjusting the difficulty of game stage objectives based on player preference alignment according to claim 1, characterized in that, Based on the action mapping table, the game stage target difficulty adjustment parameters corresponding to the target adjustment action are output, including: The target adjustment action is converted into game stage target difficulty adjustment parameters that can be executed by the game engine according to the action mapping table. The game stage target difficulty adjustment parameters include enemy number adjustment, enemy behavior intensity adjustment, supply refresh rhythm adjustment, mission time limit adjustment, prompt trigger adjustment, and checkpoint location adjustment. Send an update command containing the game stage target difficulty adjustment parameters to the game logic server, and carry the action version number, effective timestamp and rollback identifier in the update command; Within the preset observation window after the game stage target difficulty adjustment parameters take effect, the progress of the stage target, changes in the number of failures, changes in the continue rate, post-game feedback, and exit status are continuously received, forming a feedback collection record; The candidate records for manual approval and the candidate records for preference samples are updated based on the feedback collection records.
10. An electronic device comprising a memory, a processor, and a computer program stored in the memory and running on the processor, characterized in that, When the processor executes the computer program, it implements the steps of a game stage target difficulty adjustment method based on player preference alignment as described in any one of claims 1 to 9.
