Post news RSS Adding Dialogue

A brief and somewhat technical post on how dialogue is being implemented into Hevn.

Posted by on

In Hevn the player has the option to make choices that can affect the outcome of the game. One of these options takes place in the form of dialogue. "Dialogue" in this sense means communicating with other NPCs or "entities" using in-game computer terminals and tablets. This post covers some of the technical design of implementing dialogue into Hevn.

Dialogue Structure

After researching various dialogue tree/graph tools and various other designs, it was determined that creating a new and basic dialogue mechanism would be best. This is mostly to ease integration into other aspects of Hevn such as the upcoming Objectives functionality or the existing Save system.

As with most dialogue trees, Hevn also borrows the concept of using questions and responses, with responses linked to further questions or more dialogue. To help ease the editing and maintenance of dialogue, we're using a plain JSON format. Here's an example of some early test dialogue data:

In the above image we can see several attributes in each dictionary (all of which are mapped to a class):

  • "id" - This is the unique identifier for each grouped question and response.
  • "objective_id" - This is the identifier for a particular objective which is defined in a separate JSON file. These objectives will automatically be triggered in the game when the player chooses this particular response.
  • "response" - This is the player's response.
  • "dialogue" - This is the NPC's question or statement.
  • "responses" - These are the response option "ids" for the above NPC dialogue. The player can choose one of these responses.

With the above structure, we're able to map out deep dialogue trees, and some of which can be reused. Also there are a couple pre-defined rules that really help make this structure work, specifically with determining where dialogue starts and ends.

  1. Dialogue that contains no "response" value is a starting point.
  2. Dialogue that contains no "responses" value is a dialogue ending point.

Interfacing with Dialogue

With the data structure for dialogue defined, how does the player actually see this play out in the game? It's simple, in in-game computer terminals and tablets! Every computer terminal in Hevn can be interacted with and has its own set of data, objectives, and dialogue associated with it. Here's an example of a JSON configuration for a particular test computer terminal:

For this post, the only relevant piece of text is at line 14: "description":"DIALOGUE(1002)". This basically informs the in-game computer terminal that a particular dialogue option can be presented here. Here's how this configuration translates into an actual computer terminal screen:

The player essentially uses the [TAB] key to cycle through any of the above options. The [E] key selects the chosen option, which in this case is "Message Received" which happens to trigger a basic test dialogue (same one as displayed earlier in this post). After selecting this option the player is currently presented with the next screen that contains a question and actual response options:

The player has three choices at this point:

  1. Do nothing. Walking away from the screen returns it the main menu. This is a valid choice that may affect how the game plays out.
  2. Choose option 1. This triggers an objective as specified in the JSON dialogue configuration file above.
  3. Choose option 2. This triggers a story point that won't become obvious until later in the game.

For this post, we'll choose option 1. This returns the following dialogue ending point:

After making the selection, the player now has an objective and the NPC has replied back. How this plays out in the overall story might not be known until later. But at this point other messages can be injected into this computer terminal, either from NPCs, in-game systems, or even other "entities". Also there are still several things to work out as well, one of which is time delay - which usually happens with things such as email or texting.

Well, that's it for this week! Thanks so much for reading!


Post a comment
Sign in or join with:

Only registered members can share their thoughts. So come on! Join the community today (totally free - or sign in with your social account on the right) and join in the conversation.