A dialog processing method and apparatus
By constructing a composite byte structure for hash calculation, the problem of character type confusion in NPC character dialogue acquisition is solved, thereby improving the accuracy of dialogue acquisition and the individuality of NPC character dialogue.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- TENCENT TECHNOLOGY (SHENZHEN) CO LTD
- Filing Date
- 2026-05-06
- Publication Date
- 2026-06-05
AI Technical Summary
Existing methods of obtaining dialogues can easily lead to NPC characters using dialogue text information with the wrong character type style when calculating semantic matching degree through vector distance, resulting in character type confusion and a lack of individuality in NPC character dialogues.
By constructing a composite byte structure and performing hash calculations using character type identifiers, scene type identifiers, and extended behavior identifiers, a composite hash value is obtained. The matching cache hash value is then searched in the cache index layer to obtain accurate cached dialogue information, thereby improving the accuracy of dialogue retrieval and the individuality of NPC character dialogues.
This effectively avoids confusion about character types, improves the accuracy of dialogue acquisition, and enhances the individuality of NPC character dialogue.
Smart Images

Figure CN122141256A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer application technology, and in particular to a dialogue processing method and apparatus. Background Technology
[0002] In existing game businesses (e.g., those targeting large-scale open-world games), there are typically a large number of non-player characters (NPCs). These NPCs can interact (e.g., engage in dialogue) with the player characters (i.e., game characters) controlled by the user within the game's context. For example, from the perspective of the business layer of this game business, when an NPC (e.g., a virtual character Z1) engages in dialogue with the user's player character (i.e., game character X1), a dialogue query request needs to be sent to a Large Language Model (LLM). The LLM, after converting the query text carried in the dialogue query request into a query vector represented by semantic vectors, can calculate the semantic matching degree between the query text and historical query texts using vector distance calculation. This allows the LLM to use historical dialogue text information (which maps to historical query vectors) as the dialogue text information obtained for the given query text.
[0003] However, the inventors discovered in practice that existing dialogue acquisition methods aim to calculate the semantic matching degree between the query text and historical query texts using vector distance calculation. This allows for dialogue indexing in the cache storage module using vector semantic matching. This means that if query texts for different NPC roles are semantically similar, the mapping relationship between historical query vectors and historical dialogue text information maintained in the cache storage module will lead to the misinterpretation of historical dialogue text information that is mapped to other NPC roles (e.g., virtual role Z2) as the dialogue text information of this NPC role (e.g., virtual role Z1), thus reducing the accuracy of dialogue acquisition. Consequently, when an NPC role (i.e., a virtual role object) uses dialogue text information of the wrong role type style to communicate with business objects, role type confusion will occur, resulting in a lack of dialogue individuality for the NPC role (i.e., the virtual role object). Summary of the Invention
[0004] This application provides a dialogue processing method and apparatus that can improve the accuracy of dialogue acquisition and flexibly enhance the dialogue personality of NPC characters (i.e., virtual character objects).
[0005] One embodiment of this application provides a dialogue processing method, including: The cache index layer receives dialogue retrieval requests sent by the game business layer and retrieves the character type identifier, scene type identifier, and extended behavior identifier of the virtual character object from the dialogue retrieval request. The virtual character object is the object used to communicate with the business object. The extended behavior identifier describes the extended behavior performed by the virtual character object in the business scene. When constructing a composite byte structure using role type identifier, scene type identifier, and extended behavior identifier, a hash calculation is performed on the composite byte structure based on each composite byte in the composite byte structure to obtain a composite hash value for the composite byte structure. Search the cache index layer for the first cache hash value that matches the composite hash value; If the first cache hash value is found, the first cache instance corresponding to the first cache hash value is obtained from the cache index layer, and the first cache dialogue information obtained from the first cache instance is used as the dialogue output information to respond to the dialogue retrieval request. The dialogue output information is returned to the game business layer so that the game business layer can control the virtual character object to use the dialogue output information to communicate with the business object.
[0006] One embodiment of this application provides a dialogue processing apparatus, including: The request identifier acquisition module is used to receive dialogue acquisition requests sent by the game business layer through the cache index layer, and to obtain the role type identifier of the virtual character object, the scene type identifier of the business scene in which the virtual character object is located, and the extended behavior identifier from the dialogue acquisition request; the virtual character object refers to the object used to communicate with the business object; the extended behavior identifier is used to describe the extended behavior performed by the virtual character object in the business scene; The composite hash calculation module is used to perform hash calculations on the composite byte structure based on each composite byte in the composite byte structure when a composite byte structure is constructed by the role type identifier, scene type identifier and extended behavior identifier, so as to obtain the composite hash value for the composite byte structure. The cache hash lookup module is used to find the first cache hash value that matches the composite hash value in the cache index layer; If the dialogue information acquisition module finds the first cache hash value, it retrieves the first cache instance corresponding to the first cache hash value from the cache index layer, and uses the first cache dialogue information obtained from the first cache instance as the dialogue output information to respond to the dialogue acquisition request. The dialogue output information is then returned to the game business layer so that the game business layer can control the virtual character object to use the dialogue output information to communicate with the business object.
[0007] One aspect of this application provides a computer device, including a memory and a processor. The memory is connected to the processor, the memory is used to store computer programs, and the processor is used to call the computer programs so that the computer device executes the method provided in one aspect of this application.
[0008] One aspect of this application provides a computer-readable storage medium storing a computer program adapted to be loaded and executed by a processor, so that a computer device having a processor performs the method provided in one aspect of this application.
[0009] According to one aspect of this application, a computer program product is provided, comprising a computer program stored in a computer-readable storage medium. A processor of a computer device reads the computer program from the computer-readable storage medium and executes the computer program, causing the computer device to perform the method provided in the above aspect.
[0010] In this embodiment, when a virtual character object interacts with a business object through the game business layer, a dialogue acquisition request can be sent to the cache index layer. The cache index layer can then retrieve the virtual character object's character type identifier, the scene type identifier of the business scenario in which the virtual character object resides, and the extended behavior identifier from the generated dialogue acquisition request. This dialogue acquisition request can be generated by the game business layer when interacting with the virtual character object. The virtual character object (e.g., virtual character Z1) refers to the object used in the business scenario to interact with the business object (e.g., player character W1 controlled by user U1). The extended behavior identifier describes the extended behavior performed by the virtual character object in the business scenario (e.g., virtual character Z1 giving a gift to player character W1). Furthermore, in this embodiment, a composite byte structure can be constructed using the character type identifier, scene type identifier, and extended behavior identifier. Based on each composite byte in the composite byte structure, a hash calculation is performed on the composite byte structure to obtain a composite hash value. It can be understood that this composite hash value corresponds to a hash value for each of the three dimensions: character type identifier, scene type identifier, and extended behavior identifier. Furthermore, in this embodiment, a first cache hash value matching the composite hash value can be searched in the cache index layer. Here, the cache index layer is a data logic layer used to cache at least one cache instance, and each cache instance in the cache index layer corresponds to a cache hash value. If the first cache hash value is found in the cache index layer, the first cache instance corresponding to the first cache hash value can be further obtained from the cache index layer. Subsequently, this embodiment can obtain first cached dialogue information from the first cache instance and use the obtained first cached dialogue information as dialogue output information to respond to a dialogue retrieval request. The dialogue output information is returned to the game business layer so that the game business layer can control the virtual character object to use the dialogue output information to communicate with the business object.
[0011] It is understood that this application embodiment provides a novel multi-dimensional caching indexing mechanism by performing byte-level hash calculations on composite byte structures with richer information dimensions. This mechanism allows for the indexing (i.e., finding) of cache instances (i.e., first cache instances) that are more distinct in terms of role type, scene, and extended behavior within the cache index layer. These completely independent (i.e., more distinctive) cache instances avoid semantic overlap between information content from different information dimensions, thereby improving the accuracy of dialogue retrieval. Thus, when virtual character objects (e.g., NPC characters) use more accurate dialogue output information tailored to the current business scenario and role type to converse with business objects (e.g., player characters), not only can role type confusion be avoided at its source, but the individuality of the virtual character objects (e.g., NPC characters) in dialogue can also be improved to some extent. Attached Figure Description
[0012] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0013] Figure 1 This is a schematic diagram of a network architecture provided in an embodiment of this application; Figure 2 This is a schematic diagram of a data interaction scenario provided in an embodiment of this application; Figure 3 This is a schematic diagram of another data interaction scenario provided in an embodiment of this application; Figure 4 This is a schematic diagram of a dialogue processing method provided in an embodiment of this application; Figure 5 This is a schematic diagram illustrating a scenario for constructing a composite byte structure according to an embodiment of this application; Figure 6 This is a schematic diagram illustrating a scenario for performing compound hash calculations, provided in an embodiment of this application. Figure 7 This is a schematic diagram illustrating a scenario for searching a cached hash value, provided in an embodiment of this application. Figure 8 This application provides a schematic diagram of a database query scenario. Figure 9 This is a schematic diagram illustrating a scenario for searching configuration dialog information provided in an embodiment of this application; Figure 10This is a schematic diagram illustrating an instance of a dialogue configuration record provided in an embodiment of this application; Figure 11 This is a schematic diagram illustrating a scenario where an indexed dialog cache array is uniformly shuffled, as provided in an embodiment of this application. Figure 12 This is a schematic diagram illustrating a scenario of consuming a cache instance, as provided in an embodiment of this application. Figure 13 This is a schematic diagram of another dialogue processing method provided in an embodiment of this application; Figure 14 This is a schematic diagram illustrating a scenario of querying records in a business database, as provided in an embodiment of this application. Figure 15 This is a schematic diagram of a process for obtaining dialogue output information provided in an embodiment of this application; Figure 16 This is a schematic diagram of a scenario where dialogue information is generated through a model, as provided in an embodiment of this application. Figure 17 This is a schematic diagram illustrating a scenario for updating a cache instance via dialogue, as provided in an embodiment of this application. Figure 18 This is a schematic diagram of the structure of a dialogue processing device provided in an embodiment of this application; Figure 19 This is a schematic diagram of the structure of a computer device provided in an embodiment of this application. Detailed Implementation
[0014] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the scope of protection of this application.
[0015] The following describes some custom terms used in the embodiments of this application: I. Business Object: The player character controlled by the user in the game application. It is understood that when using the game application, the user can control the business object to interact with the virtual character object in the game application (e.g., dialogue). It is understood that the virtual character object here refers to the non-player character (NPC, Non-Player Character) provided in the game application in this embodiment. This embodiment can actively control the virtual character object in the game application to interact with the business object according to the virtual character action strategy (e.g., dialogue, gift-giving, competition, etc.) through the game application's game business layer. The game business layer here can be understood as the data logic layer used in the game application to control the interaction between the virtual character object and the business object. In one possible implementation, the virtual character action strategy can be a pre-set action trigger condition for the virtual character object. For example, when the affinity between the virtual character object and the business object reaches an affinity threshold, the virtual character object is triggered to give a gift to the business object. Optionally, the virtual character action strategy here can also be the behavior strategy configured by the large model agent for the virtual character object. In this case, the virtual character object can be understood as being controlled by the large model agent, and the virtual character object can also be called an intelligent character object.
[0016] II. Dialogue Acquisition Request: This refers to the request generated by the game business layer when controlling a virtual character object to engage in dialogue with a business object, in order to acquire dialogue output information. In this embodiment, the dialogue output information refers to the specific dialogue content output by the virtual character object to the business object during the dialogue. The dialogue output information can specifically include dialogue text, emoticons, voice messages, etc., and the specific form of the dialogue output information is not limited here. This embodiment allows the game business layer to generate a dialogue acquisition request related to the current dialogue when controlling a virtual character object to engage in dialogue with a business object, and send this request to the game application's cache index layer to obtain cached dialogue information from the cache index layer as the dialogue output information for this current dialogue. It is understood that the cache index layer here is the data logic layer in the game application used to provide dialogue information.
[0017] It is understood that, in the embodiments of this application, when manipulating a virtual character object to engage in dialogue with a business object, the resulting dialogue acquisition request may include a character type identifier, a scene type identifier, and an extended behavior identifier. The character type identifier is used to indicate the character type of the virtual character object. It is understood that a game application may contain multiple different virtual character objects, and the character types (e.g., character personality, character faction) corresponding to different virtual character objects may be different; therefore, the corresponding character type identifiers may also be different. The scene type identifier is used to indicate the scene type of the business scenario in which the virtual character object engages in dialogue with the business object. For example, the scene type may include a competitive scene type, a gift-giving scene type, etc. The extended behavior identifier is used to describe the extended behaviors performed by the virtual character object on the business object in the business scenario. For example, when the scene type is a competitive scene type, the extended behaviors may include taunting before the competition, begging for mercy during the competition, praising after the competition, etc. When the scene type is a gift-giving scene type, the extended behaviors may include giving equipment, giving food, giving accessories, etc.
[0018] III. Cache Space: A space in the cache index layer that has the highest index priority for storing dialogue information. This first index priority indicates that the cache space has the highest priority in the dialogue information index. In other words, upon receiving a dialogue retrieval request from the game business layer, the cache index layer will prioritize indexing the dialogue information (finding the dialogue output information) in the cache space. The cache space can be the memory space in the computer device where the game business layer resides. The cache space can store at least one cache instance, and each cache instance includes at least one piece of cached dialogue information. In the cache space, each cache instance corresponds to a unique cache hash value. In this embodiment, a composite hash value can be calculated using the role type identifier, scene type identifier, and extended behavior identifier in the dialogue retrieval request. The composite hash value is then used to find the matching first cache hash value in the cache space. It is understood that the cache instance corresponding to the first cache hash value (the first cache instance) matches the composite hash value. Therefore, the cached dialogue information stored in the first cache instance (e.g., the first cached dialogue information) matches the role type identifier, scene type identifier, and extended behavior identifier in the current dialogue retrieval request.
[0019] This application embodiment can obtain first cached dialogue information in a first cache instance and use the first cached dialogue information as dialogue output information to instruct a virtual character object to engage in dialogue with a business object. The dialogue output information at this time is precisely matched with the dialogue currently being conducted by the virtual character object with the business object. In this application embodiment, the cached dialogue information in the cache instance can be dialogue information generated by a dialogue generation model, where the dialogue generation model can be a Large Language Model (LLM), a deep learning model capable of generating natural language text based on prompt words.
[0020] IV. Business Database: A database with a second index priority in the cache index layer used to store cache instance records. The cache instance records in the business database are generated when cache instances in the cache index layer are persistently stored in the business database. In other words, in this embodiment, cache instances in the cache index layer can be serialized to obtain cache instance records, which are then stored in the business database. The second index priority is lower than the first index priority. In other words, in this embodiment, if no dialogue output information is found in the cache space with the first index priority, subsequent dialogue information indexing can be performed through the business database. Specifically, in this embodiment, if no cache instance matching the role type identifier, scene type identifier, and extended behavior identifier in the dialogue retrieval request can be found in the cache space, a multi-dimensional search can be performed using these identifiers to find a cache instance record that matches all three. Furthermore, in this embodiment of the application, the found cache instance record can be deserialized into the cache space to obtain the corresponding cache instance (second cache instance), and the second cache dialogue information obtained from the second cache instance can be used as the dialogue output information. It can be understood that the second cache dialogue information at this time is dialogue information that matches the role type identifier, scene type identifier and extended behavior identifier.
[0021] V. Dialogue Configuration Table: A data table used to store at least one dialogue configuration record in the configuration storage space. In this embodiment, the configuration storage space is a storage space with the third index priority in the cache index layer. This configuration storage space can be the disk space in the computer device where the game service layer resides, and a dialogue configuration record is a record containing multiple configuration dialogue information. In other words, the dialogue configuration table stores at least one dialogue configuration record, and each dialogue configuration record contains multiple configuration dialogue information. It can be understood that each dialogue configuration record in the dialogue configuration table corresponds to a reference scene type identifier; in other words, the configuration dialogue information in each dialogue configuration record conforms to a certain reference scene type.
[0022] In this embodiment, the third index has a lower priority than the second index. In other words, if no dialogue output information is found in the business database with the second index priority, subsequent dialogue information indexing can be performed in the configuration storage space. Specifically, when no cache instance record matching the dialogue retrieval request is found in the business database, the embodiment can search for a target dialogue configuration record matching the scene type identifier in the dialogue configuration table stored in the configuration storage space using the scene type identifier in the dialogue retrieval request. Then, using the configuration dialogue information in the target dialogue configuration record, a cache instance (third cache instance) matching the role type identifier, scene type identifier, and extended behavior identifier in the dialogue retrieval request is created in the cache index layer. Furthermore, the embodiment can use the cached dialogue information (third cached dialogue information) obtained from the third cache instance as dialogue output information.
[0023] For further details, please see Figure 1 , Figure 1 This is a schematic diagram of a network architecture provided in an embodiment of this application. Figure 1 As shown, this network architecture may include a server 10d and a user terminal cluster. The user terminal cluster may include one or more user terminals; the number of user terminals is not limited here. Figure 1As shown, the user terminal cluster can specifically include user terminal 10a, user terminal 10b, and user terminal 10c. Server 10d can be an independent physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms. User terminals 10a, 10b, and 10c can all include: smartphones, tablets, laptops, PDAs, mobile internet devices (MIDs), wearable devices (such as smartwatches and smart bracelets), smart voice interaction devices, smart home appliances (such as smart TVs), and in-vehicle devices, as well as other electronic devices with video / image playback capabilities. Figure 1 As shown, user terminals 10a, 10b, and 10c can each connect to server 10d via a network, so that each user terminal can interact with server 10d through the network connection.
[0024] It is understood that, in this embodiment of the application, a user can use a game application deployed on a user terminal (e.g., user terminal 10a). When using the game application, the user can control the player character object (business object) in the game application to converse or interact with NPCs (virtual character objects) in the game application. In one possible implementation, the user can control the business object and the virtual character object to perform related interactive behaviors through user terminal 10a, and send the interaction request to a server related to the game application (e.g., server 10d). Then, the game business layer of server 10d can control the virtual character object to respond to the interactive behavior and conduct dialogue related to this interactive behavior with the business object. Optionally, in one possible implementation, the game business layer on server 10d can trigger the relevant interactive behaviors between the virtual character object and the business object based on the virtual character control strategy, and control the virtual character object to converse with the business object.
[0025] Understandably, when server 10d manipulates virtual character objects to interact with business objects, it needs to determine what dialogue information (dialogue output information) the virtual character object should say to the business object. Therefore, server 10d's game business layer can generate a relevant dialogue retrieval request. Furthermore, the cache index layer on server 10d, used to store dialogue information, can retrieve the virtual character object's character type identifier, the scene type identifier of the business scene in which the virtual character object resides, and the extended behavior identifier from the generated dialogue retrieval request. Here, the virtual character object (e.g., virtual character Z1) refers to the object used to interact with business objects (e.g., player character W1 controlled by user U1) within the business scene. The extended behavior identifier describes the extended behaviors performed by the virtual character object within the business scene (e.g., virtual character Z1 giving a gift to player character W1).
[0026] Furthermore, Server 10d can construct a composite byte structure using the character type identifier, scene type identifier, and extended behavior identifier. Based on each composite byte in the composite byte structure, a hash calculation is performed to obtain a composite hash value. This composite hash value corresponds to a hash value for each of the three dimensions: character type identifier, scene type identifier, and extended behavior identifier. Server 10d can then search for a first cache hash value matching the composite hash value in the cache index layer. This cache index layer is a data logic layer used to cache at least one cache instance, and each cache instance in the cache index layer corresponds to a cache hash value. If Server 10d finds a first cache hash value in the cache index layer, it can further retrieve the first cache instance corresponding to that hash value. Subsequently, Server 10d can retrieve first cached dialogue information from the first cache instance and use this information as dialogue output information to respond to dialogue retrieval requests. This dialogue output information is then returned to the game business layer, allowing the game business layer to manipulate virtual character objects to interact with business objects using the dialogue output information. It is understandable that if the business object is a player character controlled by a user through user terminal 10a, then server 10d can send the dialogue output information here to user terminal 10a, and then user terminal 10a can display the dialogue output information here.
[0027] It is understood that, in this embodiment, after the server manipulates the virtual character object to engage in dialogue with the business object and generates a related dialogue retrieval request, it can construct a composite byte structure based on the multiple dimensions of identifiers (including character type identifier, scene type identifier, and extended behavior identifier) carried in the dialogue retrieval request related to this dialogue. Then, it performs a hash calculation on the composite byte structure based on each composite byte in the composite byte structure to obtain a composite hash value for the composite byte structure. Further, when the server finds a first cache hash value matching the composite hash value in the cache index layer, it can retrieve the first cache instance corresponding to the first cache hash value from the cache index layer. It is understood that the first cache instance obtained here matches the composite hash value; therefore, the dialogue information stored in the first cache instance also matches the composite hash value. It is understood that the server can retrieve first cache dialogue information from the first cache instance that matches the character type identifier, scene type identifier, and extended behavior identifier. Therefore, using the first cache dialogue information as the dialogue output information used when the virtual character object engages in dialogue with the business object can effectively improve the accuracy of the dialogue output information.
[0028] It should be noted that when the computer device in this application embodiment obtains data such as the user's personal registration information, faction match information (i.e., target game information), and game progress information, it may display a prompt interface or pop-up window. The prompt interface or pop-up window is used to prompt the user that data such as personal registration information, faction match information, or game progress information is currently being collected. The data acquisition steps will only begin after the user confirms the prompt interface or pop-up window; otherwise, the process will end.
[0029] For further details, please see Figure 2 , Figure 2 This is a schematic diagram illustrating a data interaction scenario provided in an embodiment of this application. For example... Figure 2As shown, in this embodiment of the application, when a virtual character object and a business object interact in the game business layer space, a related dialogue retrieval request 24a can be generated. Further, this embodiment of the application can obtain the character type identifier (character type identifier 241a), the scene type identifier (scene type identifier 242a), and the extended behavior identifier (extended behavior identifier 243a) of the virtual character Z1 from the generated dialogue retrieval request 24a through a cache index layer. The extended behavior identifier 243a is used to describe the extended behavior performed by the virtual character Z1 in the business scene, such as the virtual character Z1 giving food to the player character W1. Further, this embodiment of the application can construct a composite byte structure (composite byte structure 25a) using the character type identifier 241a, scene type identifier 242a, and extended behavior identifier 243a, and perform a hash calculation on the composite byte structure 25a based on each composite byte in the composite byte structure 25a to obtain a composite hash value (composite hash value 26a) for the composite byte structure 25a.
[0030] It is understood that the composite hash value 26a at this time is a hash value corresponding to the three dimensions of the identifier: the character type identifier 241a, the scene type identifier 242a, and the extended behavior identifier 243a. Further, in this embodiment, a first cache hash value (cache hash value 271a) matching the composite hash value 26a can be found in the cache index layer. Each cache instance in the cache index layer corresponds to a cache hash value. If this embodiment finds the cache hash value 271a in the cache index layer, the first cache instance (cache instance 272a) corresponding to the cache hash value 271a can be further obtained from the cache index layer. Then, this embodiment can obtain the first cached dialogue information (cache dialogue information 28a) from the cache instance 272a, and use the obtained cached dialogue information 28a as dialogue output information 29a to respond to the dialogue retrieval request 24a. The dialogue output information 29a is then returned to the game business layer, so that the game business layer can control the virtual character object to use the dialogue output information 29a to communicate with the business object.
[0031] For further details, please see Figure 3 , Figure 3 This is a schematic diagram of another data interaction scenario provided in an embodiment of this application. For example... Figure 3 As shown, it can be understood that in this embodiment of the application, the user (user U1) can use the game application deployed on the user terminal 20a through the user terminal 20a. When using the game application, user U1 can control the player character object (business object) in the game application to have dialogues or interactions with the NPC (virtual character object) in the game application, such as... Figure 3As shown, user U1 can click on the interactive control 211a in the game interface 21a to control the interaction between the business object (player character W1) and the virtual character object (virtual character Z1). It is understood that when user U1 controls player character W1 to interact with virtual character Z1, this embodiment of the application can update the affinity of virtual character Z1 towards player character W1. For example... Figure 3 As shown, the user terminal can execute step S11, responding to the user U1's click operation on the interactive control 211a, and send an interaction request 22a to the server 20b. The server 20b can execute step S12, providing interactive feedback on the interaction request 22a. Specifically, it can update the interaction influence degree 23a of the virtual character Z1 towards the player character W1 based on the interaction request 22a. Here, the interaction influence degree 23a can be the favorability degree of the virtual character Z1 towards the player character W1. It is understood that, in this embodiment of the application, the server 20b can execute the triggering of relevant interactive behaviors between the virtual character object and the business object based on the virtual character control strategy, and control the virtual character object to engage in dialogue with the business object. Here, the virtual character control strategy can be that when the favorability degree of the virtual character Z1 towards the player character W1 reaches the favorability threshold, the server controls the virtual character Z1 to give food to the player character W1 and engage in related dialogue.
[0032] like Figure 3 As shown, when the interaction influence 23a reaches the influence threshold, server 20b can control the virtual character Z1 to interact with the player character W1 (giving food to player character W1) through the game business layer. It needs to determine what dialogue information (dialogue output information) the controlled virtual character object should say to the business object. Therefore, server 20b can generate a related dialogue retrieval request 24a at the game business layer. Furthermore, server 20b can look up the dialogue output information 29a used to respond to dialogue retrieval request 24a in the cache index layer. For details on the process of retrieving dialogue output information 29a, please refer to [link to relevant documentation]. Figure 2 The description in the text will not be repeated here. Server 20b can use the dialogue output information 29a here as interactive feedback 22b in response to interactive request 22a. Further, server 20b can execute step S13 to return the interactive feedback 22b to user terminal 20a, so that user terminal 20a can execute step S14 to display the dialogue output information 29a carried in interactive feedback 22b in game interface 21b.
[0033] It is understood that in this embodiment of the application, when manipulating virtual character objects to interact with business objects, related dialogues will occur, and a related dialogue retrieval request can be generated. Furthermore, this embodiment of the application can construct a composite byte structure based on multiple dimensions of identifiers (including character type identifier, scene type identifier, and extended behavior identifier) related to the current dialogue carried in the dialogue retrieval request, and perform hash calculations on the composite byte structure based on each composite byte in the composite byte structure to obtain a composite hash value for the composite byte structure. Further, when a first cache hash value matching the composite hash value is found in the cache index layer, the first cache instance corresponding to the first cache hash value can be obtained from the cache index layer. It is understood that the first cache instance obtained here matches the composite hash value; therefore, the dialogue information stored in the first cache instance also matches the composite hash value. Using the first cache dialogue information in the first cache instance as the dialogue output information used when the virtual character object and the business object engage in dialogue can effectively improve the accuracy of the dialogue output information.
[0034] For further details, please see Figure 4 , Figure 4 This is a schematic diagram of a dialogue processing method provided in an embodiment of this application. Figure 4 As shown, it is understandable that Figure 4 The dialogue processing method shown can be executed by either a user terminal or a server. For ease of understanding, we will use a server as an example here. In this case, the server can be, for example, a user terminal or a server server. Figure 1 Server 10d is shown. (As shown) Figure 4 As shown, the dialogue processing method may include at least the following: Figure 4 Steps S101 to S104 in the process.
[0035] Step S101: Receive the dialogue retrieval request sent by the game business layer through the cache index layer, and retrieve the role type identifier of the virtual character object, the scene type identifier of the business scene in which the virtual character object is located, and the extended behavior identifier from the dialogue retrieval request. It is understood that, in this application embodiment, the virtual character object in the game application can be manipulated by the game business layer to perform related interactive behaviors (e.g., dialogue, gift-giving, competition, etc.) with the business object. Here, the business object can be the user using the game application; optionally, the player character controlled by the user in the game application can also be called the business object. The virtual character object is the non-player character (NPC, Non-PlayerCharacter) provided in the game application in this application embodiment. It is understood that, in this application embodiment, the interaction between the virtual character object and the business object is controlled based on the virtual character action strategy in the game business layer. In one possible implementation, the virtual character action strategy can be a pre-set action trigger condition for the virtual character object. For example, when the affinity between the virtual character object and the business object reaches an affinity threshold, the virtual character object is triggered to give a gift to the business object. Optionally, the virtual character action strategy can also be a behavior strategy configured by a large model agent for the virtual character object. In this case, the virtual character object can be understood as being controlled by the large model agent, and the virtual character object can also be called an intelligent character object. No specific limitation is made to the virtual character action strategy here.
[0036] It is understood that, in this embodiment of the application, when manipulating a virtual character object to engage in dialogue with a business object, it is necessary to obtain the dialogue information (dialogue output information) output by the virtual character object to the business object during this dialogue. In other words, the dialogue output information here refers to the specific dialogue content output by the virtual character object to the business object during the dialogue. The dialogue output information can specifically be dialogue text information, dialogue emoticon information, dialogue voice information, etc., and the specific form of the dialogue output information is not limited here. It is understood that, in this embodiment of the application, when it is necessary to obtain the dialogue output information for this dialogue, a corresponding dialogue retrieval request can be generated through the game business layer, and the dialogue retrieval request can be sent to the cache index layer of the game application to obtain the cached dialogue information in the cache index layer as the dialogue output information for this dialogue.
[0037] It is understood that, in this embodiment, after the game application's cache index layer receives the dialogue retrieval request, it can obtain the character type identifier, scene type identifier, and extended behavior identifier related to the current dialogue from the dialogue retrieval request. The character type identifier is used to indicate the character type of the virtual character object. It is understood that the game application may contain multiple different virtual character objects, and the character types (e.g., character personality, character faction) corresponding to different virtual character objects may be different, therefore the corresponding character type identifiers may also be different. The scene type identifier is used to indicate the scene type of the business scenario in which the virtual character object and the business object are engaged in dialogue. For example, the scene type may include a competitive scene type, a gift-giving scene type, etc. The extended behavior identifier is used to describe the extended behaviors performed by the virtual character object on the business object in the business scenario. For example, when the scene type is a competitive scene type, the extended behaviors may include taunting before the competition, begging for mercy during the competition, praising after the competition, etc. When the scene type is a gift-giving scene type, the extended behaviors may include giving equipment, giving food, giving accessories, etc.
[0038] Step S102: When constructing the composite byte structure through the role type identifier, scene type identifier and extended behavior identifier, perform hash calculation on the composite byte structure based on each composite byte in the composite byte structure to obtain the composite hash value for the composite byte structure. It is understood that, after obtaining the role type identifier, scene type identifier, and extended behavior identifier related to the current dialogue from the dialogue acquisition request, this embodiment of the application can construct a composite byte structure based on these identifiers. Furthermore, a hash calculation can be performed on the composite byte structure based on each composite byte to obtain a composite hash value for the composite byte structure. This composite hash value corresponds to the dialogue acquisition request.
[0039] In this embodiment, the scene type identifier can be an integer enumeration value, corresponding to a predefined NPC interaction scene in the game application (such as gift-giving, dating, competition, etc.). The character type identifier can be an integer number, corresponding to a specific NPC character type in the game. Each character type corresponds to a set of personality parameters, including personality trait descriptions, language style settings, and background narratives. The extended behavior identifier can be an integer additional dimension identifier, used to provide further subdivision capabilities given that the scene type is determined. The extended behavior indicated by the extended behavior identifier is determined by the scene type. For example, in a gift-giving scene, the extended behavior identifier can represent the item category number (such as different categories like equipment, accessories, food, etc.), allowing the same NPC to obtain different dialogue information when giving different categories of items, avoiding the NPC saying the same line about giving food when giving equipment. In scene types that do not require further subdivision, the extended parameters can be set to the default value of zero.
[0040] In one possible implementation, the cache index layer includes a cache space for storing composite byte structures. It is understood that this cache space is also the storage space in the cache index layer used to store cache instances. In this embodiment, when constructing a composite byte structure using a role type identifier, a scene type identifier, and an extended behavior identifier, the embodiment can obtain the role type identifier byte indicated by the role type identifier, the scene type identifier byte indicated by the scene type identifier, and the extended behavior identifier byte indicated by the extended behavior identifier. In one possible implementation, this embodiment can obtain the role type value indicated by the role type identifier, perform byte conversion on the role type value to obtain the role type identifier byte for the role type identifier. It can also obtain the scene type value indicated by the scene type identifier, perform byte conversion on the scene type value to obtain the scene type identifier byte for the scene type identifier. Finally, it can obtain the extended behavior value indicated by the extended behavior identifier, perform byte conversion on the extended behavior value to obtain the extended behavior identifier byte for the extended behavior identifier.
[0041] It is understandable that when the character type identifier, scene type identifier, and extended behavior identifier are all integer types (i.e., the character type value, scene type value, and extended behavior value are all integers), if the integer is stored in the computer device in four bytes, then the character type identifier byte, scene type identifier byte, and extended behavior identifier byte are all four bytes, and one byte has 8 bits in the computer device. For example, when scene type identifier = gift (2), character type identifier = knight-errant type (128), and extended behavior identifier = food category (3), the scene type identifier byte = 00 00 00 02 (hexadecimal), the character type identifier byte = 00 00 00 80 (hexadecimal), and the extended behavior identifier byte = 00 00 00 03 (hexadecimal).
[0042] Furthermore, embodiments of this application can obtain a structure construction strategy and, based on the structure construction strategy, determine each byte in the role type identifier byte, scene type identifier byte, and extended behavior identifier byte as a composite byte. The structure construction strategy here can be used to indicate the order in which the role type identifier byte, scene type identifier byte, and extended behavior identifier byte are determined as all composite bytes. For example, all composite bytes can be determined in the order of role type identifier byte, scene type identifier byte, and extended behavior identifier byte. Furthermore, a composite byte structure for a dialogue acquisition request can be constructed from all composite bytes. This composite byte structure is composed of all the composite bytes mentioned above; in other words, this composite byte structure contains the bytes corresponding to the role type identifier byte, scene type identifier byte, and extended behavior identifier byte, respectively. For example, when the scene type identifier byte = 00 00 00 02 (hexadecimal), the role type identifier byte = 00 00 00 80 (hexadecimal), and the extended behavior identifier byte = 00 00 00 03 (hexadecimal), the composite byte structure contains all composite bytes = 00 00 00 02 00 00 00 8000 00 00 03 (hexadecimal), where each consecutive two bits represent one byte. Furthermore, in this embodiment, the total number of bytes in all composite bytes can be determined as the composite byte length for the composite byte structure. Based on the composite byte length, a structure storage space for storing the composite byte structure can be determined in the cache space. The storage space index address of the structure storage space in the cache space can be obtained. Further, the composite byte structure can be stored in the structure storage space based on the storage space index address. Alternatively, the storage space index address and the composite byte length can be stored together in the cache space. Specifically, a byte-length storage space can be determined in the cache space, and the storage space index address and the composite byte length can be stored in that byte-length storage space.
[0043] For further details, please see Figure 5 , Figure 5 This is a schematic diagram illustrating a scenario for constructing a composite byte structure according to an embodiment of this application. Figure 5 As shown, in this embodiment of the application, when constructing a composite byte structure using role type identifier 30a, scene type identifier 30b, and extended behavior identifier 30c, the role type identifier byte 31a indicated by role type identifier 30a, the scene type identifier byte 31b indicated by scene type identifier 30b, and the extended behavior identifier byte 31c indicated by extended behavior identifier 30c can be obtained. Specifically, as... Figure 5As shown, the character type identifier 30a has a character type value of 301a=128, the scene type identifier 30b has a scene type value of 301b=2, and the extended behavior identifier 30c has an extended behavior value of 301c=3. Here, the character type value 301a, scene type value 301b, and extended behavior value 301c can be converted into byte representations respectively, resulting in character type identifier byte 31a, scene type identifier byte 31b, and extended behavior identifier byte 31c. Among them, the role type identifier byte 31a includes: B1_1=00000000, B1_2=00000000, B1_3=00000000, B1_4=10000000; the scene type identifier byte 31b includes: B2_1=00000000, B2_2=00000000, B2_3=00000000, B2_4=00000010; and the extended behavior identifier byte 31c includes: B3_1=00000000, B3_2=00000000, B3_3=00000000, B3_4=00000011.
[0044] Furthermore, embodiments of this application can obtain a structure construction strategy, and based on the structure construction strategy, determine the role type identifier byte 31a, scene type identifier byte 31b, and extended behavior identifier byte 31c as all composite bytes. The structure construction strategy here can be used to indicate the order in which the role type identifier byte 31a, scene type identifier byte 31b, and extended behavior identifier byte 31c are determined to be all composite bytes, such as... Figure 5 As shown, all composite bytes can be determined in the order of role type identifier byte 31a, scene type identifier byte 31b, and extended behavior identifier byte 31c. Furthermore, a composite byte structure 32a for the dialogue acquisition request can be constructed from all composite bytes.
[0045] In one possible implementation, the cache index layer includes a cache space with a first index priority. The composite byte structure is stored in the structure storage space of the cache space, and the storage space index address corresponding to the structure storage space is stored in the byte length storage space corresponding to the composite byte length of the composite byte structure. It is understood that in this embodiment, when performing hash calculations on the composite byte structure based on each composite byte in the composite byte structure to obtain a composite hash value for the composite byte structure, the cache space is first accessed according to the first index priority, and the storage space index address of the structure storage space and the composite byte length of the composite byte structure are obtained from the byte length storage space of the cache space. Further, a hash calculation function for performing the structure hash calculation is obtained, and the storage space index address and the composite byte length are transmitted to the hash calculation function. At this time, the hash calculation function can obtain each composite byte in the structure storage space using the storage space index address and the composite byte length, and perform hash calculations on each obtained composite byte according to the byte-level hash calculation method indicated by the hash calculation function to obtain the composite hash value for the composite byte structure.
[0046] In one possible implementation, adjacent bytes at any two adjacent positions in all composite bytes include the first byte and the second byte, where the first byte is the byte preceding the second byte. When performing hash calculations on each composite byte, the hash calculation function provided in this application first obtains the initial hash value and hash calculation parameters for the first byte according to the byte-level hash calculation method indicated by the hash calculation function. Then, it multiplies the initial hash value and hash calculation parameters to obtain the first multiplication result. Here, the initial hash value is obtained by hashing the byte preceding the first byte. In one possible implementation, if the first byte is the first byte in the composite byte, the initial hash value can be set to zero. Furthermore, the hash calculation function can add the first byte and the first multiplication result to obtain the first addition result, and use the first addition result as the first hash value.
[0047] At this point, the initial hash value can be updated using the first hash value to obtain the initial hash update value used for hash calculation on the second byte. In other words, the first hash value is used as the initial hash update value. Then, the hash calculation function can multiply the initial hash update value and the hash calculation parameters to obtain a second multiplication result, add the second byte and the second multiplication result to obtain a second addition result, and use this second addition result as the second hash value. Furthermore, the hash calculation function can determine the composite hash value for the dialogue retrieval request based on the second hash value. It can be understood that the hash calculation function can perform the hash calculation as described above on each byte in the composite byte structure, and use the hash value obtained from the last byte as the composite hash value for the composite byte structure.
[0048] It is understood that the hash calculation function in this embodiment of the application, when performing hash calculation on a composite byte structure, can be understood as traversing byte by byte starting from the first byte in the composite byte structure, and performing polynomial rolling hash accumulation on each byte. Specifically, the hash calculation function at this time is: current hash value = current byte value + fixed prime number × existing hash value. Here, the fixed prime number is the hash calculation parameter indicated by the hash calculation function. When the current byte value is the first byte (first byte) in the composite byte structure, the existing hash value at this time is the initial hash value indicated by the hash calculation function, which can be set to zero. When the current byte value is the last byte in the composite byte structure (taking a composite byte structure containing 12 bytes as an example, the last byte at this time is the 12th byte), the current hash value obtained at this time can be used as the final composite hash value for the composite byte structure.
[0049] It is understood that, in the embodiments of this application, when performing hash calculations on each composite byte of a composite byte structure using a hash calculation function to obtain a composite hash value for the composite byte structure, the three integer fields included in the composite byte structure (each dimension's identifier in the dialogue acquisition request corresponds to an integer field) can be treated as a continuous block of binary data for hash calculation, without needing to concatenate them into a string or serialize them into other intermediate formats. This eliminates the format conversion from integer to string and string concatenation operations, avoids dynamic memory allocation, and the input length for hash calculation is fixed at the total number of composite bytes, not increasing with the number of bits in the field values, thereby reducing the time consumption of hash calculation and improving the speed of acquiring dialogue output information.
[0050] For further details, please see Figure 6 , Figure 6 This is a schematic diagram illustrating a scenario for performing compound hash calculations, provided in an embodiment of this application. For example... Figure 6As shown, in this embodiment of the application, when performing hash calculations using the individual composite bytes in the composite byte structure, it can be understood as traversing byte by byte starting from the first byte in the composite byte structure, performing polynomial rolling hash accumulation on each byte. Specifically, the hash calculation function at this time is: Current hash value = Current byte value + Fixed prime number × Existing hash value. Wherein, the fixed prime number is the hash calculation parameter indicated by the hash calculation function. Figure 6 As shown, during hash calculation, the first byte (composite byte 351a) in the composite byte structure 35a is used as the current byte in the hash calculation function. It can be understood that in the composite byte structure 35a, composite byte 351a and composite byte 351b are adjacent. Therefore, composite byte 351a can be used as the first byte, and composite byte 351b as the second byte for hash calculation. The initial hash value (hash value 38a=0) used for hash calculation of the first byte (composite byte 351a) is obtained. The initial hash value and the hash calculation parameters are multiplied to obtain the first multiplication result. Then, the byte value of the first byte (the byte value of composite byte 351a) is added to the first multiplication result to obtain the first addition result, which is then used as the first hash value (hash value 36a) corresponding to the first byte (composite byte 351a). At this point, hash value 36a can be used as the initial hash update value for hash calculation of the second byte (composite byte 251b). Then, hash value 36a and hash calculation parameters can be multiplied to obtain the second multiplication result. The byte value of the second byte (byte value of composite byte 251b) and the second multiplication result can be added to obtain the second addition result. The second addition result is used as the second hash value (hash value 26b) corresponding to the second byte (composite byte 251b).
[0051] Subsequently, a composite hash value for the composite byte structure can be determined based on the second hash value. Specifically, similar processing to that described for composite bytes 351a and 351b can be applied to subsequent adjacent composite bytes. Specifically, the third byte (composite byte 351c) in composite byte structure 35a can be used as the current byte in the hash calculation function, and hash value 36b can be used as an existing hash value to calculate the current hash value (hash value 36c). The hash calculation for all subsequent composite bytes is similar to the above process. It can be understood that when performing a hash calculation on the last byte (composite byte 351n) in composite byte structure 35a, composite byte 351n can be used as the current byte, and the previous hash value (hash value 36c) can be used as an existing hash value to calculate the current hash value (hash value 36n), and this hash value 36n can be used as the composite hash value 37a for composite byte structure 35a.
[0052] Step S103: Search for the first cache hash value that matches the composite hash value in the cache index layer; It is understood that, after calculating the composite hash value for the composite byte structure, this embodiment of the application can search for a first cache hash value that matches the composite hash value in the cache index layer. In one possible implementation, the cache index layer includes a cache space with a first index priority, and the cache space stores a cache hash table containing at least one cache hash value. When searching for the first cache hash value that matches the composite hash value in the index cache layer, this embodiment of the application can access the cache space of the cache index layer based on the first index priority and read the cache hash table from the cache space. Furthermore, it can search for the first cache hash value that matches the composite hash value among the at least one cache hash value contained in the cache hash table; in other words, the first cache hash value here is the cache hash value found in the cache hash table that matches the composite hash value. It is understood that, in the embodiments of this application, each cache hash value in the cache hash table can be understood as being calculated by a set of specific candidate request identifiers (including candidate scene type identifiers, candidate role type identifiers, and candidate extended behavior identifiers). When a first cache hash value matching the composite hash value is found in the cache hash identifiers, it indicates that the candidate request identifier corresponding to the first cache hash value is the same as the request identifier carried in the current dialogue acquisition request. That is, the candidate scene type identifier, candidate role type identifier, and candidate extended behavior identifier used to calculate the first cache hash value are the same as the scene type identifier, role type identifier, and extended behavior identifier used to calculate the composite hash value.
[0053] Step S104: If the first cache hash value is found, the first cache instance corresponding to the first cache hash value is obtained from the cache index layer, and the first cache dialogue information obtained from the first cache instance is used as the dialogue output information to respond to the dialogue retrieval request. The dialogue output information is returned to the game business layer so that the game business layer can control the virtual character object to use the dialogue output information to communicate with the business object.
[0054] It is understood that, after finding a first cache hash value matching the composite hash value in the cache index layer, this embodiment of the application can retrieve the first cache instance corresponding to the first cache hash value from the cache index layer. It is also understood that the cache space in the cache index layer can store multiple cache instances, each corresponding to a cache hash value. Because the first cache hash value here matches the composite hash value, the first cache instance corresponding to the first cache hash value retrieved here can also be understood as matching the composite hash value. Furthermore, this embodiment of the application can use the first cached dialogue information retrieved from the first cache instance as dialogue output information to instruct the virtual character object to engage in dialogue with the business object. In other words, the first cached dialogue information is used as dialogue output information to respond to a dialogue retrieval request, and the dialogue output information is returned to the game business layer so that the game business layer can control the virtual character object to use the dialogue output information to engage in dialogue with the business object.
[0055] In one possible implementation, the cache index layer includes a cache space for storing N cache instances, and the cache space stores a cache hash table associated with each of the N cache instances. The cache hash table stores cache hash values that are mapped to each of the N cache instances, where N is a positive integer. In this embodiment, the cache hash table can be retrieved from the cache space of the cache index layer, and the cache instance mapped to the first cache hash value can be obtained through the cache hash table. The retrieved cache instance is then used as the first cache instance corresponding to the first cache hash value. This mapping relationship can be an instance mapping relationship; that is, the cache hash table stores a direct mapping relationship between cache hash values and cache instances. After finding the first cache hash value in the cache hash table, the cache instance mapped to the first cache hash value can be used as the first cache instance.
[0056] The mapping relationship in the cache hash table also includes an address mapping relationship. This address mapping relationship indicates the relationship between the first cache hash value and the instance space index address of the first cache instance in the cache hash table. That is, one cache hash value corresponds to the instance space index address of an instance storage space in the cache space, and one instance storage space stores one cache instance. In this embodiment, when retrieving the first cache instance corresponding to the first cache hash value from the cache space, the first instance space index address that has an address mapping relationship with the first cache hash value can be obtained from at least one instance space index address contained in the cache hash table, and this obtained instance space index address is used as the first instance space index address. Then, the first instance storage space in the cache space can be determined through the first instance space index address, and the cache instance retrieved from the first instance storage space is used as the first cache instance corresponding to the first cache hash value. In other words, the cache hash table stores the address mapping relationship between cache hash values and the storage address (instance space index address) of cache instances. In this embodiment, after finding the first cache hash value that matches the composite hash value in the cache hash table, the storage address (first instance space index address) of the cache instance indicated by the first cache hash value can be obtained from the cache hash table. The first instance space index address here can indicate the first instance storage space where the first cache instance corresponding to the first cache hash value is located, and thus the embodiments of this application can obtain the first cache instance in the first instance storage space.
[0057] It is understood that this application embodiment stores multiple cache instances in the cache space, each cache instance corresponding to a cache hash value. Therefore, when this application embodiment receives a dialogue retrieval request and calculates a composite hash value based on the scene type identifier, role type identifier, and extended behavior identifier in the dialogue retrieval request, it can find a first cache hash value matching the composite hash value in the cache space, and then retrieve the first cache instance corresponding to the first cache hash value. It is understood that the first cache instance matches the composite hash value at this time; therefore, the cached dialogue information stored in the first cache instance matches the scene type identifier, role type identifier, and extended behavior identifier in the dialogue retrieval request. Therefore, the first cached dialogue information retrieved from the first cache instance matches the scene type of the current business scenario, the role type of the virtual role object, and the extended behavior of the virtual role object in the business scenario. Using the first cached dialogue information as dialogue output information can effectively improve the accuracy of the dialogue output information. It is understandable that, in the game application aspect of this application embodiment, the same NPC will speak in completely different styles of dialogue in different business scenarios. For example, in a gift-giving scenario, the NPC is warm and considerate, while in a competitive scenario, the NPC is sharp and decisive. Different NPCs will show their personality differences in the same business scenario. For example, a generous NPC speaks frankly, while a refined NPC uses subtle language. The same NPC will also make differences when it comes to different items or conditions in the same business scenario. For example, the lines for giving equipment and giving food should not be the same.
[0058] For further details, please see Figure 7 , Figure 7 This is a schematic diagram illustrating a scenario for looking up a cached hash value, as provided in an embodiment of this application. Figure 7 As shown, the cache space stores a cache hash table containing at least one cache hash value (including cache hash value 42a, cache hash value 42b, cache hash value 42c, and cache hash value 42d). Each cache hash value corresponds to an instance space index address in an instance storage space within the cache space. An instance storage space is used to store one cache instance, such as... Figure 7 As shown, cache hash value 42a corresponds to instance address 43a (the storage address of cache instance 44a), cache hash value 42b corresponds to instance address 43b (the storage address of cache instance 44b), cache hash value 42c corresponds to instance address 43c (the storage address of cache instance 44c), and cache hash value 42d corresponds to instance address 43d (the storage address of cache instance 44d).
[0059] This embodiment of the application first obtains the scene type identifier 40b (indicating the business scene is a gift-giving scene), the role type identifier 40a (indicating the role type is a knight-errant role type), and the extended behavior identifier 40c (indicating the extended behavior is giving food) from the request through dialogue. Then, it performs all composite byte-level zero-serialization hash calculations using the scene type identifier 40b, role type identifier 40a, and extended behavior identifier 40c. For details, please refer to [link to relevant documentation]. Figure 6 The description is omitted here. It is understood that after performing hash calculation to obtain the composite hash value 41a, the matching first cache hash value (cache hash value 42d) can be found in the cache hash table using the composite hash value 41a. Then, the storage address (first instance space index address) of the cache instance indicated by cache hash value 42d can be obtained from the cache hash table. This first instance space index address (instance address 43d) can indicate the first instance storage space where the first cache instance (cache instance 44d) corresponding to cache hash value 42d is located. Therefore, in this embodiment, cache instance 44d can be obtained from the first instance storage space. The first cache dialogue information (cache dialogue information 45a) is then obtained from cache instance 44d, and cache dialogue information 45a is identified as dialogue output information 46a.
[0060] Optionally, in one possible implementation, the cache index layer includes a cache space with a first index priority and a business database with a second index priority. The first index priority is higher than the second index priority. The business database is used to store at least one cache instance record related to a cache instance. In this embodiment, if a first cache hash value matching the composite hash value is not found in the cache space based on the first index priority, the request context in the dialog retrieval request can be retrieved. When constructing the callback function structure based on the request context, a database query request can be constructed based on the role type identifier, scene type identifier, and extended behavior identifier carried in the request context. Here, the request context refers to the context information related to the current dialog retrieval request. Further, this embodiment can send a database query request to the business database, which then performs a cache instance record query based on the role type identifier, scene type identifier, and extended behavior identifier in the database query request to find whether a target cache instance record matching the role type identifier, scene type identifier, and extended behavior identifier exists.
[0061] It is understood that in this embodiment, the business database can store multiple cache instance records. These cache instance records are generated when cache instances in the cache space are persistently stored in the business database. In other words, in this embodiment, cache instances in the cache space can be serialized to obtain cache instance records, which are then stored in the business database. Specifically, this persistent storage process can be performed when the business process of the game application's cache index layer restarts. Serialization refers to the process of converting data structures or object states in memory into a storable or transmittable byte sequence (or string). No specific serialization format is limited here. In this embodiment, the cache space used to store cache instances is located on the business server (e.g., ...). Figure 3 Taking server 10d as an example, the business database can be deployed on the business server or on another computer device that has a network connection to the business server (e.g., ...). Figure 3 (User terminal 10b in the example), where the specific deployment location of the business database is not limited.
[0062] It is understandable that after querying the cache instance record in the business database and obtaining the query results, if the query results indicate that a matching target cache instance record has been found, the target cache instance record can be instantiated in the cache space through a callback function structure to obtain a second cache instance. It is also understood that the target cache instance record matching the database query request matches the scene type identifier, role type identifier, and extended behavior identifier in the dialogue acquisition request. Furthermore, the second cache instance obtained by instantiating the target cache instance record also matches the scene type identifier, role type identifier, and extended behavior identifier. Further, in this embodiment, the second cache instance can be obtained from the cache space, and the dialogue output information can be updated using the second cache dialogue information obtained from the second cache instance. That is, the second cache dialogue information is used as the dialogue information output when the virtual role object interacts with the business object.
[0063] It is understood that, in this embodiment of the application, when a first cache instance matching the composite hash value cannot be obtained from the cache space, a cache instance record query can be initiated from the business database, and the queried target cache instance record can be instantiated to obtain a second cache instance. Then, the second cached dialogue information in the second cache instance can be obtained as dialogue output information. This approach can effectively increase the number of cache instances stored in this embodiment of the application, adapt to various different dialogue retrieval requests, and improve the speed of obtaining dialogue output information. It is understood that the second cache instance obtained from the cache space in this embodiment of the application matches the scene type identifier, role type identifier, and extended behavior identifier. Therefore, the second cached dialogue information obtained from the second cache instance matches the scene type of the current business scenario, the role type of the virtual role object, and the extended behavior of the virtual role object in the business scenario. Using the second cached dialogue information as dialogue output information can effectively improve the accuracy of the dialogue output information.
[0064] In one possible implementation, the cache space stores a cache hash table containing at least one cache hash value. Each cache hash value corresponds to an instance space index address of an instance storage space within the cache space, and each instance storage space stores one cache instance. In this embodiment, when instantiating a target cache instance record in the cache space using a callback function structure to obtain a second cache instance, the serialized data indicated by the target cache instance record is first obtained, and deserialization is performed on the serialized data to obtain the second cache instance described in the deserialized manner. Then, a second instance storage space for storing the second cache instance can be determined within the cache space. Further, this embodiment can obtain the second instance space index address of the second instance storage space and store the second cache instance in the second instance storage space based on the second instance space index address. It is understandable that a cache hash table is stored in the cache space. When a new cache instance (after the second cache instance) is stored in the cache space, the cache hash table needs to be updated. Specifically, in this embodiment, a composite hash value can be used as the second cache hash value, and an address relationship between the second cache hash value and the second instance space index address can be established. The cache hash table is then retrieved from the cache space, and updated using the established address mapping relationship. It is understood that the second cache hash value here refers to the composite hash value used as the cache hash value when the composite hash value is stored in the cache hash table during the instantiation of the second cache instance through the target cache instance record.
[0065] It is understood that in this embodiment, a second cache instance can be obtained by instantiating a cache instance record in the business database and storing the second cache instance in the cache space. Then, when other dialogue retrieval requests arrive subsequently, a corresponding hash calculation can be performed, potentially hitting the second cache instance. At this point, the cached dialogue information in the second cache instance can be directly retrieved as the dialogue output information for this dialogue retrieval request, thereby improving the timeliness and accuracy of dialogue output information retrieval. It is also understood that the cache index layer deployed with the game application in this embodiment can be stored in the business server. The business server can be configured with a dedicated business process to handle dialogue retrieval requests generated by the game business layer. When this business process needs to restart for some reason (e.g., process upgrade), all cache instances in the current cache space can be persistently stored in the business database. This preserves the accumulated dialogue information and ensures the diversity of the retrieved dialogue output information when the business process restarts.
[0066] For further details, please see Figure 8 , Figure 8 This is a schematic diagram illustrating a database query scenario provided by an embodiment of this application. For example... Figure 8 As shown, in this embodiment of the application, after obtaining a composite hash value 48a by hashing the scene type identifier 47b, role type identifier 47a, and extended behavior identifier 47c in the dialogue acquisition request, a search can be conducted in the cache space to see if a first cache hash value matching the composite hash value 48a exists. If the first cache hash value is found (i.e., the hash lookup is successful), a first cache instance (cache instance 53b) matching the first cache hash value can be obtained, and then the first cache dialogue information (cache dialogue information 54b) in cache instance 53b can be used as dialogue output information. If the first cache hash value is not found (i.e., the hash lookup is unsuccessful), a cache instance record query can be initiated to the business database. Specifically, a database query request 49a can be generated based on the scene type identifier 47b, role type identifier 47a, and extended behavior identifier 47c, and the database query request 49a can be sent to the business database 50a. The business database 50a can perform a record search based on the scene type identifier 47b, role type identifier 47a, and extended behavior identifier 47c to obtain the record query result (query result 51a).
[0067] This embodiment of the application can obtain the target cache instance record (cache instance record 52a) carried in the query result 51a, and instantiate the cache instance record 52a in the cache space to obtain the second cache instance (cache instance 53a). First, the serialized data indicated by the cache instance record 52a can be obtained, and a deserialization operation can be performed on the serialized data to obtain a record dialogue cache group for the cache instance record 52a. Here, the record dialogue cache group can be understood as an array used to cache dialogue information. Further, this embodiment of the application can construct a cache instance 53a for the cache instance record 52a based on the element content contained in the record dialogue cache group, and determine a second instance storage space in the cache space for storing the cache instance 53a based on the content quantity of the element content. It can be understood that the content quantity of the element content here is the number of cached dialogue information in the cache instance 53a. After determining the number of cached dialogue information in the cache instance 53a, a corresponding size of storage space (second instance storage space) can be allocated for the cache instance 53a in the cache space. Furthermore, in this embodiment, the second instance space index address (instance address 54a) of the second instance storage space can be obtained, and the cache instance 53a can be stored in the second instance storage space based on the instance address 54a. It is understood that a cache hash table is stored in the cache space. Since a new cache instance (after cache instance 53a) is stored in the cache space, the cache hash table needs to be updated. Specifically, in this embodiment, a correspondence can be established between the composite hash value 48a and the instance address 54a, and the cache hash table can be obtained from the cache space. The cache hash table can then be updated using the composite hash value 48a, the instance address 54a, and their correspondence.
[0068] Optionally, in one possible implementation, the cache index layer further includes a configuration storage space with a third index priority, which is lower than the second index priority. If no target cache instance record is found in the business database based on the second index priority, in other words, the business database does not contain a cache instance record that matches the role type identifier, scene type identifier, and extended behavior identifier in the dialogue acquisition request. Therefore, this embodiment can access the configuration storage space according to the third index priority, and retrieve a dialogue configuration table storing at least one dialogue configuration record. The space type of the configuration storage space is different from the space type of the cache space. Here, the configuration storage space can be the disk space in the computer device where the game application's cache index layer is located, and the dialogue configuration record is a record containing multiple configuration dialogue information. In other words, at least one dialogue configuration record is stored in the dialogue configuration table, and each dialogue configuration record contains multiple configuration dialogue information. In the dialogue configuration table, each dialogue configuration record corresponds to a reference scene type identifier; in other words, the dialogue configuration table is used to store the configuration mapping relationship between a dialogue configuration record and a reference scene type identifier.
[0069] It is understood that, after obtaining the dialogue configuration table, this embodiment can search for a target reference scene type identifier that matches the scene type identifier in at least one reference scene type identifier contained in the dialogue configuration table, and obtain the target dialogue configuration record corresponding to the target reference scene type identifier from at least one dialogue configuration record contained in the dialogue configuration table. It is understood that the target dialogue configuration record at this time matches the scene type identifier in the dialogue acquisition request. Further, this embodiment can configure and instantiate the target dialogue configuration record in the cache space to obtain a third cache instance for the composite hash value. Instantiating the target dialogue configuration record can be understood as storing the dialogue information (configuration dialogue information) contained in the target dialogue configuration record in the cache space as a cache instance. The obtained third cache instance can then be used as a cache instance matching the composite hash value. Further, this embodiment can obtain the third cache instance from the cache space and update the dialogue output information using the third cached dialogue information obtained from the third cache instance, that is, using the third cached dialogue information as the dialogue output information when the virtual role object interacts with the business object.
[0070] Understandably, when storing the third cache instance in the cache space, the cache hash table will also be updated, similar to the update process when storing the second cache instance. At this point, the composite hash value can be used as the third cache hash value, and a mapping relationship between the third cache hash value and the third cache instance can be established in the cache hash table. In other words, the third cache hash value here is the cache hash value used when the composite hash value is stored in the cache hash table after instantiating the third cache instance through the target cache instance record.
[0071] It is understood that, in this embodiment of the application, when a search for the first cache instance in the cache space fails and a search for the target cache instance record in the business database also fails, a dialogue configuration table storing dialogue configuration records can be obtained. The target dialogue configuration record in the dialogue configuration table that matches the scene type identifier in the current dialogue retrieval request is then retrieved, and stored in the cache space as a cache instance, resulting in a third cache instance. The third cached dialogue information retrieved from the third cache instance also matches the scene type identifier. Using this third cached dialogue information as dialogue output information ensures the accuracy of the dialogue output information. Furthermore, relatively accurate dialogue output information can be obtained even under abnormal circumstances. These abnormal circumstances may include a cold start of the business server (the server with the cache space deployed), temporary unavailability of the business database, etc. These abnormal circumstances may cause the cache space or business database to fail to find dialogue information matching the current dialogue retrieval request. In such cases, this embodiment of the application can effectively retrieve dialogue output information by searching for the dialogue configuration record in the dialogue configuration table.
[0072] For further details, please see Figure 9 , Figure 9 This is a schematic diagram illustrating a scenario for searching configuration dialog information provided in an embodiment of this application. For example... Figure 9As shown, in this embodiment, a dialogue acquisition request 55a can be obtained at the game business layer (business layer). A composite hash value 56a is obtained by hashing the scene type identifier 551a, character type identifier 552a, and extended behavior identifier 553a in the dialogue acquisition request 55a. Then, the multi-dimensional index layer can be entered to search the cache space for a first cache hash value that matches the composite hash value 56a. If the first cache hash value is found (i.e., a hash lookup hit), the first cache instance (cache instance 57a) corresponding to the first cache hash value can be obtained, and the first cached dialogue message can be obtained by consuming the cache instance 57a through a unified instance consumption function. If the first cache hash value is not found (i.e., a hash lookup miss), the degradation recovery layer can be entered, and a cache instance record query can be initiated to the business database. If the query result indicates that a target cache instance record (cache instance record 58a) exists in the business database, the cache instance record 58a can be instantiated to obtain a second cache instance (cache instance 57b), and the second cached dialogue information can be obtained from the cache instance 57b as dialogue output information.
[0073] If the query result indicates that the target cache instance record does not exist in the business database, this embodiment can obtain a dialogue configuration table storing at least one dialogue configuration record in the configuration storage space. Then, it can search for a target reference scene type identifier matching scene type identifier 551a among at least one reference scene type identifier contained in the dialogue configuration table, and obtain the target dialogue configuration record (dialogue configuration record 59a) corresponding to the target reference scene type identifier from at least one dialogue configuration record contained in the dialogue configuration table. It can be understood that the dialogue configuration record 59a at this time matches the scene type identifier 551a in the dialogue retrieval request. Further, this embodiment can instantiate the dialogue configuration record 59a in the cache space to obtain a third cache instance (cached instance 57c) for the composite hash value 56a. Further, this embodiment can use the third cache dialogue information obtained from the third cache instance as dialogue output information.
[0074] In one possible implementation, when instantiating the target dialogue configuration record in the cache space to obtain a third cache instance for the composite hash value, the following steps are taken: First, the list of configuration dialogue information indicated by the target dialogue configuration record can be obtained, and the number of multiple configuration dialogue information contained in the list can be counted to obtain the number of dialogue information for the list. It is understood that the configuration dialogue information contained in the list can be dialogue content pre-written by the game application's designers. Further, this embodiment can create an indexed cache array containing multiple array elements based on the number of dialogue information. The number of array elements in the indexed cache array can be the same as the number of dialogue information. Further, this embodiment can obtain the configuration sequence number of each configuration dialogue information in the configuration dialogue information list, and based on the configuration sequence number of each configuration dialogue information, fill each configuration dialogue information into an array element of the indexed cache array. It is understood that each configuration dialogue information can be filled into the array element corresponding to the element index with the same configuration sequence number. For example, if the configuration sequence number of the first configuration dialog is zero (which indicates that the first configuration dialog is the first dialog in the configuration dialog list), the first configuration dialog can be filled into the array element with the zero index in the index cache array.
[0075] It is understood that after each configuration dialogue information in the configuration dialogue information list is filled into the corresponding array element in the index cache array, each array element in the index cache array corresponds to one configuration dialogue information. This filled index cache array can be called the index dialogue cache array. In this embodiment, the configuration dialogue information corresponding to each array element in the index dialogue cache array can be adjusted to obtain an adjusted index cache array. Further, this embodiment can create a configuration dialogue cache group for composite hash values, and based on the element indices contained in the adjusted index cache array, fill the configuration dialogue information corresponding to multiple array elements contained in the adjusted index cache array into the configuration dialogue cache group to obtain a configuration update dialogue cache group. It is understood that the configuration dialogue cache group here can be understood as an array used to cache dialogue information. In this embodiment, the configuration dialogue information stored in the adjusted index cache array can be used as cached dialogue information and stored in this configuration dialogue cache group to obtain the configuration update dialogue cache group. Specifically, the storage process is based on the element indices corresponding to each configuration dialogue information in the adjusted index cache array, for example, according to the order of the element indices corresponding to the configuration dialogue information, the configuration dialogue information is stored sequentially in the configuration dialogue cache group. Furthermore, in this embodiment of the application, a third cache instance for the composite hash value can be constructed based on the configuration update of the dialogue cache group, and the third cache instance can be stored in the cache space. The specific process of storing the third cache instance in the cache space can be referred to the above description of the process of storing the second cache instance in the cache space (including instance storage space allocation and cache hash table update), and will not be repeated here.
[0076] It is understood that, in the embodiments of this application, when configuring and instantiating the target dialogue configuration record, the configuration dialogue information in the target dialogue configuration record is shuffled, and a third cache instance for the composite hash value is constructed based on the shuffled configuration dialogue information. This ensures that when different dialogue acquisition requests (e.g., a first dialogue acquisition request and a second dialogue acquisition request) arrive, if the scene type identifier carried in the first dialogue acquisition request and the second dialogue acquisition request are the same, and thus the same target dialogue configuration record is acquired, the order of the configuration dialogue information in the cache instance obtained by configuring and instantiating the target dialogue configuration record will be different. Furthermore, from the user's perspective, the dialogues of different NPCs in the same business scenario are unpredictable, which can improve the diversity of dialogue output information used by virtual characters to communicate with business objects, thereby improving the user's gaming experience.
[0077] For further details, please see Figure 10 , Figure 10 This is a schematic diagram illustrating an instance of a dialogue configuration record provided in an embodiment of this application. For example... Figure 10 As shown, in this embodiment, the scenario type identifier 551a in the request can be obtained through the dialogue. The target dialogue configuration record (dialogue configuration record 602c) is then located in the dialogue configuration table. This dialogue configuration table includes multiple dialogue configuration records, each corresponding to a reference scenario type identifier, including: dialogue configuration record 602a corresponding to reference scenario type identifier 601a, dialogue configuration record 602b corresponding to reference scenario type identifier 601b, and dialogue configuration record 602c corresponding to reference scenario type identifier 601c. Specifically, the target reference scenario type identifier (reference scenario type identifier 601c) matching the scenario type identifier 551a can be found in the dialogue configuration table, and the dialogue configuration record 602c corresponding to the reference scenario type identifier 601c can be obtained.
[0078] When instantiating the dialogue configuration record 602c, the configuration dialogue information list 61a indicated by the dialogue configuration record 602c can first be obtained, and the number of multiple configuration dialogue information (including E0, E1, E2, E3, E4, E5) contained in the configuration dialogue information list 61a can be counted to obtain the number of dialogue information for the configuration dialogue information list. Further, in this embodiment, an array containing multiple array elements can be created based on the number of dialogue information, where the number of array elements in array 62a is the same as the number of dialogue information. Further, in this embodiment, the configuration sequence number of each configuration dialogue information in the configuration dialogue information list can be obtained, and based on the configuration sequence number of each configuration dialogue information, each configuration dialogue information can be filled into an array element of array 62a. It can be understood that each configuration dialogue information can be filled into the array element corresponding to the element index with the same configuration sequence number. At this point, in array 62a, the array element with index 0 is E0, the array element with index 1 is E1, the array element with index 2 is E2, the array element with index 3 is E3, the array element with index 4 is E4, and the array element with index 5 is E5. It can be understood that the array element corresponding to index 622a stores the dialogue information 621a (E0).
[0079] This application embodiment can adjust the configuration dialogue information corresponding to each array element in the indexed dialogue cache array to obtain an adjusted indexed cache array (array 63a). In array 63a, the array element with index 0 is E3, the array element with index 1 is E0, the array element with index 2 is E5, the array element with index 3 is E1, the array element with index 4 is E4, and the array element with index 5 is E2. Furthermore, this application embodiment can create configuration dialogue cache groups (including cache group 64a and cache group 64b) for composite hash values, and based on the element indices contained in array 63a, fill the configuration dialogue information corresponding to the multiple array elements contained in array 63a into the configuration dialogue cache group to obtain a configuration update dialogue cache group. Here, based on an alternating allocation strategy, array elements with even indices in array 63a can be filled into cache group 64a, at which point cache group 64a includes E3, E5, and E4. Array elements with odd indices in array 63a can be filled into cache group 64b, at which point cache group 64a includes E0, E1, and E2. Furthermore, based on this configuration, the dialogue cache groups (cache group 64a and cache group 64b) can be updated as a third cache instance (cache instance 65a).
[0080] In one possible implementation, when filling each configuration dialogue information into an array element of the index cache array based on its configuration sequence number, this embodiment can select one configuration dialogue information from multiple configuration dialogue information as the target configuration dialogue information, and use the configuration sequence number of the target configuration dialogue information as the target configuration sequence number. Then, it can search for a target element index matching the target configuration sequence number among the multiple element indices contained in the index cache array. Optionally, the index value of the target element index can be the same as the sequence number value of the target configuration sequence number. Further, this embodiment can obtain the target first array element corresponding to the target element index from the multiple array elements contained in the index cache array, and fill the target configuration dialogue information into the target first array element. At this time, the element content corresponding to the target first array element is the target configuration dialogue information. It is understood that when this embodiment selects each configuration dialogue information from multiple configuration dialogue information as the target configuration dialogue information, each configuration dialogue information can be filled into an array element of the index cache array, thereby obtaining the index dialogue cache array.
[0081] In one possible implementation, when adjusting the configuration dialogue information corresponding to each array element in the indexed dialogue cache array to obtain the adjusted indexed cache array, a Fisher-Yates shuffling strategy can be used. Starting from the first element in the indexed dialogue cache array, a uniformly random index is generated for each position from the current position to the end of the array. Then, the value at the current position (configuration dialogue information) is swapped with the value (configuration dialogue information) at the random index position. Specifically, in this embodiment, multiple array elements contained in the indexed dialogue cache array can be used as first array elements. The array element with the smallest index value among these first array elements is selected as the target first array element. If the multiple first array elements include all array elements in the indexed dialogue cache array, then the target first array element is the array element with index zero in the indexed dialogue cache array.
[0082] Furthermore, in this embodiment, a uniformly random index configured for the target first array element can be obtained based on the element index of the target first array element and the number of elements in the indexed dialogue cache array. It is understood that the index value of the obtained mean random index is not less than the element index value of the target first array element and is less than the number of elements obtained. Therefore, the uniformly random index can point to a random array element from the current target first array element to the last array element in the indexed dialogue cache array. Further, in this embodiment, a first array element whose element index matches the uniformly random index can be found among multiple first array elements and used as an exchange array element. Information exchange processing is performed between the configuration dialogue information indicated by the target first array element and the configuration dialogue information indicated by the exchange array element, and the target first array element is removed from the multiple first array elements. It is understood that when each array element in the multiple first array elements is selected as the target first array element, information adjustment processing of the configuration dialogue information corresponding to each array element in the multiple array elements contained in the indexed dialogue cache array can be completed. At this time, the indexed dialogue cache array that has undergone information adjustment processing can be used as the adjusted indexed cache array. It is understood that by adjusting the configuration dialogue information corresponding to each array element in the indexed dialogue cache array, the embodiments of this application can effectively ensure the randomness of the arrangement of cached dialogue information in the subsequent third cache instance, thereby improving the diversity of the obtained dialogue output information.
[0083] For further details, please see Figure 11 , Figure 11 This is a schematic diagram illustrating a scenario where an indexed dialog cache array is uniformly shuffled, as provided in an embodiment of this application. Figure 11As shown, in this embodiment of the application, when adjusting the configuration dialogue information corresponding to each array element in the indexed dialogue cache array (array 62a) to obtain the adjusted indexed cache array (array 63a), a Fisher-Yates shuffling strategy can be used. Starting from the first array element in array 62a, a uniformly random index is generated for each position from the current position to the end of the array. Then, the value (configuration dialogue information) at the current position is swapped with the value (configuration dialogue information) at the random index position. In array 62a, the configuration dialogue information corresponding to the array element with index 0 is E0, the configuration dialogue information corresponding to the array element with index 1 is E1, the configuration dialogue information corresponding to the array element with index 2 is E2, the configuration dialogue information corresponding to the array element with index 3 is E3, the configuration dialogue information corresponding to the array element with index 4 is E4, and the configuration dialogue information corresponding to the array element with index 5 is E5.
[0084] Specifically, such as Figure 11 As shown, firstly, a uniformly random index (random index 66a=3) can be generated for index 0. Then, a dialogue exchange can be performed on indices 0 and 3 in array 62a (i.e., the dialogue information in the array elements corresponding to indices 0 and 3 is exchanged), resulting in array 62b. In array 62b, the configuration dialogue information corresponding to index 0 is E3, and the configuration dialogue information corresponding to index 3 is E0. Further, a uniformly random index (random index 66b=3) can be generated for index 1. Then, a dialogue exchange can be performed on indices 1 and 3 in array 62b (i.e., the dialogue information in the array elements corresponding to indices 1 and 3 is exchanged), resulting in array 62c. In array 62c, the configuration dialogue information corresponding to index 1 is E0, and the configuration dialogue information corresponding to index 3 is E1. Further, a uniformly random index (random index 66c=5) can be generated for index 2. Then, a dialogue exchange can be performed on indices 2 and 5 in array 62a (i.e., the dialogue information in the array elements corresponding to indices 2 and 5 is exchanged), resulting in array 62d. Furthermore, a uniformly random index (random index 66d=3) can be generated for index 3. Then, indices 3 and 3 in array 62d can be swapped (i.e., no replacement is performed), resulting in array 62e. Further, a uniformly random index (random index 66e=4) can be generated for index 4 in array 62e. Then, indices 4 and 4 in array 62e can be swapped, resulting in array 63a. Array 63a is then the adjusted index cache array after uniformly randomizing array 62a.
[0085] In one possible implementation, the configuration dialogue cache group includes a first configuration dialogue cache group and a second configuration dialogue cache group. In this embodiment, when filling the configuration dialogue information corresponding to multiple array elements in the adjustment index cache array into the configuration dialogue cache group based on the element indices contained in the adjustment index cache array, even-numbered element indices with even-numbered index values can be selected from the element indices contained in the adjustment index cache array. The index values of each element indices in the even-numbered element indices are then sorted to obtain a first dialogue filling order. Here, the index values of each element can be sorted from smallest to largest to obtain the first dialogue filling order. Further, in this embodiment, even-numbered array elements corresponding to even-numbered element indices can be obtained from the adjustment index cache array. Based on the first dialogue filling order, the configuration dialogue information corresponding to each even-numbered array element in the even-numbered array elements can be filled into the cache entries of the first configuration dialogue cache group to obtain the filled first configuration dialogue cache group. The first configuration dialog cache group here can include multiple cache entries, each of which can be used to store configuration dialog information. Optionally, when the first configuration dialog cache group is a cache array, the cache entries here are array elements in the cache array.
[0086] Similarly, in this embodiment, odd-numbered element indices with odd-numbered indexes can be selected from the element indices contained in the adjustment index cache array, and the index values of each element in the odd-numbered element indices can be sorted to obtain the second dialogue filling order. Alternatively, the index values of each element can be sorted in ascending order to obtain the second dialogue filling order. Then, in the adjustment index cache array, the odd-numbered array elements corresponding to the odd-numbered element indices can be obtained, and the configuration dialogue information corresponding to each odd-numbered array element in the odd-numbered array elements can be filled into the cache entries of the second configuration dialogue cache group based on the second dialogue filling order, resulting in the filled second configuration dialogue cache group. It can be understood that at this point, all configuration dialogue information in the adjustment index cache array is filled into the first and second configuration dialogue cache groups. Therefore, in this embodiment, the filled first and second configuration dialogue cache groups can be used as configuration update dialogue cache groups. It is understood that, in the embodiments of this application, when constructing a third cache instance through a target dialogue configuration record, due to the randomness of Fisher-Yates shuffling, the initialization results of the same target dialogue configuration record on different cache instances are different. Consequently, the order of pre-made dialogues returned by different NPC characters during the cold start phase will not be uniform. Furthermore, due to the alternating allocation strategy (allocating odd-numbered array elements and even-numbered array elements in the indexed dialogue cache array to two cache groups), the initial contents of the two cache groups (including the first configuration dialogue cache group and the second configuration dialogue cache group) do not overlap. When one cache group is exhausted, the dialogue output information obtained when switching to another cache group will not be repeated, thereby improving the diversity of dialogue output information.
[0087] In one possible implementation, the configuration update dialogue cache group includes a first configuration dialogue cache group and a second configuration dialogue cache group. In this embodiment, when constructing a third cache instance for the composite hash value based on the active dialogue cache group, a consumption pointer for each configuration dialogue cache group is stored in the third cache instance. This consumption pointer can be used to indicate the consumption progress of the corresponding configuration dialogue cache group, i.e., which cached dialogue information has been consumed and which has not. Specifically, this embodiment can obtain the first number of cache entries contained in the first configuration dialogue cache group and the second number of cache entries contained in the second configuration dialogue cache group. Then, a first consumption pointer can be configured for the first configuration dialogue cache group based on the first number of entries, and a second consumption pointer can be configured for the second configuration dialogue cache group based on the second number of entries. In other words, both the first and second consumption pointers point to the last cache entry in the corresponding configuration dialogue cache group, indicating that the cached dialogue information corresponding to all cache entries in the configuration dialogue cache group has not been consumed.
[0088] Furthermore, the cache group identifier of the first configuration dialogue cache group can be obtained, and this identifier can be used as the first active cache group identifier. This first active cache group identifier can indicate which configuration dialogue cache group among the cache instances to be built can be consumed first. Further, a third cache instance for the composite hash value can be constructed based on the obtained first configuration dialogue cache group, first consumption pointer, second configuration dialogue cache group, second consumption pointer, and first active cache group identifier. It is understandable that constructing and storing the third cache instance in the cache space allows subsequent dialogue retrieval requests with the same composite hash value as the current dialogue retrieval request to quickly hit the third cache instance and consume it (selecting a cached dialogue information from the third cache instance as the dialogue output information for this session), thus improving the speed of obtaining dialogue output information.
[0089] In one possible implementation, when using the first cached dialogue information obtained from the first cache instance as dialogue output information to instruct a virtual role object to engage in dialogue with a business object, this embodiment first consumes the first cache instance. Specifically, it can obtain at least one dialogue cache group included in the first cache instance and a second active cache group identifier indicated by the first cache instance. Further, it can obtain the cache group identifier of each dialogue cache group within the at least one dialogue cache group, and search for a target cache group identifier that matches the second active cache group identifier among the obtained cache identifiers. The dialogue cache group corresponding to the target cache group identifier is then designated as the active dialogue cache group. It is understood that the second active cache group identifier here corresponds to the identifier of the cache group that should be consumed first, as indicated by the first cache instance. Therefore, this acquisition of the first cached dialogue information will consume the active dialogue cache group that matches the second active cache group identifier. It is also understood that this embodiment can obtain a third consumption pointer indicated by the active dialogue cache group, and consume the active dialogue cache group based on the third consumption pointer to obtain the first cached dialogue information. The third consumption pointer here can be used to indicate the consumption progress of the active dialogue cache group, that is, which cached dialogue information has been consumed and which cached dialogue information has not been consumed in the active dialogue cache group. Furthermore, in the embodiments of this application, the acquired first cached dialogue information can be used as dialogue output information to instruct the virtual role object to conduct a dialogue with the business object.
[0090] In one possible implementation, the active dialogue cache group in the first cache instance includes multiple cache entries, each corresponding to an entry index. This means that each cache entry stores one cached dialogue information. In this embodiment, when consuming the active dialogue cache group based on the third consumption pointer to obtain the first cached dialogue information, the consumption entry index corresponding to the cache entry indicated by the third consumption pointer can be obtained first. The cache entry (consumed cache entry) indicated by the third consumption pointer in the active dialogue cache group is the cache entry in the current active dialogue cache group that has not been consumed and has the largest index value. Furthermore, in this embodiment, a random index can be generated based on the index value of the consumption entry index to obtain a random entry index. This generated random entry index has a positive integer value not greater than the index value of the consumption entry index; in other words, the cache entry corresponding to this random entry index is a random entry among the consumed cache entries in the active dialogue cache group.
[0091] It is understood that, in this embodiment of the application, the cache entry corresponding to the random entry index can be used as the target cache entry from multiple cache entries in the active dialogue cache group, and the consumption cache entry corresponding to the consumption entry index can be obtained. Further, this embodiment of the application can exchange the cache dialogue information corresponding to the target cache entry and the cache dialogue information corresponding to the consumption cache entry. At this time, the cache dialogue information corresponding to the target cache entry is the original cache dialogue information of the consumption cache entry, and similarly, the cache dialogue information corresponding to the consumption cache entry is the original cache dialogue information of the target cache entry. Then, the cache entry pointed to by the third consumption pointer can be modified to the cache entry corresponding to the previous entry index of the consumption entry index, and the cache dialogue information corresponding to the consumption cache entry can be obtained, using the obtained cache dialogue information as the first cache dialogue information. In other words, the third consumption pointer now points to the previous entry of the consumption cache entry because the cache dialogue information in the consumption cache entry has already been consumed. It is understood that the consumption process of the second and third cache instances can be referred to the above-described consumption process of the first cache instance, and will not be repeated here. Understandably, in the game application's cache index layer, a failed lookup at each level automatically triggers a lookup at the next level. The query paths at all three levels eventually converge into the same result processing flow (consuming cached instances through the same consumption function), which is completely transparent to the game's business layer.
[0092] For further details, please see Figure 12 , Figure 12 This is a schematic diagram illustrating a scenario of consuming a cached instance, as provided in an embodiment of this application. Figure 12As shown, cache instance 68a can be a first cache instance, a second cache instance, or a third cache instance; here, cache instance 68a is taken as the first cache instance. At this time, cache instance 68a includes two dialogue cache groups (cache group 67a and cache group 67b). The active cache group identifier (active group index) in cache instance 68a is 0, indicating cache group 67a. Cache group 67a can then be consumed as the active dialogue cache group. Cache group 67a includes multiple cache entries, each corresponding to an entry index. This means that each cache entry stores one cached dialogue information. For example... Figure 12 As shown, in cache group 67a, the cache entry with entry index 0 (index 0) stores cache session information E0, the cache entry with entry index 1 (index 1) stores cache session information E1, the cache entry with entry index 2 (index 2) stores cache session information E2, the cache entry with entry index 3 (index 3) stores cache session information E3, and the cache entry with entry index 4 (index 4) stores cache session information E4. At this time, the third consumer pointer (consumer pointer 641a) in cache group 67a points to cache entry 3.
[0093] It is understood that, in this embodiment of the application, when consuming cache group 67a based on consumption pointer 641a and obtaining the first cache dialogue information, the consumption entry index (3) corresponding to the cache entry indicated by consumption pointer 641a can be obtained first. It is understood that, in cache group 67a, the consumption cache entry indicated by consumption pointer 641a is the cache entry in the current cache group 67a that has not been consumed and has the largest index value of the entry index. Then, step S30 can be executed to generate a random index based on the index value (3) of the consumption entry index to obtain a random entry index (random index 671a=1). It is understood that, in this embodiment of the application, the cache entry corresponding to random index 671a can be used as the target cache entry (entry 1) among multiple cache entries in cache group 67a, and the entry 3 corresponding to the consumption entry index can be obtained. Furthermore, in this embodiment, step S31 can be executed to exchange the cached dialogue information corresponding to index 1 and the cached dialogue information corresponding to index 33. At this time, the cached dialogue information corresponding to index 1 is E3, and the cached dialogue information corresponding to index 3 is E1. Then, step S32 can be executed to obtain the cached dialogue information (cached dialogue information 69a, i.e., E1) corresponding to index 3, and step S33 can be executed to use the cached dialogue information 69a as the dialogue output information. Furthermore, in this embodiment, step S34 can be executed to modify the cached entry pointed to by the consumption pointer 641a to the cached entry corresponding to the previous entry index (index 2) of the consumption entry index (index 3), that is, to shift the consumption pointer 641a one position to the left.
[0094] It is understood that, in the embodiments of this application, the dialogue cache group in the cache instance can be understood as a fixed-size array. Taking the active dialogue cache group in the first cache instance as an example, the cache entries in the active dialogue cache group are the array elements in the array, and each array element corresponds to one cached dialogue information. When consuming the dialogue cache group in the cache instance, the swap-to-tail algorithm can be used. Specifically, taking the consumption of the active dialogue cache group in the first cache instance as an example, the array corresponding to the active dialogue cache group at this time has five cached dialogue information: ["A", "B", "C", "D", "E"]. When consuming the active dialogue cache group for the first time, the third consumption pointer points to position 4 ("E"). At this time, the index of the generated random entry is 2, that is, "C" (position 2) is randomly selected in the active dialogue cache group. At this time, "C" and the last "E" can be swapped in the active dialogue cache group, and the resulting active dialogue cache group is: ["A", "B", "E", "D", "C"]. At this time, "C" pointed to by the third consumption pointer will be used as the first cached dialogue information, and the third consumption pointer will be moved forward one position to point to position 3 ("D"). This marks that the entries after position 3 have been consumed. The entries that have not been consumed are: ["A", "B", "E", "D"].
[0095] When consuming the active dialogue cache group for the second time, the third consumption pointer points to position 3 ("D"). At this time, the index of the generated random entry is 1, that is, "B" (position 1) in the active dialogue cache group is randomly selected. At this time, "B" in the active dialogue cache group and "D" pointed to by the third consumption pointer can be swapped. The resulting active dialogue cache group is: ["A", "D", "E", "B", "C"]. At this time, "B" pointed to by the third consumption pointer will be used as the first cached dialogue information, and the third consumption pointer will be moved forward one position to point to position 2 ("E"). This marks that the entries after position 2 have been consumed. The entries that have not been consumed are: ["A", "D", "E"].
[0096] When consuming the active conversation cache group for the third time, the third consumption pointer points to position 2 ("Wu"). At this time, a random entry index of 0 is generated, that is, "Jia" (position 0) in the active conversation cache group is randomly selected. At this time, "Jia" in the active conversation cache group can be exchanged with "Wu" pointed to by the third consumption pointer. The obtained active conversation cache group is: ["Wu", "Ding", "Jia", "Yi", "Bing"]. At this time, "Jia" pointed to by the third consumption pointer will be used as the first cached conversation information obtained, and the third consumption pointer will be moved forward one position to point to position 1 ("Ding"), which marks that the entries after position 1 have been consumed. The unconsumed entries are: ["Wu", "Ding"]. Here, the subsequent consumption process will not be elaborated. It can be understood that when all the cached entries in the active conversation cache group are consumed, switch to another cache group in the first cache instance and continue with a similar consumption process. It can be understood that by using the swap-to-tail algorithm to consume the conversation cache group, the time complexity of consumption can be made constant, involving one random selection, one swap, and one pointer movement. At the same time, it can ensure that the obtained cached conversation information is not repeated because the consumed ones are swapped to the tail for isolation, and no auxiliary structures such as bitmaps and sets are required.
[0097] It can be understood that in the embodiments of the present application, by performing hash calculation and cache instance matching through the scenario type identifier, role type identifier, and extended behavior identifier in the dialogue acquisition request, accurate cache instance positioning and complete content isolation can be achieved, thereby improving the accuracy of the dialogue output information. It can be understood that by adopting multi-level lookup (including the first level: cache space, the second level: business database, the third level: dialogue configuration table), the embodiments of the present application can perform layer-by-layer degradation recovery and randomized configuration preheating under various abnormal conditions such as cold start (fewer cache instances in the cache space), database failure, and capacity eviction (cache instances in the cache space are cleared), so as to keep the dialogue cache service continuously available and the dialogue content diverse.
[0098] Further, please refer to Figure 13 , Figure 13 which is a schematic diagram of another dialogue processing method provided by the embodiments of the present application. As Figure 13 shown, it can be understood that Figure 13 the dialogue processing method shown can be executed by a user terminal or a server. For the sake of understanding, here, the server is taken as an example. At this time, the server here can be the server 10d as shown in Figure 1 . As Figure 13 shown, the dialogue processing method can at least include Figure 13 steps S201 to S208 in
[0099] Step S201: Receive the dialogue retrieval request sent by the game business layer through the cache index layer, and retrieve the role type identifier of the virtual character object, the scene type identifier of the business scene in which the virtual character object is located, and the extended behavior identifier from the dialogue retrieval request. It is understood that, in this embodiment of the application, when manipulating a virtual character object to engage in dialogue with a business object through the game business layer, it is necessary to obtain the dialogue information (dialogue output information) output by the virtual character object to the business object in this dialogue. When this embodiment of the application needs to obtain the dialogue output information for this dialogue, it can generate a corresponding dialogue retrieval request through the game business layer and send the dialogue retrieval request to the cache index layer to obtain the cached dialogue information in the cache index layer as the dialogue output information for this dialogue. It is understood that after the game application's cache index layer receives the dialogue retrieval request, it can obtain the character type identifier, scene type identifier, and extended behavior identifier related to this dialogue from the dialogue retrieval request.
[0100] Step S202: When constructing the composite byte structure through the role type identifier, scene type identifier and extended behavior identifier, perform hash calculation on the composite byte structure based on each composite byte in the composite byte structure to obtain the composite hash value for the composite byte structure. In this embodiment, after obtaining the role type identifier, scene type identifier, and extended behavior identifier related to the current dialogue from the dialogue acquisition request, a composite byte structure can be constructed based on these identifiers. Furthermore, a hash calculation can be performed on the composite byte structure based on each byte to obtain a composite hash value corresponding to the dialogue acquisition request.
[0101] Step S203: Search for the first cache hash value that matches the composite hash value in the cache index layer; In this embodiment, after calculating the composite hash value for the composite byte structure, a first cache hash value matching the composite hash value can be searched in the cache index layer. In one possible implementation, a cache hash table containing at least one cache hash value is stored in the cache space of the cache index layer. When searching for the first cache hash value matching the composite hash value in the cache index layer, the cache hash table can be retrieved from the cache space, and among the at least one cache hash value contained in the cache hash table, a cache hash value identical to the composite hash value is searched. This found cache hash value is then used as the first cache hash value matching the composite hash value. If the first cache hash value is found, the first cache instance corresponding to the first cache hash value in the cache space can be retrieved, and the first cache instance can be consumed to obtain the first cached dialogue information that can be used as dialogue output information. This process involves only one structure hash calculation, one hash table lookup, one cache memory read operation, and one cache memory write operation, typically completed in microseconds, which effectively improves the efficiency of obtaining dialogue output information.
[0102] Step S204: If the first cache hash value is not found in the cache space based on the first index priority, the request context in the dialog acquisition request is obtained, and when the callback function structure is constructed based on the request context, the database query request is constructed based on the role type identifier, scene type identifier and extended behavior identifier carried in the request context. Step S205: Send a database query request to the business database based on the second index priority. The business database then searches for a target cache instance record that matches the role type identifier, scene type identifier, and extended behavior identifier in at least one cache instance record based on the database query request. If, in this embodiment, a first cache hash value matching the composite hash value is not found in the cache space based on the first priority index, the request context in the dialog retrieval request can be obtained. When constructing the callback function structure based on the request context, a database query request is constructed based on the role type identifier, scene type identifier, and extended behavior identifier carried in the request context. Further, this embodiment can send a database query request to the business database, which then searches for a target cache instance record matching the role type identifier, scene type identifier, and extended behavior identifier in at least one cache instance record. The callback function structure here can be understood as a structure created for the callback function. After receiving the query result for the database query request returned by the business database, the index cache layer in this embodiment can call the corresponding callback function through this callback function structure to perform subsequent processing on the query result. The request context in the callback function structure is the context information of the current dialog retrieval request. When calling the callback function through the callback function structure, the callback function can use this context information to determine the specific information of the dialog retrieval request that needs to be processed, so as to facilitate subsequent processing.
[0103] In one possible implementation, when searching for a target cache instance record in the business database, this embodiment first obtains a multi-dimensional indexing strategy related to the business database. The business database then retrieves the first-dimensional index information from the multiple-dimensional index information included in the database query request according to the multi-dimensional indexing strategy. This multiple-dimensional index information includes at least a role type identifier, a scene type identifier, and an extended behavior identifier used for multi-dimensional indexing. If the first-dimensional index information is a role type identifier, a cache instance record matching the role type identifier can be searched among at least one cache instance record, and the found cache instance record is used as the first cache instance record. In another possible scenario, the first-dimensional index information can be a scene type identifier; in this case, a cache instance record matching the scene type identifier can be searched among at least one cache instance record and used as the first cache instance record.
[0104] Furthermore, the business database can retrieve the second-dimensional index information from multiple dimensions using a multi-dimensional indexing strategy. When the second-dimensional index information is a scene type identifier (while the first-dimensional index information is a role type identifier), it searches for a cache instance record matching the scene type identifier in the first cache instance record and uses this record as the second cache instance record. Similarly, the business database can retrieve the third-dimensional index information from multiple dimensions using a multi-dimensional indexing strategy. When the third-dimensional index information is an extended behavior identifier, it searches for a cache instance record matching the extended behavior identifier in the second cache instance record and uses this record as the target cache instance record to match the database query request. It is understood that the target cache instance record at this point matches the role type identifier, scene type identifier, and extended behavior identifier in the dialogue retrieval request simultaneously.
[0105] For further details, please see Figure 14 , Figure 14 This is a schematic diagram illustrating a scenario for querying records in a business database, as provided in an embodiment of this application. For example... Figure 14As shown, in this embodiment of the application, the target cache instance record that matches the scene type identifier 721a (128), scene type identifier 721b (2), and extended behavior identifier 721c (1) in the database query request 72a can be used to search for a matching cache instance record in the business database 71a. Specifically, in this embodiment of the application, the scene type identifier 721b can be used as the first dimension index information, and then step S41 can be executed to search for a first cache instance record (including cache instance record 70a, cache instance record 70b, cache instance record 70c, cache instance record 70d, and cache instance record 70e) that matches the scene type identifier 721b in at least one cache instance record stored in the business database (including cache instance record 70a, cache instance record 70b, cache instance record 70c, cache instance record 70d, and cache instance record 70e). It can be understood that each cache instance record in the business database 71a corresponds to a set of scene identifiers, role identifiers, and extended identifiers. Furthermore, in this embodiment of the application, the role type identifier 721a can be used as the second dimension index information, and step S42 is executed to search for a cache instance record (including cache instance record 70a and cache instance record 70c) that matches the role type identifier 721a in the first cache instance record. Then, the extended behavior identifier 721c can be used as the third dimension index information, and step S43 is executed to search for a cache instance record (cache instance record 70a) that matches the extended behavior identifier 721c in the cache instance records (second cache instance records) that match both the role type identifier 721a and the scene type identifier 721b. The found cache instance record 70a is then used as the target cache instance record that matches the database query request 72a, and the target cache instance record is used as the record query result.
[0106] Understandably, after retrieving the target cache instance record that matches the role type identifier, scene type identifier, and extended behavior identifier from the business database, the target cache instance record can be instantiated in the cache space through a callback function structure.
[0107] Optionally, in one possible implementation, before instantiating the target cache instance record in the cache space through the callback function structure, this embodiment can backfill the target cache instance record into the request context in the callback function structure. Further, this embodiment can obtain the callback function pointer of the callback function structure and call the query callback function indicated by the callback function pointer to read the target cache instance record backfilled in the request context, thereby performing the step of instantiating the target cache instance record in the cache space. It is understood that the callback function structure here is a callback data structure obtained by encapsulating the context information of the current dialogue retrieval request (including composite primary key value, business parameters, request source identifier, and subsequent processing function pointer) when sending a database query request to the business database. Among them, the business parameters are callback parameters used to pass to the callback function (to facilitate the restoration of the request context), the request source identifier can identify the user from which the request originates, the subsequent processing function pointer is used to indicate the callback function, and the composite primary key value is the role type identifier, scene type identifier, and extended behavior identifier in the dialogue retrieval request. At this time, the database query request sent to the business database in this embodiment is an asynchronous request. At this time, the game application's cache index layer can handle other dialogue retrieval requests. When the record query result of this database query request is returned, the cache index layer can call the callback function through the encapsulated callback function structure to perform subsequent query result processing.
[0108] For further details, please see Figure 15 , Figure 15 This is a schematic diagram of a process for obtaining dialogue output information provided in an embodiment of this application. For example... Figure 15As shown, in this embodiment, a dialogue retrieval request 75a can be obtained at the game business layer (business layer). This dialogue retrieval request 75a carries a multi-dimensional composite primary key 751a (K1, K2, ..., K3). It is understood that in one possible implementation, this multi-dimensional composite primary key 751a may include other identifiers besides scene type identifier, role type identifier, and extended behavior identifier. For example, in a cloud gaming scenario, the multi-dimensional composite primary key 751a may carry a game type identifier to distinguish specific games. It is understood that this embodiment can perform hash calculations on the scene type identifier, role type identifier, and extended behavior identifier in the dialogue retrieval request 75a to obtain a composite hash value. Then, it can proceed to the first-level lookup (cached space) and execute step S21, searching the hash table in the cache space for a first cache hash value that matches the composite hash value. If a first cache hash value is found, the first cache instance corresponding to the first cache hash value can be obtained, and step S28 can be executed to consume the first cache instance to obtain a first cached dialogue message, which is then used as dialogue output information 76a. If the first cache hash value is not found, the second-level search (business database) can be performed. First, step S22 is executed to encapsulate the context information of the current dialog request 75a (including composite primary key value, business parameters, request source identifier and subsequent processing function pointer) into a callback function structure, and then step S23 is executed to perform an asynchronous query on the business database to obtain the record query results.
[0109] Then, step S24 is executed, and the callback function is called through the encapsulated callback function structure to perform subsequent query result analysis. If the query result indicates that the target cache instance record exists in the business database, step S25 is executed to instantiate the target cache instance record to obtain a second cache instance, and step S28 is executed to obtain the second cache dialogue information from the second cache instance as dialogue output information 76a. If the query result indicates that the target cache instance record does not exist in the business database, this embodiment can perform a third-level search (dialogue configuration table). First, step S26 is executed to obtain the dialogue configuration table in the configuration storage space, and then the target dialogue configuration record matching the scene type identifier can be obtained from at least one dialogue configuration record contained in the dialogue configuration table. Further, this embodiment can execute step S27 to configure and instantiate the target dialogue configuration record in the cache space to obtain a third cache instance for the composite hash. Further, this embodiment can execute step S28 to use the third cache dialogue information obtained from the third cache instance as dialogue output information 76a.
[0110] Step S206: If no target cache instance record is found in the business database based on the second index priority, the configuration storage space is accessed based on the third index priority, and the dialog configuration table containing at least one dialog configuration record is obtained from the configuration storage space. Step S207: Search for a target reference scene type identifier that matches the scene type identifier in at least one reference scene type identifier contained in the dialogue configuration table, and in at least one dialogue configuration record, take the dialogue configuration record that has a configuration mapping relationship with the target reference scene type identifier as the target dialogue configuration record. Step S208: Instantiate the configuration of the target dialogue configuration record in the cache space to obtain a third cache instance, and update the dialogue output information by obtaining the third cache dialogue information from the third cache instance; It is understood that if no target cache instance record is found in the business database based on the second index priority, this embodiment can obtain a dialogue configuration table storing at least one dialogue configuration record in the configuration storage space based on the third index priority. It is understood that in the dialogue configuration table, each dialogue configuration record has a configuration mapping relationship with a reference scenario type identifier; in other words, the configuration dialogue information in each dialogue configuration record conforms to a certain reference scenario type. After obtaining the dialogue configuration table, this embodiment can search for a target reference scenario type identifier that matches the scenario type identifier in at least one reference scenario type identifier contained in the dialogue configuration table, and obtain the target dialogue configuration record that has a configuration mapping relationship with the target reference scenario type identifier from at least one dialogue configuration record contained in the dialogue configuration table. Further, this embodiment can instantiate the target dialogue configuration record in the cache space to obtain a third cache instance for the composite hash value. Here, instantiating the target dialogue configuration record can be understood as storing the dialogue information (configuration dialogue information) contained in the target dialogue configuration record in the cache space as a cache instance. At this point, the obtained third cache instance can be used as a cache instance that matches the composite hash value. Furthermore, in this embodiment, the third cache instance can be obtained from the cache space, and the dialogue output information can be updated by using the third cache dialogue information obtained from the third cache instance. That is, the third cache dialogue information can be used as the dialogue output information when the virtual role object and the business object have a dialogue.
[0111] Optionally, in one possible implementation, this embodiment of the application can obtain the corresponding dialogue information through a large language model and store the obtained dialogue information in a cache space. Specifically, a business configuration table for generating dialogue information can be obtained. Among the multiple prompt word templates contained in the business configuration table, a target prompt word template matching the scene type identifier is obtained. Each prompt word template in the business configuration table corresponds to a reference scene type identifier. In other words, different business scenarios will use different prompt word templates for dialogue generation. It is understood that after obtaining the target prompt word template, the extended behavior parameters matching the extended behavior identifier can be obtained from the extended parameter configuration table indicated by the target prompt word template. It is understood that the extended parameter configuration table indicates the semantic parameters corresponding to each extended behavior identifier under the scene type of the current business scenario, that is, what the extended behavior indicated by the extended behavior identifier is.
[0112] Furthermore, this embodiment can obtain a role configuration table for generating dialogue information, and among the multiple role type parameters included in the role configuration table, obtain a target role type parameter that matches the role type identifier. It can be understood that each role type parameter in the business configuration table corresponds to a reference role type identifier. The role type parameter can be understood as the personality parameter of the reference role type corresponding to the reference role type identifier, including personality trait description, language style setting, identity background description, etc. Here, the target role type parameter can be understood as the personality description of the virtual role object indicated by the role type identifier in the dialogue acquisition request. Further, by extending the behavior parameters and the target role type parameter, the target prompt word template can be improved to obtain dialogue generation prompt words, and a dialogue generation request can be constructed based on the dialogue generation prompt words. Then, the dialogue generation request can be sent to the dialogue generation model, so that the dialogue generation model can generate dialogue information based on the dialogue generation prompt words in the dialogue generation request, obtaining model-generated dialogue information. This embodiment can accept the model-generated dialogue information returned by the dialogue generation model and store the model-generated dialogue information in a first cache instance.
[0113] It is understood that, in this embodiment of the application, a dialogue generation request can be asynchronously sent to the dialogue generation model upon receiving a dialogue acquisition request and consuming a cached dialogue information in a cache instance (e.g., the first cache instance). Alternatively, a dialogue generation request can be sent to the dialogue generation model when there is insufficient unconsumed cached dialogue information in some cache instances (e.g., the first cache instance) in the cache space; no specific limitation is made here. It is understood that the prompt word template contained in the business configuration table can be as follows: "System prompt word: You are an NPC of {personality description}, User prompt word: The current scene is {scene type}, you have performed {extended behavior}, please generate dialogue." It is understood that in the target prompt word template matching the scene type identifier obtained in this embodiment of the application, {scene type} is determined. Subsequently, the extended behavior parameters and target role type parameters can be filled into {extended behavior} and {personality description} respectively to improve the target prompt word template and obtain the dialogue generation prompt words.
[0114] For further details, please see Figure 16 , Figure 16 This is a schematic diagram illustrating a scenario where dialogue information is generated through a model, as provided in an embodiment of this application. Figure 16 As shown, this embodiment of the application can obtain a service configuration table (service configuration table 81a) for generating dialogue information, and perform step S50. From the multiple prompt word templates included in the service configuration table 81a, a target prompt word template matching the scene type identifier 80a is obtained. Each prompt word template in the service configuration table 81a corresponds to a reference scene type identifier. Specifically, the multiple prompt word templates in the service configuration table 81a include prompt word template 812a corresponding to reference scene type identifier 811a, prompt word template 812b corresponding to reference scene type identifier 811b, and prompt word template 812c corresponding to reference scene type identifier 811c. Here, a reference scene type identifier 811c matching the scene type identifier 80a can be found, and then the prompt word template 812c corresponding to the reference scene type identifier 811c can be used as the target prompt word template.
[0115] Understandably, after obtaining the prompt word template 812c, step S51 can be executed to obtain the extended parameter configuration table (extended parameter configuration table 83a) indicated by the prompt word template 812c, and step S52 can be executed to obtain the extended behavior parameter matching the extended behavior identifier 80c from the extended parameter configuration table 83a. Here, the extended parameter configuration table 83a includes the extended behavior parameter 832a corresponding to the reference extended behavior identifier 831a, the extended behavior parameter 832b corresponding to the reference extended behavior identifier 831b, and the extended behavior parameter 832c corresponding to the reference extended behavior identifier 831c. Here, the reference extended behavior identifier 831b matching the extended behavior identifier 80c can be found, and then the extended behavior parameter 832b corresponding to the reference extended behavior identifier 831b can be used as the extended behavior parameter indicated by the extended behavior identifier 80c.
[0116] Furthermore, in this embodiment, a role configuration table (role configuration table 82a) for generating dialogue information can be obtained, and step S53 is executed to obtain the target role type parameter (role type parameter 822c) that matches the role type identifier 80b from the multiple role type parameters (including the role type parameter 822a corresponding to the reference role type identifier 821a, the role type parameter 822b corresponding to the reference role type identifier 821b, and the role type parameter 822c corresponding to the reference role type identifier 821c) included in the role configuration table 82a. Further, step S54 is executed to improve the target prompt word template (prompt word template 812c) by extending the behavior parameter 832c and the role type parameter 822c, obtaining the dialogue generation prompt word (prompt word 84a). Then, step S55 is executed to input the prompt word 84a into the dialogue generation model 85a, so that the dialogue generation model 85a generates dialogue information based on the prompt word 84a, and step S56 is executed to output the model-generated dialogue information (dialogue information 86a).
[0117] In one possible implementation, the first cache instance includes at least one dialogue cache group, wherein one dialogue cache group corresponds to one cache group identifier, one dialogue cache group includes multiple cache entries, and one cache entry corresponds to one entry index. In this embodiment, when storing model-generated dialogue information in the first cache instance, the vacant cache group identifier indicated by the first cache instance can be obtained, and a filling cache group identifier matching the vacant cache group identifier can be found among the at least one cache group identifier included in the first cache instance. Here, the vacant cache group identifier is used to indicate the dialogue cache group in the first cache instance that needs to be filled. Further, the filling dialogue cache group corresponding to the filling cache group identifier can be obtained from at least one dialogue cache group, and the fourth consumption pointer indicated by the filling dialogue cache group can be obtained. Then, among the multiple entry indices included in the filling dialogue cache group, the next entry index corresponding to the entry index of the cache entry indicated by the fourth consumption pointer can be used as the filling entry index. Furthermore, among the multiple cache entries included in the dialog cache group, the fill cache entry corresponding to the fill entry index can be obtained, the cache entry indicated by the fourth consumer pointer can be modified into the fill cache entry, and the model-generated dialog information can be stored in the fill cache entry. In other words, when filling the dialog cache group in the cache instance with model-generated dialog information, the present application embodiment can fill the model-generated dialog information into the next entry of the cache entry indicated by the consumer pointer of the current dialog cache group, and point the consumer pointer to the filled cache entry, thereby realizing the filling of model-generated dialog information.
[0118] For further details, please see Figure 17 , Figure 17 This is a schematic diagram illustrating a scenario for updating a cache instance via dialogue, as provided in an embodiment of this application. Figure 17As shown, the cache instance 90a (e.g., the first cache instance) that matches the extended behavior identifier 80c, scene type identifier 80a, and role type identifier 80b includes at least one dialogue cache group (including cache group 91a and cache group 91b). In this embodiment, when storing model-generated dialogue information in cache instance 90a, the vacant cache group identifier (vacant group index: 0) indicated by cache instance 90a can be obtained, and a filling cache group identifier matching the vacant cache group identifier can be found among the at least one cache group identifier included in cache instance 90a. Here, the vacant cache group identifier is used to indicate the dialogue cache group that needs to be filled in cache instance 90a. Further, the filling dialogue cache group (cache group 91a) corresponding to the filling cache group identifier can be obtained from at least one dialogue cache group. Furthermore, the fourth consumption pointer (consumption pointer 911a) indicated by cache group 91a can be obtained. Then, among the multiple entry indices included in cache group 91a, the next entry index (1) of the entry index (0) corresponding to the cache entry indicated by consumption pointer 911a (the cache entry with entry index 0) can be used as the fill entry index. Furthermore, among the multiple cache entries included in cache group 91a, the fill cache entry (entry 1) corresponding to the fill entry index can be obtained. Then, the consumption pointer can be shifted one position to the right, modifying the cache entry indicated by consumption pointer 911a to the fill cache entry (entry 1). At this time, the index value corresponding to consumption pointer 911a is 1. Furthermore, the model-generated dialogue information (dialogue information 86a: E5) can be used to update the cached dialogue information corresponding to entry 1.
[0119] In one possible implementation, after receiving the model-generated dialogue information returned by the dialogue generation model, this embodiment of the application can persist the model-generated dialogue information to the business database. Specifically, a cache instance record update request can be generated based on the model-generated dialogue information and its corresponding multiple dimension identifiers (including role type identifier, scene type identifier, and extended behavior identifier). Then, the cache instance record update request can be sent to the business database, so that the business database can find the target cache instance record that matches all three identifiers (role type identifier, scene type identifier, and extended behavior identifier) among multiple cache instance records, and update the target cache instance record using the model-generated dialogue.
[0120] It is understood that, in the embodiments of this application, the cache index layer of the game application can achieve accurate cache instance location and complete content isolation through a three-key composite primary key (including scene type identifier, character type identifier, and extended behavior identifier) and zero-serialization hash (multiple-order rolling hash calculation). At the same time, through three-level step-by-step fallback, it can automatically complete recovery or reconstruction when the cache instance in the cache space does not exist. Both of these ensure that requests (dialogue acquisition requests) with any combination of dimensions can obtain correct and independent dialogue output information in any running state, thereby improving the accuracy and diversity of dialogue output information acquisition.
[0121] For further details, please see Figure 18 , Figure 18 This is a schematic diagram of the structure of a dialogue processing device provided in an embodiment of this application. Figure 18 As shown, the dialogue processing device 1 can be a computer program (including program code) running on a computer device. For example, the dialogue processing device 1 can be an application software, and the dialogue processing device 1 can be used to execute the functions provided in the embodiments of this application. Figure 4 and Figure 12 The corresponding steps in the method.
[0122] The device 1 includes: a request identifier acquisition module 11, a composite hash calculation module 12, a cache hash lookup module 13, and a dialogue information acquisition module 14; The request identifier acquisition module 11 is used to receive the dialogue acquisition request sent by the game business layer through the cache index layer, and to obtain the role type identifier of the virtual character object, the scene type identifier of the business scene in which the virtual character object is located, and the extended behavior identifier from the dialogue acquisition request; the virtual character object refers to the object used to communicate with the business object; the extended behavior identifier is used to describe the extended behavior performed by the virtual character object in the business scene; The composite hash calculation module 12 is used to perform hash calculation on the composite byte structure based on each composite byte in the composite byte structure when the composite byte structure is constructed by the role type identifier, scene type identifier and extended behavior identifier, so as to obtain the composite hash value for the composite byte structure. The cache hash lookup module 13 is used to find the first cache hash value that matches the composite hash value in the cache index layer; If the dialogue information acquisition module 14 finds the first cache hash value, it retrieves the first cache instance corresponding to the first cache hash value from the cache index layer, and uses the first cache dialogue information obtained from the first cache instance as the dialogue output information to respond to the dialogue acquisition request. The dialogue output information is then returned to the game business layer so that the game business layer can control the virtual character object to use the dialogue output information to communicate with the business object.
[0123] The cache index layer includes a cache space for storing composite byte structures; Before performing the step of constructing a composite byte structure using the role type identifier, scene type identifier, and extended behavior identifier, the composite hash calculation module 12 is also used for: Obtain the role type value indicated by the role type identifier, perform byte conversion on the role type value, and obtain the role type identifier bytes corresponding to the role type identifier; Obtain the scene type value indicated by the scene type identifier, perform byte conversion on the scene type value, and obtain the scene type identifier bytes for the scene type identifier; Obtain the extended behavior value indicated by the extended behavior identifier, perform byte conversion on the extended behavior value, and obtain the extended behavior identifier bytes for the extended behavior identifier; Obtain the structure construction strategy related to the cache index layer. Based on the structure construction strategy, determine each byte in the role type identifier byte, scene type identifier byte, and extended behavior identifier byte as a composite byte, and construct a composite byte structure using all the determined composite bytes.
[0124] The composite hash calculation module 12 is also used for: When constructing a composite byte structure using all determined composite bytes, the number of bytes in all composite bytes is determined as the composite byte length for the composite byte structure, and byte length storage space is configured for the composite byte length. Configure a structure storage space in the cache space that matches the length of the composite byte structure, and obtain the storage space index address of the structure storage space in the cache space. When storing the storage space index address into the byte-length storage space, the composite byte structure is stored associatively in the structure storage space.
[0125] The cache index layer includes a cache space with a first index priority, a composite byte structure is stored in the structure storage space of the cache space, and the storage space index address corresponding to the structure storage space is stored in the byte length storage space corresponding to the composite byte length of the composite byte structure. When performing the step of hashing the composite byte structure based on each composite byte in the composite byte structure to obtain the composite hash value for the composite byte structure, the composite hash calculation module 12 is specifically used for: Access the cache space according to the first index priority, and read the storage space index address and composite byte length from the byte length storage space of the cache space; Obtain the hash calculation function used for structure hash calculation, and pass the storage space index address and composite byte length to the hash calculation function; The hash calculation function accesses the structure storage space based on the storage space index address, and reads the composite byte structure from the structure storage space until each composite byte with a composite byte length is read. According to the byte-level hash calculation method indicated by the hash calculation function, hash calculation is performed on each composite byte to obtain the composite hash value for the composite byte structure.
[0126] In each composite byte, any two adjacent bytes at adjacent positions include the first byte and the second byte, where the first byte is the byte preceding the second byte; When performing the step of hashing each composite byte according to the byte-level hashing method indicated by the hashing function to obtain the composite hash value for the composite byte structure, the composite hashing module 12 is specifically used for: According to the byte-level hash calculation method indicated by the hash calculation function, obtain the initial hash value and hash calculation parameters for hashing the first byte, and multiply the initial hash value and hash calculation parameters to obtain the first multiplication result; the initial hash value is obtained by hashing the byte preceding the first byte. The byte value of the first byte is added to the first multiplication result to obtain the first addition result, and the first addition result is used as the first hash value corresponding to the first byte; The initial hash value is updated by hashing the first hash value using the byte-level hash calculation method, and the updated initial hash value is obtained for hashing the second byte. The initial hash update value and the hash calculation parameters are multiplied to obtain the second multiplication result. The byte value of the second byte is then added to the second multiplication result to obtain the second addition result. The second addition result is used as the second hash value corresponding to the second byte. The composite hash value for the composite byte structure is determined based on the second hash value.
[0127] For details on the implementation of the request identifier acquisition module 11 and the composite hash calculation module 12, please refer to the above. Figure 4 The descriptions of steps S101 and S102 in the corresponding implementation will not be repeated here.
[0128] The cache index layer includes a cache space with a first index priority; the cache space stores a cache hash table containing at least one cache hash value. When performing the step of searching for a first cached hash value that matches the composite hash value in the cache index layer, the cache hash lookup module 13 is specifically used for: Access the cache space of the cache index layer based on the first index priority, and read the cache hash table from the cache space; In at least one cache hash value contained in the cache hash table, find the cache hash value that matches the composite hash value; the cache hash value that matches the composite hash value is the first cache hash value.
[0129] The cache index layer includes a cache space for storing N cache instances, and a cache hash table associated with each of the N cache instances. The cache hash table stores the cache hash value that is mapped to each of the N cache instances, and the cache hash value stored in the cache hash table includes at least the first cache hash value. N is a positive integer. When the dialogue information acquisition module 14 performs the step of retrieving the first cache instance corresponding to the first cache hash value from the cache index layer, it is specifically used for: Retrieve the cache hash table from the cache space of the cache index layer, and obtain the cache instance that has a mapping relationship with the first cache hash value through the cache hash table; The obtained cache instance is used as the first cache instance corresponding to the first cache hash value.
[0130] The mapping relationship includes the address mapping relationship; the address mapping relationship is used to indicate the relationship between the first cache hash value and the instance space index address of the first cache instance in the cache hash table; When the dialogue information acquisition module 14 performs the step of retrieving the cache instance that has a mapping relationship with the first cache hash value through the cache hash table, it is specifically used for: Read the instance space index address that has an address mapping relationship with the first cache hash value from the cache hash table, and use the read instance space index address as the first instance space index address corresponding to the first cache hash value; The first instance storage space in the cache index layer is determined by the first instance space index address, and the cache instance obtained from the first instance storage space is used as the first cache instance corresponding to the first cache hash value.
[0131] For details on the implementation of the cache hash lookup module 13 and the dialogue information acquisition module 14, please refer to the above. Figure 4 The descriptions of steps S103 and S104 in the corresponding implementation will not be repeated here.
[0132] The cache index layer includes a cache space with a first index priority and a business database with a second index priority; the first index priority is higher than the second index priority; the business database is used to store at least one cache instance record related to a cache instance. Device 1 also includes an instance record query module 15, specifically used for: If the first cache hash value is not found in the cache space based on the first index priority, the request context in the dialog request is obtained, and when the callback function structure is constructed based on the request context, the database query request is constructed based on the role type identifier, scene type identifier and extended behavior identifier carried in the request context. Based on the second index priority, a database query request is sent to the business database. The business database then searches for a target cache instance record that matches the role type identifier, scene type identifier, and extended behavior identifier in at least one cache instance record based on the database query request. If the target cache instance record is found, the target cache instance record is instantiated in the cache space through the callback function structure to obtain the second cache instance, and the dialogue output information is updated through the second cache dialogue information obtained from the second cache instance.
[0133] Specifically, when the instance record query module 15 executes the step of searching for a target cached instance record that matches the role type identifier, scene type identifier, and extended behavior identifier in at least one cached instance record based on a database query request from the business database, it is used for: Obtain the multi-dimensional indexing strategy related to the business database. The business database then retrieves the first-dimensional index information from the multiple-dimensional index information contained in the database query request according to the multi-dimensional indexing strategy. The multiple-dimensional index information includes at least the role type identifier, scenario type identifier, and extended behavior identifier used for multi-dimensional indexing. If the first dimension index information is a role type identifier, then search for a cache instance record that matches the role type identifier in at least one cache instance record, and use the found cache instance record as the first cache instance record; The business database retrieves the second-dimensional index information from multiple-dimensional index information according to the multi-dimensional index strategy. When the second-dimensional index information is a scenario type identifier, it searches for a cache instance record that matches the scenario type identifier in the first cache instance record and uses the found cache instance record as the second cache instance record. The business database retrieves the third-dimensional index information from multiple dimension index information according to the multi-dimensional index strategy. When the third-dimensional index information is an extension behavior identifier, it searches for a cache instance record that matches the extension behavior identifier in the second cache instance record and uses the found cache instance record as the target cache instance record that matches the database query request.
[0134] The callback function structure includes the request context and a pointer to the callback function associated with the request context; Before executing the step of instantiating the target cache instance record in the cache space through the callback function structure, the instance record query module 15 is also used for: When the target cache instance record is backfilled into the request context, the callback function pointer of the callback function structure is obtained, and the query callback function pointed to by the callback function pointer is called to read the target cache instance record backfilled in the request context, so as to perform the step of instantiating the target cache instance record in the cache space.
[0135] Specifically, when the instance record query module 15 executes the instantiation process of the target cache instance record in the cache space through the callback function structure to obtain the second cache instance, it is used for: The target cache instance record to be filled into the request context is obtained through the callback function structure; Perform deserialization processing on the target cache instance record described in serialization in the cache space to obtain the cache instance described in deserialization. Configure a second instance storage space for the obtained cache instance in the cache space, and cache the second cache instance in the second instance storage space.
[0136] The cache space stores a cache hash table containing at least one cache hash value; a cache hash value corresponds to the instance space index address of an instance storage space in the cache space, and an instance storage space is used to store a cache instance; Instance record query module 15 is also used for: When caching the second cache instance in the second instance storage space, obtain the index address of the second instance storage space. When using the composite hash value corresponding to the second cache instance as the second cache hash value, an address mapping relationship is established between the second cache hash value and the space index address of the second instance, and the cache hash table is updated based on the address mapping relationship.
[0137] For details on the implementation process of the instance record query module 15, please refer to the above. Figure 4 The description of step S104 in the corresponding implementation will not be repeated here.
[0138] The cache index layer also includes a configuration storage space with a third index priority, which is lower than the second index priority. Device 1 also includes a configuration dialog lookup module 16, used for: If the target cache instance record is not found in the business database based on the second index priority, the configuration storage space is accessed based on the third index priority, and the dialog configuration table containing at least one dialog configuration record is obtained from the configuration storage space; the space type of the configuration storage space is different from the space type of the cache space; the dialog configuration table is used to store the configuration mapping relationship between a dialog configuration record and a reference scenario type identifier; In the dialogue configuration table, find the target reference scene type identifier that matches the scene type identifier in at least one reference scene type identifier, and in at least one dialogue configuration record, take the dialogue configuration record that has a configuration mapping relationship with the target reference scene type identifier as the target dialogue configuration record. The target dialogue configuration record is configured and instantiated in the cache space to obtain a third cache instance, and the dialogue output information is updated by obtaining the third cache dialogue information from the third cache instance.
[0139] Specifically, when the configuration dialogue lookup module 16 performs the step of instantiating the target dialogue configuration record in the cache space to obtain a third cache instance, it is used for: Obtain the list of configuration dialogue information indicated by the target dialogue configuration record, and count the number of multiple configuration dialogue information contained in the list of configuration dialogue information to obtain the number of dialogue information for the list of configuration dialogue information. Create an index cache array containing multiple array elements based on the number of dialogue messages, obtain the configuration sequence number of each configuration dialogue message in the configuration dialogue message list, fill each configuration dialogue message into the array element of the index cache array based on the configuration sequence number of each configuration dialogue message, and determine the filled index cache array as the index dialogue cache array. The configuration dialogue information corresponding to each array element in the index dialogue cache array is adjusted, and the adjusted index dialogue cache array is used as the adjusted index cache array. To adjust the index cache array, a configuration dialog cache group is created. Based on the element indices contained in the adjustment index cache array, the configuration dialog information corresponding to the element indices is updated to the configuration dialog cache group, resulting in a configuration update dialog cache group. A third cache instance is then constructed based on the configuration update dialog cache group.
[0140] Specifically, when the configuration dialogue lookup module 16 performs the step of filling each configuration dialogue information into the array element of the index cache array based on the configuration sequence number of each configuration dialogue information, it is used for: Select one configuration dialog from multiple configuration dialogs as the target configuration dialog, and use the configuration sequence number of the target configuration dialog as the target configuration sequence number; Search for the target element index that matches the target configuration sequence number among the multiple element indices contained in the index cache array; Among the multiple array elements contained in the index cache array, retrieve the first target array element corresponding to the target element index, and fill the target configuration dialog information into the first target array element; When selecting each of the multiple configuration dialog messages as the target configuration dialog message, each configuration dialog message is populated into an array element of the index cache array.
[0141] Specifically, when the configuration dialogue lookup module 16 performs information adjustment processing on the configuration dialogue information corresponding to each array element in the index dialogue cache array, and uses the adjusted index dialogue cache array as the index cache array, it is used for the following steps: The multiple array elements contained in the indexed dialog cache array are each taken as the first array element, and the first array element corresponding to the element with the smallest index value is selected from the multiple first array elements as the target first array element; Based on the element index of the target first array element and the number of elements in the index dialogue cache array, obtain the uniformly random index configured for the target first array element, and find the first array element corresponding to the element index that matches the uniformly random index among multiple first array elements, which is used as the exchange array element for exchanging information with the target first array element; The configuration dialog information indicated by the target first array element and the configuration dialog information indicated by the exchange array element are processed for information exchange, and the target first array element is removed from the multiple first array elements; When each of the multiple first array elements is selected as the target first array element, the information adjustment processing of the configuration dialogue information corresponding to each array element in the multiple array elements contained in the index dialogue cache array is completed, and the index dialogue cache array after information adjustment processing is used as the adjusted index cache array.
[0142] The configuration dialogue cache group includes a first configuration dialogue cache group and a second configuration dialogue cache group; When configuring the dialog lookup module 16 performs the step of updating the configuration dialog cache group by adjusting the element indices contained in the index cache array and updating the configuration dialog cache group accordingly, it is specifically used for: Select even-numbered element indices with even index values from the element indices contained in the adjusted index cache array, and sort the index values of each element in the even-numbered element indices to obtain the first dialog filling order; In the adjusted index cache array, the even-numbered array element corresponding to the even-numbered element index is obtained. Based on the first dialogue filling order, the configuration dialogue information corresponding to each even-numbered array element in the even-numbered array element is filled into the cache entry of the first configuration dialogue cache group to obtain the filled first configuration dialogue cache group. Select the odd-numbered element index with an odd index value from the element indexes contained in the adjusted index cache array, and sort the index values of each element index in the odd-numbered element indexes to obtain the second dialogue filling order; In the adjusted index cache array, the odd array element corresponding to the odd element index is obtained. Based on the second dialogue filling order, the configuration dialogue information corresponding to each odd array element in the odd array element is filled into the cache entry of the second configuration dialogue cache group to obtain the filled second configuration dialogue cache group. The populated first configuration dialog cache group and the populated second configuration dialog cache group are used as the configuration update dialog cache group.
[0143] The configuration update dialogue cache group includes a first configuration dialogue cache group and a second configuration dialogue cache group; When configuring the dialog lookup module 16 to execute the step of building a third cache instance based on the configuration update dialog cache group, it is specifically used for: Get the first number of cache entries contained in the first configuration dialog cache group and the second number of cache entries contained in the second configuration dialog cache group; Configure a first consumption pointer for a first configuration dialogue cache group based on the first number of entries, and configure a second consumption pointer for a second configuration dialogue cache group based on the second number of entries; Obtain the cache group identifier of the first configuration dialog cache group, and use the obtained cache group identifier as the first active cache group identifier; A third cache instance is constructed based on the first configured dialogue cache group, the first consumer pointer, the second configured dialogue cache group, the second consumer pointer, and the first active cache group identifier.
[0144] For details on the implementation process of configuring the dialog search module 16, please refer to the above. Figure 4The description of step S104 in the corresponding implementation will not be repeated here.
[0145] The first cache instance includes an active cache group identifier and at least one conversation cache group; When the dialogue information acquisition module 14 executes the step of using the first cached dialogue information obtained from the first cache instance as dialogue output information in response to the dialogue acquisition request, it specifically performs the following: Use the active cache group identifier included in the first cache instance as the second active cache group identifier, and obtain the cache group identifier of each conversation cache group in at least one conversation cache group included in the first cache instance. In each dialogue cache group, find the target cache group identifier that matches the second active cache group identifier, and take the dialogue cache group corresponding to the target cache group identifier as the active dialogue cache group determined for the second active cache group identifier. The consumption pointer indicated by the active dialogue cache group is used as the third consumption pointer, and the cached dialogue information in the active dialogue cache group is consumed based on the third consumption pointer to obtain the cached dialogue information after information consumption. When using the cached dialogue information after information consumption as the first cached dialogue information obtained from the first cache instance, the first cached dialogue information is used as the dialogue output information to respond to the dialogue retrieval request.
[0146] The active dialogue cache group includes multiple cache entries, and each cache entry corresponds to an entry index; When the dialogue information acquisition module 14 performs the step of consuming cached dialogue information in the active dialogue cache group based on the third consumption pointer to obtain the consumed cached dialogue information, it is specifically used for: The index of the cache entry pointed to by the third consumer pointer is used as the consumer entry index. A random index is generated based on the index value of the consumer entry index to obtain the random entry index. The index value of the random entry index is less than or equal to the index value of the consumer entry index. Among multiple cache entries, the cache entry corresponding to the random entry index is used as the target cache entry, and the cache entry corresponding to the consumer entry index is used as the consumer cache entry; The cache dialogue information corresponding to the target cache entry and the cache dialogue information corresponding to the consumer cache entry are swapped. The cache entry pointed to by the third consumer pointer is changed from the consumer cache entry to the previous cache entry corresponding to the previous entry index of the consumer entry index. The previous cache entry is the cache entry that is adjacent to the consumer cache entry and is located before the consumer cache entry among multiple cache entries. When the cache entry pointed to by the third consumer pointer is the previous cache entry, the cache dialogue information corresponding to the consumed cache entry will be used as the cache dialogue information after information consumption.
[0147] The device 1 also includes a dialogue information generation module 17, used for: Obtain the business configuration table used for generating dialogue information. Among the multiple prompt word templates contained in the business configuration table, obtain the target prompt word template that matches the scene type identifier. In the extended parameter configuration table indicated by the target prompt word template, obtain the extended behavior parameter that matches the extended behavior identifier. Obtain the role configuration table used for generating dialogue information, and among the multiple role type parameters contained in the business configuration table, obtain the target role type parameter that matches the role type identifier; By expanding the behavior parameters and target role type parameters, the target prompt word template is improved to obtain the dialogue generation prompt words, and a dialogue generation request is constructed based on the dialogue generation prompt words; Send a dialogue generation request to the dialogue generation model so that the dialogue generation model can generate dialogue information according to the dialogue generation prompts in the dialogue generation request, and obtain the model-generated dialogue information. Receive the model-generated dialogue information returned by the dialogue generation model and store the model-generated dialogue information in the first cache instance.
[0148] The first cache instance includes at least one conversation cache group; one conversation cache group corresponds to one cache group identifier; one conversation cache group includes multiple cache entries, and one cache entry corresponds to one entry index; When performing the step of storing the dialogue information generated by the model in the first cache instance, the dialogue information generation module 17 is specifically used for: Obtain the empty cache group identifier indicated by the first cache instance, and among at least one cache group identifier included in the first cache instance, use the cache group identifier that matches the empty cache group identifier as the filling cache group identifier. In at least one dialogue cache group, the dialogue cache group corresponding to the filling cache group identifier is used as the filling dialogue cache group, and the fourth consumption pointer indicated by the filling dialogue cache group is obtained. Among the multiple entry indices included in the populated dialog cache group, the entry index corresponding to the cache entry indicated by the fourth consumer pointer is taken as the populated entry index, and the next entry index of the populated entry index is taken as the populated entry index. Among the multiple cache entries included in the populated dialogue cache group, the cache entry corresponding to the populated entry index is used as the populated cache entry, the cache entry indicated by the fourth consumption pointer is modified from the cache entry corresponding to the populated entry index to the populated cache entry, and the model-generated dialogue information is stored in the populated cache entry.
[0149] The dialogue information generation module 17, after performing the step of receiving the model-generated dialogue information returned by the dialogue generation model, is further used for: Based on the model, dialogue information, role type identifier, scene type identifier, and extended behavior identifier are generated to generate cache instance record update requests; The cache instance record update request is sent to the business database so that the business database can find the target cache instance record that matches the role type identifier, scene type identifier, and extended behavior identifier among multiple cache instance records, and update the target cache instance record by generating dialogue information through the model.
[0150] For details on the implementation process of the dialogue information generation module 17, please refer to the above. Figure 13 The description of step S208 in the corresponding implementation will not be repeated here.
[0151] Further, please see Figure 19 , Figure 19 This is a schematic diagram of the structure of a computer device provided in an embodiment of this application. Figure 19 As shown, the computer device 1000 can be a user terminal, for example, the one described above. Figure 1 The user terminal 10a in the corresponding embodiment can also be a server, for example, as described above. Figure 1 The server 10d in the corresponding embodiment will not be limited here. For ease of understanding, this application takes a computer device as a user terminal as an example. The computer device 1000 may include: a processor 1001, a network interface 1004, and a memory 1005. In addition, the computer device 1000 may also include: a user interface 1003, and at least one communication bus 1002. The communication bus 1002 is used to realize the connection and communication between these components. The user interface 1003 may also include a standard wired interface and a wireless interface. The network interface 1004 may optionally include a standard wired interface and a wireless interface (such as a Wi-Fi interface). The memory 1005 may be a high-speed RAM memory or a non-volatile memory, such as at least one disk storage device. The memory 1005 may also optionally be at least one storage device located away from the aforementioned processor 1001. Figure 19As shown, the memory 1005, which is a computer-readable storage medium, may include an operating system, a network communication module, a user interface module, and a device control application.
[0152] The network interface 1004 in the computer device 1000 can also provide network communication functions, and a user interface 1003 is optional. Figure 19 In the computer device 1000 shown, the network interface 1004 provides network communication functionality; the user interface 1003 is mainly used to provide an input interface for the user; and the processor 1001 can be used to call the device control application stored in the memory 1005 to implement the aforementioned... Figure 4 or Figure 13 The description of the dialogue processing method in the corresponding embodiments can also be executed as described above. Figure 18 The description of the dialogue processing device 1 in the corresponding embodiments will not be repeated here. Furthermore, the beneficial effects of using the same method will also not be repeated here.
[0153] Furthermore, it should be noted that this application embodiment also provides a computer-readable storage medium, which stores a computer program executed by the aforementioned dialogue processing device 1. The computer program includes computer instructions, and when the processor executes the computer instructions, it can execute the aforementioned... Figure 4 or Figure 13 The description of the dialogue processing method in the corresponding embodiments is already provided and will not be repeated here. Furthermore, the beneficial effects of using the same method will also not be repeated. For technical details not disclosed in the computer-readable storage medium embodiments related to this application, please refer to the description of the method embodiments of this application.
[0154] Furthermore, it should be noted that this application also provides a computer program product, which may include a computer program that can be stored in a computer-readable storage medium. The processor of a computer device reads the computer program from the computer-readable storage medium, and the processor can execute the computer program, causing the computer device to perform the aforementioned... Figure 4 or Figure 13 The description of the dialogue processing method in the corresponding embodiments is already provided and will not be repeated here. Furthermore, the beneficial effects of using the same method will also not be repeated. For technical details not disclosed in the computer program products or computer program embodiments related to this application, please refer to the description of the method embodiments of this application.
[0155] It should be noted that, for the sake of simplicity, the foregoing method embodiments are all described as a series of actions. However, those skilled in the art should understand that this application is not limited to the described order of actions, as some steps may be performed in other orders or simultaneously according to this application. Furthermore, those skilled in the art should also understand that the embodiments described in the specification are preferred embodiments, and the actions and modules involved are not necessarily essential to this application.
[0156] In the embodiments of this application, the terms "module" or "unit" refer to a computer program or part of a computer program that has a predetermined function and works with other related parts to achieve a predetermined goal, and can be implemented wholly or partially using software, hardware (such as processing circuitry or memory), or a combination thereof. Similarly, a processor (or multiple processors or memory) can be used to implement one or more modules or units. Furthermore, each module or unit can be part of an overall module or unit that includes the functionality of that module or unit.
[0157] The steps in the method of this application embodiment can be adjusted, combined, or deleted according to actual needs.
[0158] The modules in the device of this application embodiment can be merged, divided, and deleted according to actual needs.
[0159] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a computer-readable storage medium, and when executed, it can include the processes of the embodiments of the methods described above. The storage medium can be a magnetic disk, optical disk, read-only memory (ROM), or random access memory (RAM), etc.
[0160] The above-disclosed embodiments are merely preferred embodiments of this application and should not be construed as limiting the scope of this application. Therefore, any equivalent variations made in accordance with the claims of this application shall still fall within the scope of this application.
Claims
1. A dialogue processing method, characterized in that, The method includes: The cache index layer receives a dialogue retrieval request sent by the game business layer, and retrieves the character type identifier of the virtual character object, the scene type identifier of the business scene in which the virtual character object is located, and the extended behavior identifier from the dialogue retrieval request; the virtual character object refers to the object used to communicate with the business object; the extended behavior identifier is used to describe the extended behavior performed by the virtual character object in the business scene; When constructing a composite byte structure using the role type identifier, the scene type identifier, and the extended behavior identifier, a hash calculation is performed on the composite byte structure based on each composite byte in the composite byte structure to obtain a composite hash value for the composite byte structure. Search in the cache index layer for a first cache hash value that matches the composite hash value; If the first cache hash value is found, the first cache instance corresponding to the first cache hash value is obtained from the cache index layer, and the first cache dialogue information obtained from the first cache instance is used as dialogue output information to respond to the dialogue retrieval request. The dialogue output information is returned to the game business layer so that the game business layer can control the virtual character object to use the dialogue output information to have a dialogue with the business object.
2. The method according to claim 1, characterized in that, The cache index layer includes a cache space for storing the composite byte structure; Before constructing the composite byte structure using the role type identifier, the scene type identifier, and the extended behavior identifier, the method further includes: Obtain the role type value indicated by the role type identifier, and perform byte conversion on the role type value to obtain the role type identifier bytes for the role type identifier; Obtain the scene type value indicated by the scene type identifier, perform byte conversion on the scene type value, and obtain the scene type identifier bytes for the scene type identifier; Obtain the extended behavior value indicated by the extended behavior identifier, and perform byte conversion on the extended behavior value to obtain the extended behavior identifier bytes for the extended behavior identifier; Obtain the structure construction strategy related to the cache index layer, and based on the structure construction strategy, determine each byte in the role type identifier byte, the scene type identifier byte, and the extended behavior identifier byte as a composite byte, and construct the composite byte structure by using all the determined composite bytes.
3. The method according to claim 2, characterized in that, The method further includes: When constructing the composite byte structure using all determined composite bytes, the number of bytes in all composite bytes is determined as the composite byte length for the composite byte structure, and byte length storage space is configured for the composite byte length. Configure a structure storage space in the cache space that matches the length of the composite byte structure, and obtain the storage space index address of the structure storage space in the cache space; When storing the storage space index address into the byte-length storage space, the composite byte structure is associated and stored in the structure storage space.
4. The method according to claim 1, characterized in that, The cache index layer includes a cache space with a first index priority. The composite byte structure is stored in the structure storage space of the cache space, and the storage space index address corresponding to the structure storage space is stored in the byte length storage space corresponding to the composite byte length of the composite byte structure. The step of performing a hash calculation on the composite byte structure based on each composite byte in the composite byte structure to obtain a composite hash value for the composite byte structure includes: Access the cache space according to the first index priority, and read the storage space index address and the composite byte length from the byte length storage space of the cache space; Obtain the hash calculation function for performing structure hash calculation, and transmit the storage space index address and the composite byte length to the hash calculation function; The hash calculation function accesses the structure storage space based on the storage space index address, and reads the composite byte structure from the structure storage space until each composite byte with the composite byte length is read; According to the byte-level hash calculation method indicated by the hash calculation function, the hash calculation is performed on each composite byte to obtain the hash value of each composite byte, and the composite hash value for the composite byte structure is determined by the hash value of each composite byte.
5. The method according to claim 4, characterized in that, The adjacent bytes at any two adjacent positions in each composite byte include the first byte and the second byte, wherein the first byte is the byte preceding the second byte; The step of performing hash calculations on each composite byte according to the byte-level hash calculation method indicated by the hash calculation function to obtain the hash value of each composite byte, and determining the composite hash value for the composite byte structure using the hash values of each composite byte, includes: According to the byte-level hash calculation method indicated by the hash calculation function, the initial hash value and hash calculation parameters for hashing the first byte are obtained, and the initial hash value and the hash calculation parameters are multiplied to obtain the first multiplication result; the initial hash value is obtained by hashing the byte preceding the first byte. The byte value of the first byte and the first multiplication result are added together to obtain a first addition result, and the first addition result is used as the first hash value corresponding to the first byte; The initial hash value is updated by hashing the first hash value according to the byte-level hash calculation method to obtain the initial hash update value for hashing the second byte; The initial hash update value and the hash calculation parameter are multiplied to obtain a second multiplication result. The byte value of the second byte and the second multiplication result are added to obtain a second addition result. The second addition result is used as the second hash value corresponding to the second byte. The composite hash value for the composite byte structure is determined based on the second hash value.
6. The method according to claim 1, characterized in that, The cache index layer includes a cache space with a first index priority; the cache space stores a cache hash table containing at least one cache hash value; The step of searching for a first cache hash value that matches the composite hash value in the cache index layer includes: Access the cache space of the cache index layer based on the first index priority, and read the cache hash table from the cache space; Among the at least one cache hash value contained in the cache hash table, a cache hash value that matches the composite hash value is found; the cache hash value that matches the composite hash value is the first cache hash value.
7. The method according to claim 1, characterized in that, The cache index layer includes a cache space for storing N cache instances, and the cache space stores a cache hash table associated with the N cache instances; The cache hash table is used to store cache hash values that have a mapping relationship with each of the N cache instances, and the cache hash values stored in the cache hash table include at least the first cache hash value; N is a positive integer; The step of obtaining the first cache instance corresponding to the first cache hash value from the cache index layer includes: The cache hash table is obtained from the cache space of the cache index layer, and a cache instance that has a mapping relationship with the first cache hash value is obtained through the cache hash table; The obtained cache instance is used as the first cache instance corresponding to the first cache hash value.
8. The method according to claim 7, characterized in that, The mapping relationship includes an address mapping relationship; the address mapping relationship is used to indicate the relationship between the first cache hash value and the instance space index address of the first cache instance in the cache hash table; The step of obtaining a cache instance that has a mapping relationship with the first cache hash value through the cache hash table includes: Read the instance space index address that has the address mapping relationship with the first cache hash value from the cache hash table, and use the read instance space index address as the first instance space index address corresponding to the first cache hash value; The first instance storage space in the cache index layer is determined by the first instance space index address, and the cache instance obtained from the first instance storage space is used as the first cache instance corresponding to the first cache hash value.
9. The method according to claim 1, characterized in that, The cache index layer includes a cache space with a first index priority and a business database with a second index priority; the first index priority is higher than the second index priority. The business database is used to store at least one cache instance record related to a cache instance; The method further includes: If the first cache hash value is not found in the cache space based on the first index priority, the request context in the dialogue acquisition request is obtained, and when the callback function structure is constructed based on the request context, a database query request is constructed based on the role type identifier, the scene type identifier, and the extended behavior identifier carried in the request context. Based on the second index priority, the database query request is sent to the business database, and the business database searches for a target cache instance record that matches the role type identifier, the scene type identifier, and the extended behavior identifier in the at least one cache instance record based on the database query request. If the target cache instance record is found, the target cache instance record is instantiated in the cache space through the callback function structure to obtain a second cache instance, and the dialogue output information is updated through the second cache dialogue information obtained from the second cache instance.
10. The method according to claim 9, characterized in that, The step of searching for a target cache instance record that matches the role type identifier, the scene type identifier, and the extended behavior identifier in at least one cache instance record based on the database query request by the business database includes: A multi-dimensional indexing strategy related to the business database is obtained, and the business database obtains the first dimension index information from the multiple dimension index information contained in the database query request according to the multi-dimensional indexing strategy; the multiple dimension index information includes at least the role type identifier, the scene type identifier, and the extended behavior identifier used for multi-dimensional indexing; If the first dimension index information is the role type identifier, then search for a cache instance record that matches the role type identifier in the at least one cache instance record, and use the found cache instance record as the first cache instance record; The business database obtains the second dimension index information from the multiple dimension index information according to the multi-dimensional index strategy. When the second dimension index information is the scene type identifier, the database searches for a cache instance record that matches the scene type identifier in the first cache instance record and uses the found cache instance record as the second cache instance record. The business database obtains the third-dimensional index information from the multiple-dimensional index information according to the multi-dimensional index strategy. When the third-dimensional index information is the extended behavior identifier, the database searches for a cache instance record that matches the extended behavior identifier in the second cache instance record and uses the found cache instance record as the target cache instance record that matches the database query request.
11. The method according to claim 9, characterized in that, The instantiation of the target cache instance record in the cache space through the callback function structure to obtain the second cache instance includes: The target cache instance record to be filled back into the request context is obtained through the callback function structure; In the cache space, a deserialization operation is performed on the target cache instance record described in a serialized manner to obtain a second cache instance described in a deserialized manner; Configure a second instance storage space for the second cache instance in the cache space, and cache the second cache instance in the second instance storage space.
12. The method according to claim 9, characterized in that, The cache index layer also includes a configuration storage space with a third index priority, which is lower than the second index priority; The method further includes: If the target cache instance record is not found in the business database based on the second index priority, the configuration storage space is accessed based on the third index priority, and a dialogue configuration table storing at least one dialogue configuration record is obtained in the configuration storage space; the space type of the configuration storage space is different from the space type of the cache space; the dialogue configuration table is used to store the configuration mapping relationship between a dialogue configuration record and a reference scenario type identifier; In the dialogue configuration table, find the target reference scene type identifier that matches the scene type identifier, and in the at least one dialogue configuration record, take the dialogue configuration record that has a configuration mapping relationship with the target reference scene type identifier as the target dialogue configuration record; The target dialogue configuration record is configured and instantiated in the cache space to obtain a third cache instance, and the dialogue output information is updated by obtaining the third cache dialogue information from the third cache instance.
13. The method according to claim 12, characterized in that, The step of configuring and instantiating the target dialogue configuration record in the cache space to obtain a third cache instance includes: Obtain the list of configuration dialogue information indicated by the target dialogue configuration record, and count the number of multiple configuration dialogue information contained in the list of configuration dialogue information to obtain the number of dialogue information for the list of configuration dialogue information. Based on the number of dialogue information, an index cache array containing multiple array elements is created, and the configuration sequence number of each configuration dialogue information in the multiple configuration dialogue information is obtained in the configuration dialogue information list. Based on the configuration sequence number of each configuration dialogue information, each configuration dialogue information is filled into the array element of the index cache array, and the filled index cache array is determined as the index dialogue cache array. The configuration dialogue information corresponding to each array element in the index dialogue cache array is adjusted, and the adjusted index dialogue cache array is used as the adjusted index cache array. A configuration dialog cache group is created for the adjustment index cache array, and the configuration dialog information corresponding to the element index is updated to the configuration dialog cache group based on the element index contained in the adjustment index cache array, to obtain a configuration update dialog cache group, and the third cache instance is constructed based on the configuration update dialog cache group.
14. The method according to claim 13, characterized in that, The step of adjusting the configuration dialogue information corresponding to each array element in the indexed dialogue cache array, and using the adjusted indexed dialogue cache array as the adjusted indexed cache array, includes: The multiple array elements contained in the indexed dialog cache array are respectively used as the first array elements, and the first array element corresponding to the element with the smallest index value is selected from the multiple first array elements as the target first array element; Based on the element index of the target first array element and the number of elements in the index dialogue cache array, a uniformly random index configured for the target first array element is obtained. The first array element corresponding to the element index that matches the uniformly random index is found among the multiple first array elements and used as the exchange array element for exchanging information with the target first array element. The configuration dialog information indicated by the target first array element and the configuration dialog information indicated by the exchange array element are exchanged, and the target first array element is removed from the plurality of first array elements; When each of the plurality of first array elements is selected as the target first array element, the information adjustment processing of the configuration dialogue information corresponding to each array element in the plurality of array elements contained in the index dialogue cache array is completed, and the index dialogue cache array after information adjustment processing is used as the adjusted index cache array.
15. The method according to claim 13, characterized in that, The configuration dialog cache group includes a first configuration dialog cache group and a second configuration dialog cache group; The step of updating the configuration dialogue information corresponding to the element indices contained in the adjustment index cache array to the configuration dialogue cache group to obtain the configuration update dialogue cache group includes: Select even-numbered element indices with even index values from the element indices contained in the adjusted index cache array, and sort the index values of each element indices in the even-numbered element indices to obtain the first dialogue filling order; In the adjusted index cache array, the even-numbered array element corresponding to the even-numbered element index is obtained, and the configuration dialogue information corresponding to each even-numbered array element in the even-numbered array element is filled into the cache entry of the first configuration dialogue cache group based on the first dialogue filling order, so as to obtain the first configuration dialogue cache group after filling. From the element indices contained in the adjusted index cache array, select odd element indices with odd index values, and sort the index values of each element in the odd element indices to obtain the second dialogue filling order; In the adjusted index cache array, the odd array element corresponding to the odd element index is obtained, and the configuration dialogue information corresponding to each odd array element in the odd array element is filled into the cache entry of the second configuration dialogue cache group based on the second dialogue filling order, so as to obtain the filled second configuration dialogue cache group. The first and second configuration dialog cache groups, after being filled, are used as the configuration update dialog cache groups.
16. The method according to claim 1, characterized in that, The first cache instance includes an active cache group identifier and at least one conversation cache group; The step of using the first cached dialogue information obtained from the first cache instance as dialogue output information in response to the dialogue retrieval request includes: Use the active cache group identifier included in the first cache instance as the second active cache group identifier, and obtain the cache group identifier of each conversation cache group in at least one conversation cache group included in the first cache instance. In each dialogue cache group, a target cache group identifier that matches the second active cache group identifier is found in the cache group identifier, and the dialogue cache group corresponding to the target cache group identifier is taken as the active dialogue cache group determined for the second active cache group identifier. The consumption pointer indicated by the active dialogue cache group is used as the third consumption pointer, and the cached dialogue information in the active dialogue cache group is consumed based on the third consumption pointer to obtain the cached dialogue information after information consumption. When the cached dialogue information after the information consumption is used as the first cached dialogue information obtained from the first cache instance, the first cached dialogue information is used as the dialogue output information for responding to the dialogue retrieval request.
17. The method according to claim 16, characterized in that, The active dialogue cache group includes multiple cache entries, and each cache entry corresponds to an entry index; The step of consuming cached dialogue information in the active dialogue cache group based on the third consumption pointer to obtain the consumed cached dialogue information includes: The index of the cache entry pointed to by the third consumer pointer is used as the consumer entry index. A random index is generated based on the index value of the consumer entry index to obtain a random entry index. The index value of the random entry index is less than or equal to the index value of the consumer entry index. Among the plurality of cache entries, the cache entry corresponding to the random entry index is taken as the target cache entry, and the cache entry corresponding to the consumer entry index is taken as the consumer cache entry; The cache dialogue information corresponding to the target cache entry and the cache dialogue information corresponding to the consumer cache entry are exchanged, and the cache entry indicated by the third consumer pointer is modified from the consumer cache entry to the previous cache entry corresponding to the previous entry index of the consumer entry index; the previous cache entry is the cache entry among the plurality of cache entries that is adjacent to the consumer cache entry and located before the consumer cache entry; When the cache entry indicated by the third consumption pointer is the previous cache entry, the cached dialogue information corresponding to the consumed cache entry is used as the cached dialogue information after the information is consumed.
18. The method according to claim 1, characterized in that, The method further includes: Obtain a business configuration table for generating dialogue information; among the multiple prompt word templates contained in the business configuration table, obtain a target prompt word template that matches the scene type identifier; and in the extended parameter configuration table indicated by the target prompt word template, obtain an extended behavior parameter that matches the extended behavior identifier. Obtain the role configuration table used for generating dialogue information, and among the multiple role type parameters contained in the business configuration table, obtain the target role type parameter that matches the role type identifier; The target prompt word template is improved by using the extended behavior parameters and the target role type parameters to obtain dialogue generation prompt words, and a dialogue generation request is constructed based on the dialogue generation prompt words. The dialogue generation request is sent to the dialogue generation model so that the dialogue generation model generates dialogue information according to the dialogue generation prompts in the dialogue generation request, and the model-generated dialogue information is obtained. Receive the model-generated dialogue information returned by the dialogue generation model, and store the model-generated dialogue information in the first cache instance.
19. The method according to claim 18, characterized in that, The first cache instance includes at least one conversation cache group; one conversation cache group corresponds to one cache group identifier; one conversation cache group includes multiple cache entries, and one cache entry corresponds to one entry index; The step of storing the dialogue information generated by the model in the first cache instance includes: Obtain the empty cache group identifier indicated by the first cache instance, and among at least one cache group identifier included in the first cache instance, use the cache group identifier that matches the empty cache group identifier as the filling cache group identifier. In the at least one dialogue cache group, the dialogue cache group corresponding to the filling cache group identifier is taken as the filling dialogue cache group, and the fourth consumption pointer indicated by the filling dialogue cache group is obtained. Among the multiple entry indices included in the filling dialog cache group, the entry index corresponding to the cache entry indicated by the fourth consumption pointer is taken as the filled entry index, and the next entry index of the filled entry index is taken as the filling entry index. Among the multiple cache entries included in the filling dialogue cache group, the cache entry corresponding to the filling entry index is used as the filling cache entry, the cache entry indicated by the fourth consumption pointer is modified from the cache entry corresponding to the already filled entry index to the filling cache entry, and the model-generated dialogue information is stored in the filling cache entry.
20. A dialogue processing device, characterized in that, The device includes: The request identifier acquisition module is used to receive a dialogue acquisition request sent by the game business layer through the cache index layer, and to acquire the role type identifier of the virtual character object, the scene type identifier of the business scene in which the virtual character object is located, and the extended behavior identifier from the dialogue acquisition request; the virtual character object refers to the object used to have a dialogue with the business object; the extended behavior identifier is used to describe the extended behavior performed by the virtual character object in the business scene; The composite hash calculation module is used to perform hash calculation on the composite byte structure based on each composite byte in the composite byte structure when constructing the composite byte structure through the role type identifier, the scene type identifier and the extended behavior identifier, so as to obtain the composite hash value for the composite byte structure. A cache hash lookup module is used to find a first cache hash value that matches the composite hash value in the cache index layer; If the dialogue information acquisition module finds the first cache hash value, it retrieves the first cache instance corresponding to the first cache hash value from the cache index layer, and uses the first cache dialogue information obtained from the first cache instance as dialogue output information to respond to the dialogue acquisition request. The dialogue output information is then returned to the game business layer so that the game business layer can control the virtual character object to use the dialogue output information to have a dialogue with the business object.