Adaptive speed regulation method

By configuring independent lead deceleration and lag acceleration curves in racing games and setting transition intervals between them, the problem of unnatural AI speed adjustment is solved, achieving smooth speed transitions and a natural racing experience.

CN122624892APending Publication Date: 2026-08-25SHANGHAI SIPHON ENGINE NETWORK TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202610923565.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-06-25
Publication Date
2026-08-25

AI Technical Summary

Technical Problem

In existing racing games, the AI's speed adjustment methods struggle to balance smoothness and differentiation. This results in the AI ​​intentionally slowing down when leading or intentionally cheating when lagging behind, leading to unnatural performances that players can easily detect as being manipulated by the rules.

Method used

The AI ​​adaptive speed adjustment method is adopted. By configuring independent leading deceleration curves and lagging acceleration curves and setting a transition range between them, the speed correction coefficient can be smoothly transitioned at the switching between leading and lagging, avoiding the abrupt feeling of sudden speed changes.

Benefits of technology

It achieves continuous changes in AI speed when switching between leading and lagging, avoiding the abrupt feeling of sudden speed changes. At the same time, it does not deliberately throw the game when leading or cheat when lagging, thus improving the naturalness of the AI ​​and the game experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122624892A_ABST
    Figure CN122624892A_ABST
Patent Text Reader

Abstract

The application relates to an AI adaptive speed regulation method, which comprises the following steps: determining a progress difference between an AI entity and a target entity and normalizing the progress difference into a curve input ratio; configuring a leading deceleration curve and a lagging acceleration curve which are independent of each other, and setting a transition interval between the two curves; when the progress difference is outside the transition interval, a speed correction coefficient is obtained by sampling the corresponding curve according to the direction mark; when the progress difference is within the transition interval, the speed correction coefficient is smoothly transitioned between the sampling results of the two curves; and the target speed is obtained by correcting a basic speed with the speed correction coefficient and is injected into a vehicle dynamic control loop. The application has the advantages that the AI speed transition is smooth, and the leading is not deliberately watered down and the lagging is not deliberately cheated.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of software development, and in particular to an AI adaptive speed adjustment method. Background Technology

[0002] In racing games, the realism and challenge of the opponent AI largely depend on whether it can automatically adjust its speed based on the real-time distance and ranking relationship with the player in order to maintain the suspense and rhythm of the game. For this reason, the industry generally adopts a speed adjustment mechanism that corrects the AI ​​speed based on the progress difference between the AI ​​entity and the player.

[0003] However, existing speed adjustments often employ linear or stepwise correction methods with a single set of parameters, making it difficult to balance smoothness and differentiation. Because the speed correction amount changes linearly or in segments with the progress difference, the target speed is prone to sudden changes that can be perceived by the player when the progress difference changes, resulting in a stiff feeling of the AI ​​being fast or slow. Furthermore, since the same set of correction parameters is used for both leading and lagging situations, it is difficult to ensure that the AI ​​does not deliberately slow down when leading or deliberately cheat when lagging, thus making the AI's speed behavior appear unnatural and players can easily perceive that it is being guided by the rules. Summary of the Invention

[0004] In order to enable the speed of the opponent AI in racing games to naturally decelerate when leading and reasonably accelerate when lagging behind, with a smooth transition, this application provides an AI adaptive speed adjustment method.

[0005] Firstly, this application provides an AI adaptive speed adjustment method, which adopts the following technical solution: An AI adaptive speed adjustment method includes the following steps: S1. Determine the progress difference between the AI ​​entity and the target entity. The progress difference includes a directional marker that indicates whether the AI ​​entity is leading or lagging behind. Normalize the progress difference to the curve input ratio. S2. Configure independent leading deceleration curves and lagging acceleration curves, and set a transition range between the leading deceleration curve and the lagging acceleration curve; S3. In response to the schedule difference being outside the transition interval, select the corresponding curve from the leading deceleration curve and the lagging acceleration curve according to the direction mark, and sample the selected curve according to the curve input ratio to obtain the speed correction coefficient; In response to the schedule difference being within the transition interval, sample the leading deceleration curve and the lagging acceleration curve according to the curve input ratio respectively, and make the speed correction coefficient smoothly transition between the sampling results of the leading deceleration curve and the sampling results of the lagging acceleration curve. S4. The base speed is corrected using a speed correction factor to obtain the target speed, and the target speed is injected into the vehicle power control loop to adjust the speed of the AI ​​entity.

[0006] By adopting the above technical solution, the progress difference between the AI ​​entity and the target entity is used as the input for speed adjustment and normalized into a curve input ratio, so that the same set of curves can be adapted to tracks of different lengths. By configuring independent curves for leading and lagging, the deceleration adjustment when leading and the acceleration adjustment when lagging are independent of each other, thus ensuring that there is no deliberate letting up when leading and no deliberate cheating when lagging. By setting a transition interval between the two curves and making the speed correction coefficient smoothly transition between the sampling results of the two curves within the interval, the speed correction of the AI ​​changes continuously at the switching between leading and lagging, avoiding the speed jump caused by hard switching in direction, and thus making the AI ​​speed transition smoothly throughout the process without any abrupt changes in speed.

[0007] Optionally, in S1, the progress difference is normalized to the curve input ratio, including: determining the normalization denominator based on the length of the track segment where the AI ​​entity is located, and weighting the normalization denominator according to the curvature of the track segment so that the greater the curvature of the track segment, the smaller the normalization denominator; dividing the progress difference by the normalization denominator, and clamping the result to [0,1] to obtain the curve input ratio.

[0008] By adopting the above technical solution, the normalized denominator changes with the length and curvature of the track segment, thereby providing more sensitive corrections for the same progress difference in key overtaking sections such as curves, and improving the adaptability of the corrections to different track segments.

