@@ -95,23 +95,35 @@ private static List<AgentTool> CreateTools(NarrativeGraph graph)
95
95
"\" targetnodename\" : \" the name of the target node that should be connected using this edge. " +
96
96
"This node can already exist in the graph or it can be this node, if this node is the target \" } ] } " +
97
97
"Each edge must include a list of conditions (which may be empty if no prerequisites exist) and " +
98
- "connect either from or to an existing node to maintain coherence in the narrative structure.\n \n " +
98
+ "connect either from or to an existing node to maintain coherence in the narrative structure. " +
99
+ "These conditions must be formulated as short easy-to-answer questions.\n \n " +
99
100
"Example Usage:\n " +
101
+ "Example 1: Gaining Information on The Abandoned Ruins\n " +
100
102
"Scenario Context:\n " +
101
103
"The player is currently at \" The Village of Eldermere\" . A new story point is being introduced: " +
102
104
"\" The Abandoned Ruins\" , which contains an ancient shrine with hidden inscriptions. The player can " +
103
- "only proceed if they have spoken to the village elder.\n " +
105
+ "only proceed if they have spoken to the village elder and removed a large boulder in the way .\n " +
104
106
"Tool Call Example:\n " +
105
107
"{ \" name\" : \" The Abandoned Ruins\" , \" storycontent\" : \" A crumbling stone structure overgrown " +
106
108
"with vines, hiding an ancient shrine with faded inscriptions. The air is thick with mystery, and a " +
107
109
"sense of forgotten history lingers. Possible discoveries include ancient artifacts and hidden passages.\" , " +
108
- "\" edges\" : [ { \" conditions\" : [ \" Has the player spoken to the Village Elder?\" ], " +
110
+ "\" edges\" : [ { \" conditions\" : [ \" Has the player spoken to the Village Elder?\" , \" Has the player removed the large boulder? \" ], " +
109
111
"\" sourcenodename\" : \" The Village of Eldermere\" , \" targetnodename\" : \" The Abandoned Ruins\" } ] } " +
110
112
"Expected Outcome:\n " +
111
113
"The tool returns an updated string representation of the graph, now including \" The Abandoned Ruins\" " +
112
- "as a new node, connected to \" The Village of Eldermere\" via an edge with the condition " +
113
- "\" Has the player spoken to the Village Elder?\" You can now verify the structure and ensure " +
114
- "that traversal logic remains consistent with the scenario documents." ) ;
114
+ "as a new node, connected to \" The Village of Eldermere\" via an edge with the conditions " +
115
+ "\" Has the player spoken to the Village Elder?\" and \" Has the player removed the large boulder?\" You can now verify the structure and ensure " +
116
+ "that traversal logic remains consistent with the scenario documents.\n " +
117
+ "Example 2: Entering the Forbidden Archives (No Conditions Required)\n " +
118
+ "A new node is added when the player discovers the Forbidden Archives, an ancient library containing lost knowledge. \n " +
119
+ "{ \" name\" : \" Forbidden Archives\" , \" storycontent\" : \" A vast underground library filled with " +
120
+ "crumbling tomes, forbidden knowledge, and the echoes of long-forgotten scholars. " +
121
+ "Strange symbols glow faintly on the walls, hinting at secrets waiting to be uncovered.\" , " +
122
+ "\" edges\" : [ { \" conditions\" : [], \" sourcenodename\" : \" Grand Library\" , \" targetnodename\" : \" Forbidden Archives\" } ] } " +
123
+ "Outcome:\n " +
124
+ "- The Forbidden Archives is introduced as a new story node.\n " +
125
+ "- The Grand Library is directly connected to it without conditions, meaning the player can freely enter the archives.\n " +
126
+ "- The archives can now serve as a new exploration point with potential clues, puzzles, or hidden dangers." ) ;
115
127
tools . Add ( addNodeTool ) ;
116
128
117
129
var addEdgeTool = new AddEdgeTool ( graph , "addedgetool" ,
@@ -150,14 +162,58 @@ private static List<AgentTool> CreateTools(NarrativeGraph graph)
150
162
"To enter the Royal Chamber, the player must have:\n " +
151
163
"1. Met Sir Ivan, the Wizard, who provides the key to the chamber.\n " +
152
164
"2. Defeated the Elite Guards stationed outside.\n " +
165
+ "3. Dispelled the magical barrier on the Royal Chamber doors." +
153
166
"Input to AddEdgeTool:\n " +
154
167
"{ \" sourcenodename\" : \" Castle Courtyard\" , \" targetnodename\" : \" Royal Chamber\" , \" conditions\" : " +
155
- "[ \" Has the player met Sir Ivan, the Wizard?\" , \" Has the player defeated the Elite Guards?\" ] } " +
168
+ "[ \" Has the player been granted the key by Sir Ivan, the Wizard?\" , \" Has the player defeated the Elite Guards? \" , \" Has the player dispelled the magical barrier ?\" ] } " +
156
169
"Outcome:\n " +
157
170
"- The Castle Courtyard is now connected to the Royal Chamber.\n " +
158
- "- The player cannot enter until both conditions are fulfilled." ) ;
171
+ "- The player cannot enter until all conditions are fulfilled." ) ;
159
172
tools . Add ( addEdgeTool ) ;
160
173
174
+ var addEndNodeTool = new AddEndNodeTool ( graph , "addendnodetool" ,
175
+ "This tool must be used to add a new end node to the narrative graph. An end node represents " +
176
+ "a definitive conclusion to a story branch, meaning that once the player reaches this point, the " +
177
+ "story will end. This tool must be used whenever a branch of the story does not loop back to another " +
178
+ "plot point but instead results in a final outcome.\n " +
179
+ "There can be multiple possible endings in an adventure scenario, so this tool must be invoked " +
180
+ "whenever a narrative path leads to a conclusion instead of continuing forward. End nodes should be " +
181
+ "used to signify significant story resolutions, such as:\n " +
182
+ "- The player meeting their demise.\n " +
183
+ "- The player achieving victory.\n " +
184
+ "- The player failing or being trapped indefinitely.\n " +
185
+ "- Any other scenario where the player's journey logically concludes.\n " +
186
+ "Usage Format:\n " +
187
+ "The tool requires valid JSON input structured as follows:\n " +
188
+ "{ \" sourcenodename\" : \" the name of the source node which already exists in the graph\" , " +
189
+ "\" conditions\" : [ \" condition that define if the ending is reached based on the player’s choices\" ] } " +
190
+ "The conditions list may be empty if the edge does not require prerequisites for traversal.\n " +
191
+ "Example Usage:\n " +
192
+ "Example 1: A Hero’s Victory\n " +
193
+ "If the player successfully defeats the Dark Lord and restores peace, the ending is triggered:\n " +
194
+ "{ \" sourcenodename\" : \" Victory Over the Dark Lord\" , " +
195
+ "\" conditions\" : [ \" Has the player defeated the Dark Lord?\" ] } " +
196
+ "Outcome:\n " +
197
+ "- This ending is reached only if the player defeats the Dark Lord.\n " +
198
+ "Example 2: The Player’s Demise\n " +
199
+ "If the player fails to escape a collapsing dungeon:\n " +
200
+ "{ \" sourcenodename\" : \" Buried Beneath the Ruins\" , " +
201
+ "\" conditions\" : [ \" Has the player failed to escape the ruins before time ran out?\" ] } " +
202
+ "Outcome:\n " +
203
+ "- The story ends when the player fails to escape the ruins.\n " +
204
+ "Example 3: The Ascension of the New King\n " +
205
+ "If the player successfully claims the throne by fulfilling multiple prerequisites:\n " +
206
+ "{ \" sourcenodename\" : \" Ascension to the Throne\" , " +
207
+ "\" conditions\" : [ \" Has the player retrieved the Royal Crown?\" , " +
208
+ "\" Has the player gained the support of the High Council?\" , " +
209
+ "\" Has the player defeated the False Heir in battle?\" ] } " +
210
+ "Outcome:\n " +
211
+ "- This ending is only reached if the player has:\n " +
212
+ "\t - Retrieved the Royal Crown, signifying their right to rule.\n " +
213
+ "\t - Secured the High Council’s approval, ensuring political stability.\n " +
214
+ "\t - Defeated the False Heir, eliminating rival claims to the throne." ) ;
215
+ tools . Add ( addEndNodeTool ) ;
216
+
161
217
return tools ;
162
218
}
163
219
}
0 commit comments