Conversation control method and device for non-player character, electronic equipment and storage medium

By acquiring dialogue between players and non-player characters in the game, determining the optimal set of keywords, and matching them to the memory bank, the problem of inaccurate dialogue by non-player characters was solved, thus enhancing the game's fun.

CN119280839APending Publication Date: 2025-01-10BEIJING PERFECT WORLD SOFTWARE TECH DEV CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202311737641.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-12-15
Publication Date
2025-01-10

AI Technical Summary

Technical Problem

The existing non-player character dialogue method directly matches the player character's input statements with the memory bank, resulting in inaccurate responses and reducing the game's fun.

Method used

By acquiring the target dialogue statements between player characters and non-player characters, the optimal keyword set is determined, and this keyword set is used to replace the current input statement for memory matching to generate dialogue response statements.

Benefits of technology

The accuracy of memory matching has been improved, making the dialogue responses of non-player characters more in line with actual expectations and enhancing the game's fun.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119280839A_ABST
    Figure CN119280839A_ABST
Patent Text Reader

Abstract

The invention relates to a dialogue control method and device for a non-player character, electronic equipment and a storage medium, and the method comprises the steps that a target dialogue statement between the non-player character and a player character in a game scene is obtained, and the target dialogue statement comprises a current input statement of the player character and an ith round of dialogue statement before the current input statement; determining an optimal keyword set according to the current input statement and the ith round of dialogue statement before the current input statement; matching target memory data most matched with the optimal keyword set from a preset memory library; and generating a dialogue reply statement according to the target memory data, and sending the dialogue reply statement to the player character. In this way, the optimal keyword set can be used for replacing the current input statement of the player character to perform memory bank matching search, so that the memory obtained through matching is more accurate and real, the dialogue reply statement of the non-player character better conforms to the actual expectation, and the effect of improving the interestingness of a game is achieved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of game development technology, and in particular to a method, device, electronic device and storage medium for controlling a dialogue of a non-player character. Background Art

[0002] In order to enrich the game scenes, many games have non-player characters (NPCs), that is, game characters that are not controlled by real players. In the actual game process, the player character may need to interact with the non-player character to increase the fun of the game.

[0003] However, the current dialogue method of non-player characters is usually to directly match the current input sentence of the player character with the memory data in the preset memory bank, and then obtain the dialogue reply sentence of the non-player character based on the selected memory data. However, since the current input sentence of the player character contains too little information and it is very likely that it does not contain the actual meaning of the current dialogue, the memory data selected from the memory bank in this way is not accurate enough, resulting in the dialogue reply sentence of the non-player character not being in line with the actual expectation, which reduces the fun of the game. Summary of the invention

[0004] The present application provides a dialogue control method, device, electronic device and storage medium for a non-player character, so as to solve the problem that the memory data screened out from the memory bank in the existing dialogue mode of the non-player character is not accurate enough, resulting in the dialogue response sentences of the non-player character not being consistent with the actual expectations, thereby reducing the fun of the game.

[0005] In a first aspect, an embodiment of the present application provides a method for controlling a dialogue of a non-player character, the method comprising:

[0006] Obtaining a target dialogue sentence between a non-player character and a player character in a game scene, wherein the player character is any virtual character in the game scene that interacts with the non-player character in dialogue, and the target dialogue sentence includes a current input sentence of the player character and an i-th round of dialogue sentence before the current input sentence, wherein the current input sentence and the i-th round of dialogue sentence before the current input sentence are both minimum sentence units related to the target topic content, i is an integer greater than 0 and less than M, and M is any preset integer greater than 1;

[0007] Determine an optimal keyword set according to the current input sentence and the i-th round of dialogue sentence before the current input sentence, wherein the optimal keyword set includes a plurality of mutually independent keywords, and each of the keywords is used to represent key information in the minimum sentence unit, and the optimal keyword set is used to replace the current input sentence for memory library matching search;

[0008] Matching target memory data that best matches the optimal keyword set from a preset memory library;

[0009] A dialogue response statement is generated according to the target memory data, and the dialogue response statement is sent to the player character.

[0010] Optionally, determining an optimal keyword set according to the current input sentence and the i-th round of dialogue sentence before the current input sentence includes:

[0011] Generate a descriptive text content corresponding to the target dialogue sentence according to the current input sentence and the i-th round of dialogue sentence before the current input sentence, wherein the descriptive text content is obtained by describing the current input sentence and the i-th round of dialogue sentence before the current input sentence in the order of occurrence of the dialogue and the names of the dialogue roles;

[0012] Performing semantic conversion on the descriptive text content to obtain N candidate text contents, where N is an integer greater than 1;

[0013] Obtaining N candidate keyword sets corresponding to the N candidate text contents;

[0014] Based on the N candidate keyword sets, the optimal keyword set is determined, wherein the optimal keyword set is the union of the N candidate keyword sets.

[0015] Optionally, obtaining N candidate keyword sets corresponding to the N candidate text contents includes:

[0016] Replacing the character name of the non-player character and the character name of the player character in the target candidate text content with different personal pronouns, respectively, wherein the target candidate text content is any candidate text content among the N candidate text contents;

[0017] Eliminate non-core keywords in the replaced target candidate text content and increase the weight of core keywords, wherein the non-core keywords include the personal pronouns;