[0009] Optionally, before normalizing the progress difference in S1, the progress difference is further subjected to time filtering, and the relative motion intensity is determined based on the inter-frame change rate of the progress difference. The filtering coefficient of the time filtering increases with the increase of the relative motion intensity, and the width of the transition interval decreases with the increase of the relative motion intensity.

[0010] By adopting the above technical solution, the filtering intensity and transition zone width are adjusted synchronously with the same relative motion intensity, which makes the response fast when the relative motion is violent and suppresses jitter when the motion is static, thus avoiding multiple adaptive parts from acting independently and oscillating with each other.

[0011] Optionally, in S3, the speed correction coefficient is smoothly transitioned, including sub-steps S31-S33: S31. Sample the leading deceleration curve and the lagging acceleration curve according to the curve input ratio to obtain the first sample value and the second sample value. S32. Determine the fusion weight based on the position of the progress difference within the transition interval. The fusion weight is zero at the center of the transition interval, positive on the side closer to the leading deceleration curve, and negative on the side closer to the lagging acceleration curve. S33. In response to a positive fusion weight, the speed correction coefficient is determined as the sum of 1 and the first product, where the first product is the product of the difference between the first sample value and 1 and the fusion weight; in response to a negative fusion weight, the speed correction coefficient is determined as the sum of 1 and the second product, where the second product is the product of the difference between the second sample value and 1 and the absolute value of the fusion weight; in response to a zero fusion weight, the speed correction coefficient is determined as 1.

[0012] By adopting the above technical solution, the offset from the neutral value is weighted according to the fusion weight, so that the speed correction coefficient is always 1 when the AI ​​is aligned with the target, avoiding arbitrary acceleration or deceleration when aligned, and ensuring that the fusion result transitions continuously between the two curves.

[0013] Optionally, determining the fusion weight in S32 includes: maintaining a smooth fusion weight, updating the smooth fusion weight according to the target fusion weight corresponding to the position in each control cycle, using a first update rate in the direction of increasing absolute value of the smooth fusion weight and a second update rate in the direction of decreasing absolute value of the smooth fusion weight, wherein the first update rate is greater than the second update rate, and using the smooth fusion weight as the fusion weight.

[0014] By adopting the above technical solution, the fusion weight is easy to advance but difficult to retreat, so that when the AI ​​and the target are running side by side and repeatedly overtaking each other, it will not retreat due to slight reversals, thus suppressing the speed correction jitter caused by repeated fusion weights.

[0015] Optionally, the leading deceleration curve includes a deceleration saturation segment, which maintains the speed correction coefficient at a deceleration saturation value after the curve input ratio exceeds the deceleration inflection point; the lagging acceleration curve includes an acceleration holding segment, an acceleration rising segment, and an acceleration saturation segment in sequence along the direction of increasing curve input ratio. The acceleration holding segment maintains the speed correction coefficient at an acceleration holding value, the acceleration rising segment increases the speed correction coefficient as the curve input ratio increases, and the acceleration saturation segment maintains the speed correction coefficient at an acceleration saturation value.

[0016] By adopting the above technical solutions, the deceleration rate when leading is large is saturated without unlimited acceleration, and the acceleration when lagging is small remains neutral without cheating, thereby constraining the strength boundary of AI speed correction.

[0017] Optionally, sampling the leading deceleration curve and the lagging acceleration curve in S3 includes: pre-discretizing the leading deceleration curve and the lagging acceleration curve into lookup tables, with each entry in the lookup table storing the sampled value and the curve slope at the sampled value; determining the corresponding entry based on the curve input ratio; and linearly extrapolating the sampled value and the curve slope of the corresponding entry relative to the offset of the corresponding entry according to the curve input ratio to obtain the sampling result.

[0018] By adopting the above technical solution, the sampling overhead per frame is reduced by replacing real-time curve evaluation with a pre-discrete lookup table, and the quantization step at the bucket boundary of the lookup table is eliminated by linear extrapolation of the table entry slope.

[0019] Optionally, the determination of the base speed in S4 includes: obtaining the speed output by the upstream power control link and stripping the speed correction already applied by the upstream power control link to obtain the base speed; or, taking the smaller of the speed limit of the track segment where the AI ​​entity is located and the upper limit of the performance speed of the AI ​​entity as the base speed.

[0020] By adopting the above technical solution, the corrections already applied to the base speed are removed when the base speed comes from the upstream power output, avoiding repeated corrections to the same speed quantity, thus making the correction input boundary of this method clear.

[0021] Optionally, in S4, the base speed is taken as the speed limit of the track segment where the AI ​​entity is located; when the AI ​​entity crosses the segment boundary of two adjacent track segments, the base speed is transitioned from the speed limit of the previous track segment to the speed limit of the next track segment within the transition distance; wherein, in response to the speed limit of the next track segment being lower than the speed limit of the previous track segment, the transition begins within the transition distance before the AI ​​entity reaches the segment boundary; in response to the speed limit of the next track segment being higher than the speed limit of the previous track segment, the transition begins after the AI ​​entity crosses the segment boundary.

[0022] By adopting the above technical solutions, the base speed can be smoothly transitioned across track segments rather than abruptly, and the transition is only allowed in advance in the deceleration direction and in a delayed transition in the acceleration direction, thus maintaining smoothness while avoiding exceeding the speed limit in the previous track segment.

[0023] Optionally, before correcting the base speed with the speed correction factor in S4, the speed correction factor is constrained within a coefficient range, and the range between the upper and lower bounds of the coefficient range narrows towards 1 as the base speed increases.

