Plot interaction method and apparatus
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- SHANGHAI BILIBILI TECH CO LTD
- Filing Date
- 2026-03-20
- Publication Date
- 2026-06-12
AI Technical Summary
In existing interactive narrative systems, the connection mechanism between virtual resources and plot is rigid, making it difficult to achieve intelligent and dynamic interaction between resources and plot, resulting in poor system scalability and maintainability.
By mapping virtual resource identifiers to ability tags, filtering candidate plot events using a plot state transition graph, and matching trigger conditions based on ability tags, a logical link is established between resource attributes, plot conditions, and state transitions. An optimistic locking mechanism is used to ensure state consistency and push incremental state synchronization.
It improves the flexibility and logic of interactive storylines, reduces the adaptation costs of resources and story branches, enhances the impact of user actions on story development, and improves system scalability and immersion.
Smart Images

Figure CN122183160A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of Internet technology, and in particular to a method, apparatus, computer device, computer-readable storage medium, and computer program product for interactive storytelling. Background Technology
[0002] In interactive narrative systems, driving plot progression through user interaction is the core technology. To enhance the depth of interaction, developers attempt to link the use of virtual resources (such as props and gifts) with plot development. Existing technologies typically employ script-based control with "conditions and branches," but this approach has fundamental flaws, limiting the system's dynamism and scalability.
[0003] Specifically, existing solutions generally embed the triggering effects of virtual resources directly and fixedly into specific plot scripts. For example, at a fixed plot node, the code directly determines "if the user uses [resource A], then jump to [plot X]". This approach results in: rigid plot interaction mechanisms, difficulty in expansion, and difficulty in achieving intelligent and dynamic association between resources and plot.
[0004] It should be noted that the above content is not necessarily prior art, nor is it intended to limit the scope of patent protection of this application. Summary of the Invention
[0005] This application provides a method, apparatus, computer device, computer-readable storage medium, and computer program product for interactive storytelling, in order to solve or alleviate one or more of the technical problems mentioned above.
[0006] One aspect of this application provides a plot interaction method, the method comprising: Receive a target virtual resource trigger event, wherein the target virtual resource trigger event includes a target virtual resource identifier; Map the target virtual resource identifier to at least one corresponding capability tag; Based on the plot state transition graph of the current plot node, potential triggerable plot events are determined; Whether to trigger the candidate plot event is determined based on the triggering conditions of the candidate plot event and the at least one ability tag; If the candidate plot event is determined to be triggered, update the current plot state; Based on the updated storyline status, corresponding storyline interaction response information is generated and pushed to the client, so that the client can present storyline interaction effects based on the storyline interaction response information.
[0007] Optionally, mapping the target virtual resource identifier to at least one corresponding capability tag includes: Obtain a virtual resource configuration table, which includes multiple virtual resource identifiers and at least one capability tag corresponding to each virtual resource identifier; Based on the virtual resource configuration table, at least one capability tag corresponding to the target virtual resource is determined.
[0008] Optionally, each ability tag includes an ability attribute, and determining whether to trigger the candidate plot event based on the triggering conditions of the candidate plot event and the at least one ability tag includes: Detect whether the at least one ability tag matches the candidate plot event; If a match is found, for each matched ability tag, the corresponding sub-contribution value is calculated based on its ability attribute, and each sub-contribution value is accumulated to the accumulator corresponding to the candidate plot event in turn. When the accumulated contribution value in the accumulator reaches the trigger threshold of the candidate plot event, the candidate plot event is triggered.
[0009] Optionally, the capability attribute includes a capability strength value and a capability priority value, and the calculation of the sub-contribution value based on the capability attribute includes: The sub-contribution value is calculated based on the capability strength value, capability priority value, and a preset contribution value calculation algorithm.
[0010] Optionally, updating the current story state includes: Obtain the current story state, which includes story state information and version identifier; Determine the plot status information to be updated and the new version identifier; An atomic update operation is performed to replace the plot state information with the plot state information to be updated, and to replace the version identifier with the new version identifier, when the current version identifier of the stored plot state matches the current version identifier.
[0011] Optionally, the plot interaction response information includes plot interaction text, which is generated in the following manner: Query the pre-generated text cache pool; If a text content matching the candidate plot event is found in the pre-generated text cache pool, the plot interaction text is generated based on the matching text content.
[0012] Optionally, the plot state includes updated plot nodes, and the method further includes: After the plot state is updated, based on the plot state transition graph of the updated plot node, at least one target subsequent plot node is determined, and the target subsequent plot node is a subsequent plot node that needs to generate text content. Generate corresponding text content for each of the at least one target's subsequent story nodes.
[0013] Optionally, the plot state transition graph includes at least one subsequent plot node and the transition probability of each subsequent plot node. Based on the updated plot state transition graph of the plot nodes, determining at least one target subsequent plot node includes: Based on the transition probability of each subsequent plot node, select the Nth subsequent plot node with the highest transition probability from at least one subsequent plot node as the target subsequent plot node. N is an integer greater than or less than 1, and the value of N is not greater than the total number of subsequent plot nodes.
[0014] Optionally, generating corresponding text content for each of the at least one target's subsequent story nodes includes: The large language model is used to generate corresponding text content for each of the at least one target's subsequent plot nodes.
[0015] Optionally, the method further includes: If no text content matching the candidate plot event is found in the pre-generated text cache pool, obtain the complexity of the plot node corresponding to the candidate plot event; When the complexity is less than a preset complexity value, the plot interaction text is generated using a preset template; When the complexity is not less than the preset complexity value, the interactive text of the storyline is generated through a large language model.
[0016] Optionally, generate and push corresponding plot interaction response information to the client, including: Confirm information about changes in the updated storyline compared to the original storyline. Based on the changed information, an incremental update message is generated; The incremental update message is pushed to the client so that the client updates its local story state based on the incremental update message.
[0017] Optionally, before the step of mapping the target virtual resource identifier to at least one corresponding capability tag, the method further includes: Perform a verification operation on the target virtual resource, and after the verification operation passes, perform the mapping step.
[0018] Another aspect of this application provides a story interaction device, the device comprising: The receiving module is configured to receive a target virtual resource triggering event, wherein the target virtual resource triggering event includes a target virtual resource identifier; The mapping module is used to map the target virtual resource identifier to at least one corresponding capability tag; The first determining module is used to determine the candidate plot events that can be triggered based on the plot state transition graph of the current plot node; The second determining module is used to determine whether to trigger the candidate plot event based on the triggering conditions of the candidate plot event and the at least one ability tag; The update module is used to update the current plot state when it is determined that the candidate plot event has been triggered; The push module is used to generate and push corresponding plot interaction response information to the client based on the updated plot status, so that the client can present plot interaction effects based on the plot interaction response information.
[0019] Another aspect of this application provides a computer device, including: At least one processor; and A memory that is communicatively connected to the at least one processor; Wherein: the memory stores instructions that can be executed by the at least one processor, the instructions being executed by the at least one processor to enable the at least one processor to perform the method as described above.
[0020] Another aspect of this application provides a computer-readable storage medium storing computer instructions that, when executed by a processor, implement the method described above.
[0021] Another aspect of this application provides a computer program product including a computer program that, when executed by a processor, implements the method described above.
[0022] The embodiments of this application employing the above-described technical solution may have the following advantages: By receiving target virtual resource trigger events and extracting resource identifiers, which are then mapped to standardized capability tags, an abstract representation of virtual resource attributes is achieved, breaking the hard coupling between resources and the plot. Furthermore, by combining the state transition graph of the current plot node with candidate plot events and matching the trigger conditions of these events with capability tags, a precise logical link between resource attributes, plot conditions, and state transitions is established. This ensures the rigor of plot trigger judgments, avoids logical conflicts caused by mismatched resources triggering plots, and reduces the adaptation cost of adding new resources or plot branches through tag-based mapping, thus improving system scalability. Finally, based on the updated plot state, interactive response information is pushed, directly linking the plot's direction with the user's resource operations. This strengthens the impact of user actions on plot development, achieving a synergistic improvement in the flexibility, logic, and immersion of plot interaction. Attached Figure Description
[0023] The accompanying drawings exemplify embodiments and form part of the specification, serving together with the textual description to explain exemplary implementations of the embodiments. The illustrated embodiments are for illustrative purposes only and do not limit the scope of the claims. Throughout the drawings, the same reference numerals refer to similar but not necessarily identical elements.
[0024] Figure 1 The diagram illustrates the operating environment of the story interaction method according to Embodiment 1 of this application; Figure 2 A flowchart illustrating a plot interaction method according to Embodiment 1 of this application is shown schematically; Figure 3 Schematic illustration Figure 2 Detailed flowchart of step S202; Figure 4 Schematic illustration Figure 2 Detailed flowchart of step S206 in the document; Figure 5 Schematic illustration Figure 2 A detailed flowchart outlining the steps to update the current storyline status; Figure 6 The flowchart illustrates the detailed steps involved in generating interactive story text. Figure 7 A flowchart illustrating the additional steps according to Embodiment 1 of this application is shown schematically; Figure 8 Schematic illustration Figure 2 A detailed flowchart outlining the steps involved in generating and pushing relevant interactive storyline responses to the client. Figure 9 A block diagram of a story interaction device according to Embodiment 2 of this application is schematically shown; and Figure 10 A schematic diagram of the hardware architecture of a computer device according to Embodiment 3 of this application is shown. Detailed Implementation
[0025] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application. All other embodiments obtained by those skilled in the art based on the embodiments in this application without inventive effort are within the scope of protection of this application.
[0026] It should be noted that the descriptions involving "first," "second," etc., in the embodiments of this application are for descriptive purposes only and should not be construed as indicating or implying their relative importance or implicitly specifying the number of technical features indicated. Therefore, a feature defined with "first" or "second" may explicitly or implicitly include at least one of that feature. Furthermore, the technical solutions of the various embodiments can be combined with each other, but this must be based on the ability of those skilled in the art to implement them. If the combination of technical solutions is contradictory or impossible to implement, it should be considered that such a combination of technical solutions does not exist and is not within the scope of protection claimed in this application.
[0027] It should be noted that, in any stage of this application involving the collection, storage, use, transmission, and processing of data, each stage strictly adheres to the laws, regulations, industry standards, and regulatory requirements of the data source, usage location, and relevant countries and regions to ensure the legality and compliance of data activities. In the collection stage, the purpose, method, and scope of collection are clearly communicated to the data subject in a prominent manner. Collection is conducted only after obtaining the data subject's legal authorization, ensuring that the collection process follows the "minimum necessary" principle and does not exceed the scope of data collection. In the storage stage, storage periods are limited, and data is promptly deleted or anonymized / encrypted after the storage purpose is achieved. In the usage stage, a strict data security protection mechanism is implemented, using field-level desensitization technology and processing the original data according to preset desensitization rules. For different types of data, multiple desensitization strategies, such as data generalization, data anonymization, and data encryption, are employed to effectively mitigate the risk of sensitive information leakage and ensure that all data used is securely processed and desensitized, comprehensively protecting the rights and interests of data subjects and data security. In the transmission and processing stages, the confidentiality and security of data are ensured during transmission and processing.
[0028] In the description of this application, it should be understood that the numerical labels before the steps do not indicate the order of the steps, but are only used to facilitate the description of this application and to distinguish each step, and therefore should not be construed as a limitation of this application.
[0029] First, a definition of the terminology used in this application is provided: Optimistic locking is a more relaxed locking mechanism compared to pessimistic locking. It always assumes the best-case scenario, that is, that each operation of a transaction will not modify the data in the database, so it will not lock the data. However, when the transaction operation is completed and the data in the database is updated, it will check whether the data has been modified by other transactions during the time the transaction read it. If so, it indicates that there is a conflict and returns an error message; if not, it updates the database according to the data committed by the transaction.
[0030] Secondly, to facilitate understanding of the technical solutions provided in the embodiments of this application by those skilled in the art, the relevant technologies are described below: In interactive narrative systems, driving plot progression through user interaction is the core technology. To enhance the depth of interaction, developers attempt to link the use of virtual resources (such as props and gifts) with plot development. Existing technologies typically employ script-based control with "conditions and branches," but this approach has fundamental flaws, limiting the system's dynamism and scalability.
[0031] Specifically, existing solutions generally embed the triggering effects of virtual resources directly and fixedly into specific plot scripts. For example, at a fixed plot node, the code directly determines "if the user uses [resource A], then jump to [plot X]". This approach results in: rigid plot interaction mechanisms, difficulty in expansion, and difficulty in achieving intelligent and dynamic association between resources and plot.
[0032] To address this, this application provides a plot interaction technical solution. First, by abstracting specific gift behaviors into ability tags and triggering plot events based on threshold rules, the gift system is decoupled from the plot logic. As the types of gifts expand, the plot structure and state machine rules remain stable, significantly improving the system's scalability and maintainability. Second, through a version-number-based optimistic locking state machine mechanism, in high-concurrency scenarios with multiple viewers sending gifts, consistent updates to the plot state can be guaranteed without introducing blocking locks, avoiding issues such as duplicate triggering and state overwriting, while also considering system throughput performance. Third, by leveraging the predictability of plot state transitions to pre-generate and cache narrative text for high-probability successor nodes, the cached return results are prioritized when the event is actually triggered, significantly reducing plot feedback latency and minimizing the computational cost of real-time calls to large models. Finally, through incremental state synchronization and version verification mechanisms, only changed state fields are pushed to the client, reducing network transmission and parsing overhead while ensuring client state consistency, improving end-to-end real-time performance and stability in weak network environments. See below for details.
[0033] Finally, for ease of understanding, an exemplary operating environment is provided below.
[0034] like Figure 1 As shown in the diagram, the runtime environment includes: Service Platform 2, Network 4, and Client 6, where: Service platform 2 can consist of one or more computing devices. These computing devices may include virtualized computing instances. Virtualized computing instances may include virtual machines, such as emulations of computer systems, operating systems, servers, etc. The computing devices can load virtual machines based on virtual images and / or other data that define specific software used for emulation (e.g., operating systems, dedicated applications, servers). As the demand for different types of processing services changes, different virtual machines can be loaded and / or terminated on one or more computing devices. A hypervisor can be implemented to manage the use of different virtual machines on the same computing device.
[0035] Service platform 2 can be configured to communicate with clients 6, etc., via network 4. Network 4 includes various network devices, such as routers, switches, multiplexers, hubs, modems, bridges, repeaters, firewalls, proxy devices, and / or similar devices. Network 4 may include physical links, such as coaxial cable links, twisted pair cable links, fiber optic links, or combinations thereof, or wireless links, such as cellular links, satellite links, Wi-Fi links, etc.
[0036] Service platform 2 can provide services such as storage, reading, writing, querying, and deleting, such as running interactive story programs or providing interactive story services to clients.
[0037] Client 6 can be an electronic device running operating systems such as Windows, Android™, or iOS, including smartphones, tablets, laptops, virtual reality devices, gaming devices, set-top boxes, in-vehicle terminals, and smart TVs. Based on these operating systems, various applications can run, such as applications for interactive storylines.
[0038] Client 6 can provide / configure user access pages for controlling service platform 2 or uploading objects, etc.
[0039] It should be noted that the above-mentioned equipment is exemplary, and the number and type of equipment can be adjusted in different scenarios or according to different needs.
[0040] The technical solution of this application will be described below through multiple embodiments, using service platform (server side) 2 as the execution entity. It should be understood that these embodiments can be implemented in many different forms and should not be construed as being limited to the embodiments described herein.
[0041] Example 1 Figure 2 A flowchart illustrating a plot interaction method according to Embodiment 1 of this application is shown schematically.
[0042] like Figure 2As shown, this interactive storyline method can be applied to the server side in scenarios such as live-streamed interactive storylines and game interactive storylines. The method includes steps S200-S210, wherein: Step S200: Receive a target virtual resource trigger event, wherein the target virtual resource trigger event includes a target virtual resource identifier.
[0043] Step S202: Map the target virtual resource identifier to at least one corresponding capability tag.
[0044] Step S204: Determine the candidate plot events that can be triggered based on the plot state transition graph of the current plot node.
[0045] Step S206: Determine whether to trigger the candidate plot event based on the triggering conditions of the candidate plot event and the at least one ability tag.
[0046] Step S208: If it is determined that the candidate plot event has been triggered, update the current plot state; Step S210: Based on the updated story state, generate and push corresponding story interaction response information to the client, so that the client can present story interaction effects based on the story interaction response information.
[0047] The narrative interaction method provided in this embodiment receives target virtual resource trigger events and extracts resource identifiers, mapping them to standardized ability tags. This achieves an abstract representation of virtual resource attributes, breaking the hard coupling between resources and the narrative. Furthermore, by combining the state transition graph of the current narrative node with candidate narrative events, and matching the trigger conditions of candidate events with ability tags, a precise logical link of resource attributes, narrative conditions, and state transitions is established. This ensures the rigor of narrative trigger judgment, avoids logical conflicts caused by mismatched resources triggering narratives, and reduces the adaptation cost of adding new resources or narrative branches through tag-based mapping, thus improving system scalability. Finally, based on the updated narrative state, interactive response information is pushed, directly linking the narrative direction with the user's resource operations. This strengthens the impact of user operations on narrative development, achieving a synergistic improvement in the flexibility, logic, and immersion of narrative interaction.
[0048] The following combination Figure 2 The steps in steps S200 to S210, as well as other optional steps, are described in detail.
[0049] Step S200 Receive a target virtual resource trigger event, wherein the target virtual resource trigger event includes a target virtual resource identifier.
[0050] The server receives target virtual resource trigger events uploaded by the client via network communication protocols such as WebSocket. These target virtual resource trigger events are generated by specific user actions performed on the client, such as a viewer sending a gift in a live stream or a player using an item in a game. The target virtual resource identifier is a unique identifier for the virtual resource, such as a gift ID or item code, used to distinguish different virtual resources.
[0051] Step S202 The target virtual resource identifier is mapped to at least one corresponding capability tag.
[0052] The server can pre-store the association between virtual resources and ability tags. These ability tags are abstract attributes that characterize the role of virtual resources in advancing the plot, such as "lighting," "healing," and "destruction." Based on the received target virtual resource identifier, the server queries a pre-defined association table and converts it into at least one matching ability tag. A single virtual resource can correspond to one or more ability tags to achieve a combined plot-advancing effect. For example, a single virtual resource may correspond to 1-3 ability tags.
[0053] In an optional implementation, see [link to relevant documentation]. Figure 3 The step of mapping the target virtual resource identifier to at least one corresponding capability tag includes: Step S300: Obtain a virtual resource configuration table, which includes multiple virtual resource identifiers and at least one capability tag corresponding to each virtual resource identifier.
[0054] The virtual resource configuration table is a structured data table pre-stored in the server database, and its table structure is shown in the following example:
[0055] In one implementation, to improve the matching efficiency of tag queries, when storing tag-related data in the virtual resource configuration table, a multi-dimensional tag index can be used for storage. For example, a composite hash index of {tag type → {intensity range → [target virtual resource ID list]}} can be used to store the correspondence between various capability tags and their corresponding target virtual resource ID lists. Through this indexing method, the search complexity can be optimized from O(N) to O(1).
[0056] Step S302: Determine at least one capability tag corresponding to the target virtual resource based on the virtual resource configuration table.
[0057] After obtaining the virtual resource configuration table, the server can use the received target virtual resource identifier as a query keyword to perform precise matching in the virtual resource configuration table. If the match is successful, all capability tags corresponding to the virtual resource identifier are extracted. If no matching virtual resource identifier is found, it is determined to be an invalid trigger event, the subsequent process is terminated, and an error message is returned to the client.
[0058] In this embodiment, the association between virtual resources and capability tags is managed uniformly through a configuration table. Later, when adding or modifying virtual resources, this can be achieved by modifying the configuration table without altering the core code, thus improving system scalability and lowering the system's maintenance threshold. Furthermore, by supporting flexible configuration of composite tags, the triggering requirements of composite story events are met, enriching the diversity of interactive gameplay.
[0059] In an optional implementation, before the step of mapping the target virtual resource identifier to at least one corresponding capability tag, the method further includes: Perform a verification operation on the target virtual resource, and after the verification operation passes, perform the mapping step.
[0060] In this embodiment, the verification operation can be configured according to different interaction scenarios. As an example, for a live streaming scenario, the following verification operation can be set: Balance verification: The server queries the user's virtual account balance to determine if it is sufficient to pay for the target gift (e.g., a small flashlight costs 10 gold coins, so the user's balance must be ≥10). Anti-fraud detection: The risk control algorithm detects whether the user's gift-giving behavior is abnormal (such as sending gifts more than 10 times in 1 second, or sending gifts in batches from multiple accounts on the same IP address). If it is determined to be gift-fraud behavior, the request will be rejected. Deduction Processing: After the balance verification is successful, the corresponding virtual currency in the user's account will be deducted, and the transaction record will be recorded.
[0061] As an example, for a game scenario, the following verification operation can be set: Item validity verification: Query the user's game item inventory to determine whether the target item exists, whether it has not expired, and whether it meets the usage conditions (such as level restrictions). Operation legality verification: Check whether the user's use of items complies with the game rules (such as whether it is used in an allowed area or whether it is in a cooldown period); Item Consumption Processing: After the item's validity is verified, the corresponding item quantity will be deducted from the user's inventory.
[0062] In this embodiment, if the verification operation passes, the tag mapping step continues, that is, the target virtual resource identifier is mapped to at least one corresponding capability tag; if the verification fails, the subsequent process is terminated and a clear prompt message (such as "insufficient balance" or "item expired") is returned to the client.
[0063] In this embodiment, the above verification operation can prevent malicious users from cheating, protect the security of the platform and users' virtual property, and maintain the fairness of the story interaction.
[0064] Step S204 Based on the plot state transition graph of the current plot node, candidate plot events that can be triggered are determined.
[0065] In this embodiment, each plot node is configured with a corresponding plot state transition diagram. The plot state transition diagram includes all plot events that can be triggered under that plot node, the triggering conditions of each plot event, and the plot node jump path after the plot event is triggered. The server can obtain the current plot node in real time and retrieve the plot state transition diagram corresponding to that plot node to extract all triggerable candidate plot events.
[0066] Step S206 Whether to trigger the candidate plot event is determined based on the triggering conditions of the candidate plot event and the at least one ability tag.
[0067] The server parses the triggering conditions for each candidate plot event one by one. These triggering conditions include a list of ability tags required for the candidate plot event, minimum ability attributes, and the cumulative contribution threshold required for each ability tag. After obtaining at least one ability tag, the server matches that tag against the triggering conditions of each candidate plot event to determine if the tag matches and if the contribution value corresponding to that tag reaches the threshold. If the matching operation is successful, the server determines whether to trigger the candidate plot event.
[0068] In an optional implementation, each capability tag contains capability attributes, see [link / reference] Figure 4 The step of determining whether to trigger the candidate plot event based on the triggering conditions of the candidate plot event and the at least one ability tag includes: Step S400: Detect whether the at least one ability tag matches the candidate plot event.
[0069] Each candidate plot event's trigger conditions include a list of required ability tags, minimum ability attributes, and the cumulative contribution threshold required for each ability tag.
[0070] After obtaining at least one ability tag, the server compares it one by one with the list of ability tags required in the triggering conditions of the candidate plot event. If at least one ability tag contains all the ability tags required in the triggering conditions, it is considered a successful match. If at least one ability tag does not contain all the ability tags required in the triggering conditions, it is considered a failed match, and no further processing is performed on the candidate plot event.
[0071] As an example, the triggering conditions for event E001 "Illuminating the Cave" (candidate story event) are as follows: Required tag: "Lighting"; Minimum strength: 0.1; Cumulative threshold: 50.
[0072] Step S402: If a match is found, for each matched ability tag, calculate the corresponding sub-contribution value based on its ability attribute, and sequentially accumulate each sub-contribution value to the accumulator corresponding to the candidate plot event.
[0073] The capability attributes include, but are not limited to, quantitative parameters such as capability strength value and capability priority value.
[0074] The contribution value is a quantitative parameter that measures the readiness of candidate plot events and is the basis for determining whether a candidate plot event is triggered. When the contribution value reaches the trigger threshold of a candidate plot event, the candidate plot event is triggered.
[0075] The server calculates the sub-contribution value for each matching tag based on a preset algorithm.
[0076] It should be noted that when there is only one matching capability tag, only the contribution value of that capability tag needs to be calculated. Only when there are multiple matching capability tags does it need to be calculated separately for each matching capability tag.
[0077] In this embodiment, each matched ability tag is configured with a dedicated accumulator to store the cumulative contribution value of that ability tag. These dedicated accumulators serve as the accumulators corresponding to the candidate plot events.
[0078] After calculating the sub-contribution values for each matching ability tag, the sub-contribution values are accumulated into the accumulator corresponding to the candidate plot event, thereby updating the accumulated contribution values recorded in the accumulator.
[0079] In an optional implementation, the capability attribute includes a capability strength value and a capability priority value, and the calculation of the sub-contribution value based on the capability attribute includes: The sub-contribution value is calculated based on the capability strength value, capability priority value, and a preset contribution value calculation algorithm.
[0080] In this embodiment, the server is pre-configured with a unified contribution value calculation algorithm, the algorithm formula of which is: Contribution value = Ability strength value × 100 × (Ability priority value / 10) Among them, the ability strength value is a quantitative parameter that measures the degree to which the ability tag advances the plot, and its value can be 0-1; the ability priority value is a quantitative parameter that measures the importance of the ability tag, and its value can be 1-10.
[0081] In this embodiment, the server extracts the corresponding capability strength value and capability priority value from the matched capability tags, substitutes them into the above formula for calculation, and obtains the sub-contribution value of a single capability tag; if there are multiple matched capability tags, the sub-contribution value of each capability tag is calculated separately and then accumulated into the corresponding accumulator.
[0082] As an example, if the ability strength value of a certain ability tag is 0.6 and the ability priority value is 7, then its contribution value = 0.6 × 100 × (7 / 10) = 42.
[0083] In this embodiment, the contribution value is calculated by the ability strength value and the ability priority value, which can flexibly control the role of different virtual resources in promoting the plot. For example, rare virtual resources have higher tag strength and priority, and thus contribute more, which speeds up the plot and improves the value differentiation of virtual resources.
[0084] Step S404: When the accumulated contribution value in the accumulator reaches the trigger threshold of the candidate plot event, the candidate plot event is triggered.
[0085] In this embodiment, when there are multiple candidate plot events, each candidate plot event has a preset trigger threshold, which is the minimum contribution value required to trigger the candidate plot event. After the contribution value accumulation operation is completed, the server will determine whether the current accumulated contribution value is greater than or equal to the trigger threshold. If the accumulated contribution value is greater than or equal to the trigger threshold, the candidate plot event will be triggered; if the accumulated contribution value does not reach the trigger threshold, only the accumulator value will be updated, and the candidate plot event will not be triggered.
[0086] In one implementation, when the accumulated contribution value in the accumulator reaches the trigger threshold of the candidate plot event, the accumulated contribution value in the accumulator will be reset to 0 to avoid repeatedly triggering the candidate plot event.
[0087] It should be noted that when a candidate plot event has multiple accumulators, the candidate plot event will only be triggered when the cumulative contribution value in all multiple accumulators is greater than or equal to the corresponding trigger threshold.
[0088] In this embodiment, the dual determination mechanism of tag type matching and contribution value accumulation avoids the accidental triggering of plot events, making the pace of plot progression controllable and improving the user's interactive experience.
[0089] Step S208 If the candidate plot event is determined to be triggered, the current plot state is updated.
[0090] In this embodiment, after determining that a target candidate plot event has been triggered, the server updates the current plot state. The plot state may include core parameters such as plot node information, contribution values of various ability tags (e.g., illumination 50, health 60), and accumulator values; at the same time, the plot state may also include a version identifier to ensure the uniqueness and traceability of the state update.
[0091] In an optional implementation, see [link to relevant documentation]. Figure 5 The update of the current storyline status includes: Step S500: Obtain the current story state, which includes story state information and version identifier.
[0092] The plot status information is a set of core parameters for the current plot, including plot node information, contribution values corresponding to ability tags, accumulator values, etc.; the version identifier is a unique version number for the plot status, which can be updated using an incremental numbering rule.
[0093] In this embodiment, the server can read the plot status information and version identifier corresponding to the current plot node from the plot status instances stored in the distributed cache, and load them into local memory.
[0094] Step S502: Determine the plot status information to be updated and the new version identifier.
[0095] The server can use the state machine engine to perform state transition calculations based on the current story state to obtain the story state information to be updated and the new version identifier.
[0096] The new version identifier can be generated by incrementing the current version identifier by 1.
[0097] For example, if the previous version number was 42, then the new version number will be 43.
[0098] Step S504: Perform an atomic update operation to replace the plot state information with the plot state information to be updated and replace the version identifier with a new version identifier when the current version identifier of the stored plot state is consistent with the current version identifier obtained.
[0099] The server can perform atomic update operations through preset scripts. For example, it can use a Lua script to execute a CAS (Compare-And-Swap) operation to replace the plot status information with the plot status information to be updated, and replace the version identifier with a new version identifier.
[0100] The core logic of CAS operations includes: 1. The script reads the current version identifier stored in Redis; 2. Compare whether the stored version identifier is consistent with the version identifier obtained in step S501; 3. If they match, replace the story status information in Redis with the story status information to be updated, and update the version identifier to the new version identifier; 4. If there is a discrepancy, it is determined to be a version conflict. The update operation will be terminated and steps S500-S504 will be re-executed until the update is successful.
[0101] In this embodiment, since the CAS operation is an implementation mechanism of optimistic locking concurrency control, the above update operation can realize the concurrent execution of multiple requests without waiting for the lock. This solves the problem that the plot state is inconsistent, repeated triggering or performance degradation is easy to occur when multiple users trigger the target virtual resource triggering event at the same time. It can also increase the system throughput from 5000 TPS to 25000 TPS (400% improvement).
[0102] Step S210 Based on the updated storyline state, corresponding storyline interaction response information is generated and pushed to the client, so that the client can present storyline interaction effects based on the storyline interaction response information.
[0103] Based on the updated storyline status, the server generates storyline interaction response information containing interactive text, special effects commands, and status change notifications. After generating the interaction response information, the server sends it to all relevant clients. Upon receiving the information, the clients perform corresponding rendering operations, such as displaying the interactive text, playing interactive effects (e.g., playing the "light effect" animation and the "cave echo" sound effect), and updating the UI to visualize the interactive storyline effects.
[0104] In this embodiment, by receiving target virtual resource trigger events and extracting resource identifiers, which are then mapped to standardized capability tags, an abstract representation of virtual resource attributes is achieved, breaking the hard coupling between resources and the plot. Furthermore, by combining the state transition graph of the current plot node with candidate plot events, and matching the trigger conditions of candidate events with capability tags, a precise logical link of resource attributes, plot conditions, and state transitions is established. This ensures the rigor of plot trigger determination, avoids logical conflicts caused by non-matching resources triggering plots, and reduces the adaptation cost of adding new resources or plot branches through tag-based mapping, thus improving system scalability. Finally, based on the updated plot state, interactive response information is pushed, directly linking the plot development with the user's resource operations, strengthening the impact of user operations on plot development, and achieving a synergistic improvement in the flexibility, logic, and immersion of plot interaction.
[0105] In an optional implementation, the plot interaction response information includes plot interaction text, see below. Figure 6 The interactive story text is generated in the following way: Step S600: Query the pre-generated text cache pool.
[0106] The pre-generated text cache pool is a text content cache space pre-built by the server, storing candidate text content corresponding to different plot events. Candidate text content may include plot narration, event prompts, interactive feedback, etc.
[0107] In this embodiment, the candidate text content can be one or multiple items.
[0108] As an example, the candidate text content for plot event A is shown below: [1] "Thanks to [{user}] for the {gift}! The light has dispelled the darkness, and you have discovered the passage to the sealed core!"
[0109] [2] "With the help of [{user}], the cave was illuminated, and a mysterious passage appeared in front of it...".
[0110] [3] "The {gift} of [{user}] played a key role, and the secret of the seal is about to be revealed!"
[0111] It should be noted that "[{user}]" and "{gift}" are the variable contents that need to be filled in.
[0112] Step S602: If a text content matching the candidate plot event is found in the pre-generated text cache pool, the plot interaction text is generated based on the matching text content.
[0113] If a matching text is found, the server will fill in the variable content in the text based on specific parameters in the current story state, generating personalized story interaction text.
[0114] As an example, the matched text is: "Thanks to [{user}] for the {gift}! The light dispelled the darkness, and you discovered the passage to the sealed core!" After filling in the variable content, the following interactive text can be obtained: "Thanks to [Xiao Ming]'s flashlight! The light dispelled the darkness, and you discovered the passage to the core of the seal!"
[0115] It should be noted that when there are multiple candidate text contents corresponding to a candidate plot event, one can be randomly selected as the matching text content.
[0116] In this embodiment, by pre-generating a text cache pool, the computational overhead of generating text in real time every time a plot event is triggered is avoided, and millisecond-level acquisition of plot interaction text is achieved, which improves the client's response speed and optimizes the user's real-time experience.
[0117] In an optional implementation, the plot state includes updated plot nodes, see [link / reference]. Figure 7 The method further includes: Step S700: After the plot state is updated, based on the plot state transition graph of the updated plot node, at least one target subsequent plot node is determined, wherein the target subsequent plot node is a subsequent plot node that needs to generate text content.
[0118] After the plot status is updated, the server obtains the updated plot node and retrieves the plot status transition graph corresponding to that node; it extracts all possible subsequent plot nodes from the plot status transition graph, and determines the target subsequent plot nodes for which text content needs to be pre-generated according to preset filtering rules.
[0119] Step S702: Generate corresponding text content for each of the at least one target subsequent story nodes.
[0120] The server can generate corresponding text content based on the node information of the target's subsequent plot nodes, the plot event information associated with the node, the current state variable information, style requirements, etc., to provide text support for the triggering of subsequent plot events.
[0121] In this embodiment, the text content of subsequent plot nodes is generated in advance after the plot status is updated, avoiding the text generation delay when subsequent plot events are triggered, and further improving the system's response efficiency.
[0122] In an optional implementation, the plot state transition graph includes at least one subsequent plot node and the transition probability of each subsequent plot node. Based on the updated plot state transition graph of the plot nodes, determining at least one target subsequent plot node includes: Based on the transition probability of each subsequent plot node, select the Nth subsequent plot node with the highest transition probability from at least one subsequent plot node as the target subsequent plot node. N is an integer greater than or less than 1, and the value of N is not greater than the total number of subsequent plot nodes.
[0123] The transition probability is a pre-set value, which is the probability of jumping from the updated story node to the subsequent story node.
[0124] In this embodiment, the server can analyze and calculate the transition probabilities of each subsequent plot node in the plot state transition graph based on the Markov chain algorithm to obtain the jump probability of each subsequent plot node. Furthermore, the server can pre-set a filtering threshold N (N is an integer greater than or equal to 1, and the value of N is not greater than the total number of subsequent plot nodes). Thus, after obtaining the jump probability of each subsequent plot node, the server can select the N subsequent plot nodes with the highest transition probabilities from all subsequent plot nodes and determine them as the target subsequent plot nodes.
[0125] As an example, there are 3 subsequent story nodes after the update, with transition probabilities of: node A (60%), node B (30%), and node C (10%). If N=2, then node A and node B are selected as the target subsequent story nodes.
[0126] In this embodiment, high-probability subsequent plot nodes are selected based on transition probability for text pre-generation, avoiding invalid pre-generation of low-probability nodes and saving server storage resources and computing overhead.
[0127] In an optional implementation, generating corresponding text content for each of the at least one target subsequent storyline node includes: The large language model is used to generate corresponding text content for each of the at least one target's subsequent plot nodes.
[0128] The server pre-builds a large language model calling interface, which can be a pre-trained text generation model.
[0129] When the server calls the large language model to generate text content, it can include the target subsequent plot nodes. The system takes the node information of the target's subsequent plot nodes, the plot event information associated with the node, the current state variable information, and style requirements as input parameters and sends them to the large language model's call interface. The large language model generates text content that conforms to the plot settings based on the input parameters. The server receives the generated text content, performs format verification, and stores it in the pre-generated text cache pool.
[0130] For example, if the input parameters are "Story node: core passage of the sealed cave; Story background: player unlocks the passage by lighting up the tag; Core event: discovery of a mysterious treasure chest", the large language model will generate the text "You have successfully illuminated the core passage of the sealed cave. A glimmer of light has guided you to discover a mysterious treasure chest in the corner, which seems to contain a key item that will advance the story."
[0131] As an example, the at least one target subsequent story node includes the following three story nodes: N1 = Sealed Cave_Core Passage (60%) N2 = Combat Branch (30%) N3 = On-site storyline (10%) For node N1, the following three text contents can be generated: A1: Thanks to [{user}] for the {gift}, the light has illuminated the core passage ahead.
[0132] A2: In the dim light, you finally saw the path leading to the core of the seal.
[0133] A3: The depths of the cave are illuminated, revealing the true sealed land.
[0134] For node N2, the following three text contents can be generated: B1: Suddenly, a low growl came from the darkness.
[0135] B2: In the flickering light and shadow, some creature is approaching. ... B3: A dangerous aura emanates from the depths of the cave.
[0136] For node N3, text content may not be generated.
[0137] In this embodiment, a large language model can generate logical and engaging text content, avoiding the monotony of template text and improving the quality of the narrative text and user experience. Furthermore, automatic generation via a large language model significantly reduces the manpower required for narrative development and shortens the narrative release cycle.
[0138] In an optional implementation, the method further includes: If no text content matching the candidate plot event is found in the pre-generated text cache pool, the complexity of the plot node corresponding to the candidate plot event is obtained; if the complexity is less than a preset complexity value, the plot interaction text is generated using a preset template; if the complexity is not less than the preset complexity value, the plot interaction text is generated using a large language model.
[0139] The complexity is a pre-set quantization parameter value used to determine whether to choose the template generation path or the large language model generation path when the text content is not found in the cache pool.
[0140] In this embodiment, the server can pre-configure a general plot text template, which may contain fixed expressions and variable variables. When the cache is not hit, the server matches the corresponding general template according to the event information of the candidate plot event, fills in the parameters of the current plot state, and generates plot interaction text.
[0141] In this embodiment, by using a preset template to generate the interactive text of the storyline when the complexity is less than a preset complexity value, and by generating the interactive text of the storyline through a large language model when the complexity is not less than the preset complexity value, the number of calls to the large language model can be reduced, thereby lowering the cost.
[0142] In an optional implementation, see [link to relevant documentation]. Figure 8 Generate and push corresponding plot interaction response information to the client, including: Step S800: Determine the information showing changes in the updated story state compared to the original story state.
[0143] The server compares the story status information before and after the update, extracts the fields that have changed, such as changes to story nodes, adjustments to numerical attributes, and updates to accumulator values; fields that have not changed are left unprocessed to reduce data transmission volume.
[0144] Step S802: Based on the changed information, generate an incremental update message.
[0145] The server encapsulates the changed information according to a preset format to generate an incremental update message; the incremental update message contains core information such as version identifier, changed field name, and changed value, and its data volume is much smaller than that of the full state information.
[0146] Step S804: Push the incremental update message to the client so that the client updates the local story state based on the incremental update message.
[0147] The server broadcasts incremental update messages to all clients in the live stream or game room via the WebSocket protocol. After receiving the message, the client first verifies the validity of the version identifier. If the version identifier is up-to-date, it updates the locally stored story status according to the changed fields in the message. If the version identifier has expired, it requests the full story status information from the server.
[0148] In this embodiment, only the information that has changed is pushed, which greatly reduces the amount of data in the message and reduces the bandwidth usage of the server. At the same time, it adapts to the transmission requirements in the weak network environment of mobile devices and avoids the delay in plot synchronization caused by network lag.
[0149] Example 2 Figure 9 The diagram schematically illustrates a plot interaction device according to Embodiment 2 of this application. This device can be divided into one or more program modules. One or more program modules are stored in a storage medium and executed by one or more processors to complete the embodiment of this application. The program module referred to in this embodiment is a series of computer program instruction segments capable of performing a specific function. The following description will specifically introduce the function of each program module in this embodiment. For example... Figure 9 As shown, the device 900 may include: a receiving module 910, a mapping module 920, a first determining module 930, a second determining module 940, an updating module 950, and a pushing module 960, wherein: The receiving module 910 is configured to receive a target virtual resource triggering event, wherein the target virtual resource triggering event includes a target virtual resource identifier; Mapping module 920 is used to map the target virtual resource identifier to at least one corresponding capability tag; The first determining module 930 is used to determine the candidate plot events that can be triggered based on the plot state transition graph of the current plot node; The second determining module 940 is used to determine whether to trigger the candidate plot event based on the triggering conditions of the candidate plot event and the at least one ability tag; Update module 950 is used to update the current plot state when it is determined that the candidate plot event has been triggered; The push module 960 is used to generate and push corresponding plot interaction response information to the client based on the updated plot status, so that the client can present plot interaction effects based on the plot interaction response information.
[0150] In an optional implementation, mapping the target virtual resource identifier to at least one corresponding capability tag includes: obtaining a virtual resource configuration table, the virtual resource configuration table including multiple virtual resource identifiers and at least one capability tag corresponding to each virtual resource identifier; and determining at least one capability tag corresponding to the target virtual resource based on the virtual resource configuration table.
[0151] In an optional implementation, each ability tag includes an ability attribute. The step of determining whether to trigger the candidate plot event based on the triggering conditions of the candidate plot event and the at least one ability tag includes: detecting whether the at least one ability tag matches the candidate plot event; if they match, calculating the corresponding sub-contribution value for each matching ability tag based on its ability attribute, and sequentially accumulating each sub-contribution value to the accumulator corresponding to the candidate plot event; when the accumulated contribution value in the accumulator reaches the triggering threshold of the candidate plot event, the candidate plot event is triggered.
[0152] In an optional implementation, the capability attribute includes a capability strength value and a capability priority value. Calculating the sub-contribution value based on the capability attribute includes: calculating the sub-contribution value based on the capability strength value, the capability priority value, and a preset contribution value calculation algorithm.
[0153] In an optional implementation, updating the current story state includes: obtaining the current story state, which includes story state information and a version identifier; determining the story state information to be updated and the new version identifier; and performing an atomic update operation, so that when the current version identifier of the stored story state is consistent with the obtained current version identifier, the story state information is replaced with the story state information to be updated, and the version identifier is replaced with the new version identifier.
[0154] In an optional implementation, the plot interaction response information includes plot interaction text, which is generated in the following manner: Query the pre-generated text cache pool; If a text content matching the candidate plot event is found in the pre-generated text cache pool, the plot interaction text is generated based on the matching text content.
[0155] In an optional implementation, the plot state includes updated plot nodes, and the device 900 is further configured to: After the plot state is updated, based on the plot state transition graph of the updated plot nodes, at least one target subsequent plot node is determined, and the target subsequent plot node is a subsequent plot node for which text content needs to be generated; corresponding text content is generated for each of the at least one target subsequent plot node.
[0156] In an optional implementation, the plot state transition graph includes at least one subsequent plot node and the transition probability of each subsequent plot node. Based on the updated plot state transition graph of the plot nodes, determining at least one target subsequent plot node includes: selecting the Nth subsequent plot node with the highest transition probability from the at least one subsequent plot node as the target subsequent plot node based on the transition probability of each subsequent plot node, where N is an integer greater than or less than 1, and the value of N is not greater than the total number of subsequent plot nodes.
[0157] In an optional implementation, generating corresponding text content for each of the at least one target subsequent plot nodes includes: generating corresponding text content for each of the at least one target subsequent plot nodes using a large language model.
[0158] In an optional embodiment, the device 900 is further used for: If no text content matching the candidate plot event is found in the pre-generated text cache pool, the complexity of the plot node corresponding to the candidate plot event is obtained; if the complexity is less than a preset complexity value, the plot interaction text is generated using a preset template; if the complexity is not less than the preset complexity value, the plot interaction text is generated using a large language model.
[0159] In an optional implementation, generating and pushing corresponding plot interaction response information to the client includes: determining information that the updated plot state has changed compared to the plot state before the update; generating an incremental update message based on the changed information; and pushing the incremental update message to the client so that the client updates its local plot state based on the incremental update message.
[0160] In an optional embodiment, the device 900 is further used for: A verification operation is performed on the target virtual resource, and after the verification operation is successful, the target virtual resource identifier is mapped to at least one corresponding capability tag.
[0161] Example 3 Figure 10 This illustration schematically shows a hardware architecture diagram of a computer device 10000 suitable for implementing a story interaction method according to Embodiment 3 of this application. In some embodiments, the computer device 10000 may be a terminal device such as a smartphone, wearable device, tablet computer, personal computer, in-vehicle terminal, game console, virtual device, workbench, digital assistant, set-top box, robot, etc. In other embodiments, the computer device 10000 may be a rack server, blade server, tower server, or cabinet server (including independent servers or server clusters composed of multiple servers), etc. Figure 10 As shown, the computer device 10000 includes, but is not limited to: a memory 10010, a processor 10020, and a network interface 10030 that can communicate and be linked with each other via a system bus. Wherein: The memory 10010 includes at least one type of computer-readable storage medium, including flash memory, hard disk, multimedia card, card-type memory (e.g., SD or DX memory), random access memory (RAM), static random access memory (SRAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), programmable read-only memory (PROM), magnetic memory, magnetic disk, optical disk, etc. In some embodiments, the memory 10010 may be an internal storage module of a computer device 10000, such as the hard disk or memory of the computer device 10000. In other embodiments, the memory 10010 may also be an external storage device of the computer device 10000, such as a plug-in hard disk, smart media card (SMC), secure digital (SD) card, flash card, etc., equipped on the computer device 10000. Of course, the memory 10010 may also include both the internal storage module and the external storage device of the computer device 10000. In this embodiment, the memory 10010 is typically used to store the operating system and various application software installed on the computer device 10000, such as the program code of the method described in the foregoing embodiment. Furthermore, the memory 10010 can also be used to temporarily store various types of data that have been output or will be output.
[0162] In some embodiments, processor 10020 may be a central processing unit (CPU), controller, microcontroller, microprocessor, or other chip. Processor 10020 is typically used to control the overall operation of computer device 10000, such as performing control and processing related to data interaction or communication with computer device 10000. In this embodiment, processor 10020 is used to run program code stored in memory 10010 or process data.
[0163] Network interface 10030 may include a wireless network interface or a wired network interface, which is typically used to establish a communication link between computer device 10000 and other computer devices. For example, network interface 10030 is used to connect computer device 10000 to an external terminal via a network, establishing a data transmission channel and communication link between computer device 10000 and the external terminal. The network may be an intranet, the Internet, Global System for Mobile Communication (GSM), Wideband Code Division Multiple Access (WCDMA), 4G network, 5G network, Bluetooth, Wi-Fi, or other wireless or wired networks.
[0164] It should be pointed out that, Figure 10 Only computer devices with components 10010-10030 are shown; however, it should be understood that it is not required to implement all of the shown components, and more or fewer components may be implemented instead.
[0165] In this embodiment, the plot interaction method stored in memory 10010 can also be divided into one or more program modules and executed by one or more processors (such as processor 10020) to complete the embodiment of this application.
[0166] Example 4 This application also provides a computer-readable storage medium storing a computer program thereon, wherein the computer program, when executed by a processor, implements the steps of the method described in the foregoing embodiments.
[0167] In this embodiment, the computer-readable storage medium includes flash memory, hard disk, multimedia card, card-type memory (e.g., SD or DX memory), random access memory (RAM), static random access memory (SRAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), programmable read-only memory (PROM), magnetic memory, magnetic disk, optical disk, etc. In some embodiments, the computer-readable storage medium may be an internal storage unit of a computer device, such as the hard disk or memory of the computer device. In other embodiments, the computer-readable storage medium may also be an external storage device of the computer device, such as a plug-in hard disk, smart media card (SMC), secure digital (SD) card, flash card, etc., equipped on the computer device. Of course, the computer-readable storage medium may include both the internal storage unit and the external storage device of the computer device. In this embodiment, the computer-readable storage medium is typically used to store the operating system and various application software installed on the computer device, such as the program code of the method described in the foregoing embodiments. In addition, the computer-readable storage medium can also be used to temporarily store various types of data that have been output or will be output.
[0168] Example 5 This application also provides a computer program product, including a computer program that, when executed by a processor, implements the methods described in the above embodiments.
[0169] Obviously, those skilled in the art should understand that the modules or steps of the embodiments of this application described above can be implemented using general-purpose computer devices. They can be centralized on a single computer device or distributed across a network of multiple computer devices. Optionally, they can be implemented using computer-executable program code, thereby storing them in a storage device for execution by a computer device. In some cases, the steps shown or described can be performed in a different order than those presented here, or they can be fabricated as separate integrated circuit modules, or multiple modules or steps can be fabricated as a single integrated circuit module. Thus, the embodiments of this application are not limited to any particular combination of hardware and software.
[0170] It should be noted that the above are merely preferred embodiments of this application and do not limit the scope of patent protection of this application. Any equivalent structural or procedural changes made using the content of this application's specification and drawings, or direct or indirect applications in other related technical fields, are similarly included within the scope of patent protection of this application.
Claims
1. A method for interactive storytelling, characterized in that, The method includes: Receive a target virtual resource trigger event, wherein the target virtual resource trigger event includes a target virtual resource identifier; Map the target virtual resource identifier to at least one corresponding capability tag; Based on the plot state transition graph of the current plot node, potential triggerable plot events are determined; Whether to trigger the candidate plot event is determined based on the triggering conditions of the candidate plot event and the at least one ability tag; If the candidate plot event is determined to be triggered, update the current plot state; Based on the updated storyline status, corresponding storyline interaction response information is generated and pushed to the client, so that the client can present storyline interaction effects based on the storyline interaction response information.
2. The method according to claim 1, characterized in that, The step of mapping the target virtual resource identifier to at least one corresponding capability tag includes: Obtain a virtual resource configuration table, which includes multiple virtual resource identifiers and at least one capability tag corresponding to each virtual resource identifier; Based on the virtual resource configuration table, at least one capability tag corresponding to the target virtual resource is determined.
3. The method according to claim 2, characterized in that, Each ability tag contains ability attributes. The step of determining whether to trigger the candidate plot event based on the triggering conditions of the candidate plot event and the at least one ability tag includes: Detect whether the at least one ability tag matches the candidate plot event; If a match is found, for each matched ability tag, the corresponding sub-contribution value is calculated based on its ability attribute, and each sub-contribution value is accumulated to the accumulator corresponding to the candidate plot event in turn. When the accumulated contribution value in the accumulator reaches the trigger threshold of the candidate plot event, the candidate plot event is triggered.
4. The method according to claim 3, characterized in that, The capability attributes include capability strength values and capability priority values. The calculation of sub-contribution values based on capability attributes includes: The sub-contribution value is calculated based on the capability strength value, capability priority value, and a preset contribution value calculation algorithm.
5. The method according to claim 1, characterized in that, The updated current story status includes: Obtain the current story state, which includes story state information and version identifier; Determine the plot status information to be updated and the new version identifier; An atomic update operation is performed so that when the current version identifier of the stored plot state matches the obtained current version identifier, the plot state information is replaced with the plot state information to be updated, and the version identifier is replaced with the new version identifier.
6. The method according to any one of claims 1 to 5, characterized in that, The interactive storyline response information includes interactive storyline text, which is generated in the following manner: Query the pre-generated text cache pool; If a text content matching the candidate plot event is found in the pre-generated text cache pool, the plot interaction text is generated based on the matching text content.
7. The method according to claim 6, characterized in that, The plot status includes updated plot nodes, and the method further includes: After the plot state is updated, based on the plot state transition graph of the updated plot node, at least one target subsequent plot node is determined, and the target subsequent plot node is a subsequent plot node that needs to generate text content. Generate corresponding text content for each of the at least one target's subsequent story nodes.
8. The method according to claim 7, characterized in that, The plot state transition graph includes at least one subsequent plot node and the transition probability of each subsequent plot node. Based on the updated plot state transition graph of the plot nodes, determining at least one target subsequent plot node includes: Based on the transition probability of each subsequent plot node, select the Nth subsequent plot node with the highest transition probability from at least one subsequent plot node as the target subsequent plot node. N is an integer greater than or less than 1, and the value of N is not greater than the total number of subsequent plot nodes.
9. The method according to claim 7, characterized in that, Generating corresponding text content for each of the at least one target's subsequent story nodes includes: The large language model is used to generate corresponding text content for each of the at least one target's subsequent plot nodes.
10. The method according to claim 6, characterized in that, The method further includes: If no text content matching the candidate plot event is found in the pre-generated text cache pool, obtain the complexity of the plot node corresponding to the candidate plot event; When the complexity is less than a preset complexity value, the plot interaction text is generated using a preset template; When the complexity is not less than the preset complexity value, the interactive text of the storyline is generated through a large language model.
11. The method according to claim 1, characterized in that, Generate and push relevant story interaction response information to the client, including: Confirm information about changes in the updated storyline compared to the original storyline. Based on the changed information, an incremental update message is generated; The incremental update message is pushed to the client so that the client updates its local story state based on the incremental update message.
12. The method according to claim 1, characterized in that, Before the step of mapping the target virtual resource identifier to at least one corresponding capability tag, the method further includes: Perform a verification operation on the target virtual resource, and after the verification operation passes, perform the mapping step.
13. A story-interactive device, characterized in that, The device includes: The receiving module is configured to receive a target virtual resource triggering event, wherein the target virtual resource triggering event includes a target virtual resource identifier; The mapping module is used to map the target virtual resource identifier to at least one corresponding capability tag; The first determining module is used to determine the candidate plot events that can be triggered based on the plot state transition graph of the current plot node; The second determining module is used to determine whether to trigger the candidate plot event based on the triggering conditions of the candidate plot event and the at least one ability tag; The update module is used to update the current plot state when it is determined that the candidate plot event has been triggered; The push module is used to generate and push corresponding plot interaction response information to the client based on the updated plot status, so that the client can present plot interaction effects based on the plot interaction response information.
14. A computer device, characterized in that, include: At least one processor; and A memory communicatively connected to the at least one processor; wherein: The memory stores instructions that can be executed by the at least one processor to enable the at least one processor to perform the method of any one of claims 1 to 12.
15. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer instructions that, when executed by a processor, implement the method as described in any one of claims 1 to 12.
16. A computer program product, comprising a computer program, characterized in that, When executed by a processor, the computer program implements the steps of the method according to any one of claims 1 to 12.