[0018] A set of candidate keywords in the processed target candidate text content is obtained.

[0019] Optionally, matching the target memory data that best matches the optimal keyword set from a preset memory library includes:

[0020] Respectively calculating the word vector similarity between the optimal keyword set and each memory data in the preset memory library, wherein the preset memory library pre-stores a plurality of memory data, and the plurality of memory data are obtained based on a plurality of rounds of dialogue sentences before the current input sentence, or are preset;

[0021] The memory data with the highest word vector similarity in the preset memory library is determined as the target memory data, wherein the target memory data belongs to the multiple memory data.

[0022] Optionally, generating a dialogue reply statement according to the target memory data includes:

[0023] Extracting text content associated with the current input sentence from the target memory data;

[0024] The dialogue reply statement is generated according to the intercepted text content.

[0025] Optionally, after generating a dialogue reply sentence according to the target memory data, the method further includes:

[0026] New memory data is generated according to the current input sentence and the dialogue reply sentence, and the new memory data is stored in the preset memory library.

[0027] In a second aspect, an embodiment of the present application further provides a dialogue control device for a non-player character, the device comprising:

[0028] An acquisition module, used for acquiring a target dialogue sentence between a non-player character and a player character in a game scene, wherein the player character is any virtual character in the game scene that interacts with the non-player character in dialogue, and the target dialogue sentence includes a current input sentence of the player character and an i-th round of dialogue sentence before the current input sentence, wherein the current input sentence and the i-th round of dialogue sentence before the current input sentence are both minimum sentence units related to the target topic content, i is an integer greater than 0 and less than M, and M is any preset integer greater than 1;

[0029] A determination module, configured to determine an optimal keyword set based on the current input sentence and the i-th round of dialogue sentence before the current input sentence, wherein the optimal keyword set includes a plurality of mutually independent keywords, and each of the keywords is used to represent key information in the minimum sentence unit, and the optimal keyword set is used to replace the current input sentence for memory library matching search;

[0030] A matching module, used to match target memory data that best matches the optimal keyword set from a preset memory library;

[0031] A generation module is used to generate a dialogue reply statement according to the target memory data, and send the dialogue reply statement to the player character.

[0032] Optionally, the determining module includes:

[0033] A first generating submodule is used to generate a descriptive text content corresponding to the target dialogue sentence according to the current input sentence and the i-th round of dialogue sentence before the current input sentence, wherein the descriptive text content is described according to the dialogue occurrence order of the current input sentence and the i-th round of dialogue sentence before the current input sentence and the names of the dialogue roles;

[0034] A conversion submodule, used for performing semantic conversion on the descriptive text content to obtain N candidate text contents, where N is an integer greater than 1;

[0035] An acquisition submodule, used to acquire N candidate keyword sets corresponding to the N candidate text contents;

[0036] The first determination submodule is used to determine the optimal keyword set based on the N candidate keyword sets, wherein the optimal keyword set is the union of the N candidate keyword sets.

[0037] In a third aspect, an embodiment of the present application further provides an electronic device, including a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other via the communication bus;

[0038] Memory, used to store computer programs;

[0039] The processor is used to implement the steps of the non-player character dialogue control method described in any one of the first aspects when executing the program stored in the memory.

[0040] In a fourth aspect, an embodiment of the present application further provides a computer-readable storage medium having a computer program stored thereon, wherein when the computer program is executed by a processor, the steps of the method for controlling a dialogue of a non-player character as described in any one of the first aspects are implemented.

[0041] The above technical solution provided by the embodiment of the present application has the following advantages over the prior art: the method provided by the embodiment of the present application obtains a target dialogue sentence between a non-player character and a player character in a game scene, wherein the player character is any virtual character in the game scene that interacts with the non-player character in dialogue, and the target dialogue sentence includes the current input sentence of the player character and the i-th round dialogue sentence before the current input sentence, and the current input sentence and the i-th round dialogue sentence before the current input sentence are both minimum sentence units related to the target topic content, i is an integer greater than 0 and less than M, and M is any preset integer greater than 1; according to the current input sentence and the i-th round dialogue sentence before the current input sentence, an optimal keyword set is determined, wherein the optimal keyword set includes multiple independent keywords, and each keyword is used to represent the key information in the minimum sentence unit, and the optimal keyword set is used to replace the current input sentence for memory library matching search; the target memory data that best matches the optimal keyword set is matched from the preset memory library; a dialogue reply sentence is generated according to the target memory data, and the dialogue reply sentence is sent to the player character. Through the above method, the target dialogue sentence between the non-player character and the player character can be used to determine the optimal keyword set, and then the optimal keyword set can be used to replace the current input sentence of the player character for memory library matching search, so that the matched memory is more accurate and real, and the dialogue response sentence of the non-player character is more in line with actual expectations, thereby achieving the effect of improving the fun of the game. BRIEF DESCRIPTION OF THE DRAWINGS

[0042] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the invention and, together with the description, serve to explain the principles of the invention.

[0043] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.

[0044] One or more embodiments are exemplarily described by pictures in the corresponding drawings, and these exemplified descriptions do not constitute limitations on the embodiments. Elements with the same reference numerals in the drawings represent similar elements, and unless otherwise stated, the figures in the drawings do not constitute proportional limitations.