[0024] By adopting the above technical solution, the adjustable range of the speed correction coefficient is narrowed towards neutral at high speeds, thus avoiding the amplification of the correction coefficient when multiplied by a larger base speed, which could lead to excessive catching up or deceleration.

[0025] Optionally, the above steps can be performed using fixed-point arithmetic.

[0026] By adopting the above technical solution, the calculation results of speed adjustment are kept consistent across different devices, supporting a multi-terminal deterministic synchronous competitive mode.

[0027] Optionally, different leading deceleration curves and lagging acceleration curves can be configured for different types of AI entities.

[0028] By adopting the above technical solutions, different types of AI entities, such as competitors, police, and leaders, can have differentiated deceleration and acceleration rhythms.

[0029] Optionally, when determining the progress difference, the cumulative track progress of the AI ​​entity and the target entity is obtained and moduloed by the single lap length of the track, and the shortest circular distance between the single lap progress of the two entities is taken as the progress difference.

[0030] By adopting the above technical solution, the interference of lap count on the progress difference is eliminated, making the progress difference stable and reliable on the circular track.

[0031] Optionally, a dead zone sub-interval is provided within the transition interval. When the progress difference falls into the dead zone sub-interval, the speed correction coefficient determined in the previous control cycle is maintained.

[0032] By adopting the above technical solution, the speed correction coefficient is kept constant when the progress difference is close to zero, thus suppressing coefficient fluctuations near the zero value.

[0033] Optionally, when discretizing the curve into a lookup table, the sampling point density of the lookup table decreases as the proportion of curve input increases, and AI entities of the same type share the same lookup table.

[0034] By adopting the above technical solution, the sampling accuracy is improved in the fine adjustment section with small progress difference, and the memory and sampling overhead of multiple AI entities are reduced by sharing the lookup table.

[0035] Optionally, the target speed can be clamped to ensure that it does not exceed the upper speed limit and is not lower than the lower speed limit. The upper speed limit is determined based on the speed limit of the track segment where the AI ​​entity is located.

[0036] By adopting the above technical solutions, the target speed is constrained to not exceed the speed limit of the track section, thus preventing the AI ​​speed from going out of control when catching up.

[0037] Optionally, before injecting the target speed into the vehicle power control loop, the change in the target speed relative to the target speed in the previous control cycle is limited.

[0038] By adopting the above technical solution, the periodic variation range of the target speed is limited, serving as a final safety net for speed smoothing.

[0039] Optionally, the base speed can be zeroed out before multiplying the speed correction factor by the base speed.

[0040] By adopting the above technical solution, the abnormal base velocity is prevented from being transmitted as an abnormal target velocity after correction.

[0041] Optionally, before injecting the target speed into the vehicle power control loop, the target speed is fused with the current speed of the AI ​​entity using a first-order low-pass filter.

[0042] By adopting the above technical solutions, the transition from target speed to actual speed can be further smoothed.

[0043] Optionally, the speed correction injection can be temporarily overridden by obstacle avoidance or collision avoidance safety actions and restored after the safety action is released.

[0044] By adopting the above technical solutions, safety actions are prioritized over speed adjustment, thus preventing collisions caused by AI trying to control the rhythm.

[0045] Optionally, when the vehicle's power control loop approaches the target speed, the upper limit of acceleration rate and the upper limit of deceleration rate can be configured separately.

[0046] By adopting the above technical solutions, the acceleration and deceleration of AI can present an asymmetrical dynamic, which is closer to the driving experience of a real vehicle.

[0047] In summary, this application includes at least one of the following beneficial technical effects: 1. By configuring independent curves for leading and lagging positions and setting transition intervals between them, the speed correction coefficient is smoothly transitioned. This ensures that the AI ​​speed changes continuously at the transition between leading and lagging positions without any abrupt changes in speed. This balances the avoidance of deliberately slowing down when leading and deliberately cheating when lagging.

[0048] 2. By clamping the speed correction coefficient to neutral at the center of the transition interval and applying a smoothing effect that makes it easier to advance than retreat to the fusion weight, the speed correction remains stable even when the AI ​​is on par with the target and when they repeatedly overtake each other, thus avoiding incorrect corrections when on par and boundary jitter.

[0049] 3. By uniformly adjusting the filtering and transition zone width based on relative motion intensity, eliminating sampling bucket boundary steps with a slope lookup table, and smoothing the base speed with asymmetric inter-segment smoothing under the premise of preventing overspeed, the smoothness and safety under complex tracks and intense competition are improved while reducing the sampling overhead per frame. Attached Figure Description

[0050] Figure 1 This is a flowchart illustrating an AI adaptive speed adjustment method provided in an embodiment of this application.

[0051] Figure 2This is a schematic diagram illustrating the relationship between the leading deceleration curve, the lagging acceleration curve, and the transition interval provided in the embodiments of this application.

[0052] Figure 3 This is a schematic diagram of the sub-steps for smooth transition of the speed correction coefficient within the transition range provided in the embodiments of this application. Detailed Implementation

[0053] The present application will be further described in detail below with reference to the accompanying drawings. It should be understood that the specific embodiments described herein are merely illustrative of the application and are not intended to limit the scope of the application.

[0054] This application discloses an AI adaptive speed adjustment method. Before describing the embodiments of this application in detail, several technical terms involved in the embodiments will be explained first.

[0055] The progress difference refers to the gap between the position of the AI ​​entity on the track and the position of the target entity on the track along the track direction. The progress difference carries a direction marker, which indicates whether the AI ​​entity is currently in a state of leading or lagging behind the target entity.

[0056] The curve input ratio is a dimensionless quantity that falls within the interval [0,1] after the progress difference is converted according to a certain normalized denominator, and is used as the horizontal axis input when sampling from the speed adjustment curve later.

