A method for real-time music generation in games
By collecting and analyzing player physiological, behavioral and game data, and adjusting game music using multiple linear regression algorithms, the problems of player fatigue and tension in the game are solved and the game experience is improved.
Patent Information
- Application Number
- CN202510102060.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-22
- Publication Date
- 2025-07-11
- Estimated Expiration
- 2045-01-22
AI Technical Summary
Existing games cannot perceive or judge the physical fatigue and mental burnout caused by players' long-term games, and cannot help players adjust their emotions and maintain a sense of pleasure by adjusting game music.
By collecting the physiological data, game difficulty coefficient, behavioral data and performance data of the player during the game, the multivariate linear regression algorithm trains the model to analyze the influence weights of these data, and dynamically adjust the rhythm, pitch, volume and dynamic range of the game music to adapt to the changes in the player's state.
Effectively regulate players' emotions, reduce fatigue, relieve tension, maintain players' interest and performance in gaming, and improve game experience.
Smart Images

Figure CN119559921B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of game music generation, and specifically refers to a method for real-time generation of music in games. Background Art
[0002] Video games are one of the common means for people to entertain. In some competitive games, in addition to hitting targets and obtaining certain scores according to the player's hitting speed, hitting accuracy, etc., and finally determining whether the player passes the level or obtains certain rewards based on the scores. At the same time, the game also has certain game music, and the game music has functions such as regulating the player's emotions. For example, adding horror and other elements to the game to create a tense atmosphere, etc.
[0003] During the process of the player playing the game, the player's score is affected by various factors. One of the influencing factors is that after the player plays the game for a certain period of time, the player generates emotions such as boredom and weariness due to the content, intensity, and difficulty of the game, which is reflected in the game as a decrease in the player's game score. Existing games cannot perceive or judge the physical fatigue and mental burnout caused by the player playing the game for a long time, and thus cannot help the player regulate emotions and maintain a sense of pleasure by adjusting the game music.
[0004] Designing a method for real-time generation of music in games to solve the problems existing in the above-mentioned prior art is the purpose of the research of the present invention. Summary of the Invention
[0005] In view of the problems existing in the above-mentioned prior art, the present invention aims to provide a method for real-time generation of music in games, which can effectively solve at least one of the problems existing in the above-mentioned prior art.
[0006] The technical solution of the present invention is as follows:
[0007] A method for real-time generation of music in games includes the following steps:
[0008] S1, collecting the physiological data, game difficulty coefficient, behavior data, and performance data of the player during the game process;
[0009] S2, analyzing the physiological data, game difficulty coefficient, behavior data, and performance data to obtain the influence weights of the physiological data, behavior data, and game difficulty coefficient on the performance data;
[0010] S3, if the influence weight of the physiological data is greater than the influence weights of the behavior data and the game difficulty coefficient, and the performance data decreases, then classify the player's state as a fatigue state, a tense state, or a normal state;
[0011] S4. If the player is in a fatigued state, generate game music with a brisk rhythm; if the player is in a tense state, generate game music with a gentle rhythm; if the player is in a normal state, keep the current game music unchanged.
[0012] Further, the physiological data includes one or more of heart rate, respiratory rate, and respiratory depth;
[0013] The behavioral data includes one or more of aiming deviation, aiming time, reaction time, game frequency, and clearance time;
[0014] The performance data includes one or more of game score, number of target hits, and number of achievements achieved.
[0015] Further, analyzing the physiological data, the game difficulty coefficient, the behavioral data, and the performance data to obtain the influence weights of the physiological data, the behavioral data, and the game difficulty coefficient on the performance data includes: establishing a multiple linear regression algorithm training model, training the multiple linear regression algorithm training model with the physiological data, the game difficulty coefficient, the behavioral data, and the performance data, and calculating the influence weight of the physiological data, the influence weight of the behavioral data, and the influence weight of the game difficulty coefficient.
[0016] Further, the multiple linear regression algorithm training model is as follows:
[0017] ;
[0018] where is the influence weight of the physiological data, is the influence weight of the behavioral data, is the influence weight of the game difficulty coefficient, and ε is the error term.
[0019] Further, classifying the player's state into a fatigued state, a tense state, and a normal state includes:
[0020] If the player's behavioral data decreases, and the physiological data decreases or remains stable, and the game difficulty coefficient is less than a preset threshold, then it is determined that the player is in a fatigued state;
[0021] If the player's behavioral data increases, and the physiological data increases, and the game difficulty coefficient is greater than a preset threshold, then it is determined that the player is in a tense state;
[0022] Otherwise, it is determined that the player is in a normal state.
[0023] Further, if the player is in a fatigued state, increase one or more of the rhythm, pitch, volume, and dynamic range of the game music; if the player is in a tense state, decrease one or more of the rhythm, pitch, volume, and dynamic range of the game music; if the player is in a normal state, keep the game music unchanged.
[0024] Further, before step S4, perform the following: establish a game music library, and classify music with the sound of one or more of the following instruments, namely guitar, piano, violin, accordion, and harmonica as the main melody as game music with a lively rhythm; classify music with the sound of one or more of the following instruments, namely drums, cello, flute, harp, environmental sound effects, synthesizer, and glockenspiel as the main melody as game music with a soothing rhythm.
[0025] Further, obtain the physiological data through a smart bracelet, and obtain the game difficulty coefficient, the behavior data, and the performance data through the game background or game logs.
[0026] Therefore, the present invention provides the following effects and / or advantages:
[0027] This application analyzes multi-dimensional data such as the player's physiological data, behavior data, and game difficulty coefficient, so as to analyze whether the user's performance data in the game has decreased due to the influence of physiological data, and then dynamically adjusts the rhythm and style of the background music to optimize the player's game experience.
[0028] This application trains a model through a multiple linear regression algorithm, so as to obtain the influence weights of different physiological data, behavior data, and difficulty coefficients on the player's performance data, so as to analyze whether the poor game performance data is caused by the player's own physiological factors, and then adjust the player through game music in this case to reduce fatigue, relieve tension or maintain the experience of the normal game state.
[0029] This application trains a model through a multiple linear regression algorithm to calculate the influence weights of various influences on the player's performance data, and can obtain various weights simply and quickly, so as to judge whether the influence of the player's physiological data factor occupies the main influence.
[0030] This application outputs corresponding game music by adjusting one or more of the rhythm, pitch, volume, and dynamic range of the game music.
[0031] Other features and advantages of the present invention will be described in the subsequent specification, and, in part, will be obvious from the specification, or will be understood by implementing the present invention. The objectives and other advantages of the present invention are achieved and obtained by the structures specifically pointed out in the specification and the drawings.
[0032] It should be understood that the above summary and the following detailed description of the present invention are exemplary and explanatory, and are intended to provide further explanation of the present invention as claimed. Description of the Drawings
[0033] Figure 1 A flowchart provided for one embodiment of the present invention. Detailed Description of the Invention
[0034] For the convenience of those skilled in the art to understand, the embodiments will now further describe the present invention in detail:
[0035] Reference Figure 1 , a method for real-time music generation in a game, comprising the following steps:
[0036] S1, collecting the physiological data, game difficulty coefficient, behavior data, and performance data of the player during the game;
[0037] Further, the physiological data includes one or more of heart rate, respiratory rate, and respiratory depth;
[0038] The behavior data includes one or more of aiming deviation, aiming time, reaction time, game frequency, and clearance time;
[0039] The performance data includes one or more of game score, number of target hits, and number of achievements achieved.
[0040] In this embodiment, the physiological data can be data obtained by detecting the physiological performance of the user through a smart watch or a smart bracelet, etc. Among them, when the heart rate, respiratory rate decreases, or the respiratory depth decreases, it can be considered that the user has become fatigued with the game. On the contrary, it indicates that the user is playing the game nervously. In the behavior data, when the aiming deviation, aiming time, reaction time, game frequency, and clearance time increase, it indicates that the user has become fatigued with the game, and it is difficult for the user to complete items with a high game score. The cognitive speed and operation efficiency of the player decrease, the speed of the brain processing information slows down, and the reaction to the game stimulus becomes slower. On the contrary, it indicates that the player's attention is highly concentrated in the game and is playing the game nervously. And, the more the performance data includes game score, number of target hits, and number of achievements achieved, the more it indicates that the user maintains an interest in the game. On the contrary, it indicates that the user is not willing to complete the items to be completed in the game with high quality, and the user randomly clicks to complete various simple actions.
[0041] S2, analyzing the physiological data, the game difficulty coefficient, the behavior data, and the performance data to obtain the influence weights of the physiological data, the behavior data, and the game difficulty coefficient on the performance data;
[0042] Different players have different performances on the game. Some players may have difficulty keeping up with the game rhythm after the game difficulty increases slightly, resulting in a decrease in performance data. Some players may have a significant change in physiological data after playing for a certain period of time, which makes it difficult for them to focus on the game, resulting in a decrease in behavioral data and difficulty focusing on the game. There is a certain weight relationship between the physiological data, the game difficulty coefficient, the behavioral data, and the performance data, and different people show different reactions and weights. This step analyzes these data to obtain the corresponding weight relationship.
[0043] Further, analyzing the physiological data, the game difficulty coefficient, the behavior data, and the performance data to obtain the influence weights of the physiological data, the behavior data, and the game difficulty coefficient on the performance data includes:
[0044] A multivariate linear regression algorithm training model is established, and the multivariate linear regression algorithm training model is trained through the physiological data, the game difficulty coefficient, the behavioral data, and the performance data to calculate the influence weight of the physiological data, the influence weight of the behavioral data, and the influence weight of the game difficulty coefficient.
[0045] In this step, the game data of a large number of players can be analyzed through the multivariate linear regression algorithm training model, so as to train and output the weights of various factors that affect the performance data of the current game. If the physiological data of the players in the current game have a greater impact on the game, it means that the players of the current game are prone to reduce their game performance data due to their own tension, fatigue, emotions, etc., and multiple or long periods of low game performance data can easily make users lose interest in the game. Therefore, it is necessary to help users relax or stay focused, etc., so as to help users obtain good performance data under the predetermined game difficulty.
[0046] Specifically, the multivariate linear regression algorithm training model is as follows:
[0047] ;
[0048] in is the impact weight of physiological data, is the influence weight of the behavior data, is the influence weight of the game difficulty coefficient, and ε is the error term.
[0049] In this step, the game data of a large number of players can be collected to generate a training data set, and the model can be trained using a multivariate linear regression algorithm to calculate the weights of each item. The largest indicates that the physiological data has a greater impact on the performance data. Taking physiological data as an example, any one of the heart rate, respiratory rate, etc. can be used as the score impact on the performance data. It can be understood that for every 1 increase / min in the heart rate or respiratory rate, the performance data increases or decreases by a certain number of points.
[0050] S3. If the influence weight of the physiological data is greater than the influence weights of the behavioral data and the game difficulty coefficient, and the performance data decreases, then classify the player's state as a fatigue state, a tense state, or a normal state.
[0051] In this embodiment, the player's state is classified only when the influence weight of the physiological data is the largest. This is because when the influence weight of the game difficulty coefficient is the largest, or when the influence weight of the behavioral data is relatively large, it is often that the player himself / herself cannot reach the required level of the game. At this time, generally, simply reducing the game difficulty can enable the user to maintain or improve the performance data, thereby helping the user maintain or increase their interest in the game.
[0052] Further, classifying the player's state as a fatigue state, a tense state, or a normal state includes:
[0053] If the player's behavioral data decreases, and the physiological data decreases or remains stable, and the game difficulty coefficient is less than the preset threshold, then determine that the player is in a fatigue state.
[0054] If the player's behavioral data increases, and the physiological data increases, and the game difficulty coefficient is greater than the preset threshold, then determine that the player is in a tense state.
[0055] Otherwise, determine that the player is in a normal state.
[0056] Specifically, the reasons for the player's fatigue state, tense state, and normal state are as follows:
[0057] Fatigue state: Data such as the player's heart rate and respiratory rate gradually slow down or remain at a low level, and the player's operations and scores in the game are poor, and the game is in a medium or low difficulty mode.
[0058] Tense state: Data such as the player's heart rate and respiratory rate suddenly speed up or remain at a high level, and the player's operations and scores in the game are good, and the game is in a high difficulty mode.
[0059] Normal state: All data is balanced, and the game is in a medium difficulty mode.
[0060] Through this quantification, when the influence weight of the player's physiological data on the performance data in the game is the largest, the player's current state can be obtained, so as to make a game music output strategy that matches the player's current state in the subsequent process.
[0061] S4. If the player is in a fatigued state, generate game music with a lively rhythm; if the player is in a tense state, generate game music with a gentle rhythm; if the player is in a normal state, keep the current game music unchanged.
[0062] In this step, the game music with a lively rhythm and the game music with a gentle rhythm can be pre-recorded or pre-generated music.
[0063] Furthermore, if the player is in a fatigued state, increase one or more of the rhythm, pitch, volume, and dynamic range of the game music; if the player is in a tense state, decrease one or more of the rhythm, pitch, volume, and dynamic range of the game music; if the player is in a normal state, keep the game music unchanged.
[0064] In this embodiment, by adjusting the specific attributes of the music, such as rhythm, pitch, volume, dynamic range, etc., generate adapted music according to the player's state. This method can directly affect the player's mood and psychological state through music, helping the player recover or stay focused.
[0065] Specifically, the game music with an increased rhythm has a faster rhythm, which can help inject energy into the player and stimulate the player's vitality; the game music with an increased pitch can bring a lively and bright mood; the game music with an increased volume can enhance the presence of the music and prevent the player from falling into a low-energy state; the game music with an expanded dynamic range has greater variations, which can attract the player's attention, stimulate the senses, motivate the player to recover vitality and enhance operation efficiency. On the contrary, decreasing the rhythm, pitch, volume, and dynamic range helps the player relieve tension and be more focused on the current task.
[0066] Specifically, if the player is in a fatigued state, the beat of the game music can be reduced to 120 - 140 BPM per minute, the volume can be increased by 3 dB, the pitch can be raised by 4 - 6 semitones, and prominent sound effect changes can be added to expand the dynamic range; if the player is in a tense state, the beat of the game music can be reduced to 60 - 80 BPM per minute, the volume can be decreased by 3 dB, the pitch can be lowered by 4 - 6 semitones, and the contrast between forte and piano can be reduced to avoid irritation and expand the dynamic range.
[0067] Furthermore, before step S4, execute: establish a game music library, classify music with the sound of one or more of the instruments including guitar, piano, violin, accordion, and harmonica as the main melody as game music with a lively rhythm, and classify music with the sound of one or more of the instruments including drums, cello, flute, harp, environmental sound effects, synthesizer, and glockenspiel as the main melody as game music with a gentle rhythm.
[0068] This step classifies music according to the characteristics of the main melody instrument, providing a benchmark for real-time music generation. This method establishes music libraries with lively rhythms and slow rhythms through the timbre characteristics of different instruments, ensuring that the generated music matches the player's state. By combining the changes in rhythm, pitch, volume, and dynamic range described above, more accurate music can be achieved to help the player maintain a good state.
[0069] Furthermore, the physiological data is obtained through a smart bracelet, and the game difficulty coefficient, the behavior data, and the performance data are obtained through the game background or game logs.
[0070] Those skilled in the art should understand that the embodiments of the present invention can be provided as a method, a system, or a computer program product. Therefore, the present invention can take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware aspects. Moreover, the present invention can take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0071] The present invention is described with reference to the flowcharts and / or block diagrams of methods, apparatuses (systems), and computer program products according to embodiments of the present invention. It should be understood that each flow and / or block in the flowchart and / or block diagram can be implemented by computer program instructions, and the combination of the flows and / or blocks in the flowchart and / or block diagram can also be implemented by computer program instructions. These computer program instructions can be provided to the processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing devices to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing devices generate means for implementing the functions specified in Figure 1 one flow or multiple flows and / or blocks Figure 1 one block or multiple blocks.
[0072] These computer program instructions can also be stored in a computer-readable memory that can direct a computer or other programmable data processing device to work in a specific manner, so that the instructions stored in the computer-readable memory generate a manufactured article including instruction means, and the instruction means implements the functions specified in Figure 1 one flow or multiple flows and / or blocks Figure 1 one block or multiple blocks.
[0073] Although the preferred embodiments of the present invention have been described, those skilled in the art can make additional changes and modifications to these embodiments once they know the basic creative concept. Therefore, the appended claims are intended to be construed as including the preferred embodiments and all changes and modifications falling within the scope of the present invention.
[0074] In the description of this specification, the description referring to terms such as "one embodiment", "some embodiments", "examples", "specific examples", or "some examples" means that the specific features, structures, materials, or characteristics described in connection with the embodiment or example are included in at least one embodiment or example of the present invention. In this specification, the schematic representations of the above terms should not be understood as necessarily referring to the same embodiment or example. Moreover, the specific features, structures, materials, or characteristics described can be combined in a suitable manner in any one or more embodiments or examples. In addition, without contradiction, those skilled in the art can combine and combine the different embodiments or examples described in this specification and the features of different embodiments or examples.
Claims
1. A method for real-time music generation in a game, characterized in that: It includes the following steps: S1. Collect the physiological data, game difficulty coefficient, behavior data, and performance data of the player during the game process; S2. Analyze the physiological data, the game difficulty coefficient, the behavior data, and the performance data to obtain the influence weights of the physiological data, the behavior data, and the game difficulty coefficient on the performance data; Analyzing the physiological data, the game difficulty coefficient, the behavior data, and the performance data to obtain the influence weights of the physiological data, the behavior data, and the game difficulty coefficient on the performance data includes: establishing a multiple linear regression algorithm training model, training the multiple linear regression algorithm training model through the physiological data, the game difficulty coefficient, the behavior data, and the performance data, and calculating the influence weight of the physiological data, the influence weight of the behavior data, and the influence weight of the game difficulty coefficient; the multiple linear regression algorithm training model is as follows: ; wherein is the influence weight of physiological data, is the influence weight of behavioral data, is the influence weight of the game difficulty coefficient, and ε is the error term; S3. If the influence weight of the physiological data is greater than the influence weights of the behavior data and the game difficulty coefficient, and the performance data decreases, then classify the player's state into a fatigue state, a tension state, and a normal state; classifying the player's state into a fatigue state, a tension state, and a normal state includes: If the player's behavior data decreases, and the physiological data decreases or remains stable, and the game difficulty coefficient is less than the preset threshold, then determine that the player is in a fatigue state; If the player's behavior data increases, and the physiological data increases, and the game difficulty coefficient is greater than the preset threshold, then determine that the player is in a tension state; If otherwise, determine that the player is in a normal state; S4. If the player is in a fatigue state, generate game music with a brisk rhythm, if the player is in a tension state, then generate game music with a gentle rhythm, if the player is in a normal state, then keep the current game music unchanged; If the player is in a fatigue state, then increase one or more of the rhythm, pitch, volume, and dynamic range of the game music, if the player is in a tension state, then decrease one or more of the rhythm, pitch, volume, and dynamic range of the game music, if the player is in a normal state, then keep the game music unchanged.
2. The real-time music generation method for games according to claim 1, wherein: The physiological data includes one or more of heart rate, respiratory rate, and respiratory depth; The behavior data includes one or more of aiming deviation, aiming time, reaction time, game frequency, and clearance time; The performance data includes one or more of game score, number of target hits, and number of achievements achieved.
3. A real-time music generation method for games according to claim 1, characterized in that: Before step S4, execute: establish a game music library, classify the music with the sound of one or more of the instruments including guitar, piano, violin, accordion, and harmonica as the main melody as game music with a brisk rhythm, and classify the music with the sound of one or more of the instruments including drums, cello, flute, harp, environmental sound effects, synthesizer, and glockenspiel as the main melody as game music with a gentle rhythm.
4. A method for real-time music generation in a game according to claim 1, characterized in that: Obtain the physiological data through a smart bracelet, and obtain the game difficulty coefficient, the behavior data, and the performance data through the game background or game logs.
Citation Information
Patent Citations
Music rhythm control terminal and method adaptive to user emotion
CN106599057A
Game music generation method and device, equipment and storage medium
CN112915525A