[0045] Figure 1 A flowchart of a method for controlling a dialogue of a non-player character provided in an embodiment of the present application;

[0046] Figure 2 A flowchart of another method for controlling a dialogue of a non-player character provided in an embodiment of the present application;

[0047] Figure 3 A schematic diagram of a chat interface within a game provided in an embodiment of the present application;

[0048] Figure 4 A schematic diagram of the structure of a dialogue control device for a non-player character provided in an embodiment of the present application;

[0049] Figure 5 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0050] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of this application.

[0051] The disclosure below provides many different embodiments or examples to implement different structures of the present invention. In order to simplify the disclosure of the present invention, the parts and settings of specific examples are described below. Of course, they are only examples, and the purpose is not to limit the present invention. In addition, the present invention can repeat reference numbers and / or letters in different examples. This repetition is for the purpose of simplification and clarity, and does not itself indicate the relationship between the various embodiments and / or settings discussed.

[0052] In order to solve the problem in the prior art that the memory data screened out from the memory bank for the dialogue mode of non-player characters is not accurate enough, resulting in the dialogue response sentences of the non-player characters not being consistent with actual expectations, the present application provides a dialogue control method, device, electronic device and storage medium for non-player characters, which can improve the accuracy of memory matching.

[0053] See also Figure 1 , Figure 1 The flowchart of a method for controlling a dialogue between a non-player character provided in an embodiment of the present application is shown in FIG. Figure 1 As shown, the dialogue control method of the non-player character may include the following steps:

[0054] Step 101: Obtain a target dialogue sentence between a non-player character and a player character in a game scene, wherein the player character is any virtual character in the game scene that interacts with the non-player character in dialogue, and the target dialogue sentence includes a current input sentence of the player character and an i-th round of dialogue sentence before the current input sentence, and both the current input sentence and the i-th round of dialogue sentence before the current input sentence are minimum sentence units related to the target topic content, i is an integer greater than 0 and less than M, and M is any pre-set integer greater than 1.

[0055] Specifically, the target dialogue sentence may include the current input sentence of the player character and the i-th round dialogue sentence before the current input sentence. The i-th round dialogue sentence can be understood as the sentence generated by the i-th round of dialogue counting forward from the current input sentence, such as the 1st round dialogue sentence, the 2nd round dialogue sentence, the 3rd round dialogue sentence, etc. before the current input sentence. The i-th round dialogue sentence contains information related to the target topic content in the current input sentence. For example, assuming that the current input sentence of the player character is "What does he do", if only the current input sentence is matched and searched in the memory library, the matching memory is very vague. At this time, the dialogue sentences "Senior, is your father busy at work?" and "It's OK" generated before the current input sentence can be obtained, and then they are combined with the current input sentence "What does he do" to form a complete semantics and then perform a memory library matching search. It should be noted that the value of i needs to be greater than 0 and less than M, where M is a preset value used to limit the range of historical dialogue sentences, for example, M is an integer such as 3, 4, 5, etc.

[0056] As an optional implementation, the value of M can be set to 3. When the current input statement of the player character is received, the i-th round of dialogue statements related to the target topic content can be obtained in the first three rounds of dialogue of the current input statement of the player character, and then the current input statement of the player character and the i-th round of dialogue statements are determined as the target dialogue statements. In this way, the efficiency and accuracy of obtaining the target dialogue statements can be improved.

[0057] Step 102: Determine an optimal keyword set based on the current input sentence and the i-th round of dialogue sentence before the current input sentence, wherein the optimal keyword set includes multiple independent keywords, and each keyword is used to represent key information in a minimum sentence unit, and the optimal keyword set is used to replace the current input sentence for memory library matching search.

[0058] In this step, the keywords in the current input sentence and the i-th round of dialogue sentences before the current input sentence can be directly obtained, and the obtained keywords can be used as the optimal keyword set; or the current input sentence and the i-th round of dialogue sentences before the current input sentence can be semantically converted to obtain multiple candidate text contents with the same semantics, and then the keywords of these multiple candidate text contents can be obtained respectively, and then the optimal keyword set can be obtained based on the obtained keywords.

[0059] Step 103: Match the target memory data that best matches the optimal keyword set from the preset memory library.

[0060] Specifically, the preset memory library refers to a preset memory library for storing memories. The preset memory library stores multiple memories, which can be pre-configured or automatically generated based on the conversation content between the player character and the non-player character.

[0061] In this step, the optimal keyword set may be used to replace the current input statement of the player character to perform a memory library matching search, thereby matching the target memory data that best matches the optimal keyword set from the preset memory library.

[0062] Step 104: Generate a dialogue response statement based on the target memory data, and send the dialogue response statement to the player character.

[0063] In this step, after the target memory data is acquired, a dialogue response statement of the non-player character may be generated according to the target memory data, and then the dialogue response statement may be sent to the player character to realize a dialogue interaction between the player character and the non-player character.

[0064] In this embodiment, the target dialogue sentence between the non-player character and the player character can be used to determine the optimal keyword set, and then the optimal keyword set is used to replace the current input sentence of the player character to perform a memory library matching search, so that the matched memory is more accurate and real, and the dialogue response sentence of the non-player character is more in line with actual expectations, thereby achieving the effect of improving the fun of the game.