[0057] The leading deceleration curve and the lagging acceleration curve are two independently configured speed adjustment curves. The leading deceleration curve is used when the AI ​​entity is ahead, and its output reduces the AI ​​entity's speed relative to the base speed. The lagging acceleration curve is used when the AI ​​entity is behind, and its output increases the AI ​​entity's speed relative to the base speed. The shape, inflection point, and value range of the two curves are independent of each other and do not affect each other.

[0058] The transition interval is a range set near the zero point where the progress difference crosses from the leading side to the lagging side, or from the lagging side to the leading side. When the progress difference of an AI entity falls within this interval, the speed correction is no longer directly given by a single curve, but is obtained by a smooth transition from the sampling results of two curves.

[0059] The core idea of ​​this application embodiment is: to determine the progress difference with directional markings between the AI ​​entity and the target entity in real time and normalize it into a curve input ratio; to select the corresponding curve from the leading deceleration curve or the lagging acceleration curve according to the directional markings to obtain the speed correction coefficient; when the progress difference falls into the transition range, to make the speed correction coefficient smoothly transition between the sampling results of the two curves; and finally to correct the base speed with the speed correction coefficient to obtain the target speed and inject it into the vehicle power control loop. Thus, without deliberately slowing down when leading or deliberately cheating when lagging, the speed of the AI ​​entity changes continuously at the switching point between leading and lagging, without any abrupt changes in speed throughout the process.

[0060] For ease of explanation, the numerical examples for each step below all use the same baseline scenario: on a circular track, an AI entity lags behind the player (the target entity), with a progress difference of 60 meters along the track direction. Directional markers indicate that the AI ​​entity is lagging behind. The steps of this method are described in detail below with reference to the accompanying diagrams. Figure 1 As shown, this method includes steps S1 to S4.

[0061] S1. Determine the progress difference between the AI ​​entity and the target entity. The progress difference includes a directional marker indicating whether the AI ​​entity is leading or lagging behind, and normalize the progress difference to the curve input ratio.

[0062] In step S1, the real-time positions of the AI ​​entity and the target entity on the track are first acquired, the progress difference between them along the track direction is calculated, and a directional marker is added to the progress difference. Continuing with the baseline scenario, if the AI ​​entity is 60 meters behind the player, the progress difference value is 60 meters, and the directional marker is "behind". Then, the progress difference is converted into a curve input ratio falling within the interval [0,1] using a normalized denominator, which serves as the horizontal axis input of the curve configured in the subsequent step S2. The larger the curve input ratio, the greater the gap between the AI ​​entity and the target entity; the directional marker determines whether to sample on the leading deceleration curve or the lagging acceleration curve in the subsequent steps.

[0063] In some embodiments, the process of normalizing the progress difference to a curve input ratio includes: determining a normalized denominator based on the length of the track segment where the AI ​​entity is located, and weighting the normalized denominator according to the curvature of the track segment, so that the greater the curvature of the track segment, the smaller the normalized denominator; then dividing the progress difference by the normalized denominator, and clamping the result to the interval [0,1] to obtain the curve input ratio. Determine using the following formula: in, For the progress difference with direction markings, The length of the track segment where the AI ​​entity is located. The curvature of this track segment, These are curvature weighting coefficients. This restricts the values ​​within the parentheses to the range [0,1]. Continuing from the baseline scenario, let the track segment containing the AI ​​entity be an approximately straight road with a length of... meters, curvature The normalized denominator is approximately 200 meters, and the curve input ratio corresponding to a progress difference of 60 meters is... This causes the normalized denominator to vary with the length and curvature of the track segment. In critical overtaking sections with large curvature, such as curves, the same progress difference is converted into a larger curve input ratio, thus providing a more sensitive correction for the same progress difference.

[0064] The timing filtering and transition interval width for the progress difference can optionally be uniformly adjusted using the same relative motion intensity. Before normalizing the progress difference in S1, timing filtering is applied to the progress difference, and the relative motion intensity is determined based on the inter-frame change rate of the progress difference. The filtering coefficient of the timing filter increases with the increase of the relative motion intensity, and the width of the transition interval set in step S2 decreases with the increase of the relative motion intensity. (Relative motion intensity) The rate of change of the relative position between the AI ​​entity and the target entity is reflected by the rate of change of the schedule difference between adjacent control cycles: in, and These represent the progress difference between the current control cycle and the previous control cycle. To control the cycle duration, The reference relative velocity used for normalization, The relative motion intensity is limited to the interval [0,1]. Filter coefficients. With transition interval width According to and Confirmed, among which , As the benchmark value, , This is an adjustment factor. Continuing from the baseline scenario, we assume the progress difference between adjacent cycles changes from 62 meters to 60 meters, and the product of the reference relative velocity and the cycle... meters, then relative motion intensity Therefore, the filter strength and transition interval width are adjusted synchronously with the same relative motion intensity: when the relative motion is intense, the filter coefficient increases and the transition interval narrows, resulting in a faster speed correction response; when the two are in a stalemate, the filter coefficient decreases and the transition interval widens, suppressing jitter near the zero point and preventing the filter and transition from oscillating independently. As an optional implementation, a fixed filter coefficient and a fixed transition interval width can also be used instead of adjusting according to the relative motion intensity.

[0065] Optionally, when determining the progress difference, the cumulative track progress of the AI ​​entity and the target entity is obtained and moduloed by the single-lap length of the track. The shortest circular distance between their single-lap progress is taken as the progress difference. For example, if the single-lap length of the track is 1200 meters, the cumulative progress of the AI ​​entity corresponds to a single-lap progress of 1100 meters, and the cumulative progress of the target entity corresponds to a single-lap progress of 1160 meters. The difference between the two is 60 meters in the forward direction of the track and 1140 meters in the reverse direction. The smaller of 60 meters is taken as the progress difference, and the backward direction mark is retained. This eliminates the interference of the number of laps on the progress difference, making the progress difference stable and reliable on the circular track.

