StupidRPG Dialogue Trees

A game like StupidRPG wouldn’t be complete without extensive NPC interaction. It’s a crucial part of the roleplaying experience the game is inspired by. The world of text adventures and computer RPGs offer many different ways of handling this. I considered several options, each of which has pros and cons. In the end, I tried to take the pieces I liked from multiple styles. This is a non-exhaustive list of the methods I considered.

Dialogue Tree

Popular in computer RPGs and adventure games, dialogue trees are basically directed graphs. Each dialogue option is a ‘node’ that can connect to a semi-arbitrary number of additional nodes. Significant depth is supported, particularly when alternate nodes are locked behind prerequesites (for example: possessing a certain item, meeting a certain NPC, or meeting alignment requirements). This style of NPC interaction has carried into modern games (pretty much any BioWare game, for starters), with a couple tweaks.

Pros:

  • Conversations of varying complexity supported
  • Easy to set up conversational ‘rabbit holes’ which eventually loop back to a root node
  • Easy to ‘gate’ nodes or chains of nodes behind situational requirements

Cons:

  • Rigidly defines what can be talked about and when
  • Player’s dialogue may not match their conceptualization based on the presented (simplified) dialogue text

Glossary / Dictionary

Commonly seen in classic adventure games and text adventures, where the player can ASK SUSAN ABOUT KOBOLDS or drag an inventory item onto a character to learn more about it.

Pros:

  • Very user-driven, somewhat freeform
  • Allows for hidden interactions / easter eggs

Cons:

  • Inevitably motivates the player to attempt every possible combination of item/topic with each NPC
  • Each interaction is isolated from the rest (lack of continuity)

Commands & Parsing

Low-tech as they are, some text adventures allow the player to give directions to NPCs, such as GARY, GO NORTH AND EAT CAKE. It’s not as complicated as it sounds; once you’ve identified the target of the command, the rest is identical to parsing a normal instruction from the player. I haven’t seen an example of more advanced parsing (e.g. TELL GARY HIS FACE IS BAD), but if such a thing exists, kudos.

Pros:

  • Situationally useful feature when dealing with friendly NPCs

Cons:

  • More complex text parsing is really hard

The StupidRPG Way

I settled on a combination of the first two options, with the third a distant goal if I find a use for it. In SRPG, a command like TALK TO THE OGRES generally initiates a dialogue tree (if one is available). Each node has:

  • Text (actually a callback, in case more complex text generation or other triggers are needed)
  • (Optional) Restrictions (e.g. this node is only available if the player previously fought the minotaur)
  • (Optional) A visibility setting (default is visible, some nodes may be hidden for reasons other than access restrictions)
  • (Optional) A node list (nodes available from this point in the conversation)
  • (Optional) A list of keywords (more on that in a second)

The second option comes into play with a list of topics each NPC can discuss. These are actually tree nodes, but the player can shortcut to them via commands like ASK ELLEN ABOUT DIVORCE.

As indicated in a previous post, the SRPG parser allows for a variety of command patterns, including patterns with ‘overflow’ text (i.e. arbitrary text only understood by a particular command or object). One of the neat things about that is the ability to define custom parsing behaviors for specific NPCs or types of NPCs. For example, a town guard might respond poorly to the (non-standard syntax) statement: SAY 'GO LICK A BEAR' TO CAPTAIN ROTH. The sky’s the limit, really.