[0065] Furthermore, the above step 102, determining the optimal keyword set according to the current input sentence and the i-th round of dialogue sentence before the current input sentence, includes:

[0066] Generate descriptive text content corresponding to the target dialogue sentence according to the current input sentence and the i-th round of dialogue sentence before the current input sentence, wherein the descriptive text content is obtained by describing the dialogue sequence of the current input sentence and the i-th round of dialogue sentence before the current input sentence and the names of the dialogue roles;

[0067] Perform semantic transformation on the descriptive text content to obtain N candidate text contents, where N is an integer greater than 1;

[0068] Obtain N candidate keyword sets corresponding to N candidate text contents;

[0069] Based on the N candidate keyword sets, an optimal keyword set is determined, wherein the optimal keyword set is the union of the N candidate keyword sets.

[0070] Specifically, the value of N can be pre-set or dynamically adjusted according to the content of the target dialogue sentence, and the embodiment of the present application does not make specific limitations. It should be noted that N is an integer greater than 1, such as any integer such as 2, 3, 4, etc.

[0071] In one embodiment, when determining the optimal keyword set, a descriptive text content corresponding to the target dialogue sentence can be generated based on the current input sentence of the player character and the i-th round of dialogue sentence before the current input sentence, and then the descriptive text content is semantically transformed to obtain multiple candidate text contents, and then the candidate keyword set corresponding to each candidate text content is obtained respectively, and then the optimal keyword set is determined based on the multiple candidate keyword sets.

[0072] For example, assuming that in a game scene, the target dialogue sentences between the player character (represented by the virtual character of the junior) and the non-player character (represented by the virtual character of A) are "Senior, is your father busy at work?", "Not bad", "What does he do", the descriptive text content can be obtained: the junior asked A's father if he was busy recently, A replied that his father was always busy, and the junior then asked what A's father did. According to the descriptive text content, three candidate text contents with the same semantics can be obtained: 1. The junior asked A about the recent situation of A's father, A replied that his father was always busy, and the junior then asked A's father's occupation. 2. The junior asked A about the current situation of A's father, A replied that his father was always busy, and the junior then asked what A's father's job was. 3. The junior asked A if A's father was busy recently, A replied that his father was always busy, and the junior then asked A's father what job he did. Then, based on these three candidate text contents, the corresponding three candidate keyword sets can be obtained, and finally the optimal keyword set can be determined based on these three candidate keyword sets.

[0073] In this embodiment, the current input sentence of the player character and the previous i-th round of dialogue sentence are summarized into a sentence to ensure that the matched information contains enough information and is relevant to the target topic content, so as to better understand the semantic and contextual relationship; and, by generating descriptive text content corresponding to the target dialogue sentence and breaking it down into a variety of keyword outputs with the same or similar semantics, the problems of vocabulary extrapolation and synonym matching are solved, making the memory library matching search more accurate.

[0074] Furthermore, the above step of obtaining N candidate keyword sets corresponding to N candidate text contents includes:

[0075] Replacing the character names of non-player characters and the character names of player characters in the target candidate text content with different personal pronouns, respectively, wherein the target candidate text content is any candidate text content among the N candidate text contents;

[0076] Eliminate non-core keywords in the target candidate text content after replacement and increase the weight of core keywords, wherein non-core keywords include personal pronouns;

[0077] Obtain a set of candidate keywords in the processed target candidate text content.

[0078] In one embodiment, when obtaining N candidate keyword sets corresponding to N candidate text contents, the character names of non-player characters and player characters in a candidate text content can be replaced with different personal pronouns, and then non-core keywords (such as personal pronouns, modal particles, etc.) in the candidate text content are eliminated, and the weight of core keywords is increased, and then the candidate keyword set in the candidate text content is obtained. In the same manner as above, the candidate keyword set corresponding to each candidate text content can be obtained.

[0079] For example, suppose that in a game scene, the target dialogue sentences between the player character (represented by the virtual character of the junior sister) and the non-player character (represented by the virtual character of A) are "Senior, is your father busy at work?", "Not bad", "What does he do?", and the descriptive text content can be obtained: the junior sister asked A's father if he was busy recently, A replied that his father was always busy, and the junior sister then asked what A's father did. According to the descriptive text content, three candidate text contents with the same semantics can be obtained: 1. The junior sister asked A about the recent situation of A's father, A replied that his father was always busy, and the junior sister then asked A's father's occupation. 2. The junior sister asked A about the current situation of A's father, A replied that his father was always busy, and the junior sister then asked what A's father's job was. 3. The junior sister asked A if A's father was busy recently, A replied that his father was always busy, and the junior sister then asked A's father what job he did. Then the character names in the three candidate text contents are replaced by the person pronouns to obtain: 1. She asked your father about the recent situation, you replied that your father was always busy, and she then asked your father's occupation. 2. She asks you about your father's current situation, you answer that your father is always busy, and she then asks what your father does for a living. 3. She asks if your father is busy recently, you answer that your father is always busy, and she then asks what your father does for a living. Then, the non-core keywords in the three candidate text contents can be eliminated and the weight of the core keywords can be increased to obtain the corresponding three candidate keyword sets: 1. Ask, father, recent situation, answer, busy, occupation. 2. Ask, father, current situation, answer, busy, work. 3. Ask, father, busy, answer, busy, work. Based on the three candidate keyword sets, the optimal keyword set is determined: [Keywords] Ask, father, recent situation, answer, busy, occupation [ / Keywords]. It should be noted that [Keywords] and [ / Keywords] are characteristic vocabulary symbols, which are used by the program to split the string. The words between [Keywords] and [ / Keywords] are independent keywords. The reason why the names of non-player characters and player characters in the target candidate text content are replaced with different personal pronouns is to make better use of the embedding mechanism and match the results more accurately. Because personal pronouns such as "you", "I", and "she" are easily ignored in the matching algorithm, the importance of other words is highlighted in contrast. However, if a specific title such as a character name is used, then when the following sentence is short and no suitable matching words appear, the weight of the title will become higher, so the title will be matched, and every memory may have this title, resulting in no better matching results.