[0066] The calculations in the above steps can optionally employ fixed-point arithmetic. For example, under fixed-point arithmetic, the calculation error for progress difference calculation, curve sampling, and position interpolation on different devices does not exceed 0.001. This ensures consistent calculation results for speed adjustment across different devices, supporting multi-device deterministic synchronous competition modes.

[0067] S2. Configure independent leading deceleration curves and lagging acceleration curves, and set a transition interval between the leading deceleration curve and the lagging acceleration curve. The relationship between the two curves and the transition interval is as follows: Figure 2 As shown.

[0068] like Figure 2 As shown, Figure 2 Using the progress difference with directional markings as the horizontal axis and the speed correction coefficient as the vertical axis, the relationship between the leading deceleration curve, the lagging acceleration curve, and the transition interval is shown. A negative progress difference indicates that the AI ​​entity is leading, and a positive progress difference indicates that the AI ​​entity is lagging. The leading deceleration curve is located on the leading side, and its speed correction coefficient is generally no greater than the neutral value of 1. It smoothly decreases from the neutral value of 1 as the leading degree increases, tending towards the deceleration saturation value at a significant lead, for example, a deceleration saturation value of 0.85. The lagging acceleration curve is located on the lagging side, and its speed correction coefficient is generally no less than the neutral value of 1. It smoothly increases from the neutral value of 1 as the lagging degree increases, tending towards the acceleration saturation value at a significant lagging degree, for example, an acceleration saturation value of 1.2. A neutral value of 1 indicates that no correction is made to the base speed. A transition interval is set near the zero point of the progress difference. Within the transition interval, the values ​​of both curves are close to the neutral value of 1 and are smoothly connected. The two curves as a whole have a flat shape at both ends and a smooth middle without inflection points, so that the speed correction coefficient changes continuously with the progress difference without abrupt changes at the transition between leading and lagging.

[0069] In S2, two independent speed adjustment curves are pre-configured: a leading deceleration curve and a lagging acceleration curve. A transition interval is set between the two curves, near the zero point of the progress difference. The leading deceleration curve uses the curve input ratio as the horizontal axis and the speed correction coefficient as the vertical axis, with its value generally not exceeding the neutral value. It is used to lower the speed when the AI ​​entity is leading. Similarly, the lagging acceleration curve uses the curve input ratio as the horizontal axis and the speed correction coefficient as the vertical axis, with its value generally not less than the neutral value. It is used to raise the speed when the AI ​​entity is lagging. Since independent curves are configured for leading and lagging, the deceleration tuning when leading and the acceleration tuning when lagging do not interfere with each other, thus ensuring that there is no deliberate easing when leading and no deliberate cheating when lagging. The transition interval defines a range of progress differences. When the progress difference of the AI ​​entity falls into this range, it enters the smooth transition branch of step S3.

[0070] In some embodiments, the leading deceleration curve includes a deceleration saturation segment, which maintains the speed correction coefficient at a deceleration saturation value after the curve input ratio exceeds the deceleration inflection point. The lagging acceleration curve includes an acceleration holding segment, an acceleration rising segment, and an acceleration saturation segment sequentially along the direction of increasing curve input ratio. The acceleration holding segment maintains the speed correction coefficient at an acceleration holding value, the acceleration rising segment increases the speed correction coefficient as the curve input ratio increases, and the acceleration saturation segment maintains the speed correction coefficient at an acceleration saturation value. For example, the lagging acceleration curve has an acceleration holding value of 1.0 and an acceleration saturation value of 1.2. The speed correction coefficient continuously increases from 1.0 to 1.2 as the curve input ratio increases within the acceleration rising segment. This ensures that lagging acceleration remains neutral and does not cheat when lagging slightly, and that the acceleration amplitude saturates and does not accelerate indefinitely when lagging significantly. Similarly, the leading deceleration amplitude saturates and does not infinitely loosen when leading significantly, thereby constraining the strength boundary of AI entity speed correction.

[0071] Different leading deceleration curves and lagging acceleration curves can be optionally configured for different types of AI entities. For example, competitor-type AI entities can be configured with a more aggressive lagging acceleration curve to create a close catch-up rhythm, while police-type and leader-type AI entities can be configured with their own deceleration and acceleration curves. This allows different types of AI entities, such as competitors, police, and leaders, to exhibit differentiated deceleration and acceleration rhythms without modifying the main method.

[0072] S3. In response to the schedule difference being outside the transition interval, select the corresponding curve from the leading deceleration curve and the lagging acceleration curve according to the direction mark, and sample the selected curve according to the curve input ratio to obtain the speed correction coefficient; in response to the schedule difference being within the transition interval, sample the leading deceleration curve and the lagging acceleration curve according to the curve input ratio respectively, and make the speed correction coefficient smoothly transition between the sampling results of the leading deceleration curve and the sampling results of the lagging acceleration curve.

