Game interaction method based on touch pen pressure input
Through the game interaction method based on the stylus pressure input, dynamically map the speed and audio feedback of the stylus pressure signal to the game character, solving the problem of insufficient control of fineness, realism and immersion in the existing technology, achieving a more natural and accurate game interaction effect and a higher sense of immersion.
Patent Information
- Application Number
- CN202510389453.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-31
- Publication Date
- 2025-06-20
AI Technical Summary
The existing game interaction methods are insufficient in controlling the fineness, realism and immersive experience, especially the lack of power input on the screen touch, the keyboard and mouse input methods are relatively rigid, and the gamepad power perception is limited, resulting in a stiff operation, not being free enough, and being unable to accurately express the intention, thereby reducing the realism and playability of the game.
The game interaction method based on the stylus pressure input is adopted, and the pressure signal of the stylus is dynamically mapped with the speed and audio feedback of the game character through steps such as signal acquisition, preprocessing, optimization, optimal control and adaptive filtering to achieve continuous and fine control.
It achieves a more natural and accurate game interaction effect, solves the problems of rigid and rigid switching, makes the character movements smoother, and enhances the realism and immersion of the game.
Smart Images

Figure CN120168942A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and particularly to a game interaction method based on stylus pressure input. Background Art
[0002] In the rapid development of digital entertainment today, the innovation of game interaction methods is becoming a key factor in enhancing the user experience. Players not only pursue visual and auditory immersion in games, but also hope that the operation methods can be natural, precise, and intuitive. Especially in games such as action, shooting, and racing, how to more delicately control character movements, adjust attack strength, or acceleration methods has become an important factor affecting the game experience.
[0003] In the prior art, game interaction methods mainly rely on screen touch, keyboard, mouse, and gamepad. These input methods have their own advantages in different game scenarios. Screen touch interaction is intuitive and can support gesture operations, and is commonly used in mobile games. The keyboard and mouse are mainstream in PC games, with fast operations. The gamepad provides analog inputs such as joysticks and trigger buttons, with a good feedback experience, enabling players to control character movement and combat through hand movements. These interaction methods have been widely applied in the market, providing stable and mature operation solutions for games on different platforms.
[0004] However, although the prior art can meet the basic game control requirements, there are still some deficiencies in terms of control fineness, realism, and immersive experience; firstly, screen touch can only operate based on X-Y coordinates, lacking force input, and it is difficult to simulate the subtle movement changes caused by different pressing forces in the real world; secondly, the input methods of the keyboard and mouse are relatively rigid, and operations such as attacks and movements are often fixed values or discrete adjustments, unable to achieve natural transitions; in addition, although the gamepad provides certain analog inputs, the force perception is limited to the trigger button, and it is still based on the mapping of electronic signals within a limited range, far less accurate and linearly variable than the stylus pressure sensing. These interaction methods more or less make players feel that the operations are rigid, not free enough, unable to accurately express intentions, and thus reduce the realism and playability of the game. Summary of the Invention
[0005] Aiming at the deficiencies of the prior art, the present invention provides a game interaction method based on stylus pressure input, which solves the problems of the deficiencies of the existing game interaction methods in terms of control fineness, realism, and immersive experience.
[0006] To achieve the above objectives, the present invention is realized through the following technical solutions: A game interaction method based on stylus pressure input, comprising the following steps: S1. Signal acquisition: Acquire the pressure signal and the position signal of the stylus. S2. Signal preprocessing: Denoise and smooth the collected pressure signal. S3. Signal optimization: Filter the pressure signal of the stylus using Kalman filter to obtain a stable pressure sensing value. S4. Optimal control: Optimize the feedback control relationship between the stable pressure sensing value and the game character through an optimal control algorithm. S5. Adaptive filtering: Further optimize the stable pressure sensing value using the LMS adaptive filtering algorithm. S6. Feedback output: Control the speed and audio feedback of the game character according to the stable pressure sensing value.
[0007] Preferably, the signal acquisition step includes: Collect the pressure signal and the position signal of the stylus through a pressure sensor and a position sensor. The pressure signal of the stylus reflects the pressure intensity applied by the stylus on the screen. The position signal of the stylus includes the horizontal and vertical coordinates of the stylus on the screen.
[0008] Preferably, the signal preprocessing step includes: Denoise the collected pressure signal of the stylus to reduce the high-frequency noise in the pressure signal. Use low-pass filtering to smooth the pressure signal of the stylus and eliminate the random jitter generated during the use of the stylus. Smooth the pressure signal of the stylus using a low-pass filter.
[0009] Preferably, the signal optimization step includes: Use the Kalman filtering algorithm to optimize the collected pressure signal of the stylus to obtain a filtered and stable pressure sensing value. The stable pressure sensing value is the processing result of removing noise and jitter and is used to precisely control the game feedback.
[0010] Preferably, the optimal control step includes: Based on the optimal control theory, set an optimization objective function to minimize the error between the pressure sensing signal and the game feedback. Adopt a nonlinear optimization method to solve the control parameters to ensure the optimal mapping between the pressure signal of the stylus and the speed of the character. The optimal control method optimizes the influence of the pressure sensing signal on the game feedback by minimizing the objective function.
[0011] Preferably, the adaptive filtering step includes: Use the LMS adaptive filtering algorithm to adaptively adjust the pressure signal of the stylus to optimize the filter weights. The LMS algorithm dynamically adjusts the low-pass filter by minimizing the mean square error to reduce the noise of the pressure signal. The LMS algorithm updates the weights of the low-pass filter through the error pressure signal, thereby continuously improving the processing accuracy of the pressure signal.
[0012] Preferably, the feedback output step includes: Controlling the moving speed of the game character according to the stable pressure sensing value; Adjusting the audio feedback in the game according to the stable pressure sensing value, and the audio playback rate is in a proportional relationship with the intensity of the pressure sensing signal.
[0013] Preferably, the optimal control algorithm includes: Using the least squares method or the gradient descent method to calculate the control parameters; The algorithm optimizes the control effect by minimizing the weighted sum between the feedback error and the control error.
[0014] Preferably, the signal optimization step and the optimal control step work together to achieve a dynamic optimization mapping relationship between the stylus pressure signal and the game feedback, improving the user operation accuracy and the game interaction experience.
[0015] The present invention provides a game interaction method based on stylus pressure input. It has the following beneficial effects: 1. The present invention adopts the stylus pressure sensing input technology, maps the pressure value to parameters such as the speed and attack power of the game character, and realizes continuous and fine control. It achieves a more natural and accurate game interaction effect. Compared with the existing screen touch control, keyboard or joystick solutions that rely on fixed numerical input, it solves the problems of rigid operation and abrupt switching, making the character movements smoother.
[0016] 2. The present invention processes the pressure signal through low-pass filtering and combines it with the real-time mapping algorithm to make the pressure input more stable and controllable. It achieves the effect of reducing noise interference and avoiding the influence of short-term fluctuations on the game performance. Compared with the existing joystick or button input modes that cannot perceive the change of force in real time, it solves the problems of insufficient input response sensitivity and difficulty in realizing dynamic control.
[0017] 3. The present invention constructs a multi-dimensional interaction mechanism, and simultaneously applies the pressure information and position information of the stylus to the behavior adjustment of the game character. It achieves the effect of not only being able to control the direction, but also being able to affect parameters such as speed and skill intensity through the magnitude of the force. Compared with the existing method of controlling character actions only based on position coordinates, it solves the deficiencies of single input dimension and lack of realism, making the operation more hierarchical.
[0018] 4. The present invention maps pressure input to multi-modal feedback, including character animation, sound effect changes, visual effects, etc., to enhance the immersion of the game. The technical effect of allowing players to intuitively feel the feedback of the game world through subtle changes in hand strength is achieved. Compared with the existing solution of relying solely on buttons and sliding for interaction, the problem of dull game feedback and lack of real physical perception is solved. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] Figure 1 is a flow chart of the method of the present invention; Figure 2 A schematic diagram of applying pressure to the present invention; Figure 3 A schematic diagram of the method of using the present invention; Figure 4 It is an implementation diagram of the method of using the present invention. DETAILED DESCRIPTION
[0020] The following will be combined with the drawings in the specification of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0021] Please see attached Figure 1 -Attached Figure 4 , an embodiment of the present invention provides a game interaction method based on stylus pressure input, comprising the following steps: S1. Signal acquisition: collecting the pressure signal and position signal of the stylus; The pressure signal acquisition of the stylus relies on a highly sensitive pressure sensor that can capture the pressure intensity of the stylus on the screen in real time. The collected original pressure signal is recorded as ,in: Indicates at time The original pressure value collected at all times; is the time variable, the unit is second (s); Pressure value The value range of depends on the characteristics of the sensor, usually 0 to 4096 or 0 to 1024, and the unit is the pressure unit (such as Newton N or a custom pressure level).
[0022] In order to further improve the accuracy of the acquisition, the method of taking the average value of multiple sampling is adopted. The specific calculation formula is: ; in: Indicates the pressure value after mean processing at time ; Indicates the total number of samplings within a sampling period; Indicates the th raw pressure value obtained from the sampling; Indicates the sampling sequence number; Indicates the time variable at the sampling moment.
[0023] This mean processing method can effectively reduce the fluctuations caused by single - sampling errors or external interferences, making the pressure signal more stable and improving the stability of subsequent signal processing.
[0024] The acquisition of the position signal relies on a high - precision touch - coordinate sensor system to obtain the position trajectory of the stylus on the screen in real time. The position signal is represented by the horizontal coordinate and the vertical coordinate together, where: Indicates the coordinate position of the stylus in the horizontal direction of the screen at time , with the unit of pixel; Indicates the coordinate position of the stylus in the vertical direction of the screen at time , with the unit of pixel.
[0025] Similarly, to improve the stability of the position signal, the method of taking the mean of multiple samplings is adopted, and the calculation formulas are respectively: ; ; where: and respectively indicate the horizontal and vertical coordinate values after mean processing at time ; Indicates the total number of samplings within a sampling period; and are respectively the horizontal and vertical coordinate values obtained from the th sampling; Indicates the sampling sequence number; Indicates the time variable at the sampling moment.
[0026] By taking the mean of multiple samplings, it can effectively reduce the coordinate jumps caused by hand tremors or device errors, improving the smoothness and accuracy of the position signal.
[0027] In this embodiment, to ensure the synchronization of the pressure signal and the position signal, a unified timestamp mechanism is adopted to ensure that each set of acquired data corresponds to a unique time identifier. The structure of each set of data is as follows: ; Wherein: represents a set of data collected at time ; is the pressure signal; and are the position signals; represents the timestamp, in seconds (s), with a precision of at least milliseconds to ensure the accuracy of the data time series.
[0028] The data acquisition system is equipped with a cache module to temporarily store the data collected each time, ensuring that data will not be lost or misaligned under high-frequency sampling conditions. The caching mechanism adopts the first-in-first-out (FIFO) strategy to ensure that data is passed into the subsequent processing flow in an orderly manner.
[0029] To ensure the reliability of the collected data, this embodiment sets up a data anomaly detection mechanism to detect the following situations: Abnormal pressure value: If exceeds the maximum or minimum range specified by the sensor, it is marked as abnormal; Position signal jump: If , it is considered that the coordinate signal has an abnormal jump; wherein, and are respectively the preset maximum allowable jump ranges, and the specific values are set according to the device resolution and application scenarios.
[0030] Abnormal data will be filtered to prevent it from entering the subsequent processing link, ensuring the stability and accuracy of the data.
[0031] In different application scenarios, there may be different requirements for the sensitivity of pressure acquisition. For example, in painting games, a higher pressure sensitivity helps to capture more delicate brushstroke changes, while in speed control games, more attention is paid to the overall trend of the pressure signal. Therefore, in this embodiment, the acquisition system can dynamically adjust the sampling sensitivity according to the game type.
[0032] When it is detected that the user is continuously performing delicate operations, the sampling accuracy is automatically increased, and the and values within each sampling period are increased; When the user performs large-scale or high-speed operations, the sampling accuracy is appropriately reduced to improve the processing speed and reduce the consumption of computing resources.
[0033] Through technical measures such as multiple sampling means, anomaly detection, time synchronization, and data caching, the reliability and accuracy of data acquisition are greatly improved, ensuring the smoothness and responsiveness in the final game control process.
[0034] S2. Signal preprocessing: Denoise and smooth the collected pressure signal; S2 is used to further optimize the original signal. Through multiple denoising and smoothing processes, it ensures the accuracy and stability of the final input data.
[0035] The process of signal preprocessing includes three key links: noise removal, smoothing, and normalization. These series of processing steps work together to significantly reduce signal fluctuations, improve data consistency, and ensure that subsequent processing and optimization steps can operate based on a more accurate signal.
[0036] In this embodiment, for the collected signal, a low-pass filter is used for noise removal. The low-pass filter can effectively filter out high-frequency noise in the signal, retain the effective low-frequency components in the pressure signal, and improve the stability of the signal.
[0037] The mathematical formula for low-pass filtering is as follows: ; Where: represents the pressure signal value after low-pass filtering at time , with the unit of Newton (N) or a custom pressure level; represents the original pressure signal value collected and averaged at time , with the unit of Newton (N); represents the pressure signal value after filtering at the previous time , with the unit of Newton (N); represents the smoothing coefficient. A larger value can accelerate the response speed, while a smaller value helps to improve the smoothness of the signal; represents the time variable, with the unit of second (s).
[0038] This filtering method is simple and efficient, capable of processing the collected signal in real time and avoiding signal delay problems.
[0039] To ensure the consistency of signals under different devices and sampling environments, the pressure signal and position signal are further normalized. The normalized signal is more suitable for subsequent optimization algorithm processing and facilitates the unified control logic of different devices.
[0040] The normalization processing formula is as follows: ; ; ; Where: represents at time The pressure signal value after time normalization; and respectively represent the normalized lateral and longitudinal position signal values; , and respectively represent the pressure signal and position signal values after filtering and smoothing processing; and respectively represent the minimum and maximum pressure values supported by the device to ensure the correctness of the normalization calculation; , , and respectively represent the minimum and maximum values of the lateral and longitudinal coordinates supported by the device to ensure the accuracy of the position signal normalization processing; represents the time variable, with the unit of seconds (s).
[0041] Normalization processing ensures signal consistency between different devices and avoids control deviations caused by hardware differences.
[0042] Through low-pass filtering and normalization processing, the stability, continuity, and consistency of the pressure signal and position signal are comprehensively improved. Multiple signal optimization methods ensure that the signal data can meet the strict requirements of subsequent processing, reduce the negative impacts brought by noise and errors, and provide a solid technical guarantee for achieving high-precision and stable game control.
[0043] S3, Signal Optimization: Use Kalman filtering to filter the stylus pressure signal to obtain a stable pressure sensing value; To further improve the stability and accuracy of the pressure signal and ensure that the system can perform control feedback based on a more stable signal, S3 uses the Kalman filtering algorithm to deeply optimize the preprocessed signal and finally outputs a stable and reliable pressure sensing value.
[0044] The Kalman filtering algorithm is an optimal filtering algorithm based on recursive estimation. It can dynamically estimate the optimal value of the system state through continuous prediction and update steps in the presence of noise and uncertainty in the system. In this embodiment, Kalman filtering is applied to optimize the normalized pressure signal, thereby eliminating residual noise and stabilizing signal variations, and ensuring an accurate and reliable data basis for subsequent optimal control.
[0045] The Kalman filtering process includes two core stages, namely the prediction stage and the update stage. Each stage performs recursive processing based on a strict mathematical model to ensure the dynamic optimal estimation of the system state.
[0046] In the prediction stage, based on the state estimate value and its error covariance at the previous moment, the system state and error covariance at the current moment are predicted. The specific prediction formula is as follows: ; ; where: represents the predicted value of the pressure signal at time , with the unit being the normalized pressure value (range: [0, 1]). This value is the prediction result based on the stable pressure value at the previous time, reflecting the expected state at the current time; represents the state transition matrix of the system, describing the transition relationship of the system state from the previous time to the current time; represents the stable pressure signal value after optimization at time , with the unit being the normalized pressure value; represents the influence coefficient of the control input on the system state; represents the external control input signal; represents time , the predicted value of the error covariance at time reflecting the uncertainty of the current state measurement. The unit is a dimensionless value; represents the error covariance at time describing the stability of the state estimate value at the previous time; represents the transpose of the matrix; represents the process noise.
[0047] Update stage: ; ; ; where: represents the Kalman gain coefficient, determining the weight allocation between the predicted value and the measured value at the current time; represents the observation matrix, describing the mapping relationship between the actual measured value and the state value of the system; represents the transpose of the matrix ; represents the measurement noise covariance, reflecting the noise intensity in the actual measured value. The unit is a dimensionless value. The smaller the value, the more accurate the measurement signal; is the predicted value of the pressure signal obtained in the prediction stage; represents the pressure signal value after normalization at time , with the unit being a dimensionless value; represents the stable pressure signal value after Kalman filter optimization at time , with the unit being a dimensionless value; represents the updated error covariance, reflecting the uncertainty of the current state estimate; is the identity matrix, which is used to ensure the correctness of matrix calculations; is the predicted error covariance.
[0048] In the specific implementation process, the optimization process of the Kalman filter follows the following flow: First, through the prediction stage, based on the stable value at the previous moment and the error covariance , predict the state value at the current moment and the error covariance .
[0049] Then, combine the actual measurement value at the current moment , calculate the Kalman gain to balance the relative influence of the predicted value and the measured value.
[0050] Subsequently, correct the predicted value through the update formula to obtain the final stable pressure value , and update the error covariance to provide a basis for the prediction of the next moment.
[0051] Generally, the system noise covariance and the measurement noise covariance are key parameters for the performance of the Kalman filter. In this embodiment, according to the noise characteristics of the device and the actual use environment, the following optimization strategies are carried out: If there is high external noise interference in the device, the value of the system noise covariance can be appropriately increased to enhance the system's dependence on historical data and ensure signal smoothness.
[0052] If the measurement signal accuracy is high, the value of the measurement noise covariance can be reduced to enhance the system's response speed to real-time measurement data and improve the signal's dynamic responsiveness.
[0053] Through the Kalman filter optimization process in step S3, the residual noise and irregular fluctuations in the signal can be effectively eliminated, ensuring that the final obtained pressure signal has high smoothness and stability. This stable pressure signal can not only improve the accuracy of the subsequent optimal control algorithm but also effectively avoid abnormal game feedback caused by signal fluctuations, further enhancing the game interaction experience and the system's robustness.
[0054] S4. Optimal control: Optimize the feedback control relationship between the stable pressure sensing value and the game character through the optimal control algorithm; S4 adopts an optimization algorithm based on the theory of adaptive control. Combining with the stable pressure signal after Kalman filtering, it further optimizes the control feedback of the system. Specifically, the purpose of optimizing the control feedback is to quickly respond to external changes and precisely control the action feedback of the game character on the premise of ensuring the stability of the system. To achieve this goal, this embodiment is based on an adaptive feedback adjustment mechanism, and adjusts the control parameters to respond to the changes of the signal in real time, thereby optimizing the control effect.
[0055] Generally, the core idea of the adaptive control algorithm is to dynamically adjust the parameters of the controller according to the real-time feedback of the system to adapt to the changes of the system parameters and the external environment. In this embodiment, for the stable pressure signal that has been optimized by Kalman filtering, the feedback control algorithm is combined to adjust the system, so that the control system can self-adjust under different working conditions, improving the response speed and control accuracy.
[0056] Specifically, this embodiment adopts an adaptive algorithm based on proportional-integral-derivative (PID) control to optimize the feedback response in real time by adjusting the pressure signal.
[0057] The PID control algorithm is widely used in automatic control. Its basic idea is to control the output of the system by adjusting the three parameters of proportional, integral and derivative, so that the system remains stable during the feedback control process and reduces errors as much as possible. For this embodiment, the PID controller is used to adjust the dynamic response of the pressure signal so that it can better adapt to different external interferences and system state changes.
[0058] The mathematical formula of PID control is as follows: ; Where: represents the control output, the magnitude of the control signal. The unit is a dimensionless value. This output signal will be used to adjust the system controller and affect the dynamic performance of the game character; is the proportional coefficient, and the controller's response intensity to the current error . The unit is a dimensionless value. The larger the proportional gain, the faster the system responds to the current error, but too large may cause the system to oscillate; represents the error at the current moment; is the integral coefficient, and the controller's response intensity to the error accumulation. The unit is a dimensionless value. The role of the integral gain is to eliminate the persistent error and enhance the system stability; represents the integral term of the error, reflecting the accumulation of errors over a period of time in the past. The unit is a dimensionless value; Differential coefficient, the controller's response intensity to the rate of change of the error. The unit is a dimensionless value; The differential term representing the error reflects the rate of change of the error. The unit is a dimensionless value.
[0059] Specifically, in this embodiment, the three coefficients of the PID controller , and adopt an adaptive adjustment strategy. Generally, the parameters of the controller are fixed. However, due to various external interferences that may exist in the actual system or changes in the system state, the fixed PID parameters may not be able to adapt to the new working environment. Therefore, in this embodiment, these parameters are adjusted through real-time feedback to ensure the optimal performance of the system under different states.
[0060] In a possible implementation manner, the parameters of the controller , and are dynamically adjusted according to the feedback signal of the system. For example, when the system error is large, the proportional gain will increase to accelerate the error correction speed; when the system has been in a state of error accumulation for a long time, the integral gain will be appropriately increased to eliminate the long-term deviation of the error; when the system response is too intense, the derivative gain will be appropriately increased to balance the response speed and stability of the system; The optimized PID parameter settings are as follows: ; Where: is the proportional gain for the next iteration, with the unit being a dimensionless value; is the current proportional gain, with the unit being a dimensionless value; is the objective function with respect to the proportional gain , representing the influence degree of control accuracy on this parameter; is the adjustment step size, which determines the convergence speed of the optimization, with the unit being a dimensionless value; is the integral gain for the next iteration, with the unit being a dimensionless value; is the current integral gain, with the unit being a dimensionless value; is the objective function with respect to the integral gain , representing the influence degree of system error accumulation on this parameter; is the adjustment step size, with the unit being a dimensionless value; is the derivative gain for the next iteration, with the unit being a dimensionless value; is the current derivative gain, with the unit being a dimensionless value; is the objective function with respect to the derivative gain The gradient indicates the degree of influence of the system error change rate on this parameter; is the adjustment step size, with the unit being a dimensionless value.
[0061] In a possible implementation, the adjustment step size , and adopt an adaptive update strategy to enable dynamic adjustment according to the optimization progress, preventing system oscillation or slow convergence caused by too fast or too slow parameter updates.
[0062] As an option, the mathematical model of the system may change under different operating conditions. Therefore, it is necessary to dynamically correct the model to ensure that the controller can always match the true state of the system. In this embodiment, a dynamic parameter identification method based on the least squares method is used to correct the system model. Assume the dynamic equation of the system is: ; Where: is the current system output value, and the unit depends on the specific application scenario (such as pressure, temperature, etc.); , represent the system output values of the past two time steps; , represent the system input signals of the past two time steps; , is the system state coefficient, representing the historical influence weight of the output signal; , is the influence coefficient of the input signal on the system output; is the random error term, representing system noise.
[0063] In a possible implementation, new parameters , , , are estimated through the least squares method, enabling the system model to more accurately reflect the current state and thus improving the control accuracy.
[0064] Specifically, after parameter optimization and dynamic model correction, the control algorithm of the system needs to be further enhanced to improve robustness and adaptability. In this embodiment, a combination of fuzzy control and PID control is adopted to make up for the deficiencies of PID control in nonlinear systems.
[0065] As an option, the fuzzy control part is used to dynamically adjust the PID parameters. The system performs fuzzy inference based on the error and the error change rate to dynamically adjust the PID gains, enabling the controller to maintain optimal performance under different operating conditions.
[0066] Generally, the fuzzy control rules are as follows: When is larger and is smaller, increase to accelerate the convergence speed.
[0067] When is smaller but is larger, increase to reduce oscillation.
[0068] When deviates from zero for a long time, increase to eliminate the steady-state error.
[0069] In a possible implementation, the input variables of the fuzzy control are and , and the output variable is , , the adjustment amount of. By adjusting the control parameters online, the system can better handle non-linear, time-varying, and uncertain factors.
[0070] The PID controller dynamically adjusts the control parameters according to the real-time change of the error to ensure that the system can always maintain the best performance in a changing environment. In addition, the combination of the PID control algorithm and the optimization of the Kalman filter ensures the stability of the pressure signal and further optimizes the dynamic response of the control system through the adaptive adjustment mechanism.
[0071] S5. Adaptive filtering: Use the LMS adaptive filtering algorithm to further optimize the stable pressure sensing value; The purpose of S5 is to comprehensively evaluate the system performance, quantify key indicators such as error, response time, control accuracy, and system stability, and adjust the control parameters according to the evaluation results. Through this process, the system can self-optimize, ensure to maintain the optimal performance during long-term operation, adapt to external changes, and improve the overall control effect. Performance evaluation and adjustment not only help to maintain the stability of the system in the long term, but also can effectively cope with external disturbances and parameter changes, and improve the adaptability and reliability of the system.
[0072] In step S5, the performance evaluation is mainly achieved by monitoring and analyzing the following key indicators of the system: Error evaluation Response time evaluation Control accuracy evaluation Stability evaluation Error evaluation Error is one of the key indicators to measure the performance of the control system, which usually reflects the gap between the system output and the target output. In this embodiment, the calculation formula of the error is as follows: ; in: is the error, which indicates the error value at the current moment, and the unit is a dimensionless value. This error indicates a stable pressure signal With target pressure value The difference between.
[0073] Response time measures the time it takes for a system to receive an input signal and output a response. A shorter response time usually indicates a system's fast response capability. Calculated by the following formula: ; in: is the response time, which indicates the time required for the system to complete the target response from receiving the input signal, in seconds (s); The time when the system receives the input signal, in seconds (s); The time it takes for the system to complete the target response, in seconds (s).
[0074] Control accuracy is used to measure the consistency between the actual output of the system and the target output. In order to quantify the control accuracy, the root mean square error (RMSE) is often used. The specific calculation formula is as follows: ; in: is the root mean square error, which represents the quantitative value of control accuracy and is a dimensionless value; is the number of error samples, which indicates the number of error sampling points within a period of time; Indicates at time The calculated error as a dimensionless value. The error is the difference between the stable pressure signal and the target pressure value.
[0075] Stability assessment aims to measure the system's ability to recover after external disturbances or changes in internal parameters. In this embodiment, stability assessment is quantified by oscillation amplitude and convergence time. Oscillation amplitude and convergence time are calculated by the following formulas: Oscillation Amplitude :Measure the maximum fluctuation amplitude in the system feedback process. The formula is as follows: ; in: is the oscillation amplitude, and the unit is a dimensionless value. It represents the maximum fluctuation amplitude generated by the system during the feedback process; is the stable pressure signal after optimization, and its unit is dimensionless value; is the target pressure value, and its unit is dimensionless value.
[0076] Based on the performance evaluation results in step S5, the system can dynamically adjust the control parameters according to the feedback errors, response time, control accuracy, and stability indicators to optimize the system performance. The specific adjustment methods include the dynamic adjustment of PID controller parameters and external disturbance compensation.
[0077] Generally, when the error is large, the proportional gain will increase to accelerate the system's response to the error; when the system error accumulates, the integral gain will increase to eliminate long-term errors; when the system oscillates excessively, the derivative gain will increase to slow down the system's response and reduce oscillations.
[0078] For example, in some embodiments, the proportional gain of the system is adjusted according to the current error magnitude. When the error is small, the proportional gain will decrease to avoid over-response of the system; while in the case of a large system error, the proportional gain will be appropriately increased to accelerate the system's correction speed.
[0079] S6. Feedback Output: Control the speed of the game character and audio feedback according to the stable pressure sensing value; S6 is the "Feedback Output" part, which involves controlling the behavior, speed of the game character, and audio feedback according to the pressure value S6 Feedback Output: Objective: According to the pressure value of the stylus to dynamically control the physical attributes of the game character (such as movement speed) and the playback speed of the audio feedback. This process requires precise control according to different pressure values, real-time feedback of the user's operations, and enhancement of the game's immersion.
[0080] Control the physical attributes of the character (such as character speed): Algorithm description: According to the stable pressure value , map this value to the physical attributes of the character. Specifically, through a proportional coefficient , convert the pressure value into the speed of the character.
[0081] Formula: ; Where: is the speed of the character; is a user-defined proportional coefficient to adjust the mapping relationship between pressure and character speed; is the stable pressure value, the pressure data after filtering and processing.
[0082] Speed adjustment: Dynamically adjust the movement speed of the character according to the player's input through the pressure value. For example, when pressing gently, the character may move slowly, while when pressing hard, the speed increases.
[0083] To improve the sensitivity and responsiveness of character control, the mapping coefficient can be dynamically adjusted according to the player's operation behavior (such as a light touch or a heavy press). By using a sensitivity factor, the mapping relationship between the pressure value and the speed can be flexibly adjusted according to the player's operation habits, game scenarios, or the state of the character.
[0084] When the player makes a slight operation, the mapping coefficient is small, making the character respond slowly and avoiding too fast a response; while when the player makes a larger force operation, the mapping coefficient increases to ensure that the character's movement speed is correspondingly increased.
[0085] The dynamic adjustment of the sensitivity factor can be based on the current state of the character. For example, in different scenarios within the game, the character requires different control sensitivities. For instance, in a high-speed racing mode, the character may require a higher sensitivity, while in a fine operation mode, the sensitivity should be reduced.
[0086] To avoid the character's movement being too abrupt, a non-linear mapping function (such as an exponential function, a logarithmic function, etc.) is used to adjust the relationship between the pressure value and the character's speed to smooth the character's movement changes.
[0087] When the pressure value is low, a logarithmic function is used for smooth mapping to ensure that the character's movement changes are not drastic when lightly pressed.
[0088] When the pressure value is high, methods such as an exponential function are used to increase the speed change so that the character can quickly respond according to the user's input force.
[0089] If logarithmic mapping is selected, the formula for calculating the character's speed can be: ; Where: is the character speed; is the stable pressure value; is the proportionality coefficient, adjusting the relationship between the player's input and the character's speed.
[0090] In some games, the character's movement speed not only depends on the player's input but is also affected by the physics engine (such as friction, gravity, acceleration, etc.). Therefore, when calculating the character's speed, in addition to the pressure value mapping, the parameters of the physics engine need to be comprehensively considered.
[0091] In the formula for calculating the character's speed, add the dynamic parameters of the physics engine, such as factors like friction and inertia, to simulate a more realistic character movement.
[0092] For example, assuming that the character's movement is affected by friction, the formula can be: ; Where: is the frictional force; is the finally calculated character speed.
[0093] Based on the player's operation rhythm and control intensity, the rate of change of the character's speed is adjusted in real time, so that the character has a more delicate feedback performance in the game.
[0094] If the player makes multiple rapid operations in a short period of time (such as quickly tapping lightly or frequently changing the intensity), the "acceleration limit" mechanism can be adopted to avoid drastic fluctuations in the character's speed.
[0095] Conversely, if the player maintains a stable pressure input for a long time, the character's speed will increase smoothly and will not change too much due to pressure fluctuations.
[0096] Algorithm description: In actual operations, abnormal fluctuations or distortions of the pressure signal may occur, resulting in inappropriate responses of the character's speed. Therefore, an anomaly detection mechanism needs to be introduced to ensure the smoothness of the game experience.
[0097] When an abnormal pressure fluctuation is detected, the speed is automatically adjusted to the nearest stable speed value, or the abnormal signal is smoothed through a filter to prevent sudden pressure changes from causing the character's speed to be too fast or too slow.
[0098] If the change in the pressure value exceeds a preset threshold, anomaly handling can be initiated to set the character's speed to a certain safe value or use a smoothing algorithm to repair the fluctuation.
[0099] Combining the above supplementary content, the speed calculation formula of the character can be further expanded to: ; where: is the mapping function from pressure to speed (which can be a linear or non-linear function); is the proportionality coefficient used to adjust the mapping between pressure and character speed; is the frictional force calculated by the physics engine; is the adjustment coefficient of the frictional force used to control the character's speed in different physical environments; is the correction value based on the anomaly detection mechanism or sensitivity adjustment.
[0100] Through these supplementary contents, the technical solution for controlling the physical attributes of the character can more precisely adjust the movement of the character, making the character feedback in the game more smooth and real, and further enhancing the user's interactive experience.
[0101] Audio feedback (controlling the playback rate of background music): According to the pressure value of the stylus , control the playback rate of the background music. We need to map the pressure value to the music playback speed to produce a more immersive sound effect response.
[0102] Formula: ; Where: is the playback rate of the audio; is the stable pressure value; (·) is a limiting function.
[0103] Specific steps: Audio rate mapping: By dividing the pressure value by 500, an audio rate related to the pressure is obtained. For example, a smaller pressure value will result in a slower audio playback rate, and a larger pressure value will result in a faster rate.
[0104] Rate limitation: To prevent the audio rate from being too fast or too slow, we use the clamp function to limit the audio rate between 0.5 and 2.0. This ensures that the background music plays within a certain range.
[0105] Example: If = 2500, then the audio rate = 2500 divided by 500 = 5.0, but after limitation, = 2.0.
[0106] If = 1000, then the audio rate = 1000 divided by 500 = 2.0, still meeting the range limitation.
[0107] Specific process: When the user presses the stylus, the pressure and coordinates are collected in real time, and the pressure value is optimized through dynamic filtering.
[0108] According to the pressure value, control the physical properties (such as speed) of the character, and map the pressure to the character's movement speed through the formula .
[0109] According to the pressure value, adjust the playback rate of the background music, and achieve the change of audio feedback through the formula .
[0110] Through the refined control of these feedback outputs, the immersion and interactivity of the game have been significantly enhanced. Users can finely control the character's behavior through the pressure input of the stylus and experience the changes in sound effects and visuals in real time, greatly improving the richness of the game experience and the accuracy of the feedback.
[0111] Although embodiments of the present invention have been shown and described, it will be understood by those of ordinary skill in the art that various changes, modifications, substitutions and variations can be made to these embodiments without departing from the principles and spirit of the present invention, and the scope of the present invention is defined by the appended claims and their equivalents.
Claims
1. A game interaction method based on stylus pressure input, characterized in that: The following steps are involved: S1. Signal acquisition: collecting the pressure signal and position signal of the stylus; S2, signal preprocessing: denoising and smoothing the collected pressure signal; S3, signal optimization: using Kalman filtering to filter the stylus pressure signal to obtain a stable pressure sensitivity value; S4, optimal control: optimizing the feedback control relationship between the stable pressure sense value and the game character through an optimal control algorithm; S5, adaptive filtering: using LMS adaptive filtering algorithm to further optimize the stable pressure sense value; S6. Feedback output: controlling the speed and audio feedback of the game character according to the stable pressure value.
2. The game interaction method based on stylus pressure input according to claim 1, characterized in that: The signal acquisition step comprises: Collecting a pressure signal and a position signal of the stylus pen through a pressure sensor and a position sensor; The pressure signal of the stylus reflects the pressure intensity applied by the stylus on the screen; The stylus position signal includes the horizontal and vertical coordinates of the stylus on the screen.
3. The game interaction method based on stylus pressure input according to claim 1, characterized in that: The signal preprocessing step comprises: De-noising the collected stylus pressure signal to reduce the high-frequency noise in the pressure signal; The pressure signal of the stylus is smoothed using a low-pass filter to eliminate random jitter generated during the use of the stylus.
4. The game interaction method based on stylus pressure input according to claim 1, characterized in that: The signal optimization step comprises: The Kalman filter algorithm is used to optimize the collected stylus pressure signal to obtain a filtered stable pressure value; Stable pressure values are the result of removing noise and jitter, and are used to precisely control game feedback.
5. The game interaction method based on stylus pressure input according to claim 1, characterized in that: The optimal control step comprises: Based on optimal control theory, an optimization objective function is set to minimize the error between the pressure-sensing signal and the game feedback; A nonlinear optimization method is used to solve the control parameters to ensure the optimal mapping between the stylus pressure signal and the character's velocity; The optimal control method optimizes the influence of the pressure-sensing signal on the game feedback by minimizing the objective function.
6. The game interaction method based on stylus pressure input according to claim 1, characterized in that: The adaptive filtering step comprises: Adaptively adjust the stylus pressure signal using the LMS adaptive filtering algorithm to optimize the filter weight; The LMS algorithm dynamically adjusts the low-pass filter by minimizing the mean square error to reduce the noise of the pressure signal; The LMS algorithm updates the low-pass filter weights through the error pressure signal, thereby continuously improving the pressure signal processing accuracy.
7. The game interaction method based on stylus pressure input according to claim 1, characterized in that: The feedback output step comprises: Control the movement speed of the game character according to the stable pressure value; Adjust the audio feedback in the game based on the stable pressure value. The audio playback rate is proportional to the strength of the pressure signal.
8. The game interaction method based on stylus pressure input according to claim 1, characterized in that: The optimal control algorithm includes: Use least squares or gradient descent methods to calculate control parameters; The algorithm optimizes the control effect by minimizing the weighted sum between the feedback error and the control error.
9. The game interaction method based on stylus pressure input according to claim 1, characterized in that: The signal optimization step and the optimal control step work together to achieve a dynamic optimization mapping relationship between the stylus pressure signal and the game feedback, thereby improving the user's operation accuracy and game interaction experience.