[0080] For another example, in a massively multiplayer online role-playing game (MMORPG) with a simulated business gameplay, there are usually multiple intelligent NPCs in the area provided. When the intelligent NPC talks with other NPCs or virtual characters controlled by players, the artificial intelligence model will identify the identity, content, style and strategy of the interlocutor, and form memories and store them in the memory bank. Then, based on these memories and the preset persona or personality of the NPC, the NPC's own opinions and habits will gradually be formed. Past interactions and historical conversation data may affect the NPC's future conversation style, behavior pattern, etc. As the game continues to operate, many NPCs may also form their own social attributes such as hobbies, occupations, etc., and virtual forces such as gangs, societies or religious groups will be formed between NPCs or between NPCs and virtual characters controlled by players in the game, and then perform relevant behaviors that conform to the characteristics of the organization, such as resource collection teams, transportation teams, mercenary teams, intelligence organizations, bands, dance troupes, artist management companies, etc., becoming an ecological community composed of AI that will self-evolve in the entire game environment.

[0081] In this embodiment, by replacing the character names with personal pronouns, removing core keywords, and increasing the weights of core keywords, etc., the accuracy of the memory library matching search results can be further improved, thereby obtaining a memory with higher accuracy.

[0082] Furthermore, the above step 103, matching the target memory data that best matches the optimal keyword set from the preset memory library, includes:

[0083] Calculate the word vector similarity between the optimal keyword set and each memory data in the preset memory library respectively, wherein the preset memory library pre-stores a plurality of memory data, and the plurality of memory data are obtained based on a plurality of rounds of dialogue sentences before the current input sentence, or are pre-set;

[0084] The memory data with the highest word vector similarity in the preset memory library is determined as the target memory data, wherein the target memory data belongs to multiple memory data.

[0085] Specifically, the preset memory library stores a plurality of memory data in advance, and the plurality of memory data may be obtained based on multiple rounds of dialogue sentences before the current input sentence, or may be preset.

[0086] In one embodiment, the optimal keyword set can be input into the artificial intelligence (AI) model for memory library matching search, which is embedding collision for word vector matching for GPT. The entire search memory process is divided into three steps: input information - collision embedding for word vector matching - output of the matched results from the memory library. In the process of collision embedding, the word vector similarity between the optimal keyword set and each memory data in the preset memory library can be calculated respectively, and then the memory data with the highest word vector similarity in the preset memory library is determined as the target memory data. For example, suppose the following memory exists in the preset memory library:

[0087] 100011 Your father is a successful business elite with a strong sense of professionalism.

[0088] 100012 Your father came from a poor family, so he took his career very seriously. He was a financial investor by profession.

[0089] 100013 Your father has a professional disease and is used to controlling his life with business thinking.

[0090] 100014 Your father has high standards and strict requirements for everything.

[0091] 100015 Your father is a self-centered male chauvinist who doesn't like too many changes in life.

[0092] 100016 Your father doesn't like being asked to do things by others and thinks it will disturb his life.

[0093] 100017 Your father likes to do things strictly according to his own plan and doesn't like others to disrupt his plans.

[0094] At this time, the optimal keyword set such as [Keywords] inquiry, father, recent status, answer, busy, occupation[ / Keywords] can be matched with each memory data in the preset memory library, and then the memory data with the highest word vector similarity in the preset memory library is determined as the target memory data, such as "100012 Your father was born in a poor family, so he attaches great importance to his career. He is a financial investor."

[0095] In this embodiment, the target memory data with the highest word vector similarity can be matched from the preset memory library according to the optimal keyword set, thereby improving the accuracy of the memory library matching search results.

[0096] Furthermore, the above step 104, generating a dialogue reply sentence according to the target memory data, includes:

[0097] Extracting text content associated with the current input sentence from the target memory data;

[0098] Generate a dialogue reply statement based on the intercepted text content.

[0099] In one embodiment, after acquiring the target memory data, text content associated with the current input sentence can be intercepted from the target memory data, such as occupation-related text "occupation", "financial investor", etc., and then a dialogue reply sentence is generated based on the intercepted text content, such as "he is a financial investor", etc. In this way, a dialogue interaction can be carried out dynamically and in real time with the player character based on the acquired target memory data, thereby improving the memory search capability of the AI ​​model, which plays an important role in improving the intelligence level of non-player characters, the interactivity, immersion and playability of the game, etc.

