Method, device and equipment for controlling virtual character in game and storage medium
By acquiring the format and tonal information of the ci (a type of classical Chinese poetry) tunes, and adjusting the trigger probability and pitch changes of the virtual character's humming, the problem of low consistency between the virtual character's humming and the ci tunes was solved, thus improving the interactivity and cultural integration of the game's music.
Patent Information
- Application Number
- CN202311029583.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-08-15
- Publication Date
- 2026-08-25
- Estimated Expiration
- 2043-08-15
AI Technical Summary
In existing technologies, the matching degree between virtual characters humming lyrics and tunes in games is low, which cannot effectively enhance the musical interaction between players and games.
By acquiring the format information of the ci (a type of classical Chinese poetry) tune, including sentence structure and tonal patterns, the trigger probability of the virtual character humming is determined, and the humming process is adjusted according to the tonal patterns to make the virtual character's humming conform to the number of characters and the rhythmic rules of the ci tune.
It improves the fit between the virtual character's humming and the ci (a type of classical Chinese poetry) tune, enhances the player's musical interaction with the game, subtly integrates traditional culture, and improves the gaming experience.
Smart Images

Figure CN117101137B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of game technology, and in particular to a method for controlling virtual characters in a game, a device for controlling virtual characters in a game, a corresponding electronic device, and a corresponding computer-readable storage medium. Background Technology
[0002] In the relevant game, there may be scenes where a troupe of singers and musicians performs lyrics. In order to make players feel more immersed when listening to the lyrics and to enhance the fun when players are in the wild, virtual characters with identities such as protagonists and knights can be allowed to hum along within the range of the lyrics performance, and to hum randomly when staying in the wild for too long, thereby improving the interaction between players and the music in the game.
[0003] In related technologies, the entire song can usually be divided according to the lyrics, and each line can be set to trigger humming with a specific probability. However, since the lyrics contain strict rhyme and meter, this method has a low degree of fit with the lyrics. Summary of the Invention
[0004] In view of the above problems, embodiments of the present invention are proposed to provide a method for controlling a virtual character in a game, a device for controlling a virtual character in a game, a corresponding electronic device, and a corresponding computer-readable storage medium to overcome or at least partially solve the above problems.
[0005] This invention discloses a method for controlling a virtual character in a game, the method comprising:
[0006] In response to the trigger command of the virtual character to hum a target ci poem, the format information of the target ci poem is obtained; the format information includes sentence structure information and tonal information.
[0007] The trigger probability of the virtual character for the target ci poem is determined based on the sentence structure information;
[0008] The virtual character is triggered to hum the target melody based on the trigger probability, and the humming process of the virtual character is adjusted based on the tonal information.
[0009] This invention also discloses a control device for a virtual character in a game, the device comprising:
[0010] The format information acquisition module is used to respond to the trigger command of the virtual character to hum and judge the target ci poem, and to acquire the format information of the target ci poem; the format information includes sentence structure information and tonal information;
[0011] The trigger probability determination module is used to determine the trigger probability of the virtual character for the target ci poem based on the sentence structure information;
[0012] The humming adjustment module is used to trigger the virtual character to hum the target melody based on the trigger probability, and to adjust the humming process of the virtual character based on the tonal information.
[0013] This invention also discloses an electronic device, including: a processor, a memory, and a computer program stored in the memory and capable of running on the processor, wherein the computer program, when executed by the processor, implements any of the aforementioned methods for controlling virtual characters in the game.
[0014] This invention also discloses a computer-readable storage medium storing a computer program, which, when executed by a processor, implements any of the aforementioned methods for controlling virtual characters in a game.
[0015] The embodiments of the present invention have the following advantages:
[0016] In this embodiment of the invention, the trigger probability of a virtual character singing a target ci (a type of classical Chinese poetry) can be determined based on the sentence structure information of the target ci, responding to the trigger command of the virtual character. Furthermore, during the process of the virtual character singing the target ci based on the trigger probability, the singing process can be adjusted according to the tonal information of the target ci. By strengthening the connection between the singing gameplay and the ci based on the sentence structure and tonal information of the ci, the rules of the number of characters and the phonetic rhythm of the ci can be combined to align the virtual character's singing gameplay with the game's worldview, thereby enhancing the player's musical interactivity with the game. Attached Figure Description
[0017] Figure 1 This is a flowchart illustrating the steps of an embodiment of a virtual character control method in a game according to the present invention;
[0018] Figure 2 This is a flowchart illustrating the steps of another embodiment of the method for controlling virtual characters in a game according to the present invention;
[0019] Figure 3 This is a schematic diagram illustrating the process of establishing a ci (a type of classical Chinese poetry) database according to an embodiment of the present invention;
[0020] Figure 4 This is a schematic diagram of the humming determination triggering process provided in an embodiment of the present invention;
[0021] Figure 5 This is a structural block diagram of an embodiment of a control device for virtual characters in a game according to the present invention. Detailed Implementation
[0022] To make the above-mentioned objects, features and advantages of the present invention more apparent and understandable, the present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments.
[0023] In relevant game scenarios, a humming function can be provided for virtual characters to enhance the player's musical interaction with the game.
[0024] In related technologies, imperfect humming can create a sense of immersion for players, similar to how, even though most people's singing level is significantly lower than that of professional singers at a concert, they can unconsciously sing along and blend into the environment. Similarly, imperfect humming by virtual characters in the game world can also enhance the connection between players and the game world.
[0025] Specifically, in the process of intentionally creating an imperfect humming effect, one or more of the following methods can usually be used in combination: a) Record audio of both the lyric version and the lyricless version (e.g., using the interjection "La" to replace lyrics) as humming audio; b) Avoid modifying the pitch of the humming audio file, for example, retaining the current semitone when the pitch difference from the target pitch is less than 1 / 2 semitone; c) When the virtual character first visits the band's singer, only the lyricless version will be triggered, and then gradually transition to the lyric version as the number of visits increases; d) Divide the entire song according to the lyrics, and set each line to trigger humming with a specific probability; e) If the pitch difference between the last note of the current line and the first note of the next line exceeds a preset degree, such as 12 degrees, the probability of triggering humming for the next line will decrease significantly; f) Allow the pitch to change randomly within a certain range each time humming is triggered; g) Only allow the player to hear humming when the virtual character is in idle or walking mode, etc.
[0026] However, because the ci (lyric poetry) tunes contain strict metrical rules, this method does not fit the ci tunes well.
[0027] This invention, based on the sentence structure and tonal patterns of classical Chinese poetry (ci) tunes, strengthens the connection between the humming gameplay and the ci tunes. It allows for the integration of the number of characters and the tonal rules of the ci tunes with the virtual character's humming gameplay and the game's worldview, subtly incorporating traditional culture into the game and enhancing the player's musical interactivity. Furthermore, by incorporating the number of characters in the ci tunes, the virtual character first familiarizes themselves with shorter sentences before gradually becoming familiar with the entire song, resulting in a smoother transition between the lyric version and the lyric-free version.
[0028] Reference Figure 1 The diagram illustrates a flowchart of an embodiment of a method for controlling a virtual character in a game according to the present invention, which may specifically include the following steps:
[0029] Step 101: Respond to the trigger command of the virtual character to hum the target ci poem and obtain the format information of the target ci poem;
[0030] In related games, there may be scenes where a troupe of singers performs lyrics and songs. Singers are mainly female singers kept by the ancient court, government, or private families. The singing of singers not only emphasizes vocalization and singing skills, but also pays attention to the overall effect of the performance, such as the excellence of dance, proficiency in musical instruments, appearance and even the exquisiteness of clothing. In the embodiments of this invention, it can refer to singers performing lyrics and songs.
[0031] Ci-pattern music refers to music created by setting ancient ci (lyric poetry) patterns to music. The ci pattern name is the name of a standard melody for ci, and was the original name of a set of roughly fixed musical pieces frequently used to write ci during the Tang and Song dynasties. Ci, on the other hand, is a type of poetry set to music, originating from the Yuefu poems of the Tang and Song dynasties. It adapted to the needs of cultural life and became popular by combining the developments in music and poetry at the time; its predecessor was a folk tune.
[0032] In this embodiment of the invention, players can control a virtual character to walk, stand still, etc., within a game scene where a songstress ensemble is performing a lyric piece. During these movements, the virtual character can be given a humming function, enhancing player immersion and increasing musical interactivity. At this time, a trigger command can be initiated to determine if the virtual character is humming a target lyric piece, allowing the player to control the virtual character to hum the target lyric piece based on the humming determination result.
[0033] In practical applications, the game engine can generate a trigger command when it detects that a virtual character has entered the performance range of the ci poem, or has stayed in an outdoor scene for more than a preset time, or when the ci poem is being played or played to a specific position (such as the beginning of each line). This trigger command is used to trigger the judgment of the virtual character to hum, so as to decide whether to control the virtual character to hum.
[0034] Specifically, the name of the ci (lyric poetry) title can determine the requirements for writing lyrics, and the number of characters and tonal variations in each line may differ. That is, ci titles possess their own unique format information, typically including character count patterns and phonetic rules. The character count pattern can be represented based on sentence structure information, which primarily indicates the number of characters in each line of the ci title. The phonetic rules can be reflected based on tonal patterns, which refer to the four tones, summarized using an incomplete inductive method: "level tone refers to flatness, oblique tone refers to variation." The rising, departing, and entering tones are oblique tones, while the rest are level tones. Tonal information primarily indicates the degree of pitch variation.
[0035] In one embodiment of the present invention, a triggering command can be issued in response to a virtual character's humming judgment of a target ci poem, and the format information of the target ci poem can be obtained so as to trigger a humming judgment based on the sentence structure information and tonal information of the target ci poem.
[0036] It should be noted that the target ci poem can be determined based on the generation conditions of the trigger command. For example, if the trigger command is generated based on the virtual character being in the performance or playback range of the ci poem, then the target ci poem can be the currently performed or played ci poem. This embodiment of the invention does not impose any restrictions on this.
[0037] Step 102: Determine the trigger probability of the virtual character for the target ci poem based on the sentence structure information;
[0038] The triggering logic for humming judgment based on the sentence structure and tonal information of the target ci poem can first determine the trigger probability based on the sentence structure information, so as to control the virtual character to trigger accordingly based on the determined trigger probability.
[0039] Trigger probability usually refers to the probability that a virtual character will hum a target melody. In this embodiment of the invention, based on the probability of humming, the trigger probability can be further subdivided into trigger probabilities of different humming versions, i.e., humming version trigger probabilities. The humming version can include a lyric version and a lyricless version (e.g., using the interjection "La" to replace lyrics). In other words, the trigger probability can be subdivided into humming version trigger probabilities, thereby making the transition between the lyric version and the lyricless version of the virtual character smoother.
[0040] Specifically, the setting of the trigger probability can be based on the strategy of the virtual character first becoming familiar with shorter sentences and then gradually becoming familiar with the whole song. This embodiment of the invention does not limit this.
[0041] Step 103: Trigger the virtual character to hum the target ci poem based on the trigger probability, and adjust the humming process of the virtual character based on the tonal information.
[0042] The triggering logic for humming based on the sentence structure and tonal information of the target ci poem can be used to determine the trigger probability of the virtual character. At this time, the virtual character can be triggered to hum the target ci poem according to the trigger probability. During the process of the virtual character humming the target ci poem, the humming process can be adjusted according to the tonal information of the target ci poem, so that the ci poem hummed by the virtual character not only conforms to the number of characters, but also conforms to the rhyme and meter of the ci poem. This makes the humming gameplay based on the aforementioned triggering logic fit the ci poem.
[0043] Specifically, the tonal information can be mainly used to indicate the degree of pitch change. That is, the pitch can be continuously adjusted based on the degree of pitch change during the virtual character's humming process in order to control the rhythm and meter of the ci poem.
[0044] In practical applications, the humming behavior of a virtual character typically manifests as the playback of the humming audio for the player. That is, the aforementioned process of triggering the humming of a virtual character can be represented as the generation and playback of the humming audio. Furthermore, to enhance the realism of the virtual character's humming, virtual expressions and body language can be added, but this embodiment of the invention does not impose any limitations on this.
[0045] In this embodiment of the invention, the trigger probability of a virtual character singing a target ci (a type of classical Chinese poetry) can be determined based on the sentence structure information of the target ci, responding to the trigger command of the virtual character. Furthermore, during the process of the virtual character singing the target ci based on the trigger probability, the singing process can be adjusted according to the tonal information of the target ci. By strengthening the connection between the singing gameplay and the ci based on the sentence structure and tonal information of the ci, the rules of the number of characters and the phonetic rhythm of the ci can be combined to align the virtual character's singing gameplay with the game's worldview, thereby enhancing the player's musical interactivity with the game.
[0046] Reference Figure 2 The diagram illustrates a flowchart of another embodiment of the method for controlling virtual characters in a game according to the present invention, which may specifically include the following steps:
[0047] Step 201: Obtain the ci (lyric) pattern information of several ci tunes, build a ci pattern library based on the ci pattern information, and import the ci pattern library into the game engine;
[0048] Ci-pattern music refers to music composed based on ancient ci-patterns. The name of the ci-pattern music determines the requirements for writing lyrics, and the number of characters and tonal variations in each line may differ. In this embodiment of the invention, the triggering logic for humming judgment can be introduced by influencing the sentence structure and tonal variations of different ci-pattern music.
[0049] Specifically, information on several ci (lyric) patterns can be obtained, and then a ci pattern library can be built based on the ci pattern information. The built ci pattern library can then be imported into the game engine so that relevant information on the sentence structure and tonal changes of different ci patterns required for triggering logic can be obtained later.
[0050] The information about the ci (lyric) patterns and tunes can include the names of the ci patterns and tunes and their format information. The format information usually includes the rules of the number of characters and the rules of rhyme and meter. The rules of the number of characters can be represented based on the sentence structure information, which is mainly used to indicate the number of characters in each line of the ci pattern and tune, that is, the number of characters in each line. The rules of rhyme and meter can be represented based on the tonal pattern information, which is mainly used to indicate the degree of pitch variation.
[0051] In practical applications, the information of each ci (a type of classical Chinese poetry) can be saved in the form of a table. That is, the ci can be converted into a CSV (Comma-Separated Values) table, which stores table data in plain text format, and then imported into the game engine. The table can store the format information of each ci in the form of parameters.
[0052] For example, suppose that some of the musical pieces involved in the game can be represented as shown in Table 1 below:
[0053] Waves Washing Sand Order Butterfly Loves Flowers Green Jade Table - Lantern Festival Water Dragon Chant Rui Hexian Ode to the Goose Mound A Spray of Plum Blossoms (Hangzhou Dialect Version) A Spray of Plum Blossoms (Mandarin Version) Mountain Slope Sheep - Daoqing Mountain Slope Sheep - Nostalgia for Tongguan Untitled Looking South of the Yangtze River - Willows of Jiangnan Su Muzhe - Nostalgia wind and rain Silver lamp xiaochongshan Jiang Chengzi Man Jiang Hong Crane Bridge Fairy
[0054] Table 1
[0055] At this point, we can obtain the lyric lists for each ci poem title in Table 1. For example, the lyric list for "Lang Tao Sha Ling: Raindrops Outside the Curtain" is shown in Table 2 below:
[0056] string string c c 23.35 Rain pattering outside the window 28.86 Spring is waning 35.25 The thin quilt could not withstand the chill of the early morning. 40.28 In dreams, one is unaware of being a guest. 45.29 A moment of pleasure 52.13 In dreams, one is unaware of being a guest. 27.13 A moment of pleasure 96.18 Do not lean on the railing alone 101.75 Boundless Rivers and Mountains 108.00 Parting is easy, meeting again is hard. 113.00 Flowing water, fallen flowers, spring is gone. 118.61 Heaven and Earth 124.93 Flowing water, fallen flowers, spring is gone. 129.94 Heaven and Earth
[0057] Table 2
[0058] like Figure 3 As shown, the process of building a ci (a type of classical Chinese poetry) database can be accomplished using a script. Figure 2 The vocabulary list shown is converted to the desired format, such as the corresponding CSV format, as shown in Table 3 below:
[0059] 1 4 1100 2 7 1011100 3 7 1110011 4 4 1100 5 7 1110011 6 4 1100 7 5 11100 8 4 1100 9 7 1011100 10 7 1110011 11 4 1100 12 7 1110011 13 4 1100
[0060] Table 3
[0061] After being converted to CSV format, the table can store the format information of each ci poem in the form of parameters. The first column can be used to represent the line number in the ci poem, that is, which line of the poem; the second column can be used to represent the number of characters in that line. The smaller the number, the shorter the sentence, which is easier for the virtual character to remember and has a relatively higher probability of triggering humming; the third column can be used to represent the tone pattern of the sentence in that line, where 0 represents level tone and 1 represents oblique tone. When the corresponding character is 0, it means that the random pitch change is small, and when the corresponding character is 1, it means that the random pitch change is large.
[0062] The converted CSV table can then be imported into the game engine, such as UE4. After importing Table 3 into UE4, the interface can display the table information as shown in Table 4, so that relevant information on the sentence structure and tonal changes of different ci poems required for triggering logic can be obtained later.
[0063] 1 0 5 11100 2 1 4 1100 3 2 7 1011100 4 3 7 1110011 5 4 4 1100 6 5 7 1110011 7 6 4 1100 8 7 5 11100 9 8 4 1100 10 9 7 1011100 11 10 7 1110011 12 11 4 1100 13 12 7 1110011 14 13 4 1100
[0064] Table 4
[0065] Step 202: Respond to the trigger command of the virtual character to hum the target ci poem, and determine the trigger probability of the virtual character humming the version of each line in the target ci poem;
[0066] In this embodiment of the invention, players can control a virtual character to walk, stand still, etc., within a game scene where a songstress ensemble is performing a lyric piece. During these movements, the virtual character can be given a humming function, enhancing player immersion and increasing musical interactivity. At this time, a trigger command can be initiated to determine if the virtual character is humming a target lyric piece, allowing the player to control the virtual character to hum the target lyric piece based on the humming determination result.
[0067] In practical applications, the game engine can generate a trigger command when it detects that a virtual character has entered the performance range of the ci poem, or has stayed in the wild scene for more than a preset time, or when the ci poem is played or played to a specific position (such as the beginning of each sentence, which can be determined based on the time shown in Table 2). This trigger command is used to trigger the judgment humming of the virtual character to decide whether to control the virtual character to hum.
[0068] Specifically, the trigger logic for determining humming can be based on the sentence structure and tonal information of the target ci poem. At this time, the system can respond to the trigger command of the virtual character to determine humming of the target ci poem and obtain the format information of the target ci poem. In the humming trigger determination stage, the sentence structure information of the target ci poem can be obtained to determine the trigger probability of the virtual character for the target ci poem based on the obtained sentence structure information.
[0069] Trigger probability usually refers to the probability that a virtual character will hum a target melody. In this embodiment of the invention, based on the probability of humming, the trigger probability can be further subdivided into trigger probabilities of different humming versions, i.e., humming version trigger probabilities. The humming version can include a lyric version and a lyricless version (e.g., using the interjection "La" to replace lyrics). In other words, the trigger probability can be subdivided into humming version trigger probabilities, thereby making the transition between the lyric version and the lyricless version of the virtual character smoother.
[0070] The acquired sentence structure information can be used to indicate the number of characters in each line of the target lyric poem, i.e., the number of characters in each sentence, so as to determine the trigger probability by reading the number of characters in the corresponding sentence. Specifically, the smaller the number in the character count information, the shorter the sentence is, which is easier for the virtual character to remember, and the higher the trigger probability for humming. Therefore, when setting the trigger probability, it is possible to set the specific strategy based on the virtual character first becoming familiar with shorter sentences, and then gradually becoming familiar with the whole song. At this time, the trigger probability of the virtual character's humming version of the target lyric poem can be determined based on the number of characters in each line of the target lyric poem.
[0071] In one embodiment of the present invention, the specific strategy is as follows: Figure 4 As shown, in practical applications, the triggering strategy can be implemented through a triggering module pre-deployed in the UE engine. This module primarily triggers a humming judgment when the song reaches a specific position based on a marker callback function. Then, a strategy based on the number of visits can be combined with different types of word count information to determine whether to hum and whether to play the humming video. Specifically, the triggering module can obtain the initial state of the humming version trigger probability for different types of word count information. Then, by obtaining the virtual character's visit count, and based on the visit count and the initial state, it determines the trigger probability of the virtual character's humming version for each line of the target song.
[0072] Among them, the different types of word count information can be obtained through a pre-established ci (lyric) database. At this time, the type of word count can be obtained by reading the count column. For example, in "Lang Tao Sha Ling: Rain Chirping Outside the Curtain", there are three different types of word count information: 4 characters, 5 characters, and 7 characters. At this time, an integer variable "Type count" can be set and assigned a value of 3 to indicate that the current target ci song has three types of word count information.
[0073] Each category has an independent trigger probability. The initial state of the trigger probability for humming versions of word count information in different categories can be the same. For example, it can be expressed as follows:
[0074] The probability of triggering the 4-character version (lyrics version) is 0%, while the probability of triggering the version without lyrics is 50%.
[0075] The probability of triggering the 5-word version (lyrics version) is 0%, while the probability of triggering the version without lyrics is 50%.
[0076] The probability of triggering the 7-character version (lyrics version) is 0%, while the probability of triggering the version without lyrics is 50%.
[0077] At this point, based on the number of visits, the initial state of the virtual character's humming version trigger probability for different types of word count information in the target lyric tune can be adjusted to obtain the humming version trigger probability after the adjustment of different types of word count information.
[0078] Specifically, the trigger probability of the humming version can include a first trigger probability corresponding to the lyrics version and a second trigger probability corresponding to the lyricsless version. The first trigger probability can be positively correlated with the number of visits, and the second trigger probability can be negatively correlated with the number of visits. The sum of the first and second trigger probabilities is the preset trigger probability, assumed to be 50%. For example, each trigger can be randomly selected from the lyrics version and the lyricsless version, and its initial humming trigger probability can be 50% (i.e., 0% for the lyrics version + 50% for the lyricsless version). Each time the virtual character visits, the trigger probability of the lyrics version can be increased by a preset value, such as 1%, based on the positive correlation, with an upper limit of 50%. That is, assuming that the number of times the player visits the band singer reaches 50, the humming trigger probability is still 50%, but this trigger probability can be subdivided into a first trigger probability of 50% for the lyrics version and a second trigger probability of 0% for the lyricsless version.
[0079] In practical applications, the weights of different types of word count information in the target lyrics can be obtained. These weights are used to indicate the degree of influence of the same number of visits on the trigger probability of humming versions of different types of word count information. This aligns with the pattern that virtual characters first become familiar with shorter sentences and then gradually become familiar with the whole song. Then, in response to the number of visits reaching a preset threshold, the first and second trigger probabilities of the initial state of different types of word count information can be adjusted based on the weights.
[0080] For example, suppose the target lyric pattern for playback or performance is "Lang Tao Sha Ling: Raindrops Outside the Curtain," with a preset threshold of 50 times. In the first 50 visits, the initial trigger probability of 4-character lyrics can be adjusted, that is, the trigger probability of the lyrics version becomes 50%. At this time, the trigger probability of the humming version for different types of word count information is as follows:
[0081] The probability of triggering the 4-character version (lyrics version) is 50%, while the probability of triggering the version without lyrics is 0%.
[0082] The probability of triggering the 5-word version (lyrics version) is 0%, while the probability of triggering the version without lyrics is 50%.
[0083] The probability of triggering the 7-character version (lyrics version) is 0%, while the probability of triggering the version without lyrics is 50%.
[0084] At this point, during the first 100 visits, the trigger probability for lyrics with 4 or 5 characters can be increased to 50%. The trigger probability for humming versions with different word counts is as follows:
[0085] The probability of triggering the 4-character version (lyrics version) is 50%, while the probability of triggering the version without lyrics is 0%.
[0086] The probability of triggering the 5-word version (lyrics version) is 50%, while the probability of triggering the version without lyrics is 0%.
[0087] The probability of triggering the 7-character version (lyrics version) is 0%, while the probability of triggering the version without lyrics is 50%.
[0088] In practical implementation, the trigger probability of the virtual character's humming version for each line of the target ci poem can be determined based on the adjusted trigger probability of the humming version and the number of characters in each line. Specifically, the trigger probability of the humming version that matches the number of characters in each line can be obtained from the adjusted trigger probability of the humming version, and then this matching trigger probability is used as the trigger probability of the virtual character's humming version for each line of the target ci poem.
[0089] Step 203: Based on the tonal information of each line in the target ci poem, adjust the degree of pitch change of each word when the virtual character hums each line in the target ci poem.
[0090] After determining the trigger probability of the humming version of each line in the target ci tune, a virtual character can be triggered to hum the target ci tune. During the humming process, the humming process is adjusted according to the tonal information of the target ci tune, so that the ci tune hummed by the virtual character not only conforms to the number of characters, but also conforms to the rhyme and meter of the ci tune. This makes the humming gameplay based on the aforementioned trigger logic fit the ci tune.
[0091] The tonal information is used to indicate the degree of pitch change. Specifically, after a successful trigger, the settings can be continuously adjusted based on the degree of pitch change during the virtual character's humming process. That is, the pitch of the song is changed according to the tonal changes to control the rhythm and meter of the ci poem. At this time, after controlling the virtual character to hum each line of the target ci poem according to the humming version and the lyric version based on the first trigger probability and the second trigger probability respectively, the tonal information of each line of the target ci poem can be obtained. Then, based on the tonal information of each line of the target ci poem, the degree of pitch change of each word during the virtual character's humming of each line of the target ci poem can be adjusted.
[0092] In a practical implementation, the degree of pitch variation can be reflected based on the pitch variation range. For example, the pitch plugin of wwise can be used, and the pitch variation range can be changed according to the number in the pingze column. For example, for level tone characters, the amplitude value can be controlled between 1 and 5 to randomly generate the pitch, and for oblique tone characters, the amplitude value can be controlled between 1 and 10 to randomly generate the pitch. This embodiment of the invention does not impose any limitations on this.
[0093] In practical applications, the humming behavior of a virtual character typically manifests as the playback of the humming audio for the player. That is, the aforementioned process of triggering the humming of a virtual character can be represented as the generation and playback of the humming audio. Furthermore, to enhance the realism of the virtual character's humming, virtual expressions and body language can be added, but this embodiment of the invention does not impose any limitations on this.
[0094] In this embodiment of the invention, based on the sentence structure and tonal information of the ci (lyric poetry) tune, the connection between the humming gameplay and the ci tune is strengthened. This allows the humming gameplay of the virtual character to be integrated with the game's worldview by combining the number of characters and the rhythmic rules of the ci tune. This subtly integrates traditional culture into the game, thereby enhancing the player's musical interactivity. Furthermore, by combining the number of characters in the ci tune, the virtual character first becomes familiar with shorter sentences and then gradually becomes familiar with the entire song, making the transition between the lyric version and the lyric-free version smoother.
[0095] It should be noted that, for the sake of simplicity, the method embodiments are all described as a series of actions. However, those skilled in the art should understand that the embodiments of the present invention are not limited to the described order of actions, because according to the embodiments of the present invention, some steps can be performed in other orders or simultaneously. Furthermore, those skilled in the art should also understand that the embodiments described in the specification are preferred embodiments, and the actions involved are not necessarily essential to the embodiments of the present invention.
[0096] Reference Figure 5 The diagram illustrates a structural block diagram of an embodiment of a control device for virtual characters in a game according to the present invention, which may specifically include the following modules:
[0097] The format information acquisition module 501 is used to respond to the trigger command of the virtual character to hum and judge the target ci poem, and to acquire the format information of the target ci poem; the format information includes sentence structure information and tone information;
[0098] The trigger probability determination module 502 is used to determine the trigger probability of the virtual character for the target ci poem based on the sentence structure information;
[0099] The humming adjustment module 503 is used to trigger the virtual character to hum the target ci poem according to the trigger probability, and adjust the humming process of the virtual character based on the tonal information.
[0100] In one embodiment of the present invention, the sentence structure information is used to indicate the number of characters in each line of the target ci poem, and the trigger probability is used to indicate the probability that the virtual character hums the target ci poem, the trigger probability being based on the humming version trigger probability representation; the trigger probability determination module 502 may include the following sub-modules:
[0101] The trigger probability determination submodule is used to determine the trigger probability of the virtual character's humming version of the target ci poem based on the number of characters in each line of the target ci poem.
[0102] In one embodiment of the present invention, the trigger probability determination submodule may include the following units:
[0103] The trigger probability determination unit is used to obtain the initial state of the trigger probability of the humming version of different types of word count information; obtain the number of visits of the virtual character, and determine the trigger probability of the humming version of each line of the target ci poem based on the number of visits and the initial state.
[0104] In one embodiment of the present invention, the trigger probability determination unit may include the following sub-units:
[0105] The trigger probability determination subunit is used to adjust the initial state of the trigger probability of the virtual character's humming version for different types of word count information in the target ci poem based on the number of visits, so as to obtain the humming version trigger probability after adjustment for different types of word count information; and to determine the trigger probability of the virtual character's humming version for each line in the target ci poem based on the adjusted humming version trigger probability and the word count information of each line.
[0106] The trigger probability of the humming version includes a first trigger probability corresponding to the lyrics version and a second trigger probability corresponding to the lyricsless version;
[0107] The step of adjusting the initial state of the virtual character's humming version trigger probability for different types of word count information in the target ci poem based on the number of visits includes: obtaining the weights of different types of word count information in the target ci poem; the weights are used to indicate the degree of influence of the same number of visits on the trigger probability of humming versions for different types of word count information; in response to the number of visits reaching a preset threshold, adjusting the first trigger probability and the second trigger probability of the initial state of different types of word count information based on the weights; wherein the first trigger probability is positively correlated with the number of visits, the second trigger probability is negatively correlated with the number of visits, and the sum of the first trigger probability and the second trigger probability is the preset trigger probability.
[0108] The step of determining the trigger probability of the virtual character's humming version for each line of the target ci poem based on the adjusted humming version trigger probability and the number of characters in each line includes: obtaining the humming version trigger probability that matches the number of characters in each line from the adjusted humming version trigger probabilities; and using the matched humming version trigger probability as the trigger probability of the virtual character's humming version for each line of the target ci poem.
[0109] In one embodiment of the present invention, the tonal information is used to indicate the degree of pitch change, the trigger probability is used to indicate the probability that the virtual character hums the target ci poem, and the trigger probability is represented based on the humming version trigger probability, wherein the humming version trigger probability includes a first trigger probability corresponding to the lyrics version and a second trigger probability corresponding to the lyrics-free version;
[0110] The humming adjustment module 503 may include the following sub-modules:
[0111] The humming adjustment submodule is used to control the virtual character to hum each line of the target ci poem according to the humming version and the lyric version, based on the first trigger probability and the second trigger probability, respectively; to obtain the tonal information of each line of the target ci poem, and to adjust the degree of pitch change of each word of the virtual character during the humming of each line of the target ci poem based on the tonal information of each line of the target ci poem; the degree of pitch change is reflected based on the pitch variation range.
[0112] In one embodiment of the present invention, before responding to the trigger instruction of the virtual character to hum a target lyric tune, the device provided in this embodiment of the present invention may further include the following modules:
[0113] The ci (lyric pattern) library creation module is used to acquire ci information of several ci tunes and create a ci library based on the ci information; the ci information includes the ci tune name and the format information of each ci tune name; and the ci library is imported into the game engine.
[0114] In this embodiment of the invention, the control device for virtual characters in a game can respond to the virtual character's trigger command for a target ci (a type of classical Chinese poetry) tune, determine the trigger probability of the virtual character for the target ci tune tune based on the sentence structure information of the target ci tune tune, and adjust the humming process according to the tonal information of the target ci tune tune during the process of triggering the virtual character to hum the target ci tune tune based on the trigger probability. Based on the sentence structure and tonal information of the ci tune tune, the connection between the humming gameplay and the ci tune tune is strengthened, enabling the humming gameplay of the virtual character to fit the game worldview by combining the number of characters and the rhythmic rules of the ci tune tune, thereby improving the player's musical interactivity with the game.
[0115] As the device embodiment is basically similar to the method embodiment, the description is relatively simple, and relevant parts can be found in the description of the method embodiment.
[0116] This invention also provides an electronic device, comprising:
[0117] It includes a processor, a memory, and a computer program stored in the memory and capable of running on the processor. When the computer program is executed by the processor, it implements the various processes of the above-described embodiment of the control method for virtual characters in the game and achieves the same technical effect. To avoid repetition, it will not be described again here.
[0118] This invention also provides a computer-readable storage medium storing a computer program. When the computer program is executed by a processor, it implements the various processes of the above-described control method for virtual characters in the game and achieves the same technical effect. To avoid repetition, it will not be described again here.
[0119] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on the differences from other embodiments. The same or similar parts between the various embodiments can be referred to each other.
[0120] Those skilled in the art will understand that embodiments of the present invention can be provided as methods, apparatus, or computer program products. Therefore, embodiments of the present invention can take the form of entirely hardware embodiments, entirely software embodiments, or embodiments combining software and hardware aspects. Furthermore, embodiments of the present invention can take the form of computer program products 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.
[0121] This invention is described with reference to flowchart illustrations and / or block diagrams of methods, terminal devices (systems), and computer program products according to embodiments of the invention. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing terminal device to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing terminal device, generate instructions for implementing the flowchart illustrations and / or block diagrams. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0122] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing terminal device to operate in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0123] These computer program instructions can also be loaded onto a computer or other programmable data processing terminal equipment, causing a series of operational steps to be performed on the computer or other programmable terminal equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable terminal equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0124] Although preferred embodiments of the present invention have been described, those skilled in the art, upon learning the basic inventive concept, can make other changes and modifications to these embodiments. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments as well as all changes and modifications falling within the scope of the embodiments of the present invention.
[0125] Finally, it should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties. Furthermore, the collection, use and processing of the relevant data must comply with the relevant laws, regulations and standards of the relevant countries and regions, and corresponding operation portals are provided for users to choose to authorize or refuse.
[0126] It should also be noted that, in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or terminal device that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or terminal device. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or terminal device that includes said element.
[0127] The foregoing has provided a detailed description of a method for controlling virtual characters in a game, a device for controlling virtual characters in a game, a corresponding electronic device, and a corresponding computer-readable storage medium provided by the present invention. Specific examples have been used to illustrate the principles and implementation methods of the present invention. The descriptions of the above embodiments are only for the purpose of helping to understand the method and core ideas of the present invention. At the same time, for those skilled in the art, there will be changes in specific implementation methods and application scope based on the ideas of the present invention. Therefore, the content of this specification should not be construed as a limitation of the present invention.
Claims
1. A method for controlling a virtual character in a game, characterized in that, The method includes: In response to the trigger command of the virtual character to hum a target ci poem, the format information of the target ci poem is obtained; the format information includes sentence structure information and tone information; the target ci poem is obtained from a preset ci poem library, which includes the ci poem information of several ci poems; The trigger probability of the virtual character for the target ci poem is determined based on the sentence structure information; The virtual character is triggered to hum the target melody based on the trigger probability, and the humming process of the virtual character is adjusted based on the tonal information. Wherein, the sentence structure information is used to indicate the number of characters in each line of the target ci poem, the trigger probability is used to indicate the probability that the virtual character will hum the target ci poem, and the trigger probability is represented based on the trigger probability of the humming version; Determining the trigger probability of the virtual character for the target ci poem based on the sentence structure information includes: Based on the number of characters in each line of the target ci poem, determine the probability of the virtual character humming the version of the target ci poem. The step of determining the trigger probability of the virtual character's humming version of the target ci poem based on the number of characters in each line of the target ci poem includes: The initial state of the trigger probability of humming versions with different types of word count information; The number of visits by the virtual character is obtained, and the probability of triggering the humming version of each line of the target ci poem is determined based on the number of visits and the initial state.
2. The method according to claim 1, characterized in that, The step of determining the trigger probability of the virtual character humming a version of each line in the target ci poem based on the number of visits and the initial state includes: Based on the number of visits, the initial state of the trigger probability of the virtual character's humming version for different types of word count information in the target ci poem is adjusted to obtain the trigger probability of the humming version after the adjustment of different types of word count information. Based on the adjusted humming version trigger probability and the number of characters in each line, the trigger probability of the virtual character's humming version for each line in the target ci poem is determined.
3. The method according to claim 2, characterized in that, The trigger probability of the humming version includes a first trigger probability corresponding to the lyrics version and a second trigger probability corresponding to the version without lyrics; The initial state of adjusting the trigger probability of the virtual character's humming version for different types of word count information in the target ci poem based on the number of visits includes: The weights of different types of word count information in the target ci poem are obtained; the weights are used to indicate the degree of influence of the same number of visits on the trigger probability of humming versions of different types of word count information; In response to the number of visits reaching a preset threshold, the first trigger probability and the second trigger probability of the initial state of different types of word count information are adjusted based on the weight; wherein, the first trigger probability is positively correlated with the number of visits, the second trigger probability is negatively correlated with the number of visits, and the sum of the first trigger probability and the second trigger probability is the preset trigger probability.
4. The method according to claim 2 or 3, characterized in that, The determination of the trigger probability of the virtual character's humming version for each line of the target ci poem, based on the adjusted trigger probability of the humming version and the number of characters in each line, includes: From the adjusted humming version trigger probability, obtain the humming version trigger probability that matches the word count information of each line; The probability of triggering the matched humming version is taken as the probability of triggering the humming version of each line in the target lyric song by the virtual character.
5. The method according to claim 1, characterized in that, The tonal information is used to indicate the degree of pitch change, and the trigger probability is used to indicate the probability that the virtual character will hum the target ci poem. The trigger probability is represented based on the humming version trigger probability, wherein the humming version trigger probability includes a first trigger probability corresponding to the lyrics version and a second trigger probability corresponding to the version without lyrics. The step of triggering the virtual character to hum the target melody based on the trigger probability, and adjusting the humming process of the virtual character based on the tonal information, includes: Based on the first trigger probability and the second trigger probability respectively, the virtual character is controlled to hum each line of the target ci poem according to the humming version and the lyric version; Obtain the tonal information of each line in the target ci poem, and adjust the pitch variation of each word in the virtual character as the character hums each line in the target ci poem based on the tonal information of each line in the target ci poem; the pitch variation is based on the pitch range.
6. The method according to claim 1 or 5, characterized in that, Before responding to the trigger command that determines whether the virtual character hums the target lyric tune, the process also includes: Obtain the ci (lyric) pattern information of several ci patterns and qu (melody / song) patterns, and establish the ci pattern library based on the ci pattern information; the ci pattern information includes the ci pattern name and the format information of each ci pattern name; Import the aforementioned word card library into the game engine.
7. A control device for a virtual character in a game, characterized in that, The device includes: The format information acquisition module is used to respond to the trigger command of the virtual character to hum a target ci tune and acquire the format information of the target ci tune; the format information includes sentence structure information and tone information; the target ci tune is obtained from a preset ci tune library, which includes the ci tune information of several ci tunes; The trigger probability determination module is used to determine the trigger probability of the virtual character for the target ci poem based on the sentence structure information; The humming adjustment module is used to trigger the virtual character to hum the target ci poem based on the trigger probability, and to adjust the humming process of the virtual character based on the tonal information. The sentence structure information is used to indicate the number of characters in each line of the target ci poem, and the trigger probability is used to indicate the probability that the virtual character will hum the target ci poem. The trigger probability is based on the trigger probability of the humming version. The trigger probability determination module includes the following sub-modules: The trigger probability determination submodule is used to determine the trigger probability of the virtual character's humming version of the target ci poem based on the number of characters in each line of the target ci poem. The trigger probability determination submodule includes the following units: The trigger probability determination unit is used to obtain the initial state of the trigger probability of the humming version of different types of word count information; obtain the number of visits of the virtual character, and determine the trigger probability of the humming version of each line of the target ci poem based on the number of visits and the initial state.
8. An electronic device, characterized in that, include: A processor, a memory, and a computer program stored in the memory and capable of running on the processor, wherein the computer program, when executed by the processor, implements the control method for a virtual character in a game as described in any one of claims 1 to 6.
9. A computer-readable storage medium, characterized in that, A computer program is stored on the computer-readable storage medium, which, when executed by a processor, implements the control method for virtual characters in a game as described in any one of claims 1 to 6.
Citation Information
Patent Citations
Poem creation assisting method, electronic equipment and storage medium
CN112199949A
Automatic composition method based on poems and audio synthesis device
CN113192473A