[0073] In S3, it first determines whether the progress difference falls within the transition range set in S2, and then divides into two branches accordingly. If the progress difference is outside the transition range, the corresponding curve is selected according to the direction marker: a leading deceleration curve is selected when the direction marker is in the lead, and a lagging acceleration curve is selected when the direction marker is in the lag. The selected curve is then sampled using the curve input ratio to obtain the speed correction coefficient. Continuing with the baseline scenario, the AI ​​entity is 60 meters behind the player, the curve input ratio is 0.3, the direction marker is lagging, and it is outside the transition range. Therefore, the lagging acceleration curve is sampled with 0.3 as the horizontal axis, resulting in a speed correction coefficient of 1.08. If the progress difference is within the transition range, the leading deceleration curve and the lagging acceleration curve are sampled using the curve input ratio respectively, and the speed correction coefficient is smoothly transitioned between the sampling results of the two curves. This ensures that the speed correction of the AI ​​entity changes continuously at the switching points between leading and lagging, avoiding the speed jump caused by hard switching by direction, thus making the AI ​​entity's speed transition smoothly throughout, without any abrupt changes in speed. The specific implementation of the smooth transition within the transition range is detailed in the following sub-steps.

[0074] In some embodiments, such as Figure 3 As shown, the process of smoothing the transition of the speed correction coefficient in S3 includes sub-steps S31 to S33.

[0075] S31. Sample the leading deceleration curve and the lagging acceleration curve according to the curve input ratio to obtain the first sample value and the second sample value. The first sample value is the value of the leading deceleration curve at the current curve input ratio, and the second sample value is the value of the lagging acceleration curve at the current curve input ratio.

[0076] S32. The fusion weight is determined based on the position of the schedule difference within the transition interval. The fusion weight is zero at the center of the transition interval, positive on the side closer to the leading deceleration curve, and negative on the side closer to the lagging acceleration curve. That is, the closer the schedule difference is to the center of the transition interval, the smaller the absolute value of the fusion weight; the fusion weight is positive when the schedule difference is biased towards the leading side and negative when it is biased towards the lagging side.

[0077] S33. In response to a positive fusion weight, the velocity correction coefficient is determined as the sum of 1 and a first product, where the first product is the product of the difference between the first sample value and 1 and the fusion weight; in response to a negative fusion weight, the velocity correction coefficient is determined as the sum of 1 and a second product, where the second product is the product of the difference between the second sample value and 1 and the absolute value of the fusion weight; in response to a zero fusion weight, the velocity correction coefficient is determined as 1. Velocity correction coefficient Determined by the following offset fusion formula: in, The fusion weights take values ​​in the interval [-1, 1]. This is the first sampled value, i.e., the sampled value of the leading deceleration curve. This is the second sampled value, i.e., the sampled value of the lagging acceleration curve. This indicates taking the larger of the value within the parentheses and 0. Following the baseline scenario, in condition two: the AI ​​entity and the target entity are nearly aligned, and the progress difference falls on the lagging side of the transition interval; weight fusion is then applied. The leading deceleration curve sampling value is obtained by sampling the two curves according to the curve input ratio. Lagging acceleration curve sampling value Substituting into the above formula, we get When the schedule difference is exactly at the center of the transition interval. Substituting into the above formula, we get Therefore, the velocity correction coefficient is weighted by the fusion weights according to the offset from the neutral value of 1. When the AI ​​entity and the target entity are aligned, the velocity correction coefficient is always 1, avoiding arbitrary acceleration or deceleration during alignment and ensuring a continuous transition of the fusion result between the two curves. As an optional implementation, a smooth transition within the transition interval can also be achieved without the above offset fusion, by directly linearly interpolating the first and second sampled values ​​using the fusion weights to obtain the velocity correction coefficient.

[0078] In some embodiments, the process of determining the fusion weight in S32 includes: maintaining a smooth fusion weight; updating the smooth fusion weight in each control cycle according to the target fusion weight corresponding to the position of the progress difference within the transition interval; updating at a first update rate in the direction of increasing absolute value of the smooth fusion weight and at a second update rate in the direction of decreasing absolute value of the smooth fusion weight, wherein the first update rate is greater than the second update rate; and using the smooth fusion weight as the fusion weight in S33. For example, the first update rate is 0.2 per control cycle and the second update rate is 0.05 per control cycle. Suppose that in a certain control cycle the smooth fusion weight is -0.30 and the target fusion weight becomes -0.40, both of which increase the absolute value of the smooth fusion weight. Updated at the first update rate, the smooth fusion weight moves to -0.40; if subsequently the target fusion weight becomes -0.20, decreasing the absolute value of the smooth fusion weight, then updated at the second update rate, the smooth fusion weight moves only 0.05 from -0.40 to -0.35. This makes it easy to advance the fusion weights but difficult to retreat them. When the AI ​​entity and the target entity move in tandem and repeatedly overtake each other, the smooth fusion weights do not rapidly regress with small reversals, suppressing the speed correction jitter caused by repeated fusion weight changes. As an alternative implementation, the smooth fusion weights can also be updated at the same rate in both directions.

[0079] In some embodiments, the sampling process for the leading deceleration curve and the lagging acceleration curve in S3 includes: pre-discretizing the leading deceleration curve and the lagging acceleration curve into lookup tables, where each entry of the lookup table stores a sampled value and the curve slope at the sampled value; determining the corresponding entry based on the curve input ratio; and linearly extrapolating the sampled value and curve slope of the corresponding entry relative to the offset of the corresponding entry according to the curve input ratio to obtain the sampling result. Determine using the following formula: in, Enter the scale for the current curve. Enter the scale for the curve corresponding to the table item. The sampled values ​​stored for the corresponding table entries, This stores the slope of the curve for the corresponding entry. For example, one entry in the lag acceleration curve is the curve input ratio. Sample values Slope Current curve input ratio Then the sampling result Therefore, by replacing real-time curve evaluation with a pre-discrete lookup table, the computational overhead of sampling per frame is reduced, and the quantization step at the bucket boundary is eliminated by linear extrapolation using the slope of the table entries. As an optional implementation, the sampling result can also be obtained by directly linearly interpolating the sampled values ​​of adjacent entries without storing the slope.

