Display control method, device and electronic equipment for virtual character
By generating virtual character actions and response text using strategy models and generative pre-trained language models, the high cost of editing virtual character reactions and the limited scope of scene applicability in MMORPGs are solved, thus improving the gaming experience.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- NETEASE (HANGZHOU) NETWORK CO LTD
- Filing Date
- 2022-07-19
- Publication Date
- 2026-05-05
AI Technical Summary
The reactions of virtual characters in existing MMORPGs cannot meet the needs of diverse real-world scenarios, resulting in problems such as huge editing costs, limited applicability to different scenarios, and poor gaming experience.
By using a policy model to predict the behavior of virtual characters and combining it with a generative pre-trained language model to generate response text, the virtual characters are controlled to perform actions and display text, thus generating character reactions.
It reduced editing costs, improved the efficiency of character reaction generation, expanded the applicability to real-world scenarios, and enhanced the gaming experience.
Smart Images

Figure CN115463424B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of game technology, and in particular to a method, apparatus, and electronic device for displaying and controlling virtual characters. Background Technology
[0002] In massively multiplayer online role-playing games (MMORPGs), there are usually many non-player characters (NPCs) that are not controlled by real players and can interact with the players. The physical actions, emotional expressions, text responses, and subsequent states exhibited by in-game characters (NPCs or players) in response to their surroundings (other NPCs, other players, weather, time, etc.) are generally referred to as "character reactions."
[0003] In one related technology, character reactions in game scenarios are implemented through manual editing. Virtual characters are pre-programmed with corresponding states for specific commands, and then react accordingly to these commands, typically using pre-edited action response patterns. In another related technology, text responses to characters often follow fixed question-and-answer templates, such as those used by Microsoft Xiaoice, Alibaba's Xiaomi, Google's Meena, and Facebook's Blender. These rely on a question-and-answer format. In some real-world scenarios, game characters need to respond based on changes in their surrounding environment. "Asking a question" is just one dimension of these environmental changes; weather conditions, current time, and player actions are all dimensions that need to be considered.
[0004] However, with manual editing, in order to increase the diversity of character reactions and improve the player's gaming experience, multiple lines of text are usually edited for each state, effectively increasing the amount of text exponentially. Such a large amount of data makes editing game text extremely costly. For character text replies using question-and-answer templates, fixed responses can usually only be generated based on keywords in the question, and cannot be adjusted in time to changes in the surrounding environment, thus failing to meet the needs of diverse real-world scenarios.
[0005] In other words, in existing MMORPGs, the reactions of virtual characters cannot meet the needs of diverse real-world scenarios, resulting in technical problems such as huge editing costs, limited applicability to different scenarios, and poor gaming experience. Summary of the Invention
[0006] In view of this, the purpose of the present invention is to provide a method, device and electronic device for displaying and controlling virtual characters, so as to alleviate the problems of high character reaction cost, small scene applicability and poor game experience in the prior art when editing virtual characters.
[0007] To achieve the above objectives, the technical solutions adopted in the embodiments of the present invention are as follows:
[0008] In a first aspect, embodiments of the present invention provide a method for displaying and controlling a virtual character, comprising: predicting the behavior of the virtual character based on pre-generated background information of the virtual character using a strategy model to obtain a target behavior of the virtual character; the behavior includes a first limb movement and a language behavior of the virtual character; taking the descriptive text corresponding to the background information of the virtual character as input, generating a response text of the virtual character using a pre-trained generative pre-trained language model; controlling the virtual character to perform the target behavior and display the response text to generate a character response of the virtual character.
[0009] In one possible implementation, after taking the descriptive text corresponding to the background information of the virtual character as input and generating the response text of the virtual character using a pre-trained generative pre-trained language model, the method further includes: predicting the state information of the virtual character using a policy model based on the pre-generated background information of the virtual character and the response text of the virtual character, and determining the subsequent state of the virtual character; the subsequent state includes the second limb action of the virtual character.
[0010] In one possible implementation, after the step of controlling the virtual character to perform the target behavior and displaying the response text to generate the virtual character's character response, the method further includes: controlling the virtual character to perform the second limb movement.
[0011] In one possible implementation, the policy model includes: a PPL policy and a Seq2Seq model; the PPL policy is generated based on a trained GPT model; the step of predicting the behavior of the virtual character using the policy model based on the background information of the pre-generated virtual character to obtain the target behavior of the virtual character includes: using the GPT model to predict the behavior based on the background information of the pre-generated virtual character to generate a first prediction result of the behavior; using the Seq2Seq model to predict the behavior based on the background information of the pre-generated virtual character to generate a second prediction result of the behavior; and determining the target behavior based on the behavior corresponding to the first prediction result and the second prediction result.
[0012] In one possible implementation, the step of determining the target behavior action based on the behavior action corresponding to the first prediction result and the second prediction result includes: when the first prediction result is the same as the second prediction result, determining the behavior action corresponding to the first prediction result or the second prediction result as the target behavior action; when the first prediction result is different from the second prediction result, and only one of the first prediction result and the second prediction result is not empty, determining the behavior action corresponding to the non-empty prediction result as the target behavior action; when the first prediction result is different from the second prediction result, and neither the first prediction result nor the second prediction result is empty, determining the behavior action corresponding to the first prediction result as the target behavior action.
[0013] In one possible implementation, the method further includes: generating background information of the virtual character based on pre-obtained character information description text of multiple dimensions; the background information of the virtual character includes: player information, environment information, and NPC information.
[0014] In one possible implementation, the step of generating background information of a virtual character based on pre-obtained character information description text of multiple dimensions includes: obtaining player information in the current game scene; the player information includes a player character table, which includes player character name, profession, and tag; each tag corresponds to at least one description text; and concatenating the profession of each player character name in the player character table with the description text to generate the final description text of the current player character.
[0015] In one possible implementation, the step of generating background information of a virtual character based on pre-obtained character information description text of multiple dimensions further includes: obtaining NPC information in the current game scene; the NPC information includes an NPC table, which includes NPC name, profession and tag; each tag corresponds to at least one description text; and concatenating the profession and description text of each NPC name in the NPC table to generate the final description text of the current NPC.
[0016] Secondly, embodiments of the present invention provide a display control device for a virtual character, comprising: a target behavior action determination module, configured to predict the behavior action of the virtual character based on pre-generated background information of the virtual character using a strategy model to obtain the target behavior action of the virtual character; the behavior action includes the first limb movement and language behavior of the virtual character; a response text generation module, configured to take the descriptive text corresponding to the background information of the virtual character as input and generate the response text of the virtual character using a pre-trained generative pre-trained language model; and a display control module, configured to control the virtual character to perform the target behavior action and display the response text to generate the character reaction of the virtual character.
[0017] In one possible implementation, it further includes: a subsequent state generation module, used to predict the state information of the virtual character based on the pre-generated background information of the virtual character and the response text of the virtual character, and determine the subsequent state of the virtual character; the subsequent state includes the second limb action of the virtual character.
[0018] In one possible implementation, the aforementioned display control module is also used to control the virtual character to perform the second limb action.
[0019] In one possible implementation, it further includes: a background information generation module, used to generate background information of the virtual character based on pre-obtained character information description text of multiple dimensions; the background information of the virtual character includes: player information, environment information and NPC information.
[0020] In one possible implementation, the background information generation module is further configured to: obtain player information in the current game scene; the player information includes a player character table, which includes player character name, profession, and tag; each tag corresponds to at least one descriptive text; and concatenate the profession and descriptive text of each player character name in the player character table to generate the final descriptive text of the current player character.
[0021] Thirdly, embodiments of the present invention provide an electronic device, including a memory and a processor, wherein the memory stores a computer program that can run on the processor, and the processor executes the computer program to implement the steps of the virtual character display control method described in any of the first aspects above.
[0022] Fourthly, embodiments of the present invention provide a computer-readable storage medium storing machine-executable instructions, which, when invoked and executed by a processor, cause the processor to execute the virtual character display control method described in any of the first aspects above.
[0023] This invention provides a method, apparatus, and electronic device for displaying and controlling virtual characters. The method includes: first, predicting the virtual character's actions based on its background information using a strategy model to obtain a target action; then, generating the virtual character's response text using a pre-trained generative pre-trained language model; and finally, controlling the virtual character to execute the target action and display the response text to generate the virtual character's reaction. This method controls the virtual character by predicting actions and generating response text through a model, thereby generating character reactions. This significantly reduces editing costs, improves the efficiency of character reaction generation, meets the needs of diverse real-world scenarios, and enhances the gaming experience. Attached Figure Description
[0024] To more clearly illustrate the specific embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the specific embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.
[0025] Figure 1 A flowchart illustrating a method for controlling the display of a virtual character according to an embodiment of the present invention;
[0026] Figure 2 This is a schematic diagram of the structure of a virtual character display control system provided in an embodiment of the present invention;
[0027] Figure 3 A schematic diagram of the structure of a virtual character display control device provided in an embodiment of the present invention;
[0028] Figure 4 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present invention. Detailed Implementation
[0029] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. The components of the embodiments of the present invention described and shown in the accompanying drawings can generally be arranged and designed in various different configurations.
[0030] Therefore, the following detailed description of the embodiments of the invention provided in the accompanying drawings is not intended to limit the scope of the claimed invention, but merely to illustrate selected embodiments of the invention. All other embodiments obtained by those skilled in the art based on the embodiments of the invention without inventive effort are within the scope of protection of the invention.
[0031] It should be noted that similar reference numerals and letters in the following figures indicate similar items; therefore, once an item is defined in one figure, it does not need to be further defined and explained in subsequent figures. Some embodiments of the present invention will now be described in detail with reference to the accompanying drawings. Unless otherwise specified, the following embodiments and features can be combined with each other.
[0032] In massively multiplayer online role-playing games (MMORPGs), there are often many non-player character (NPC) roles that are not controlled by real players but can interact with them. The physical actions, emotional expressions, text responses, and subsequent states of in-game characters (NPCs or players) in response to their surroundings (other NPCs, players, weather, time, etc.) are generally defined as "character reactions." Currently, virtual character reactions are typically implemented by manually pre-writing status feedback. Furthermore, to increase the diversity of character reactions and enhance the player experience, multiple lines of text are usually edited for each state, effectively increasing the amount of text exponentially. For example, if there are 1000 NPCs in a game, players can perform 50 actions on NPCs, there are 5 types of weather, and 3 types of time, then the number of text responses in that scenario would be 1000 * 50 * 5 * 3 = 750,000. Such a large amount of data is extremely costly for game writers to edit, so there is an urgent need for an automated method to assist game writers in generating this character reaction data.
[0033] Aside from manually editing micro-reactions, there is currently no solution for automatically generating micro-reactions for characters in game scenarios. Specifically, the three tasks of predicting character body movements, character emotional actions, and character subsequent states are highly relevant to the application scenarios, and there are currently no readily available datasets to support processing these tasks, requiring task transformation and decomposition. For the task of character text responses, there are some dialogue response technologies, such as Microsoft Xiaoice, Alibaba's Xiaomi, Google's Meena, and Facebook's Blender. However, these rely on a question-and-answer format. In some real-world scenarios, game characters need to respond based on changes in the surrounding environment. "Asking a question" is only one dimension of these environmental changes; weather conditions, current time, and player actions are all dimensions that need to be considered. Therefore, existing dialogue response technologies cannot meet the needs of real-world scenarios.
[0034] Based on this, embodiments of the present invention provide a method, apparatus, and electronic device for displaying and controlling virtual characters, in order to alleviate the problems of existing methods for editing virtual characters' reactions being costly, inefficient, unable to meet the needs of diverse real-world scenarios, and resulting in a poor gaming experience.
[0035] To facilitate understanding of this embodiment, a method for displaying and controlling a virtual character disclosed in this invention will first be described in detail. (See also...) Figure 1 The diagram shows a flowchart of a method for displaying and controlling a virtual character. This method can be executed by an electronic device and mainly includes the following steps S110 to S130:
[0036] S110: Based on the background information of the pre-generated virtual character, use a strategy model to predict the behavior of the virtual character and obtain the target behavior of the virtual character.
[0037] The virtual character can be a player character or an NPC. That is, the virtual character display control method provided in this embodiment can be used to generate player character reactions or NPC character reactions. Specifically, players can also include online players and offline players.
[0038] In this embodiment, the virtual character's actions can include: primary physical actions and verbal actions. Primary physical actions can be actions that the character can actually perform in the game, such as waving, kneeling, or looking up; verbal actions can determine the emotional tone of the subsequent text responses, such as anger, happiness, or helplessness.
[0039] S120: Take the descriptive text corresponding to the background information of the virtual character as input, and use the pre-trained generative pre-trained language model to generate the response text of the virtual character.
[0040] Among them, the response text can be the response of the virtual character to the current scene. For example, when the player steals something from the NPC, the NPC responds, "Stealing is not good. Look, so many people are watching."
[0041] In this embodiment, the pre-trained generative pre-trained language model can be a GPT model pre-trained based on publicly available Chinese novel corpora and game scene plot corpora. The expected response text can be generated by giving background information to the model.
[0042] As a specific example, concatenate <player information> + <NPC information> + <environmental information> + <player action> + "What will the NPC do next" + <physical action> + "NPC" + <verbal behavior> + "NPC says to the player", and give this prefix information to the GPT model to guide the model to generate what the NPC says. For example: The female hero is a disciple of Zizai Sect on Sanqing Mountain, with martial arts skills, and has just come down the mountain to travel. Wu Sansao is a young woman who, as a passerby, wanders around the roadside all day long. It's sunny now. The female hero shivers in front of Wu Sansao. What will Wu Sansao do next? Wu Sansao clenches her fists tightly. Wu Sansao feels uneasy. What Wu Sansao says to the female hero: The generated result is something like: Miss, don't be afraid! We have no ill intentions.
[0043] To increase the diversity of the generated response text, the following strategy can be adopted: decode multiple times, take topn each time, score the similarity of each pair of the topn candidate responses (using BERT to extract sentence vectors and then calculating the cosine distance), only keep the candidate with the higher decoding score for the two candidates with high similarity, and finally deduplicate the results of multiple decodings uniformly (sentence vectors can also be used for deduplication, which can be adjusted according to the specific scenario).
[0044] S130: Control the virtual character to execute the target behavioral action and display the response text to generate the character reaction of the virtual character.
[0045] In one embodiment, after the above step S120, the method may further include: According to the pre-generated background information of the virtual character and the response text of the virtual character, use the policy model to predict the state information of the virtual character and determine the subsequent state of the virtual character; the subsequent state includes the second physical action of the virtual character.
[0046] Correspondingly, after the above step S130, the method may further include: Control the virtual character to execute the second physical action.
[0047] The subsequent state can be the next reaction of the virtual character after responding to the current scene, while the second physical action can be the actual action that the character can perform in the game. For example, after an NPC is angered by a player, it makes a corresponding action and response, and the subsequent state it may enter is a combat state, that is, fighting with the player. In this case, the second physical action corresponding to the subsequent state is fighting. After the NPC ends its interaction with the player, it may enter a subsequent state of saying goodbye to the player. In this case, the second physical action corresponding to the subsequent state might be waving, clasping hands, etc. This step can be used to predict whether the NPC needs to enter this subsequent state.
[0048] In one embodiment, prior to step S110, the method may include generating background information for a virtual character based on pre-obtained multi-dimensional character information description text. The background information of the virtual character includes player information, environment information, and NPC information.
[0049] Typically, various structured data need to be described in advance using "natural language" as input for subsequent pre-trained language models. This means that the descriptive text for each dimension needs to be manually edited beforehand. These dimensions can include player information, body language, verbal behavior, subsequent states, environmental information, etc. In the virtual character display control method provided in this embodiment, only manual editing of the text for each structured dimension is required. The system automatically combines the text descriptions of multiple dimensions to obtain rich background information for the scene, which assists in generating character reactions.
[0050] To simplify the descriptions, game players can be divided into two main categories: male and female, with corresponding descriptive text for each. For example, a male player could be described as, "Young hero, a disciple of the Zizai Sect of Sanqing Mountain, skilled in martial arts, who has just descended the mountain to travel." However, this description isn't limited to gender; any aspect of the player in the game can be used to expand the descriptive text for player actions.
[0051] In this embodiment, the method for automatically obtaining player information may include the following steps:
[0052] (1) Obtain player information in the current game scene;
[0053] The player information includes a player character table, which includes the player character name, class, and tags; each tag corresponds to at least one descriptive text.
[0054] (2) Concatenate the profession and description text of each player character name in the player character table to generate the final description text of the current player character.
[0055] Since the number of player actions that a player can perform in the game is a finite set, this set of actions is determined by the game. As a specific example, the scenario used in this embodiment contains 50 player actions, each corresponding to a pre-edited descriptive text. For example, the descriptive text for "waving" is "{1} waved towards {0}." (Note: In all subsequent text, {0} represents the NPC's name, and {1} represents the player's name; these will be replaced according to the specific values when the data is actually generated).
[0056] NPC information, like player information, is also categorized using a single sentence to describe the characteristics of each NPC; that is, each NPC corresponds to a single descriptive text. Since there may be thousands of NPCs in a game, writing out descriptions sequentially would be extremely time-consuming. Therefore, this embodiment proposes a method for automatically generating NPC information.
[0057] In this embodiment, the method for automatically obtaining NPC information may also include the following steps:
[0058] (A) Obtain NPC information in the current game scene;
[0059] The NPC information includes an NPC table, which contains NPC names, professions, and tags; each tag corresponds to at least one descriptive text.
[0060] (B) Concatenate the profession and description text of each NPC name in the NPC table to generate the final description text of the current NPC.
[0061] In other words, the NPC table generally contains the names, professions (which may be empty), and tags of existing NPCs in the game. First, an NPC description template is edited for each profession. There are approximately 50 profession categories; for example, the template for the "monk" profession is: {0} is a monk, wearing a kasaya (monk's robe). Then, corresponding text is edited for each tag; for example, the text for the "wealthy" tag is: "from a well-off family." Next, the profession of each NPC in the game's NPC table is retrieved (if not provided, the classification can be predicted by matching the word vector distance between the NPC name and the profession name, categorizing the NPC into the closest profession). Finally, the text descriptions of the profession and tags are concatenated to obtain the final description text of the current NPC. For example, if Xiangguo Temple Minghui is a "monk," and the tags are "tall" and "simple," the corresponding description would be: Xiangguo Temple Minghui is a monk, wearing a kasaya, tall, and very simple.
[0062] The virtual character display control method provided in this embodiment can be used for both player-NPC tasks and online player-offline player tasks. For example, for a specific player and a specific NPC, after the player performs a specific action on the NPC, the method provided in this embodiment can predict the NPC's next target action (body movements, verbal actions, text replies, and subsequent states) based on the current background information (player information, NPC information, and environmental information).
[0063] The physical actions that NPCs can perform in a game are also a finite set. As a specific example, the scenario used in this embodiment contains 70 NPC actions, similar to player actions. The descriptive text corresponding to the NPC physical actions can be written in advance. For example, "shivering": {0} shivered.
[0064] In this embodiment, NPCs exhibit approximately 20 categories of verbal (emotional) behaviors in the game, similar to body language. The descriptive text corresponding to these verbal behaviors can be pre-edited. For example, "helplessness": {0} Feeling helpless. In this embodiment, NPCs have approximately 10 subsequent states, similar to body language, and the descriptive text corresponding to these states can be pre-edited. For example, "battle": {0} Preparing to start a battle.
[0065] Environmental information includes, but is not limited to, weather (sunny, snowy, rainy) and time of day (daytime, nighttime, dusk). You can edit descriptive text for each environmental information value, such as "sunny": This is a beautiful sunny day; the sky is clear and the air is crisp.
[0066] In one embodiment, the strategy model used in step S110 includes a PPL strategy and a Seq2Seq model. The PPL strategy is generated based on a trained GPT model. As a specific example, the PPL strategy includes: after pre-training the GPT model, during the inference phase (i.e., the decoding phase), given a prefix and a suffix, the GPT model receives the prefix input and predicts the output as the score of the suffix (PPL score). The lower the score, the more fluent the suffix is when appended to the prefix, thereby enabling the function of sorting multiple candidate options.
[0067] The GPT model can be fine-tuned. In this embodiment, we use publicly available Chinese novel corpora and game scene plot data (MMORPG games usually have plot stories that depict the dialogue and behavior between virtual characters, similar to novels, which can be directly used to train language models) to fine-tune the open-source basic GPT model, thereby enabling the GPT model to understand dialogue, behavior, and game scenes.
[0068] In this embodiment, the above-mentioned prediction of the game's sexual assault behavior based on the background information of the pre-generated virtual character using a strategy model includes: using the GPT model to predict based on the background information of the pre-generated virtual character to generate a first prediction result of the behavior; and using the Seq2Seq model to predict based on the background information of the pre-generated virtual character to generate a second prediction result of the behavior; and finally determining the target behavior based on the behavior corresponding to the first prediction result and the second prediction result.
[0069] When determining the target action based on the actions corresponding to the first and second prediction results, the prediction result of the PPL strategy is given priority. Specifically, this can be manifested as follows:
[0070] (1) When the first prediction result is the same as the second prediction result, determine the action corresponding to the first prediction result or the second prediction result as the target action; if both the first prediction result and the second prediction result are empty, then do not predict the task, or in other words, the prediction result is empty.
[0071] (2) When the first prediction result is different from the second prediction result, and only one of the first prediction result and the second prediction result is not empty, the action corresponding to the non-empty prediction result is determined as the target action.
[0072] (3) When the first prediction result is different from the second prediction result, and both the first prediction result and the second prediction result are not empty, the action corresponding to the first prediction result is determined as the target action.
[0073] In one embodiment, if the first prediction result obtained by using the PPL strategy is different from the second prediction result obtained by using the Seq2Seq model, then filter thresholds are set for the PPL strategy and the Seq2Seq model respectively, and confidence scores of the first prediction result and the second prediction result are generated. Then, the behavior action corresponding to the prediction result with the higher confidence score is used as the target behavior action of the virtual character.
[0074] Taking NPC body movement tasks as an example, the process of setting filtering thresholds for the model can include: first, generating a batch of data containing predictions of NPC body movements in different scenarios (player, NPC, player actions, environment, etc.) (ranking of candidate options and their scores); then, manually labeling the reasonableness of the movement predictions beforehand, and finding a threshold T (e.g., 90%) that ensures predictions above this threshold are consistent with the manually labeled results. In subsequent actual predictions, results with scores below T can be directly filtered out. The above method can be used to set thresholds and filter unreasonable options for both PPL strategies and Seq2Seq models.
[0075] Example 1: The PPL strategy uses a GPT language model pre-trained on game scenario corpus data for prediction, and the confidence scores of each candidate action under the given background information can be obtained. Specifically, for the three tasks, the following three types of templates are defined:
[0076] i. Physical action template: <Player information> + <NPC information> + <Environmental information> + <Player action> + "What NPC will do next" + <Physical action candidate>. After replacing the content in <> with actual values and inputting it into the GPT model, the PPL score can be obtained. For example, "The female knight is a disciple of Zizai Sect on Sanqing Mountain, with martial arts skills, and has just come down the mountain to travel. Wu Sansao is a young woman, a passerby, and wanders around the roadside all day. The weather is sunny now. The female knight shivers in front of Wu Sansao. Wu Sansao will clench her fists next." By replacing the content of <Physical action candidate> with the text description of physical actions one by one, the PPL scores of each candidate can be obtained respectively.
[0077] ii. Verbal behavior template: <Player information> + <NPC information> + <Environmental information> + <Player action> + "What NPC will do next" + <Physical action> + "NPC" + <Verbal behavior candidate>. The verbal behavior is predicted after the physical action prediction. For example, "The female knight is a disciple of Zizai Sect on Sanqing Mountain, with martial arts skills, and has just come down the mountain to travel. Wu Sansao is a young woman, a passerby, and wanders around the roadside all day. The weather is sunny now. The female knight shivers in front of Wu Sansao. Wu Sansao will clench her fists next. Wu Sansao feels uneasy." Similarly, after replacing <Verbal behavior candidate>, the PPL scores of each candidate can be obtained respectively.
[0078] iii. Subsequent state template: <Player information> + <NPC information> + <Environmental information> + <Player action> + "What NPC will do next" + <Physical action> + "NPC" + <Verbal behavior> + "NPC says to the player" + <Reply text> + "NPC" + <Subsequent state candidate>. The subsequent state prediction is closely related to the text actually replied by the virtual character, so it is predicted after the verbal behavior prediction and the generation of "Reply text" is completed. See Step 4 for the details of generating "Reply text". An actual example is: The female knight is a disciple of Zizai Sect on Sanqing Mountain, with martial arts skills, and has just come down the mountain to travel. Wu Sansao is a young woman, a passerby, and wanders around the roadside all day. The weather is sunny now. The female knight shivers in front of Wu Sansao. Wu Sansao will clench her fists next. Wu Sansao feels uneasy. Wu Sansao says to the female knight, "Girl, hurry up if you have something to do! I still have to go to work!" Wu Sansao walks away. Similarly, after replacing <Subsequent state candidate>, the PPL scores of each candidate can be obtained respectively.
[0079] Embodiment 2: The Seq2seq model is a model fine-tuned on a publicly available multiple-choice question-related dataset based on the pre-trained T5 model. Generally, the multiple-choice question dataset can be processed into the seq2seq format in advance.
[0080] Among them, the construction of the multiple-choice question dataset is generally based on several NER task datasets: MSRA_NER, DuEE-fin, ccks2019_event_entity_extract, etc., and processed into seq2seq format data through templates. The NER task is to given a text, output the entities and entity categories involved in the text, and construct this task into the seq2seq format, just by changing the way of asking questions.
[0081] For the same multiple-choice question, multiple samples can be expanded based on different templates, thus expanding the training set. The Seq2seq model trained with these data has certain reasoning and decision-making abilities and is more suitable for the scenario of this embodiment.
[0082] Similar to Embodiment 1, input templates are defined for the three tasks. For example, the input template for limb movement prediction is: <Player information> + <NPC information> + <Environmental information> + <Player action> + "What behavior is the NPC most likely to do next:" + <List of limb movement candidates>. Here, the <List of limb movement candidates> will list all possible candidates. To reduce the prediction difficulty of the model, the copywriting can pre-edit the optional <Limb movement> for each <Player action>, with the number of options controlled within 10. <^
[0083] [[ID=]]For example, the input content is: "The female knight is a disciple of Zizai Sect on Sanqing Mountain, with martial arts skills, and has just come down the mountain to travel. Wu Sansao is a young woman, as a passerby, who wanders around the roadside all day. Now the weather is clear. The female knight shivers in front of Wu Sansao. What behavior is Wu Sansao most likely to do next: A. Clench both fists B. Wave her hand C. Nod her head D. Kneel down and beg for mercy." Let the model decode and output the result. For the prediction of language behavior and subsequent states, similar input templates can be set for decoding and generation. To improve the generation effect, more templates can be set for each scenario, and each template is predicted by the Seq2seq model to obtain results, and finally these results are voted to select the final result.
[0084] If n templates are set, and each template is fine-tuned using a Seq2seq model to obtain its own answer, the mode of each answer is calculated and returned as the final answer. If multiple answers have the same score, the sum of the scores for decoding the same answer under different templates is calculated (the decoding score here refers to the probability of outputting the decoded result, a value inherent in the Seq2seq model), and the answer with the highest score is returned. Setting templates can alleviate model bias. If only one template is given for the model to predict, it is likely to generate only the most common and general prediction results. This embodiment obtains more accurate and reasonable results by writing multiple templates for the model to predict separately, and then voting on the results and taking the mode.
[0085] In the scenarios described in this application embodiment, the character's reaction is not limited to game NPCs, but also applies to the following scenarios, which are achieved through... Figure 2 The "central scheduling module" in the virtual character display control system shown in the figure controls which character reactions to generate.
[0086] a) Offline Players. After a player logs off, their virtual character will still appear in the game scene. Online players can perform actions on the offline player, and the offline player needs to respond. In this scenario, we can pre-generate the offline player's character reactions.
[0087] b) Online players. When an online player performs an action on a virtual character, a corresponding reply text can be generated. For example, if a player performs a mocking action on the NPC Yan Butou, the reply text could be "You're so ugly, don't come out and scare the girls passing by." Online players can directly see the reply text accompanying their actions, enhancing their sense of immersion in the game.
[0088] c) Scenarios where some information is missing. For example: (1) When player information is missing, the NPC only reacts based on the environmental information; (2) When NPC information is missing, the player only reacts based on the environmental information after making an action.
[0089] d) The generated response text can be a spoken sentence or a thought or feeling. This can be achieved by modifying the template suffix, for example, replacing "xx said to xx:" with "xx thought:". It's not limited to these two forms; other scenarios where a trained language model can be guided to generate text by modifying the prefix can also be modified in this way to generate the desired content.
[0090] The character reaction data is generated offline in advance and stored in the database. When the game runs, the game obtains the character reaction that meets the conditions through key fields such as player information, NPC information, and environmental information, and then displays it in the game. Therefore, the latency is lower compared to online generation.
[0091] This application provides a method for displaying and controlling virtual characters. The method includes: first, predicting the virtual character's actions based on its background information using a strategy model to obtain a target action; then, generating the virtual character's response text using a pre-trained generative pre-trained language model; and finally, combining the target action and the response text to generate the virtual character's reaction. This method generates the character's reaction by predicting actions and generating response text, significantly reducing editing costs, improving the efficiency of reaction generation, expanding the applicability to real-world scenarios, and enhancing the gaming experience.
[0092] This invention also provides a display control device for virtual characters, see [link to relevant documentation]. Figure 3 As shown, the device includes:
[0093] The target behavior action determination module 310 is used to predict the behavior actions of the virtual character based on the background information of the pre-generated virtual character and using a strategy model to obtain the target behavior action of the virtual character; the behavior action includes the virtual character's first limb movements and language behavior.
[0094] The response text generation module 320 is used to take the descriptive text corresponding to the background information of the virtual character as input and generate the response text of the virtual character using a pre-trained generative pre-trained language model.
[0095] The display control module 330 is used to control the virtual character to perform the target behavior and display the response text, so as to generate the virtual character's character reaction.
[0096] In one embodiment, the above-described apparatus may further include: a subsequent state generation module, which can be used to predict the state information of the virtual character based on the pre-generated background information of the virtual character and the virtual character's reply text, and determine the subsequent state of the virtual character.
[0097] In this embodiment, the display control module can also be used to control the virtual character to perform target actions and display response text, so as to generate the virtual character's character reaction.
[0098] In one embodiment, the above-mentioned apparatus may further include: a background information generation module, which can be used to generate background information of a virtual character based on pre-obtained character information description text of multiple dimensions; the background information of the virtual character includes: player information, environment information and NPC information.
[0099] In addition, this background information generation module can also be used to: obtain player information in the current game scene; the player information includes a player character table, which includes player character name, class and tag; each tag corresponds to at least one descriptive text; and concatenate the class and descriptive text of each player character name in the player character table to generate the final descriptive text of the current player character.
[0100] The virtual character display control device provided in this application embodiment can be specific hardware on a device or software or firmware installed on the device. The device provided in this application embodiment has the same implementation principle and technical effects as the aforementioned method embodiment. For the sake of brevity, any parts not mentioned in the device embodiment can be referred to the corresponding content in the aforementioned method embodiment. Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and units described above can all be referred to the corresponding processes in the aforementioned method embodiments, and will not be repeated here. The virtual character display control device provided in this application embodiment has the same technical features as the virtual character display control method provided in the aforementioned embodiments, and therefore can solve the same technical problems and achieve the same technical effects.
[0101] This application also provides an electronic device, specifically, the electronic device includes a processor and a storage device; the storage device stores a computer program, and the computer program, when run by the processor, executes the method described in any of the above embodiments.
[0102] Figure 4 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. The electronic device 400 includes: a processor 40, a memory 41, a bus 42, and a communication interface 43. The processor 40, the communication interface 43, and the memory 41 are connected through the bus 42. The processor 40 is used to execute executable modules, such as computer programs, stored in the memory 41.
[0103] The memory 41 may include high-speed random access memory (RAM) or non-volatile memory, such as at least one disk storage device. Communication between this system network element and at least one other network element is achieved through at least one communication interface 43 (which can be wired or wireless), such as the Internet, wide area network, local area network, metropolitan area network, etc.
[0104] Bus 42 can be an ISA bus, PCI bus, or EISA bus, etc. The bus can be divided into address bus, data bus, control bus, etc. For ease of representation, Figure 4 The symbol is represented by a single double-headed arrow, but this does not mean that there is only one bus or one type of bus.
[0105] The memory 41 is used to store programs. After receiving an execution instruction, the processor 40 executes the program. The method executed by the device for defining the flow process disclosed in any of the foregoing embodiments of the present invention can be applied to the processor 40 or implemented by the processor 40.
[0106] Processor 40 may be an integrated circuit chip with signal processing capabilities. In implementation, each step of the above method can be completed by the integrated logic circuitry in the hardware of processor 40 or by instructions in software form. Processor 40 can be a general-purpose processor, including a Central Processing Unit (CPU), a Network Processor (NP), etc.; it can also be a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field-Programmable Gate Array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. It can implement or execute the methods, steps, and logic block diagrams disclosed in the embodiments of this invention. The general-purpose processor can be a microprocessor or any conventional processor. The steps of the methods disclosed in the embodiments of this invention can be directly embodied in the execution of a hardware decoding processor, or executed by a combination of hardware and software modules in the decoding processor. The software modules can reside in random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, registers, or other mature storage media in the art. The storage medium is located in memory 41. The processor 40 reads the information in memory 41 and, in conjunction with its hardware, completes the steps of the above method.
[0107] Corresponding to the above method, this application embodiment also provides a computer-readable storage medium storing machine-executable instructions. When the machine-executable instructions are called and run by a processor, the machine-executable instructions cause the processor to perform the steps of the above method.
[0108] In the embodiments provided in this application, it should be understood that the disclosed apparatus and methods can be implemented in other ways. The apparatus embodiments described above are merely illustrative. For example, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. Furthermore, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Additionally, the displayed or discussed mutual couplings, direct couplings, or communication connections may be through some communication interfaces; indirect couplings or communication connections between devices or units may be electrical, mechanical, or other forms.
[0109] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0110] In addition, the functional units in the embodiments provided in this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit.
[0111] If the aforementioned functions are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this invention, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, electronic device, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0112] It should be noted that similar reference numerals and letters in the accompanying drawings indicate similar items. Therefore, once an item is defined in one accompanying drawing, it does not need to be further defined and explained in subsequent accompanying drawings. In addition, the terms "first," "second," "third," etc. are used only to distinguish descriptions and should not be construed as indicating or implying relative importance.
[0113] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some or all of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention.
Claims
1. A method for controlling the display of a virtual character, characterized in that, include: Based on the background information of the pre-generated virtual character, the behavior of the virtual character is predicted using a strategy model to obtain the target behavior of the virtual character; the behavior includes the virtual character's first limb movements and language behavior; The virtual character's background information and corresponding descriptive text are used as input, and a pre-trained generative pre-trained language model is used to generate the virtual character's response text. Control the virtual character to perform the target action and display the response text to generate the virtual character's character reaction; It also includes: generating background information for virtual characters based on pre-obtained character information description text from multiple dimensions; the background information for virtual characters includes: player information, environment information, and NPC information; the multiple dimensions include at least: player information, body movements, language behavior, subsequent status, and environment information; The step of generating background information for a virtual character based on pre-obtained character information description text from multiple dimensions includes: obtaining player information in the current game scene; the player information includes a player character table, which includes player character name, profession, and tags; each tag corresponds to at least one descriptive text; The profession and description text of each player character name in the player character table are concatenated to generate the final description text of the current player character; The step of generating background information for a virtual character based on pre-obtained character information description text from multiple dimensions further includes: obtaining NPC information in the current game scene; the NPC information includes an NPC table, which includes NPC name, profession, and tags; each tag corresponds to at least one descriptive text; The profession and description text of each NPC name in the NPC table are concatenated to generate the final description text of the current NPC; After the step of taking the descriptive text corresponding to the background information of the virtual character as input and generating the response text of the virtual character using a pre-trained generative pre-trained language model, the method further includes: Based on the background information of the pre-generated virtual character and the response text of the virtual character, a strategy model is used to predict the state information of the virtual character and determine the subsequent state of the virtual character; the subsequent state includes the second limb action of the virtual character.
2. The method for displaying virtual characters according to claim 1, characterized in that, After the step of controlling the virtual character to perform the target behavior and display the response text to generate the virtual character's character reaction, the method further includes: Control the virtual character to perform the second limb action.
3. The method for displaying and controlling virtual characters according to claim 1, characterized in that, The strategy model includes: a PPL strategy and a Seq2Seq model; the PPL strategy is generated based on a trained GPT model. The step of predicting the target behavior of a virtual character based on its pre-generated background information using a policy model includes: Based on the background information of the pre-generated virtual character, the GPT model is used to make predictions and generate the first prediction result of the behavior action. Based on the background information of the pre-generated virtual character, a Seq2Seq model is used to predict and generate a second prediction result of the behavior action. Based on the behavioral actions corresponding to the first prediction result and the second prediction result, the target behavioral action is determined.
4. The method for displaying virtual characters according to claim 3, characterized in that, The step of determining the target behavior action based on the behavior actions corresponding to the first prediction result and the second prediction result includes: When the first prediction result is the same as the second prediction result, the behavioral action corresponding to the first prediction result or the second prediction result is determined to be the target behavioral action. When the first prediction result is different from the second prediction result, and only one of the first prediction result and the second prediction result is not empty, the behavior action corresponding to the non-empty prediction result is determined as the target behavior action. When the first prediction result is different from the second prediction result, and both the first prediction result and the second prediction result are not empty, the action corresponding to the first prediction result is determined to be the target action.
5. A display control device for a virtual character, characterized in that, include: The target behavior action determination module is used to predict the behavior actions of the virtual character based on the background information of the pre-generated virtual character and using a strategy model to obtain the target behavior action of the virtual character; the behavior action includes the virtual character's first limb movements and language behavior; The response text generation module is used to take the descriptive text corresponding to the background information of the virtual character as input and generate the response text of the virtual character using a pre-trained generative pre-trained language model. The display control module is used to control the virtual character to perform the target behavior and display the response text, so as to generate the virtual character's character reaction; It also includes: a background information generation module, used to generate background information of virtual characters based on pre-obtained character information description text of multiple dimensions; the background information of virtual characters includes: player information, environment information and NPC information; the multiple dimensions include at least: player information, body movements, language behavior, subsequent status and environment information; The background information generation module is further configured to: obtain player information in the current game scene; the player information includes a player character table, which includes player character name, profession and tag; each tag corresponds to at least one descriptive text; and concatenate the profession and descriptive text of each player character name in the player character table to generate the final descriptive text of the current player character. The background information generation module is further configured to: obtain NPC information in the current game scene; the NPC information includes an NPC table, which includes NPC name, profession and tag; each tag corresponds to at least one descriptive text; and concatenate the profession and descriptive text of each NPC name in the NPC table to generate the final descriptive text of the current NPC. Also includes: The subsequent state generation module is used to predict the state information of the virtual character based on the pre-generated background information of the virtual character and the response text of the virtual character, and to determine the subsequent state of the virtual character; the subsequent state includes the second limb action of the virtual character.
6. The virtual character display control device according to claim 5, characterized in that, The display control module is also used to control the virtual character to perform the second limb action.
7. An electronic device comprising a memory and a processor, wherein the memory stores a computer program executable on the processor, characterized in that, When the processor executes the computer program, it implements the steps of the display control method for virtual characters according to any one of claims 1 to 4.
8. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores machine-executable instructions, which, when invoked and executed by a processor, cause the processor to execute the display control method for the virtual character according to any one of claims 1 to 4.
Citation Information
Patent Citations
Session interaction method and device, electronic equipment and storage medium
CN113094490A