MiniLD #27 – designing a dialogue tree

So I thought i’d share the way I am structuring the dialogue in my game.

I am using a node graph architecture – each piece of dialogue exists as a node in a tree. Each node can have several child nodes, representing the next piece of dialogue. A child node can be any other node – including itself, or the parent of itself. This allows for recursive dialogue (“try to open door” -> “door won’t budge” -> “try to open door”…..)

Node graph

Throughout the life cycle of the game, a pointer to a dialogue node is used to track the “current node” – this is the piece of dialogue which is currently being executed, and switches to the next piece when it is able to do so. A disadvantage is that it cannot execute more than a single node at any one time – i.e. only a single piece of dialogue can be displayed.

If a node has a single child, the dialogue switches directly to the child node when the current node has finished executing. However, if it has multiple children, the choices are displayed for the player to choose from. The choice selected then becomes the new dialogue node.

To fill these nodes with content, and link them together, a description of each node exists in a table Lua-side.

node table

All of the nodes listed in the AllNodes table are created and linked together at run-time automatically. To create nodes, you just place new node descriptions in this table, and specify the names of the child nodes.

The first prototype build, which shows the dialogue tree in action (with only a small part of the Soldier path complete) is available here:

Journey through hell – prototype

Next step – text effects! more content!

-DBS