[0080] The transition interval may optionally include a dead zone sub-interval. When the schedule difference falls into the dead zone sub-interval, the speed correction coefficient determined in the previous control cycle is maintained. This keeps the speed correction coefficient unchanged when the schedule difference is close to zero, suppressing coefficient fluctuations near the zero value.

[0081] In other embodiments, when the curve is discretized into a lookup table, the sampling point density of the lookup table decreases as the curve input ratio increases, and AI entities of the same type share the same lookup table. This improves sampling accuracy in fine-tuning sections with small progress differences and reduces memory and sampling overhead for multiple AI entities by sharing the lookup table.

[0082] S4. The base speed is corrected using a speed correction factor to obtain the target speed, and the target speed is injected into the vehicle power control loop to adjust the speed of the AI ​​entity.

[0083] In S4, the speed correction coefficient obtained in S3 is multiplied by the base speed to get the current target speed of the AI ​​entity. This target speed is then injected into the vehicle's power control loop via the power output stage to drive the AI ​​entity. Continuing with the baseline scenario, with a speed correction coefficient of 1.08 and a base speed of 30 meters per second, the target speed is... At a speed of meters per second, after the target speed is injected into the vehicle's power control loop, the AI ​​entity adjusts its speed upwards based on the sampling results of the lag acceleration curve when it lags behind, in order to catch up with the target entity.

[0084] In some embodiments, determining the base speed in S4 includes: obtaining the speed output by the upstream power control unit and removing the speed correction already applied by the upstream power control unit to obtain the base speed; or, taking the smaller of the speed limit of the track segment where the AI ​​entity is located and the upper limit of the performance speed of the AI ​​entity as the base speed. For example, if the speed limit of the track segment where the AI ​​entity is located is 32 meters per second and the upper limit of the performance speed of the AI ​​entity is 30 meters per second, then the smaller value of 30 meters per second is taken as the base speed. Thus, when the base speed comes from the upstream power output, the correction already applied is removed, avoiding repeated correction of the same speed amount, making the correction input boundary of this method clear.

[0085] In other embodiments, in S4, the base speed is taken as the speed limit of the track segment where the AI ​​entity is located. When the AI ​​entity crosses the boundary between two adjacent track segments, the base speed is transitioned from the speed limit of the previous track segment to the speed limit of the next track segment within a transition distance. Specifically, if the speed limit of the next track segment is lower than that of the previous track segment, the transition begins within the transition distance before the AI ​​entity reaches the segment boundary; if the speed limit of the next track segment is higher than that of the previous track segment, the transition begins after the AI ​​entity crosses the segment boundary. For example, if the speed limit of the previous track segment is 32 meters per second and the speed limit of the next track segment is 24 meters per second, because the speed limit of the next segment is lower, the base speed is linearly transitioned from 32 meters per second to 24 meters per second within a 20-meter transition distance before the AI ​​entity reaches the segment boundary; conversely, if the speed limit of the next segment is higher than that of the previous segment, the transition begins only after the AI ​​entity crosses the segment boundary. Therefore, the base speed transitions smoothly across track segments rather than abruptly, and only allows for an earlier transition in the deceleration direction and a later transition in the acceleration direction, thus maintaining smoothness while preventing AI entities from exceeding their speed limits in the previous track segment.

[0086] In some embodiments, before correcting the base speed with a speed correction factor in S4, the speed correction factor is constrained within a coefficient range, and the range between the upper and lower bounds of the coefficient range narrows towards 1 as the base speed increases. The half-width of the coefficient range... Determine using the following formula: in, Based on speed, This represents the upper limit of the performance speed of AI entities. As the baseline half-width, the velocity correction factor is constrained within the range Inside. For example, the base half-width. Base speed meters per second, performance speed limit meters per second, then The coefficient range narrowed to If the speed correction factor is 1.08 at this time, it will be clamped to 1.05. This narrows the adjustable range of the speed correction factor from high speed to neutral, avoiding the amplification of the correction factor when multiplied by a larger base speed, which could lead to excessive catching up or deceleration.

[0087] The target speed can be optionally clamped to ensure that it does not exceed the upper speed limit and does not fall below the lower speed limit. The upper speed limit is determined based on the speed limit of the track segment in which the AI ​​entity is located. This constrains the target speed to not exceed the speed limit of the track segment, preventing the AI ​​entity from losing control of its speed when it falls behind and tries to catch up.

[0088] In one alternative implementation, the change in target speed relative to the target speed in the previous control cycle is limited before the target speed is injected into the vehicle power control loop. This limits the cycle-by-cycle variation of the target speed as a final safety net for speed smoothing.

[0089] Before multiplying the speed correction factor by the base speed, the base speed can optionally be zeroed out for protection. This prevents abnormal base speeds from being transmitted as abnormal target speeds after correction.

[0090] In some embodiments, the target speed is fused with the current speed of the AI ​​entity using a first-order low-pass filter before being injected into the vehicle's power control loop. This further smooths the transition from the target speed to the actual speed.

[0091] The injection of speed correction can be temporarily overridden by obstacle avoidance or collision avoidance safety actions, and restored after the safety actions are released. This prioritizes safety actions over speed adjustment, preventing AI entities from colliding while trying to control the pace.

[0092] In one alternative implementation, the acceleration rate cap and deceleration rate cap are configured separately as the vehicle's power control loop approaches the target speed. This makes the AI ​​entity's acceleration and deceleration exhibit asymmetrical dynamics, more closely resembling the driving experience of a real vehicle.

[0093] The above embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application, and should all be included within the protection scope of this application.

Claims