[0100] Furthermore, after the above step 104, generating a dialogue reply sentence according to the target memory data, the method further includes:

[0101] Generate new memory data based on the current input sentence and dialogue response sentence, and store the new memory data in the preset memory library.

[0102] In this embodiment, after the dialogue reply statement of the non-player character is generated, new memory data can be generated according to the current input statement of the player character and the dialogue reply statement of the non-player character, and then the new memory data can be stored in the preset memory library. In this way, the memory in the preset memory library can be dynamically updated according to the dialogue interaction between the player character and the non-player character, thereby facilitating the subsequent memory library matching search.

[0103] In one embodiment, the dialogue control process of the non-player character provided in the embodiment of the present application is as follows: Figure 2 As shown, the specific steps include:

[0104] Step 201: Collect the minimum input sentence (equivalent to the target dialogue sentence in the above text) that can fully express the current topic information in the current input context.

[0105] For example, when the player character inputs the question "What does he do?", if the traditional method is used, it is impossible to search for the memory number "100012" containing the occupation in the preset memory bank in the above example. The reason is that the AI ​​model cannot know who "he" is, and the semantics of "what" is to ask about the occupation.

[0106] Step 202: Summarize these sentences into third-person expressions according to the actual occurrence order and the actual expression objects, and output them.

[0107] Step 203: Use the AI ​​model to replace the same semantic keywords in the above sentences, remove non-core keywords such as person names, and add weights to core words.

[0108] Step 204: Output the expression as independent keywords between certain characteristic vocabulary symbols (equivalent to the optimal keyword set mentioned above).

[0109] The output of the AI ​​model is "content":"(1) The junior student asked A's father if he was busy recently. A replied that his father was always busy. The junior student then asked A's father what he did. (2) She asked your father if he was busy recently. You replied that your father was always busy. She then asked what your father did. (3) 1. She asked your father about his recent situation. You replied that your father was always busy. She then asked about your father's occupation. 2. She asked you about your father's current situation. You replied that your father was always busy. She then asked what your father's job was. 3. She asked your father if he was busy recently. You replied that your father was always busy. She then asked what your father did for a living. (4) 1. Asked about, father, recent situation. Answered, busy. Occupation. 2. Asked about, father, current situation. Answered, busy. Work. 3. Asked about, father, busy. Answered, busy. Work. [Keywords] Asked about, father, recent situation. Answered, busy. Occupation[ / Keywords]".

[0110] Step 205: The AI ​​model will use the above keywords to replace the input sentences of the player character and perform a memory library matching search.

[0111] When the above optimization method is used, the output keywords will include two key matching points: "father" and "occupation", and the preset memory library containing the memory number "100012" containing the occupation can be searched. The matching result of the AI ​​model is [Memory] Your father has an occupational disease and is used to controlling his life with business thinking. Your father was born in poverty, so he attaches great importance to his career. His occupation is a financial investor. In this way, dialogue response sentences with non-player characters can be generated, and the chat interface in the game is as follows: Figure 3 shown.

[0112] The non-player character dialogue control method provided in the embodiment of the present application can greatly improve the accuracy of memory search, thereby obtaining richer, more natural and correct NPC role-playing dialogues. Specifically, for game players, it has the following benefits:

[0113] 1) Improved gaming experience: NPCs have better memory search capabilities, which can make the gaming experience more realistic and rich. For example, NPCs can change the way they interact with players based on past interactions, which will make the gaming experience more dynamic and personalized.

[0114] 2) Increase the challenge of the game: If the NPC can remember the player's strategy or behavior pattern, then the player needs to constantly change his strategy, which will increase the challenge of the game.

[0115] 3) Better plot engagement: NPCs’ memory abilities can make the game’s plot more coherent, allowing players to better engage and feel the game’s story.

[0116] For game developers, the benefits are as follows:

[0117] 1) Improve game value: NPCs’ memory search capabilities can improve the intelligence of the game, which will increase the value of the game and may attract more players.

[0118] 2) Improve player retention: By providing a richer and more personalized gaming experience, player satisfaction and retention can be improved.

[0119] 3) Innovative Advantage: Developing NPCs with memory search capabilities can serve as an innovative competitive advantage, helping to differentiate from other games and improve market competitiveness.

[0120] See also Figure 4 , Figure 4 This is a schematic diagram of the structure of a non-player character dialogue control device provided in an embodiment of the present application. Figure 4 As shown, the device 400 includes:

[0121] The acquisition module 401 is used to acquire a target dialogue sentence between a non-player character and a player character in a game scene, wherein the player character is any virtual character in the game scene that interacts with the non-player character in dialogue, and the target dialogue sentence includes a current input sentence of the player character and an i-th round of dialogue sentence before the current input sentence, and the current input sentence and the i-th round of dialogue sentence before the current input sentence are both minimum sentence units related to the target topic content, i is an integer greater than 0 and less than M, and M is any preset integer greater than 1;

[0122] A determination module 402 is used to determine an optimal keyword set based on the current input sentence and the i-th round of dialogue sentence before the current input sentence, wherein the optimal keyword set includes a plurality of independent keywords, and each keyword is used to represent key information in a minimum sentence unit, and the optimal keyword set is used to replace the current input sentence for memory library matching search;

[0123] Matching module 403, used to match the target memory data that best matches the optimal keyword set from the preset memory library;

