A Method and System for Automatic Generation of 3D Scene Interactive Scripts Based on Large Language Models
By constructing a multi-role interaction graph and plot branching framework using a large language model, the problems of unclear plot intent and insufficient logical adaptability in 3D scene interactive script generation are solved, realizing plot coherence and emotional adaptability, and improving user experience.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-11
- Publication Date
- 2026-04-03
AI Technical Summary
Existing technologies cannot accurately grasp the plot intent in 3D scene interactive script generation, and the logic adaptability is insufficient, resulting in inconsistent character settings and semantic logic breaks when switching plot branches, which affects the user's immersive experience.
Using a large language model-based approach, semantic parsing is employed to extract character features and event association information, construct a multi-character interaction graph, integrate node weights and hierarchical relationships, optimize paths and dynamically update node attributes, generate coherent plot branches, and optimize dialogue rhythm and plot progression.
Ensuring that the generated plot is highly consistent with the input intent improves the logical coherence of the script and the emotional resonance with users, thereby enhancing the immersive experience in 3D scenes.
Smart Images

Figure CN121303094B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the fields of natural language processing and intelligent content generation, and in particular to a method and system for automatically generating 3D scene interactive scripts based on a large language model. Background Technology
[0002] Currently, the integration of natural language processing technology and intelligent content generation technology is injecting new momentum into the field of 3D scene interactive storytelling. As the core content carrier of immersive entertainment, virtual social interaction and other scenarios, the generation efficiency and quality of 3D scene interactive scripts directly determine the user's interactive experience and emotional immersion.
[0003] In existing technologies, the automatic generation of interactive scripts is mainly based on template matching. By pre-building a fixed plot template library, the script is broken down into standardized modules such as scene descriptions, character dialogues, and plot twists. By matching the user's input text description with keywords, the corresponding modules are retrieved from the template library and spliced together to form the script. However, when faced with the dynamic needs of multi-character interaction and multiple plot branches in 3D scenes, existing technologies cannot use semantic processing to uncover the hidden interaction logic in the input text, nor can they accurately link character motivations with event goals. The system may generate dialogue content that does not match the character's personality due to insufficient semantic processing, or cause contradictions due to semantic logic breaks when switching plot branches, which seriously affects the user's immersive experience.
[0004] Therefore, existing technologies for automatically generating interactive scripts for 3D scenes suffer from problems such as an inability to accurately grasp the plot's intent and insufficient logical adaptability. Summary of the Invention
[0005] This invention provides a method and system for automatically generating 3D scene interactive scripts based on a large language model, in order to solve the problems of existing technologies being unable to accurately grasp the plot intent and having insufficient logical adaptability.
[0006] In a first aspect, to address the aforementioned technical problems, this invention provides a method for automatically generating 3D scene interactive scripts based on a large language model, comprising:
[0007] Obtain the input text description, extract character features and event association information through semantic parsing, construct a multi-character interaction graph, and obtain a preliminary plot branching structure;
[0008] Based on the preliminary plot branch structure, the node weights and hierarchical relationships are integrated, the comprehensive influence value of the nodes is calculated, and the final matching degree between the nodes and the preset worldview rules is determined.
[0009] If the final matching degree is lower than the preset matching degree threshold, the association weight of the multi-character interaction graph is adjusted through path optimization and dynamic updating of node attributes, and a corrected plot branch framework is generated.
[0010] Logical verification nodes are extracted from the modified plot branch framework. By combining the mapping relationship between the event semantic parsing results and the logical verification nodes, background setting data is obtained, the coherence of the plot branches is verified, and the coherence verification plot branches are obtained.
[0011] Based on the coherence verification of the plot branches, context vectors are constructed and character emotional tendencies are embedded to generate initial plot fragments;
[0012] The initial plot fragments are optimized for logical connection and the dialogue rhythm is dynamically adjusted. Dynamically generated elements for plot progression are integrated to output the final dynamically generated script.
[0013] Secondly, this invention provides an automatic 3D scene interactive script generation system based on a large language model, comprising:
[0014] The structure building module obtains the input text description, extracts character features and event association information through semantic parsing, constructs a multi-character interaction graph, and obtains a preliminary plot branching structure;
[0015] The rule matching module, based on the preliminary plot branch structure, integrates node weights and hierarchical relationships, calculates the comprehensive influence value of nodes, and determines the final matching degree between nodes and preset worldview rules;
[0016] The framework correction module adjusts the association weights of the multi-role interaction graph by optimizing the path and dynamically updating the node attributes if the final matching degree is lower than the preset matching degree threshold, thereby generating a corrected plot branch framework.
[0017] The coherence verification module extracts logical verification nodes from the modified plot branch framework, combines the mapping relationship between the event semantic parsing results and the logical verification nodes, obtains background setting data, verifies the coherence of the plot branches, and obtains the coherence verification plot branches.
[0018] The segment generation module, based on the coherence verification plot branches, constructs context vectors and embeds character emotional tendencies to generate initial plot segments;
[0019] The output module is optimized by improving the content connection logic and dynamically adjusting the dialogue rhythm of the initial plot fragments, integrating dynamically generated elements of plot progression, and outputting the final dynamically generated script.
[0020] Compared with the prior art, the present invention has the following beneficial effects:
[0021] (1) This invention, through the collaborative work of semantic parsing, dependency parsing, and contextual reasoning, can not only extract explicit information such as character identifiers and behavioral characteristics from the input text, but also uncover hidden interaction logic and potential character motivations. By constructing a multi-character interaction graph that includes character motivations and event goals, it transforms scattered textual information into structured plot branch data. This technical approach ensures that the core basis for plot generation is highly consistent with the input intent, laying a precise data foundation for subsequent plot expansion.
[0022] (2) This invention quantifies the matching degree between each node and the preset worldview rules by disseminating hierarchical weights and performing node aggregation calculations. Then, for nodes with low matching degrees, the association weights of the multi-role interaction graph are adjusted through path optimization, dynamic updating of node attributes, and judgment of conflict intensity adaptability. This technical process forms a closed loop of "matching degree calculation - deviation identification - dynamic correction", ensuring that the generated plot branches conform to the worldview constraints and improving the logical rationality and credibility of the script.
[0023] (3) Based on the continuity verification of plot branches, this invention quantifies the emotional tendencies of characters and embeds them into the initial dialogue sequence. Then, combined with the smoothness detection and rhythm distribution analysis, it adjusts the sentence connection logic and length distribution. This technical means not only ensures the adaptability of the characters' emotional expression and personality settings and the plot atmosphere, but also makes the plot transition more natural by optimizing the dialogue rhythm, which significantly enhances the user's emotional resonance and immersive experience in the 3D scene. Attached Figure Description
[0024] Figure 1 This is a schematic diagram of the automatic generation method for 3D scene interactive scripts based on a large language model provided in the first embodiment of the present invention;
[0025] Figure 2 This is a schematic diagram of the structure of the automatic generation system for 3D scene interactive scripts based on a large language model provided in the second embodiment of the present invention. Detailed Implementation
[0026] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0027] Reference Figure 1 The first embodiment of the present invention provides a method for automatically generating 3D scene interactive scripts based on a large language model, including the following steps:
[0028] S11: Obtain the input text description, extract character features and event association information through semantic parsing, construct a multi-character interaction graph, and obtain a preliminary plot branch structure;
[0029] S12, Based on the preliminary plot branch structure, integrate node weights and hierarchical relationships, calculate the comprehensive influence value of the nodes, and determine the final matching degree between the nodes and the preset worldview rules;
[0030] S13, if the final matching degree is lower than the preset matching degree threshold, the association weight of the multi-role interaction graph is adjusted through path optimization and dynamic updating of node attributes, and a corrected plot branch framework is generated.
[0031] S14, extract logical verification nodes from the modified plot branch framework, combine the mapping relationship between the event semantic parsing results and the logical verification nodes, obtain background setting data, verify the coherence of the plot branches, and obtain the coherence verification plot branches.
[0032] S15, based on the coherence verification plot branch, construct context vectors and embed character emotional tendencies to generate initial plot fragments;
[0033] S16, optimize the content connection logic and dynamically adjust the dialogue rhythm of the initial plot fragment, integrate the dynamic generation elements of plot advancement, and output the final dynamically generated script.
[0034] In step S11, it is necessary to obtain the input text description, extract character features and event association information through semantic parsing, construct a multi-character interaction graph, and obtain a preliminary plot branching structure, including:
[0035] The input text description is obtained, and semantic parsing is used to perform word segmentation and syntactic analysis on the input text description to extract character identifiers and behavioral features, and construct a set of basic character features;
[0036] Based on the set of basic character features, the relationship between core event elements and characters is analyzed and identified, and the strength of the association between event nodes and character nodes is determined.
[0037] If the correlation strength is lower than a preset correlation threshold, hidden interaction logic is mined through contextual reasoning to identify contradictions in the character interaction.
[0038] To address the aforementioned contradictions, a multi-character interaction graph containing character motivations and event goals is constructed to generate a preliminary plot branching structure.
[0039] It should be noted that the input text description can be any form of text content provided by the user, such as a plot outline, scene setting, or character introduction. This serves as the foundational data source for all subsequent plot generation processes. Character identifiers refer to information that uniquely distinguishes different characters, such as character names or code names. Behavioral characteristics refer to quantifiable or describable features of a character in the text, such as actions, expressions, and language tendencies. The set of basic character characteristics is a structured organization of the character's core attributes, providing data support for subsequent analysis of character motivations and behavioral logic. Core event elements include key information such as the initiator, recipient, triggering conditions, and target outcome of the event. The correlation strength between event nodes and character nodes is used to quantify the closeness of the relationship between the character and the event.
[0040] The preset association threshold is a critical value used to determine whether the association is clear enough. It is dynamically adjusted based on the statistical average of effective associations between characters and events in a large amount of historical plot data, combined with the accuracy requirements of plot generation. The value generally ranges from 0.4 to 0.6. In this embodiment, the preset association threshold is 0.5. When the association strength is lower than this value, it indicates that the association logic between the character and the event is not clear enough, and further exploration of hidden information is needed. The multi-character interaction graph is a structured data model that uses nodes to represent characters and events and edges to represent relationships, intuitively presenting the core logical framework of the plot.
[0041] In this step, the input text description is first preprocessed. The continuous text is split into independent semantic units, including nouns, verbs, and adjectives, through word segmentation. Then, the syntactic relationships between the semantic units are determined through syntactic analysis, such as subject-predicate relationships and verb-object relationships, so as to accurately extract the role identifier and corresponding behavioral features and construct a set of basic role features.
[0042] Furthermore, based on the set of basic character features, the core elements of events in the text are analyzed to identify the relationships between events and characters. The identification of core event elements is achieved by filtering action verbs and related nouns in the text, and the strength of the relationship is quantified by calculating a semantic relevance score. The semantic relevance score is calculated by statistically analyzing the co-occurrence frequency and grammatical coherence of character identifiers and event verbs in the text, combining this with preset semantic relevance weights, and then weighted summing to obtain the relevance strength value. Normalization is applied to ensure the value ranges from 0 to 1, with values closer to 1 indicating a stronger relationship.
[0043] If the calculated association strength is lower than the preset association threshold of 0.5, it indicates that the association logic between the character and the event is ambiguous, requiring the initiation of a contextual reasoning process. Contextual reasoning analyzes the background information of the text context, the character's past behavioral logic, and the setting of the event to uncover hidden interaction logic, thereby supplementing the evidence for the association between the character and the event and increasing the association strength. Simultaneously, the analysis process needs to identify contradictions in the character interactions, such as whether there are conflicts in the motivations of different characters, or whether the character's behavior contradicts the event's goals.
[0044] For the identified points of conflict, a multi-role interaction graph is constructed, with character motivations and event goals as nodes, and the relationships between characters and events, and between characters themselves, as edges. The weight of each edge is determined by the strength of the relationship. This generates a preliminary plot branching structure, providing structured data support for subsequent plot expansion.
[0045] It is worth noting that the character feature set and multi-character interaction graph constructed in this step are both dynamically adjustable structures. If new character features or correlation logic are discovered in subsequent steps, they can be supplemented and corrected to ensure the flexibility and accuracy of plot generation. Meanwhile, the calculation method for semantic relevance scores can be adjusted according to different types of plot texts to adapt to the needs of different scenarios. The preset semantic association weights are based on historical data statistics of a large number of similar plots, extracting effective association cases between characters and events, and between events, calculating the mean and distribution range of association strength. Typically, the mean ± 1 standard deviation or the 25%-75th percentile of the distribution range is used. The baseline weight is determined in conjunction with the accuracy requirements of plot generation, and is set according to the purpose of the generated script (e.g., high accuracy is required for serious films and television dramas, while short videos and dramas can be more flexible). For example, a 40th percentile of the distribution range is used for film and television scripts for higher accuracy, while a 25th percentile is used for short dramas for greater flexibility. These weights can be dynamically adjusted according to the semantic association characteristics of different themes.
[0046] For example, suppose the input text is "Zhang San was criticized for a work mistake, angrily slammed the door and left. Li Si watched Zhang San's departing figure and sighed helplessly." Through word segmentation and syntactic analysis, the role identifiers "Zhang San" and "Li Si" are extracted, along with the behavioral features: "Zhang San: angry, behavior: slamming the door and leaving, triggering reason: being criticized for a work mistake" and "Li Si: helpless, behavior: sighing, triggering scenario: witnessing Zhang San slamming the door and leaving." Analyzing the core elements of the event, the event nodes are "being criticized for a work mistake," "slamming the door and leaving," and "sighing." The correlation strength between the role nodes and event nodes is calculated as follows: Zhang San and "being criticized for a work mistake" have a high co-occurrence frequency and a direct causal relationship, with a semantic relevance score of 0.9; Zhang San and "slamming the door and leaving" have a semantic relevance score of 0.85; Li Si and "sighing" have a semantic relevance score of 0.7; Li Si and "slamming the door and leaving" have a semantic relevance score of 0.45, which is lower than the preset threshold of 0.5 and needs to be supplemented through contextual reasoning. Based on the context "Li Si watched Zhang San's departing figure," the hidden interaction logic "Li Si sighed helplessly because he was worried about Zhang San's condition" was extracted. After this addition, the correlation strength between Li Si and "slamming the door and leaving" increased to 0.6. The identified contradiction point is "the emotional contrast between Zhang San's violent behavior and Li Si's restrained reaction." When constructing a multi-role interaction graph, "Zhang San being criticized," "slamming the door and leaving," "Li Si sighing," and "worrying about Zhang San" were used as core nodes, and "emotional contrast" was used as the connection edge between Zhang San and Li Si, generating a preliminary plot branch structure, such as "Zhang San slams the door and leaves - Li Si privately inquires about Zhang San's situation - finds Zhang San and communicates - whether Zhang San accepts the apology / continues the stalemate."
[0047] It is worth noting that this invention does not specify a particular type of large language model (such as GPT or BERT) or integration method. It only relies on the general capabilities of large language models to achieve automatic generation of 3D scene interactive scripts through a six-step process of "semantic parsing - graph construction - matching correction - coherence verification - sentiment embedding - optimized output". The key is that it is based on large language models to complete core operations such as word segmentation, syntactic analysis, contextual reasoning, and sentiment quantification. It does not need to be bound to a specific model or limit the integration scheme, and it takes into account both adaptability and generation quality, ensuring that the plot logic is compliant and the emotions are natural. Therefore, all large language models that can achieve the same effect are within the protection scope of this invention.
[0048] It should be noted that the natural language processing tasks involved in this invention, such as semantic parsing, contextual reasoning, and sentiment analysis, are all common core capabilities possessed by current large language models. Those skilled in the art know that whether it is a generative pre-trained model based on the Transformer architecture (such as the GPT series) or a bidirectional encoder representation model (such as BERT), both can achieve the semantic unit extraction, logical relationship mining, and sentiment tendency quantification required by this invention through their text understanding, generation, and reasoning capabilities. Therefore, in specific implementation, it is only necessary to input the corresponding text data into the selected large language model through application programming interface (API) calls or local deployment, and parse its output results to complete the functions of each method step in this invention.
[0049] In step S12, based on the preliminary plot branch structure, it is necessary to integrate node weights and hierarchical relationships, calculate the comprehensive influence value of nodes, and determine the final matching degree between nodes and preset worldview rules, including:
[0050] Extract character motivations and event goals from the initial plot branching structure, obtain the interaction logic and hierarchical relationships between nodes, and obtain preliminary propagation hierarchy data;
[0051] Based on the preliminary propagation hierarchy data, the node weights and hierarchy associations are calculated through node aggregation and integration to obtain the comprehensive influence value of the nodes;
[0052] If the overall impact value is lower than the preset impact threshold, the constraints of the preset worldview rules are analyzed through contextual reasoning to uncover hidden plot conflict factors and obtain a preliminary matching degree.
[0053] By comparing the data, the initial matching degree is mapped one by one to the constraints of the preset worldview rules, and the final matching degree is output.
[0054] It's important to note that character motivation is the core reason driving character behavior, while event goals are the expected outcomes of event development; both are core nodes in the branching plot structure. Inter-node interaction logic refers to the causal, progressive, and conflict relationships between character nodes and event nodes, and between character nodes themselves. Hierarchical relationships refer to the importance levels of different nodes within the plot structure, such as core nodes, secondary nodes, and auxiliary nodes. Preliminary propagation hierarchy data is a structured record of these interaction logics and hierarchical relationships. The comprehensive impact value is calculated by multiplying the node weight by the strength of the hierarchical relationship, used to assess the degree of influence a node has on plot development.
[0055] The preset influence threshold is a critical value used to determine whether a node needs further optimization and adjustment. Based on the statistical data of the comprehensive influence values of nodes in all historically tested similar 3D interactive scripts, a probability distribution curve is established, taking the distribution range greater than 90%, between 0.3 and 0.5. In this embodiment, the preset influence threshold is 0.4. When the comprehensive influence value is lower than this value, it indicates that the node's driving effect on the plot is insufficient or that there is a potential conflict with the worldview rules. The preset worldview rules are the set of settings in the virtual world where the plot is located, including constraints such as character behavior norms, event development rules, and world background settings. The preliminary matching degree is a quantitative value of the degree of adaptation between the node and the worldview rules. The final matching degree is the precise adaptation evaluation result after multi-dimensional comparison, with a value range of 0-1. The closer to 1, the higher the adaptation degree.
[0056] In this step, the character motivations and event goals of each node are first extracted from the initial plot branching structure. By analyzing the relationships between nodes, the interaction logic and hierarchical connections are identified. This forms the initial propagation hierarchy data: core hierarchy and secondary hierarchy.
[0057] Furthermore, node weights were set and their comprehensive impact values were calculated. The node weights were set using a hierarchical analysis approach. First, three core evaluation dimensions were established: "driving effect on plot conflict," "scope of influence on subsequent branches," and "degree of relevance to the core plot." A 1-9 scale (1 representing equal importance, 3 representing slightly important, 5 representing important, 7 representing very important, and 9 representing extremely important) was used to compare all nodes pairwise, thus constructing a 3×... ( The judgment matrix is calculated using the total number of nodes. Then, the eigenvector corresponding to the largest eigenvalue of this judgment matrix is calculated using the sum-product method. After normalizing the eigenvector, the initial values of the node weights are obtained. Simultaneously, the consistency index is used... Random consistency index (Calculate the consistency ratio by looking up the table based on the number of nodes) ,like A value less than 0.1 indicates that the judgment matrix logic is consistent and the initial weight values are valid; otherwise, the judgment matrix needs to be adjusted and recalculated. It should be noted that the... Refers to the 3× constructed using the 1-9 scale method Determining the largest eigenvalue of a matrix is a standard mathematical parameter in matrix theory; Used to measure the degree to which a judgment matrix deviates from a perfectly consistent matrix. When the matrices are perfectly consistent, , ; For normalization coefficients, ensure The values are independent of the matrix dimension and are comparable.
[0058] Finally, the quantification rules were determined, and the final node weights were uniformly standardized in the range of 0-1. Based on the statistical analysis of node influence data from all historical tests of similar 3D interactive scripts, the average influence percentage of core nodes is approximately 70%-90%, secondary nodes approximately 40%-60%, and auxiliary nodes approximately 10%-30%. Therefore, in one possible implementation, core nodes driving the main plot are assigned a weight of 0.7-1.0, secondary nodes promoting side plots are assigned a weight of 0.4-0.6, and auxiliary nodes that only serve as scene setups or transitions are assigned a weight of 0.1-0.3. The comprehensive influence value is equal to the product of the node weight and the hierarchical association, thus calculating the comprehensive influence value.
[0059] If the overall impact value is lower than the preset impact threshold of 0.4, it indicates that the node's driving effect on the plot is insufficient. It is necessary to analyze the constraints of the worldview rules through contextual reasoning to uncover hidden plot conflict factors. A preliminary matching degree is then calculated based on this conflict factor. The calculation method for the preliminary matching degree is as follows: the node's motivation, behavior, and goal are compared one by one with the constraints of the worldview rules, and a score of 0-1 is assigned based on the degree of conformity. The weighted sum is then used to obtain the preliminary matching degree. Finally, the preliminary matching degree is mapped one by one with the constraints of the preset worldview rules through data comparison to further refine the adaptation evaluation. One-by-one mapping involves comparing the node's preliminary matching degree with each constraint of the preset worldview rules, with core constraints having higher weight than secondary constraints. Refining the adaptation evaluation involves adjusting the preliminary matching degree based on the degree of fit between the node's motivation, behavior, and the rules. For example, if a character's "restraint" superficially conforms to the team harmony rules but lacks the motivation for proactive communication, the matching degree will be lowered, ultimately outputting a precise node-worldview adaptation result.
[0060] It's worth noting that the setting of node weights and the calculation method for comprehensive influence values can be adjusted according to the plot type and complexity. For complex plots with multiple characters and branches, more evaluation indicators can be added to optimize weight allocation. The constraints of the world-building rules need to be structured in advance to form quantifiable and comparable standards, ensuring the objectivity and accuracy of the matching degree calculation. Furthermore, the correction process from the initial matching degree to the final matching degree needs to assign different weights based on the importance of specific constraints. Core constraints, such as core world settings and essential character attributes, have higher weights than secondary constraints, such as scene detail requirements and secondary behavioral norms.
[0061] For example, suppose the preset worldview rule is "In workplace scenarios, colleagues should resolve conflicts through communication and prohibit excessive behavior that affects work order." In the initial plot branch structure, Zhang San's motivation is "dissatisfaction with criticism," and the event goal is "slamming the door and leaving." After extracting the node, Zhang San's weight is set to 0.65, the hierarchical association value is 0.7 (core node), and the comprehensive influence value is 0.65 × 0.7 = 0.455, which is higher than the preset influence threshold of 0.4. When calculating the matching degree, Zhang San's "slamming the door and leaving" behavior conflicts with the core constraint of "prohibiting excessive behavior that affects work order." The initial matching degree is 0.35. After mapping and correction one by one, the final matching degree is lowered to 0.3, indicating that this node is significantly inconsistent with the worldview rule and needs to be adjusted in subsequent steps.
[0062] In step S13, if the final matching degree is lower than a preset matching degree threshold, the association weights of the multi-role interaction graph are adjusted through path optimization and dynamic updating of node attributes to generate a corrected plot branch framework, including:
[0063] If the final matching degree is lower than the preset matching degree threshold, the node attributes in the preliminary plot branch structure are sorted out by data comparison, abnormal weights that deviate from the preset matching degree threshold are identified, and the propagation path to be optimized is determined.
[0064] For the propagation path to be optimized, the weights are reallocated through path planning to generate preliminary optimized path distribution data;
[0065] The plot logic continuity is judged based on the preliminary optimized path distribution data to obtain the continuity judgment result;
[0066] If the continuity judgment result is lower than the preset continuity threshold, the node attributes are dynamically updated through context parsing to generate corrected node association data;
[0067] Based on the corrected node association data, the association relationship of the plot branches is updated through weight mapping to obtain the framework correction result;
[0068] The conflict intensity adaptability of the frame modification result is judged. If the preset adaptability requirements are met, the modified plot branch frame is obtained.
[0069] It should be noted that the preset matching threshold is a critical value for judging whether a node is compatible with the worldview rules. It is determined based on the minimum requirements for plot rationality and statistical analysis of numerous plot generation cases, generally ranging from 0.4 to 0.6. In this embodiment, the preset matching threshold is 0.5. When the final matching degree is lower than this value, it indicates a significant conflict between the node and the worldview rules, requiring optimization and adjustment. Node attributes include core information such as the character's motivation, personality, and abilities, as well as the event's goal, triggering conditions, and scope of influence. Abnormal weights refer to values where the weight distribution between nodes deviates significantly from the weight distribution under normal plot logic. This is usually identified by comparing it with the average weight distribution of historical high-quality plots; a deviation exceeding 30% is considered abnormal. The propagation path refers to the chain of connections between nodes during plot development. The propagation path to be optimized includes chains with abnormal weights or those conflicting with the worldview.
[0070] The core of path planning is to reallocate the association weights between nodes to make the plot logic more consistent with the worldview rules and rationality requirements. The initially optimized path distribution data is the set of propagation paths after weight reallocation. The plot logic coherence judgment assesses whether the optimized paths conform to basic plot logic such as causality, chronological order, and consistency of character behavior. The coherence judgment result is quantified by a logic consistency score, with a value range of 0-1. The preset coherence threshold is the critical value for judging whether the path logic is coherent. Referring to the coherence score distribution data of all historically tested high-quality scripts of the same type, the average coherence score of qualified scripts is about 0.75, and the lowest qualified score is mostly concentrated between 0.68 and 0.72. Taking the median value of 0.7 as the threshold can cover most qualified cases. Below this value, it indicates that there is a break or contradiction in the path logic.
[0071] Contextual analysis dynamically updates node attributes based on the plot background, character settings, and event development logic. It modifies the core attributes of nodes to better align with the plot logic and world-building rules. The modified node association data represents the recalculated relationships and weights between nodes after attribute updates. Weight mapping applies the modified association weights to the plot branching structure, updating the strength of associations between nodes. The framework modification result is the plot branching framework with updated weights. Conflict intensity suitability assessment evaluates whether the intensity of plot conflicts within the modified framework meets preset requirements. This ensures sufficient conflict to drive plot development while avoiding overly abrupt or unreasonable conflicts. The preset suitability requirements are quantified through a conflict intensity score, ranging from 0.3 to 0.8; values within this range are considered satisfactory.
[0072] In this step, the final matching degree is first determined to be lower than the preset matching degree threshold of 0.5. If it is lower than the threshold, the data comparison process is started to sort out the attributes of all nodes in the preliminary plot branch structure, compare the association weight between each node with the average weight distribution of historical high-quality plots, identify abnormal weights, and then determine the propagation path containing the association as the propagation path to be optimized.
[0073] For the propagation path to be optimized, path planning and weight reallocation are performed. Path planning prioritizes A. * The algorithm balances efficiency and optimal path selection. For complex, multi-branch scenarios, an improved Dijkstra algorithm can be used to adapt to multi-objective path search. Weight redistribution is based on "worldview matching degree + plot logic coherence": first, abnormal weight nodes are marked as "nodes to be optimized," and then, based on A... * The algorithm's heuristic function (combining the matching score of nodes with the world view and the strength of logical connections between nodes) searches for the optimal propagation path. Then, it redistributes the total weight of the path to be optimized to each node according to the following ratio: core nodes 40%-50% weight, secondary nodes 20%-30% weight, and auxiliary nodes 10%-20% weight. (Based on statistical analysis of all historical test data of similar 3D interactive scripts, the average weight of core nodes is approximately 45%, secondary nodes approximately 25%, and auxiliary nodes approximately 15%. This ratio has been verified through multiple plot generation tests; it balances world view matching and plot flexibility, avoiding logical contradictions or weak subplots due to weight imbalance. An upward and downward adjustment of ±5% ultimately forms a fixed range for dynamic fine-tuning.) This ensures that the sum of node weights on the same path after adjustment is consistent with the original total weight, preventing plot logic imbalance. The weight redistribution is based on the node's comprehensive influence value, its matching degree with the world view, and the need for plot conflict. Abnormal weights and the associated weights of related nodes are adjusted to ensure a balanced and reasonable overall weight distribution, making the weight distribution of each node in the path more consistent with the plot logic, generating preliminary optimized path distribution data.
[0074] It should be noted that the preliminary optimized path distribution data is essentially a new node association weight scheme; the subsequent weight mapping step is to use this new weight scheme as input to directly update the weight attributes of the corresponding edges in the multi-role interaction graph, thereby forming the framework correction result; this process ensures that the results of path planning are accurately and completely applied to the plot branch structure.
[0075] Furthermore, the preliminarily optimized path distribution data is assessed for plot logic coherence. By constructing a logical relationship graph, the causal relationships between nodes in the path are examined to determine if they hold true, whether character actions align with their motivations, and whether event development conforms to chronological order and worldview rules. Next, a coherence score is calculated, assigning a coherence rating to each logical relationship in the path. The three core scoring dimensions are "causal rationality, character behavior fit, and worldview compatibility." Since causality is the core of plot logic, and characters and the worldview are crucial supports, the weight of causal rationality should be higher than the other two dimensions. In one possible implementation, the weights of each dimension can be set to 40%, 35%, and 25%, respectively. The scoring standard uses a 0-10 scale, with causal rationality scored based on "whether the causal relationship between nodes holds true" (e.g., whether event A is reasonable). The derivation of event B scores 8-10 points, while a lack of causal relationship scores 0-2 points. Character behavior fit is scored based on whether the behavior aligns with the character's established traits (8-10 points for consistent personality and motivation, 0-2 points for contradictions). Worldview compatibility is scored based on whether the plot conflicts with pre-set rules (8-10 points for perfect fit, 0-2 points for significant conflict). The final score is obtained by weighted summation of "each dimension score × corresponding weight" (total score 0-10 points), then normalized to the 0-1 range as the coherence judgment result for comparison with a pre-set coherence threshold. If the coherence judgment result is lower than the pre-set coherence threshold, the node attributes are dynamically updated through context analysis.
[0076] Contextual analysis, combined with plot background information, uncovers the underlying reasons behind node attributes and supplements or corrects them. First, it extracts logical conflict points in the path to be optimized (such as contradictions between character behavior and settings, or inconsistencies between plot and worldview), and calls a large language model to analyze the underlying reasons behind the conflicts. Then, based on data such as the corresponding character's personality, past experiences, and worldview rules, it generates attribute update suggestions, such as supplementing the "impulsive" character attribute to "impulsive but values teamwork". Finally, it verifies whether the updated attributes can resolve the logical conflicts. If the conflicts still exist, the analysis-retrieval-correction process is repeated until the node attributes are fully compatible with the plot logic, character settings, and worldview.
[0077] Based on the corrected node association data, the relationships between plot branches are updated through weight mapping. The new weight allocation scheme is applied to the plot branch structure to generate a revised framework. Finally, the revised framework is evaluated for its adaptability to conflict intensity. The conflict intensity score is calculated by weighting indicators such as the intensity of the conflict, its role in advancing the plot, and its fit with the character settings. If the conflict intensity score is between 0.3 and 0.8, it meets the preset adaptability requirements, and the revised plot branch framework is obtained. If the score is below 0.3, it indicates insufficient conflict intensity, and the association weights of related nodes need to be further increased. If the score is above 0.8, it indicates that the conflict is too intense, and the weights need to be appropriately reduced.
[0078] It is worth noting that the required level of conflict intensity can be adjusted according to the style of the plot. The threshold for conflict intensity in workplace dramas can be appropriately lowered, focusing on resolving conflicts rationally.
[0079] For example, assuming a preset matching threshold of 0.5, Zhang San's final matching score in a certain plot branch is 0.3, and his association weight with the event "slamming the door and leaving" is 0.85 (anomaly weight, historical average 0.4-0.6). The propagation path to be optimized is "Zhang San - work mistake criticized - slamming the door and leaving - Li Si sighing - tense team atmosphere". During path planning, the weight of Zhang San with "slamming the door and leaving" is reduced to 0.5, the weight of Zhang San with "proactive communication" is increased to 0.4, and the weight of Li Si with "proactive reassurance" is increased to 0.35. The path distribution data after initial optimization is "Zhang San - work mistake criticized - calm reflection - proactive communication - Li Si reassurance - team atmosphere eased". When judging logical coherence, it was found that Zhang San's motivation for "calm reflection" was unclear, and the logical consistency score was 0.58, which is lower than the preset coherence threshold of 0.7. Through contextual analysis, Zhang San's attributes were updated to "strong self-esteem but reasonable, values team relationships". The node association data was corrected, and the association weight between Zhang San and "calm reflection" was adjusted to 0.6. The conflict intensity score was 0.65, which met the adaptability requirements, and the revised plot branch framework was generated.
[0080] In step S14, it is necessary to extract logical verification nodes from the modified plot branch framework, combine the mapping relationship between the event semantic parsing results and the logical verification nodes, obtain background setting data, verify the coherence of the plot branches, and obtain coherence verification plot branches, including:
[0081] Logical verification nodes are extracted from the modified plot branch framework. The semantic content of the event target is decomposed through semantic parsing. The semantic consistency between the logical verification nodes and the event target is compared to obtain the mapping relationship.
[0082] Based on the mapping relationship, background setting data is obtained from a pre-established background database to determine the range of deviation in plot coherence.
[0083] For the aforementioned plot coherence deviation range, extract the semantic content of the event target and the semantic unit that matches the background setting data, determine whether there is a logical conflict, and if so, mark the semantic unit as an object to be adjusted;
[0084] By comparing the paths, the compatibility between the object to be adjusted and the preliminary plot branch structure is analyzed, and the direction of coherence correction and reference data are determined in conjunction with the mapping relationship.
[0085] The coherence correction direction and reference data are integrated into the content and applied to the corresponding positions of the initial plot branch structure to verify coherence, thus obtaining a coherence-verified plot branch.
[0086] It should be noted that logical verification nodes are crucial for the coherence of plot branches, including nodes where core characters' motivations change, turning points in key events, and core connections between characters and events. A pre-built background database stores all background setting information for the plot, including structured data such as character traits, world rules, historical events, and scene settings. Data sources include user-input plot outlines / character settings, publicly available film / game world-building materials, and historical data accumulated from similar scripts. Data is manually reviewed and deduplicated before being stored. The data structure adopts a hierarchical design, with the top layer divided into "Character Database, World-Building Database, and Event Database," and lower layers storing data by detailed fields (e.g., the character database includes name, personality, and motivation; the world-building database includes rules and historical background). Fields use key-value pairs for easy retrieval. The query interface uses semantic matching retrieval; inputting core semantic units (such as character personality or event goals) will match relevant data. The update mechanism consists of scheduled batch updates and real-time incremental updates. New content in the publicly available material database is updated periodically, and new data is entered in real-time when users supplement settings or generate plots, while historical versions are retained for rollback.
[0087] In this step, key logic verification nodes are first extracted from the revised plot branch framework. Based on the node's impact on subsequent plot development and its correlation density with other nodes, nodes ranking in the top 30% in both impact and correlation density (this value can be dynamically adjusted according to different script requirements) are identified as key logic verification nodes. The semantic content of the event target is then decomposed through semantic parsing, breaking it down into multiple core semantic units. The consistency between the logic verification nodes and these semantic units is compared to determine whether the core semantics of the logic verification nodes match the semantic units of the event target, thus obtaining the mapping relationship, i.e., the semantic correspondence between the two, such as inclusion, causal, or progressive relationships.
[0088] Based on this mapping relationship, relevant background setting data is obtained from the background database. The range of deviation in plot coherence is determined by comparing the semantics of the logical verification nodes with the requirements of the background setting data. For this deviation range, semantic units of event targets are extracted and logically matched with the background setting data. If a semantic unit contradicts the background setting data, character settings, or the preceding plot logic, the object to be adjusted is the semantic unit with logical conflict. The semantic unit with logical conflict is marked as the object to be adjusted and initially classified as motivational connection deviation.
[0089] By comparing paths and analyzing the position and role of the object to be adjusted within the overall narrative flow, the compatibility of the adjusted object with the overall plot logic is assessed. If incompatibility exists, a direction for coherence correction needs to be determined based on character traits or background setting data. This correction direction and reference data are then applied to the corresponding positions in the plot branches through content integration. Content integration involves incorporating the correction direction and reference data into the plot branch structure, adjusting relevant nodes and relationships, and recalculating the coherence score. If the score exceeds a preset coherence threshold, it passes verification, resulting in a coherence-verified plot branch.
[0090] It's worth noting that the extraction of logical verification nodes needs to be considered in conjunction with the complexity of the plot and the number of branches. The more branches there are, the more verification nodes need to be extracted, ensuring that each key branch has a corresponding continuity verification point. The semantic decomposition of event targets must ensure the integrity and independence of semantic units, avoiding the omission of core semantics.
[0091] For example, suppose the revised plot branch framework is "Zhang San is criticized for a work mistake - angrily slams the door - proactively communicates with the leader - conflict resolved," and extract "Zhang San proactively communicates with the leader" as the key logical verification node. The event goal "conflict resolution" is broken down into semantic units such as "recognizing the mistake," "proactively communicating," "gaining understanding," and "reaching a consensus." Comparison reveals a logical gap between Zhang San's "proactive communication" and the background setting's trait of "strong self-esteem," with the consistency deviation falling within the range of "lack of motivational support for behavioral change." The object to be adjusted is "lack of transitional motivation," and through path comparison, the direction of correction is determined to be "supplementing Zhang San's internal struggle and decision-making process," with reference data being the traits of "valuing team relationships" and "being reasonable." After content integration, the adjusted plot branch is "Zhang San is criticized for a work mistake - angrily slams the door - after calming down, he thinks: the mistake affected the team, although he feels wronged, he needs to take responsibility - he takes the initiative to communicate with his leader - he frankly admits the problem - the leader understands and provides guidance - the conflict is resolved". The coherence score is calculated to be 0.82. After verification, the coherence verification plot branch is obtained as follows: "Zhang San is criticized for a work mistake - angrily slams the door - after calming down, he thinks: the mistake affected the team, although he feels wronged, he needs to take responsibility - he takes the initiative to communicate with his leader - he frankly admits the problem - the leader understands and provides guidance - the conflict is resolved".
[0092] In step S15, based on the plot branch verification based on coherence, context vector construction and character emotional tendency embedding are performed to generate initial plot fragments, including:
[0093] Based on the coherence verification of the plot branches, core semantic units are extracted and compared with a pre-established background database to obtain context adaptation data and determine the initial dialogue sequence.
[0094] For the initial dialogue sequence, sentiment analysis is used to quantify the character's behavior and emotional tendencies, resulting in sentiment weight distribution data.
[0095] If the emotion weight distribution data exceeds the preset emotion threshold, adjust the emotion mapping parameters and embed the initial dialogue sequence to obtain an optimized dialogue sequence;
[0096] For the optimized dialogue sequence, the context and emotional tendency are verified a second time through sequence generation to generate initial plot fragments.
[0097] It should be noted that the core semantic units are key semantic fragments extracted from the plot branches used in coherence verification that embody the core logic of the plot, character motivations, and event goals, such as character behavior, event outcomes, and emotional states. Contextual adaptation data is adaptation information obtained by comparing the core semantic units with a background database, including character dialogue styles, emotional expression habits, and scene language norms, used to guide the generation of the initial dialogue sequence. The initial dialogue sequence is a set of character dialogues constructed based on the core semantic units and contextual adaptation data, and must conform to the character's personality and the requirements of the plot scene.
[0098] Sentiment analysis identifies and quantifies the emotional tendencies behind a character's behavior. These tendencies include basic emotions such as anger, joy, sadness, fear, and hesitation, as well as complex emotions. Sentiment weight distribution data quantifies the proportion of each emotional tendency within a dialogue sequence. A preset emotion threshold is a critical value used to judge whether emotional expression is excessive or insufficient. It is determined based on the character's personality and the needs of the plot scenario. Different emotion types have different thresholds. For example, if a character is described as "having strong self-esteem but restraint," the preset threshold for anger is 40%; exceeding this value is considered excessive emotional expression.
[0099] Emotion mapping parameters control the intensity and manner of emotion expression in dialogue. These parameters include the frequency of emotional vocabulary use, the selection of modal particles, and sentence structure. Adjusting these parameters makes emotional expression more consistent with character settings and the overall atmosphere of the story. Optimized dialogue sequences are the adjusted dialogue sequences with reasonable emotional expression. Secondary validation of the generated sequence checks whether the optimized dialogue sequences conform to contextual logic, whether the emotional tendencies are consistent, and whether the dialogue transitions are natural, ensuring the coherence and adaptability of the dialogue sequence with the plot branches. Initial plot fragments are complete plot fragments containing character dialogue, behavioral descriptions, and scene cues, serving as the foundation for further optimization.
[0100] In this step, the plot branches are first validated for coherence, and core semantic units are extracted. These core semantic units are then compared with a background database to obtain context-adaptation data, which guides the generation of the initial dialogue sequence. Based on the core semantic units and context-adaptation data, the initial dialogue sequence is determined. Sentiment analysis is performed on the initial dialogue sequence, using a large language model to identify emotional words, modal particles, and sentence structures in the dialogue. Then, each type of emotion is quantified by intensity from 0 to 10 levels. Finally, weights are assigned according to the priority of the emotions' impact on the plot (based on statistical data of the emotional distribution of all historically tested high-quality scripts, core emotions account for approximately 40%, secondary emotions for approximately 30%, and background emotions for approximately 30%), and the weighted sum is normalized to the 0-1 range to obtain the proportion distribution of each emotion, resulting in the emotional weight distribution data. If the emotional weight distribution data exceeds the preset emotional threshold, combined with character characteristics and other set data, the emotional expression can be appropriately reduced, and the emotional mapping parameters can be adjusted: reducing words that directly express specific emotions and increasing descriptive language to make the emotional expression more in line with the character setting, resulting in an adjusted and optimized dialogue sequence.
[0101] It should be noted that the priority of the emotional impact is determined as follows: emotions directly related to the core conflict of the current plot branch are defined as core emotions (such as anger or sadness caused by the main conflict); emotions related to the character's daily state or secondary interactions are defined as secondary emotions (such as habitual helplessness or slight joy); and emotions used to render the atmosphere of the scene and not driven by the character are defined as background emotions (such as the oppressive or relaxed feeling inherent in the scene). Based on the above definitions and combined with historical data statistics, core, secondary, and background emotions are assigned weight coefficients of approximately 40%, 30%, and 30%, respectively, and weighted calculations are performed.
[0102] Furthermore, a second validation is performed on the optimized dialogue sequence to check whether the dialogue conforms to contextual logic, whether the emotional tone is consistent, and whether the dialogue transitions are natural. If the second validation passes, an initial plot fragment is generated by combining the scene description and behavioral cues:
[0103] It is worth noting that if the second coherence check fails, the core reason for the failure needs to be identified first (such as conflict between character behavior and setting, or break in causal logic). Based on the background setting data and correction reference in S14, the corresponding nodes of the coherence check plot branches should be adjusted (such as supplementing character motivation transitions and correcting the causal relationship of events). After optimization, the coherence check should be performed again. If it still fails twice in a row, it should return to the S13 framework correction module to readjust the node relationships and weight allocation of the plot branch framework. After ensuring that the branch logic is compliant, it should return to S15 to regenerate the dialogue sequence to avoid repeated regeneration and waste of efficiency, while ensuring that the core plot logic is free of flaws.
[0104] For example, suppose the coherence verification plot branch is "Li Si sees Zhang San slam the door and leave, then proactively approaches Zhang San to communicate - expresses concern - Zhang San confides his grievances - Li Si offers advice - Zhang San decides to proactively apologize to the leader". The core semantic units are "Li Si proactively communicates", "expresses concern", "Zhang San confides his grievances", "Li Si offers advice", and "decides to apologize". In the background database, Li Si is described as "gentle, a good listener, and values colleague relationships", while Zhang San is described as "strong self-esteem and emotionally sensitive". The contextual adaptation data shows that Li Si's tone is friendly and uses many comforting words; Zhang San's initial dialogue is slightly resistant, but he gradually opens up later. In the initial dialogue sequence, Zhang San's aggrieved emotions have a weight of 70%, exceeding the preset threshold of 50%. Adjusting the emotional mapping parameters, increasing Li Si's guiding statements, reducing Zhang San's negative emotional expressions, and optimizing the dialogue sequence, the second verification passes, generating the initial plot segment.
[0105] In step S16, the initial plot fragment needs to be optimized in terms of content connection logic and dynamically adjusted in terms of dialogue rhythm. Dynamically generated elements for plot progression are then integrated to output the final dynamically generated script, including:
[0106] Based on the initial plot fragments, semantic comparison is used to extract plot-related semantic units from a pre-established context database to construct a content connection framework;
[0107] Based on the content connection framework, generate statement content that conforms to the preset logical structure, check whether the smoothness of statement transition reaches the preset smoothness threshold, and if it does not reach the preset smoothness threshold, adjust the statement arrangement order to obtain the adjusted statement sequence.
[0108] Analyze the rhythm distribution characteristics of the adjusted sentence sequence, optimize the sentence length for better fit, and form a rhythm-fitted segment structure.
[0109] Based on the rhythm-adapted segment structure, dynamic generation elements for plot progression are integrated to output the final dynamically generated script.
[0110] It should be noted that the pre-built context library stores semantic units, dialogue templates, and plot transition methods corresponding to different types of plots, scenes, and character relationships. Data sources primarily include high-quality script excerpts from publicly available films, games, and short dramas; valid content from historically generated scripts that has passed manual review; and user-input plot-derived materials. During construction, materials are first categorized by "theme, scene, and plot type," then the core semantic units, sentence structures, and rhythmic features of each category are broken down and stored in a structured format of "category tags, semantic keywords, and structural templates," forming a quickly searchable context library. The context library can be iteratively updated by manually supplementing high-quality materials and automatically filtering qualified excerpts from newly generated scripts to adapt to different scenario script generation needs. Semantic units related to plot progression refer to key semantic fragments that drive plot development, connect preceding and following plots, and trigger new interactions, such as action decisions, conflict resolution, subsequent planning, and emotional sublimation. The content connection framework is a plot logic framework built based on extracted semantic units, clarifying causal, progressive, and transitional relationships between statements to ensure the rationality of content connection.
[0111] The preset logical structure is a set of sentence organization rules based on the plot type and scene. For example, workplace scenes use a structure of "scene description - character interaction - problem communication - solution - follow-up planning," while dialogue-based scenes use a structure of "opening greetings - core topic - exchange of views - reaching a consensus." Transition smoothness is an indicator that evaluates the naturalness of the connection between sentences. It is calculated by evaluating the semantic relevance, sentence coherence, and logical connection between sentences to obtain a smoothness score, ranging from 0 to 1. The preset smoothness threshold is a critical value for judging whether the transition is natural. It is set based on the fluency requirements of natural language expression; in this embodiment, it is set to 0.8. If the value is lower than this, the sentence order needs to be adjusted.
[0112] The rhythmic distribution characteristics include sentence length distribution, dialogue intervals, and changes in emotional intensity. Dynamically generated elements for plot progression refer to elements that enhance dramatic tension and drive the plot forward, such as supplementary details, emotional deepening, and foreshadowing. These elements must be appropriately integrated based on the plot's branching structure and character settings. The final dynamically generated script is a complete script after content integration optimization, rhythm adjustment, and dynamic element fusion. It includes complete content such as scene descriptions, character dialogues, actions, and emotional cues, and can be directly used for 3D scene interactive presentation.
[0113] In this step, based on the initial plot fragments, semantic units related to plot progression are extracted from the context database through semantic comparison. A content connection framework is then constructed based on these semantic units: scene description - solution outline - responsibility clarification - rectification timeline - emotional support - follow-up commitment. Sentence content conforming to a preset logical structure is generated based on this framework. The preset logical structure is "problem analysis - solution - division of responsibilities - follow-up support," generating an initial sentence sequence. Further, the smoothness of sentence transitions is verified, and the semantic relevance between sentences is calculated. Core semantic units are extracted on a sentence-by-sentence basis. A weighted quantitative score (ranging from 0 to 1) is calculated by comparing the overlap of semantic units between sentences, the tightness of causal relationships, and sentence structure suitability. High overlap, clear causal relationships, and harmonious sentence structure result in a high score, and vice versa. A score below the preset smoothness threshold indicates an unnatural transition. The sentence order needs to be adjusted, and transitional sentences added to obtain the adjusted sentence sequence.
[0114] Furthermore, it is necessary to analyze the rhythmic distribution characteristics of the adjusted sentence sequence, optimize the sentence length for adaptation, and adjust the sentence length according to the plot atmosphere and character personality. For example, short sentences are used in serious communication scenes, while longer sentences can be used appropriately in emotional expression scenes to ensure a tight rhythm that matches the plot's emotions. Long sentences are broken down and the proportion of short sentences is adjusted to form a rhythmically adapted segment structure. Based on this rhythmically adapted segment structure, dynamically generated elements for plot progression are integrated. Based on this rhythmically adapted segment structure, three core elements are specifically added: first, supplementary details (such as character actions and scene atmosphere descriptions); second, emotional deepening (such as changes in character's eyes and tone); and third, foreshadowing (such as hints at potential collaboration problems or unfulfilled goals). This ensures that the elements are consistent with the plot logic and character settings, are not abrupt, and can naturally drive the plot forward, ultimately outputting a dynamically generated script.
[0115] For example, suppose the initial plot segment is "After Li Si persuades Zhang San, Zhang San decides to apologize proactively - the next day Zhang San finds the leader - communicates the improvement plan - the leader provides support." Semantic units extracted through semantic comparison include "proactive apology," "plan communication," "leader support," "detail rectification," and "subsequent collaboration," constructing a content connection framework: Scene description (early morning in the office) - Proactive apology (opening) - Plan communication (core) - Detail confirmation (supplement) - Leader support (emotion) - Subsequent commitment (ending). After generating the initial sentence sequence, it was found that the transitions were not natural enough. The sentence order was adjusted and the rhythm optimized, integrating "action details" elements (Zhang San's hand gestures when handing over the plan, the leader's nodding expression) and "subsequent foreshadowing" elements (mentioning potential problems in cross-departmental collaboration), ultimately outputting a dynamically generated script.
[0116] In summary, this invention discloses an automatic 3D scene interactive script generation method based on a large language model. The method includes: acquiring the input text description; extracting character features and event association information through semantic parsing; constructing a multi-character interaction graph to obtain a preliminary plot branch structure; integrating node weights and hierarchical associations to calculate the comprehensive influence value and determine the final matching degree between nodes and preset worldview rules; if the matching degree is lower than a preset threshold, generating a corrected plot branch framework through path optimization and dynamic updating of node attributes; extracting logical verification nodes and verifying the coherence of plot branches in conjunction with background setting data to obtain coherence-verified plot branches; constructing context vectors and embedding character emotional tendencies to generate initial plot fragments; and outputting the final dynamically generated script through content connection logic optimization, dynamic adjustment of dialogue rhythm, and fusion of dynamically generated elements. This invention, through the synergy of semantic parsing, syntactic analysis, and contextual reasoning, can extract explicit information such as character identifiers and behavioral characteristics, as well as uncover hidden interaction logic and potential character motivations, transforming scattered text information into structured plot branch data, ensuring a high degree of consistency between the core basis of plot generation and the input intent. Simultaneously, by quantifying the matching degree through hierarchical weight allocation and node aggregation calculation, a closed-loop system of "matching degree calculation - deviation identification - dynamic correction" is used to adjust the associated weights, ensuring that plot branches conform to the constraints of the world view and improving the logical rationality and credibility of the script. In addition, the emotional tendencies of the characters are quantified and embedded into the initial dialogue sequence. Combined with transition smoothness detection and rhythm distribution analysis, the sentence connection and length distribution are optimized. This not only achieves the adaptation of the characters' emotional expression and personality settings to the plot atmosphere, but also makes the plot transitions more natural, significantly enhancing the user's emotional resonance and immersive experience in the 3D scene.
[0117] Reference Figure 2 The second embodiment of the present invention provides an automatic 3D scene interactive script generation system based on a large language model, comprising:
[0118] The structure building module obtains the input text description, extracts character features and event association information through semantic parsing, constructs a multi-character interaction graph, and obtains a preliminary plot branching structure;
[0119] The rule matching module, based on the preliminary plot branch structure, integrates node weights and hierarchical relationships, calculates the comprehensive influence value of nodes, and determines the final matching degree between nodes and preset worldview rules;
[0120] The framework correction module adjusts the association weights of the multi-role interaction graph by optimizing the path and dynamically updating the node attributes if the final matching degree is lower than the preset matching degree threshold, thereby generating a corrected plot branch framework.
[0121] The coherence verification module extracts logical verification nodes from the modified plot branch framework, combines the mapping relationship between the event semantic parsing results and the logical verification nodes, obtains background setting data, verifies the coherence of the plot branches, and obtains the coherence verification plot branches.
[0122] The segment generation module, based on the coherence verification plot branches, constructs context vectors and embeds character emotional tendencies to generate initial plot segments;
[0123] The output module is optimized by improving the content connection logic and dynamically adjusting the dialogue rhythm of the initial plot fragments, integrating dynamically generated elements of plot progression, and outputting the final dynamically generated script.
[0124] It should be noted that the 3D scene interactive script automatic generation system based on a large language model provided in this embodiment of the invention is used to execute all the process steps of the 3D scene interactive script automatic generation method based on a large language model in the above embodiment. The working principles and beneficial effects of the two are one-to-one, so they will not be described again.
[0125] It should be noted that the system embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Furthermore, in the accompanying drawings of the system embodiments provided by this invention, the connection relationships between modules indicate that they have communication connections, which can be specifically implemented as one or more communication buses or signal lines. Those skilled in the art can understand and implement this without any creative effort.
[0126] The specific embodiments described above further illustrate the purpose, technical solution, and beneficial effects of the present invention. It should be understood that the above descriptions are merely specific embodiments of the present invention and are not intended to limit the scope of protection of the present invention. In particular, it should be noted that any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the scope of protection of the present invention for those skilled in the art.
Claims
1. A method for automatically generating 3D scene interactive scripts based on a large language model, characterized in that, include: Obtain the input text description, extract character features and event association information through semantic parsing, construct a multi-character interaction graph, and obtain a preliminary plot branching structure; Based on the preliminary plot branch structure, the node weights and hierarchical relationships are integrated, the comprehensive influence value of the nodes is calculated, and the final matching degree between the nodes and the preset worldview rules is determined. If the final matching degree is lower than the preset matching degree threshold, the association weight of the multi-role interaction graph is adjusted through path optimization and dynamic updating of node attributes, and a corrected plot branch framework is generated. Logical verification nodes are extracted from the modified plot branch framework. By combining the mapping relationship between the event semantic parsing results and the logical verification nodes, background setting data is obtained, the coherence of the plot branches is verified, and the coherence verification plot branches are obtained. Based on the coherence verification of the plot branches, context vectors are constructed and character emotional tendencies are embedded to generate initial plot fragments; The initial plot fragments are optimized for logical connection and the dialogue rhythm is dynamically adjusted. Dynamically generated elements for plot progression are integrated to output the final dynamically generated script. Wherein, if the final matching degree is lower than a preset matching degree threshold, the association weights of the multi-character interaction graph are adjusted through path optimization and dynamic updating of node attributes to generate a corrected plot branch framework, including: If the final matching degree is lower than the preset matching degree threshold, the node attributes in the preliminary plot branch structure are sorted out by data comparison, abnormal weights that deviate from the preset matching degree threshold are identified, and the propagation path to be optimized is determined. For the propagation path to be optimized, the weights are reallocated through path planning to generate preliminary optimized path distribution data; The plot logic coherence is judged on the preliminary optimized path distribution data to obtain the coherence judgment result; If the coherence judgment result is lower than the preset coherence threshold, the node attributes are dynamically updated through context parsing to generate corrected node association data; Based on the corrected node association data, the association relationship of the plot branches is updated through weight mapping to obtain the framework correction result; The conflict intensity adaptability of the frame modification result is judged. If the preset adaptability requirements are met, the modified plot branch frame is obtained.
2. The method for automatically generating 3D scene interactive scripts based on a large language model according to claim 1, characterized in that, The process of obtaining the input text description involves extracting character features and event association information through semantic parsing, constructing a multi-character interaction graph, and obtaining a preliminary plot branching structure, including: The input text description is obtained, and semantic parsing is used to perform word segmentation and syntactic analysis on the input text description to extract character identifiers and behavioral features, and construct a set of basic character features; Based on the set of basic character features, the relationship between core event elements and characters is analyzed and identified, and the strength of the association between event nodes and character nodes is determined. If the correlation strength is lower than a preset correlation threshold, hidden interaction logic is mined through contextual reasoning to identify contradictions in the character interaction. To address the aforementioned contradictions, a multi-character interaction graph containing character motivations and event goals is constructed to generate a preliminary plot branching structure.
3. The method for automatically generating 3D scene interactive scripts based on a large language model according to claim 1, characterized in that, Based on the initial plot branch structure, the process of integrating node weights and hierarchical relationships, calculating the comprehensive influence value of nodes, and determining the final matching degree between nodes and preset worldview rules includes: Extract character motivations and event goals from the initial plot branching structure, obtain the interaction logic and hierarchical relationships between nodes, and obtain preliminary propagation hierarchy data; Based on the preliminary propagation hierarchy data, the node weights and hierarchy associations are calculated through node aggregation and integration to obtain the comprehensive influence value of the nodes; If the overall impact value is lower than the preset impact threshold, the constraints of the preset worldview rules are analyzed through contextual reasoning to uncover hidden plot conflict factors and obtain a preliminary matching degree. By comparing the data, the initial matching degree is mapped one by one to the constraints of the preset worldview rules, and the final matching degree is output.
4. The method for automatically generating 3D scene interactive scripts based on a large language model according to claim 3, characterized in that, The process of extracting logical verification nodes from the modified plot branch framework, combining the mapping relationship between the event semantic parsing results and the logical verification nodes, obtaining background setting data, verifying the coherence of plot branches, and obtaining coherence verification plot branches includes: Logical verification nodes are extracted from the modified plot branch framework. The semantic content of the event target is decomposed through semantic parsing. The semantic consistency between the logical verification nodes and the event target is compared to obtain the mapping relationship. Based on the mapping relationship, background setting data is obtained from a pre-established background database to determine the range of deviation in plot coherence. For the aforementioned plot coherence deviation range, extract the semantic content of the event target and the semantic unit that matches the background setting data, determine whether there is a logical conflict, and if so, mark the semantic unit as an object to be adjusted; By comparing the paths, the compatibility between the object to be adjusted and the preliminary plot branch structure is analyzed, and the direction of coherence correction and reference data are determined in conjunction with the mapping relationship. The coherence correction direction and reference data are integrated into the content and applied to the corresponding positions of the initial plot branch structure to verify coherence, thus obtaining a coherence-verified plot branch.
5. The method for automatically generating 3D scene interactive scripts based on a large language model according to claim 1, characterized in that, The process of constructing context vectors and embedding character emotional tendencies based on the coherence verification plot branches to generate initial plot fragments includes: Based on the coherence verification of the plot branches, core semantic units are extracted and compared with a pre-established background database to obtain context adaptation data and determine the initial dialogue sequence. For the initial dialogue sequence, sentiment analysis is used to quantify the character's behavior and emotional tendencies, resulting in sentiment weight distribution data. If the emotion weight distribution data exceeds the preset emotion threshold, adjust the emotion mapping parameters and embed the initial dialogue sequence to obtain an optimized dialogue sequence; For the optimized dialogue sequence, the context and emotional tendency are verified a second time through sequence generation to generate initial plot fragments.
6. The method for automatically generating 3D scene interactive scripts based on a large language model according to claim 1, characterized in that, The process of optimizing the content connection logic and dynamically adjusting the dialogue rhythm of the initial plot fragments, integrating dynamically generated elements of plot progression, and outputting the final dynamically generated script includes: Based on the initial plot fragments, semantic comparison is used to extract plot-related semantic units from a pre-established context database to construct a content connection framework; Based on the content connection framework, generate statement content that conforms to the preset logical structure, check whether the smoothness of statement transition reaches the preset smoothness threshold, and if it does not reach the preset smoothness threshold, adjust the statement arrangement order to obtain the adjusted statement sequence. Analyze the rhythm distribution characteristics of the adjusted sentence sequence, optimize the sentence length for better fit, and form a rhythm-fitted segment structure. Based on the rhythm-adapted segment structure, dynamic generation elements for plot progression are integrated to output the final dynamically generated script.
7. A system for automatically generating 3D scene interactive scripts based on a large language model, used to implement the method for automatically generating 3D scene interactive scripts based on a large language model as described in any one of claims 1-6, characterized in that, include: The structure building module obtains the input text description, extracts character features and event association information through semantic parsing, constructs a multi-character interaction graph, and obtains a preliminary plot branching structure; The rule matching module, based on the preliminary plot branch structure, integrates node weights and hierarchical relationships, calculates the comprehensive influence value of nodes, and determines the final matching degree between nodes and preset worldview rules; The framework correction module adjusts the association weights of the multi-role interaction graph by optimizing the path and dynamically updating the node attributes if the final matching degree is lower than the preset matching degree threshold, thereby generating a corrected plot branch framework. The coherence verification module extracts logical verification nodes from the modified plot branch framework, combines the mapping relationship between the event semantic parsing results and the logical verification nodes, obtains background setting data, verifies the coherence of the plot branches, and obtains the coherence verification plot branches. The segment generation module, based on the coherence verification of the plot branches, constructs context vectors and embeds character emotional tendencies to generate initial plot segments; The output module is optimized by improving the content connection logic and dynamically adjusting the dialogue rhythm of the initial plot fragments, integrating dynamically generated elements of plot progression, and outputting the final dynamically generated script.
Citation Information
Patent Citations
Animation script automatic generation method and system, storage medium and program product
CN119917074A