1. An AI adaptive speed adjustment method, characterized in that, Includes the following steps: S1. Determine the progress difference between the AI ​​entity and the target entity, the progress difference includes a directional marker representing whether the AI ​​entity is leading or lagging, and normalize the progress difference to a curve input ratio; S2. Configure independent leading deceleration curves and lagging acceleration curves, and set a transition interval between the leading deceleration curve and the lagging acceleration curve; S3. In response to the progress difference being outside the transition interval, select a corresponding curve from the leading deceleration curve and the lagging acceleration curve according to the direction mark, and sample the selected curve at the curve input ratio to obtain a speed correction coefficient; in response to the progress difference being within the transition interval, sample the leading deceleration curve and the lagging acceleration curve at the curve input ratio respectively, and make the speed correction coefficient smoothly transition between the sampling result of the leading deceleration curve and the sampling result of the lagging acceleration curve; S4. The base speed is corrected using the speed correction coefficient to obtain the target speed, and the target speed is injected into the vehicle power control loop to adjust the speed of the AI ​​entity.

2. The AI ​​adaptive speed adjustment method according to claim 1, characterized in that, In step S1, normalizing the progress difference into a curve input ratio includes: determining a normalized denominator based on the length of the track segment where the AI ​​entity is located, and weighting the normalized denominator according to the curvature of the track segment so that the greater the curvature of the track segment, the smaller the normalized denominator; dividing the progress difference by the normalized denominator, and clamping the result to [0,1] to obtain the curve input ratio.

3. The AI ​​adaptive speed adjustment method according to claim 1, characterized in that, Before normalizing the progress difference in step S1, the method further includes performing time filtering on the progress difference; and determining the relative motion intensity based on the inter-frame change rate of the progress difference. The filtering coefficient of the time filtering increases with the increase of the relative motion intensity, and the width of the transition interval decreases with the increase of the relative motion intensity.

4. The AI ​​adaptive speed adjustment method according to claim 1, characterized in that, The process of making the speed correction coefficient transition smoothly in step S3 includes the following sub-steps: S31. Sample the leading deceleration curve and the lagging acceleration curve respectively using the curve input ratio to obtain a first sample value and a second sample value; S32. Determine the fusion weight based on the position of the progress difference within the transition interval, wherein the fusion weight is zero at the center of the transition interval, positive on the side closer to the leading deceleration curve, and negative on the side closer to the lagging acceleration curve; S33. In response to the fusion weight being positive, the speed correction coefficient is determined to be the sum of 1 and a first product, where the first product is the product of the difference between the first sampled value and 1 and the fusion weight; In response to the fusion weight being negative, the speed correction coefficient is determined to be the sum of 1 and a second product, where the second product is the product of the difference between the second sampled value and 1 and the absolute value of the fusion weight; In response to the fusion weight being zero, the speed correction coefficient is set to 1.

5. The AI ​​adaptive speed adjustment method according to claim 4, characterized in that, Determining the fusion weight in step S32 includes: maintaining a smooth fusion weight; updating the smooth fusion weight according to the target fusion weight corresponding to the position in each control cycle; the update adopts a first update rate in the direction of increasing absolute value of the smooth fusion weight and a second update rate in the direction of decreasing absolute value of the smooth fusion weight; the first update rate is greater than the second update rate; and using the smooth fusion weight as the fusion weight.

6. The AI ​​adaptive speed adjustment method according to claim 1, characterized in that, The leading deceleration curve includes a deceleration saturation segment, which maintains the speed correction coefficient at a deceleration saturation value after the curve input ratio exceeds the deceleration inflection point. The lagging acceleration curve includes an acceleration holding segment, an acceleration rising segment, and an acceleration saturation segment in sequence along the direction of increasing curve input ratio. The acceleration holding segment maintains the speed correction coefficient at an acceleration holding value, the acceleration rising segment increases the speed correction coefficient as the curve input ratio increases, and the acceleration saturation segment maintains the speed correction coefficient at an acceleration saturation value.

7. The AI ​​adaptive speed adjustment method according to claim 1, characterized in that, S3, sampling the leading deceleration curve and the lagging acceleration curve, includes: pre-discretizing the leading deceleration curve and the lagging acceleration curve into lookup tables, each entry of the lookup table storing a sampled value and the curve slope at the sampled value; determining the corresponding entry based on the curve input ratio; and linearly extrapolating the sampled value and the curve slope of the corresponding entry relative to the corresponding entry according to the curve input ratio to obtain the sampling result.

8. The AI ​​adaptive speed adjustment method according to claim 1, characterized in that, The determination of the base speed in S4 includes: obtaining the speed output by the upstream power control link and stripping the speed correction applied by the upstream power control link to obtain the base speed; or, taking the smaller of the speed limit of the track segment where the AI ​​entity is located and the performance speed limit of the AI ​​entity as the base speed.

9. The AI ​​adaptive speed adjustment method according to claim 1, characterized in that, In step S4, the base speed is taken as the speed limit of the track segment where the AI ​​entity is located; when the AI ​​entity crosses the segment boundary of two adjacent track segments, the base speed is transitioned from the speed limit of the previous track segment to the speed limit of the next track segment within a transition distance; wherein, in response to the speed limit of the next track segment being lower than the speed limit of the previous track segment, the transition begins within the transition distance before the AI ​​entity reaches the segment boundary; in response to the speed limit of the next track segment being higher than the speed limit of the previous track segment, the transition begins after the AI ​​entity crosses the segment boundary.

10. The AI ​​adaptive speed adjustment method according to claim 1, characterized in that, Before correcting the base speed with the speed correction coefficient in step S4, the speed correction coefficient is constrained within a coefficient range, and the range between the upper and lower boundaries of the coefficient range narrows towards 1 as the base speed increases.