[0124] The generation module 404 is used to generate a dialogue reply statement according to the target memory data, and send the dialogue reply statement to the player character.

[0125] Further, the determination module 402 includes:

[0126] The first generation submodule is used to generate a descriptive text content corresponding to the target dialogue sentence according to the current input sentence and the i-th round of dialogue sentence before the current input sentence, wherein the descriptive text content is obtained by describing the dialogue occurrence sequence of the current input sentence and the i-th round of dialogue sentence before the current input sentence and the names of the dialogue roles;

[0127] The conversion submodule is used to perform semantic conversion on the descriptive text content to obtain N candidate text contents, where N is an integer greater than 1;

[0128] An acquisition submodule is used to acquire N candidate keyword sets corresponding to N candidate text contents;

[0129] The first determination submodule is used to determine an optimal keyword set based on N candidate keyword sets, wherein the optimal keyword set is the union of the N candidate keyword sets.

[0130] Furthermore, the acquisition submodule includes:

[0131] a replacement unit, used to replace the character name of the non-player character and the character name of the player character in the target candidate text content with different personal pronouns, wherein the target candidate text content is any candidate text content among the N candidate text contents;

[0132] A processing unit, used to remove non-core keywords in the replaced target candidate text content and increase the weight of the core keywords, wherein the non-core keywords include personal pronouns;

[0133] The acquisition unit is used to acquire a candidate keyword set in the processed target candidate text content.

[0134] Furthermore, the matching module 403 includes:

[0135] A calculation submodule, used to respectively calculate the word vector similarity between the optimal keyword set and each memory data in the preset memory library, wherein the preset memory library pre-stores a plurality of memory data, and the plurality of memory data are obtained based on a plurality of rounds of dialogue sentences before the current input sentence, or are pre-set;

[0136] The second determination submodule is used to determine the memory data with the highest word vector similarity in the preset memory library as the target memory data, wherein the target memory data belongs to multiple memory data.

[0137] Further, the generating module 404 includes:

[0138] The interception submodule is used to intercept the text content associated with the current input sentence from the target memory data;

[0139] The second generation submodule is used to generate a dialogue reply statement according to the intercepted text content.

[0140] Furthermore, the device 400 further includes:

[0141] The storage module is used to generate new memory data according to the current input sentence and the dialogue reply sentence, and store the new memory data in a preset memory library.

[0142] It should be noted that the device 400 can implement the steps of the dialogue control method for non-player characters provided by any of the aforementioned method embodiments, and can achieve the same technical effects, which will not be described in detail here.

[0143] like Figure 5 As shown, the embodiment of the present application further provides an electronic device, including a processor 511, a communication interface 512, a memory 513 and a communication bus 514, wherein the processor 511, the communication interface 512, and the memory 513 communicate with each other through the communication bus 514.

[0144] Memory 513, used for storing computer programs;

[0145] In one embodiment of the present application, the processor 511 is used to execute the program stored in the memory 513 to implement the dialogue control method of the non-player character provided by any of the above method embodiments, including:

[0146] Obtaining a target dialogue sentence between a non-player character and a player character in a game scene, wherein the player character is any virtual character that interacts with the non-player character in the game scene, and the target dialogue sentence includes a current input sentence of the player character and an i-th round of dialogue sentence before the current input sentence, wherein the current input sentence and the i-th round of dialogue sentence before the current input sentence are both minimum sentence units related to the target topic content, i is an integer greater than 0 and less than M, and M is any preset integer greater than 1;

[0147] According to the current input sentence and the i-th round of dialogue sentence before the current input sentence, an optimal keyword set is determined, wherein the optimal keyword set includes multiple independent keywords, and each keyword is used to represent the key information in the minimum sentence unit, and the optimal keyword set is used to replace the current input sentence for memory library matching search;

[0148] Matching the target memory data that best matches the optimal keyword set from the preset memory library;

[0149] Generates a dialogue response statement based on the target memory data and sends the dialogue response statement to the player character.

[0150] The embodiment of the present application also provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the steps of the dialogue control method for a non-player character provided in any of the aforementioned method embodiments are implemented.

[0151] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, i.e., they may be located in one place, or may be distributed over multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0152] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a general hardware platform, and of course, by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the relevant technology can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.

[0153] It should be understood that the terms used herein are only for the purpose of describing specific example embodiments and are not intended to be limiting. Unless the context clearly indicates otherwise, the singular forms "one", "an" and "said" as used herein may also be meant to include plural forms. The terms "include", "comprise", "contain", and "have" are inclusive, and therefore specify the existence of stated features, steps, operations, elements and / or parts, but do not exclude the existence or addition of one or more other features, steps, operations, elements, parts, and / or combinations thereof. The method steps, processes, and operations described herein are not interpreted as necessarily requiring them to be performed in the specific order described or illustrated, unless the execution order is clearly indicated. It should also be understood that additional or alternative steps may be used.

[0154] The foregoing is merely a specific embodiment of the present invention, which enables those skilled in the art to understand or implement the present invention. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present invention. Therefore, the present invention will not be limited to the embodiments shown herein, but rather to the widest scope consistent with the principles and novel features claimed herein.

Claims

1. A method for controlling a dialogue of a non-player character, characterized in that: The method comprises: Obtaining a target dialogue sentence between a non-player character and a player character in a game scene, wherein the player character is any virtual character in the game scene that interacts with the non-player character in dialogue, and the target dialogue sentence includes a current input sentence of the player character and an i-th round of dialogue sentence before the current input sentence, wherein the current input sentence and the i-th round of dialogue sentence before the current input sentence are both minimum sentence units related to the target topic content, i is an integer greater than 0 and less than M, and M is any preset integer greater than 1; Determine an optimal keyword set according to the current input sentence and the i-th round of dialogue sentence before the current input sentence, wherein the optimal keyword set includes a plurality of mutually independent keywords, and each of the keywords is used to represent key information in the minimum sentence unit, and the optimal keyword set is used to replace the current input sentence for memory library matching search; Matching target memory data that best matches the optimal keyword set from a preset memory library; A dialogue response statement is generated according to the target memory data, and the dialogue response statement is sent to the player character.

2. The method according to claim 1, characterized in that The step of determining an optimal keyword set according to the current input sentence and the i-th round of dialogue sentence before the current input sentence includes: Generate a descriptive text content corresponding to the target dialogue sentence according to the current input sentence and the i-th round of dialogue sentence before the current input sentence, wherein the descriptive text content is obtained by describing the current input sentence and the i-th round of dialogue sentence before the current input sentence in the order of occurrence of the dialogue and the names of the dialogue roles; Performing semantic conversion on the descriptive text content to obtain N candidate text contents, where N is an integer greater than 1; Obtaining N candidate keyword sets corresponding to the N candidate text contents; Based on the N candidate keyword sets, the optimal keyword set is determined, wherein the optimal keyword set is the union of the N candidate keyword sets.

3. The method according to claim 2, characterized in that The obtaining of N candidate keyword sets corresponding to the N candidate text contents includes: Replacing the character name of the non-player character and the character name of the player character in the target candidate text content with different personal pronouns, respectively, wherein the target candidate text content is any candidate text content among the N candidate text contents; Eliminate non-core keywords in the replaced target candidate text content and increase the weight of core keywords, wherein the non-core keywords include the personal pronouns; A set of candidate keywords in the processed target candidate text content is obtained.

4. The method according to claim 1, characterized in that: The step of matching the target memory data that best matches the optimal keyword set from the preset memory library includes: Calculating the word vector similarity between the optimal keyword set and each memory data in the preset memory library respectively, wherein the preset memory library pre-stores a plurality of memory data, and the plurality of memory data are obtained based on a plurality of rounds of dialogue sentences before the current input sentence, or are pre-set; The memory data with the highest word vector similarity in the preset memory library is determined as the target memory data, wherein the target memory data belongs to the multiple memory data.

5. The method according to claim 1, characterized in that: The step of generating a dialogue reply statement according to the target memory data comprises: Extracting text content associated with the current input sentence from the target memory data; The dialogue reply statement is generated according to the intercepted text content.

6. The method according to claim 1, characterized in that After generating a dialogue reply sentence according to the target memory data, the method further includes: New memory data is generated according to the current input sentence and the dialogue reply sentence, and the new memory data is stored in the preset memory library.

7. A dialogue control device for a non-player character, characterized in that: The device comprises: An acquisition module, used for acquiring a target dialogue sentence between a non-player character and a player character in a game scene, wherein the player character is any virtual character in the game scene that interacts with the non-player character in dialogue, and the target dialogue sentence includes a current input sentence of the player character and an i-th round of dialogue sentence before the current input sentence, wherein the current input sentence and the i-th round of dialogue sentence before the current input sentence are both minimum sentence units related to the target topic content, i is an integer greater than 0 and less than M, and M is any preset integer greater than 1; A determination module, configured to determine an optimal keyword set based on the current input sentence and the i-th round of dialogue sentence before the current input sentence, wherein the optimal keyword set includes a plurality of mutually independent keywords, and each of the keywords is used to represent key information in the minimum sentence unit, and the optimal keyword set is used to replace the current input sentence for memory library matching search; A matching module, used to match target memory data that best matches the optimal keyword set from a preset memory library; A generation module is used to generate a dialogue reply statement according to the target memory data, and send the dialogue reply statement to the player character.

8. The device according to claim 7, characterized in that The determination module comprises: A first generating submodule is used to generate a descriptive text content corresponding to the target dialogue sentence according to the current input sentence and the i-th round of dialogue sentence before the current input sentence, wherein the descriptive text content is described according to the dialogue occurrence order of the current input sentence and the i-th round of dialogue sentence before the current input sentence and the names of the dialogue roles; A conversion submodule, used for performing semantic conversion on the descriptive text content to obtain N candidate text contents, where N is an integer greater than 1; An acquisition submodule, used to acquire N candidate keyword sets corresponding to the N candidate text contents; The first determination submodule is used to determine the optimal keyword set based on the N candidate keyword sets, wherein the optimal keyword set is the union of the N candidate keyword sets.

9. An electronic device, characterized in that: It includes a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other through the communication bus; Memory, used to store computer programs; The processor is used to implement the steps of the dialogue control method for non-player characters described in any one of claims 1 to 6 when executing the program stored in the memory.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method for controlling a dialogue of a non-player character according to any one of claims 1 to 6 are implemented.