Helika Logo (2)

How To Write Branching Dialogue Systems In Games

How To Write Branching Dialogue Systems In Games

When it comes to creating character interactions within your video games, there are many different approaches you can take. One popular method is using a dialogue system, which allows players to engage in conversations with non-player characters (NPCs) and make choices that influence the outcome of the game.

In this guide, we will explore how to write branching dialogue systems in games, including best practices and tips for creating meaningful choices for players.

6 Best Practices For Standard Dialogue Trees

Interactive conversations require a thoughtfully designed dialogue system that allows players to make choices and see their consequences play out in the game. Here are some best practices for creating standard dialogue trees:

1. Creating a Binary Tree 

In simple terms, a binary tree is a way to organize dialogue options in a branching structure. Each choice leads to two more choices, and so on, until the conversation ends. This format allows for multiple outcomes and adds replay value for players. Using a Mind Map can help you visualize the different paths and outcomes in your dialogue tree.

A narrative designer should consider the different choices players can make and how each one will impact the story. In many games, dialogue choices can have consequences later on, so it’s essential to plan ahead for these potential outcomes. When building thes mind maps and binary trees, it’s helpful to think about the different character motivations and how they may respond to certain choices. 

If a character has resentment towards a faction and one option is to respond with rage while the other two are deceitful, it would make sense as it aligns with the character’s motivations. Conversely, if a faction has been nothing but kind to the character, and the options are aggressively attack or betray them, that would not make sense for the character’s motivations. Although this gives more freedom for the player, the main character’s identity becomes lost, and player choice can feel disconnected from the story.

2. Have The Entire Game In Mind

One of the most important things to keep in mind when designing a branching dialogue system is to have the entire game in mind. This means considering all possible outcomes and how each choice made by the player will affect the overall story or gameplay experience. By having a clear understanding of the overall game, you can create a more cohesive and consistent dialogue tree that adds depth to the narrative.

When designing branching dialogue, it’s also vital to consider how each choice will impact the player’s relationship with other characters in the game. For example, if a player consistently chooses aggressive or deceitful dialogue options with one character, it may affect their relationship negatively, leading to different outcomes later in the game.

Red Dead Redemption’s morality bar plays well to this concept of how player choice affects relationships and outcomes. The more honorable actions a player takes, the higher their honor bar becomes, leading to different interactions with other characters and the reputation the player gains in the game’s world. Dialogue served as a common way to either increase or decrease this bar, making the player’s choices feel more impactful.

3. Use Data Structures

When it comes to branching dialogue systems, data structures are your best friend. They allow for a more organized and logical approach to creating dialogue trees, making it easier to keep track of all the different paths and outcomes.

One common data structure used in branching dialogue is the decision tree. A decision tree is a visual representation of all the possible decisions and outcomes in a branching dialogue system. It starts with a central node, representing the initial prompt or question, and then branches off into different options based on the player’s choice.

Another useful data structure is the graph. Similar to decision trees, graphs also visually map out the different paths and outcomes in a branching dialogue system. However, they allow for more complex relationships between nodes, making them useful for games with multiple characters and storylines.

To visualize how a graph can be used in a branching dialogue system, imagine a game where the player is a detective trying to solve a mystery. The central node would represent the initial prompt or question given by the detective to a suspect.

Each branch from that node would represent a different line of questioning or response from the suspect. As the player continues to make choices, the graph branches off into different paths and outcomes, ultimately leading to different endings based on the player’s decisions.

As new evidence arises, completely new beginnings to branches can be created, allowing for a dynamic and ever-changing dialogue experience for the player. Utilizing data structures like decision trees and graphs not only helps with organization but also allows for more flexibility and creativity in crafting branching dialogue systems. 

4. Using Natural Language 

The tricky part of creating NPC text is writing them in a very natural way. There are many nuances of social interaction that we humans have that are difficult to convey through scripting alone.

Have you ever read text messages from a friend thinking they were angry at you just because they used a period instead of an exclamation mark? In order to make dialogue feel more natural and realistic, it’s important to pay attention to these small details.

Pairing the character’s audio tonality with specific word choices can go a long way in making dialogue feel more natural. For example, using contractions like “I’m” instead of “I am” can give the impression that the character is speaking casually or in a friendly manner. Similarly, using shorter sentences and simpler words for less intelligent characters can help differentiate their speech from other NPCs.

A common mistake in writing dialogue is making every character sound the same. Just like in real life, people have different speech patterns and vocabularies based on their background and personality. It’s important to keep these differences in mind while writing for NPCs. For example, a jester likely wouldn’t talk in a slow, confident and deep voice, but more likely have a quicker and higher pitched tone to match their playful and energetic nature.

Another useful trick is to use phrases or expressions that are specific to certain characters, such as a catchphrase or an inside joke. This can add depth and personality to the character, making them feel more unique and memorable. Members of the same faction or group should use similar phrases or terms to further establish their relationship and shared experiences. This is true in real life as we often adopt the language and slang of those we spend time with.

5. Using Artificial Intelligence For Gaming Dialogues

Modern games have the advantage of using artificial intelligence (AI) to enhance their dialogue systems. AI can be used to generate dynamic and adaptive responses based on player choices, making the conversation feel more organic and tailored to each player’s unique experience.

AI can also be used to analyze player behavior and adapt future dialogue options to suit their playstyle. This not only makes the game more immersive, but it also allows for a deeper level of player engagement and investment in their character’s interactions with NPCs. Although real-time AI has yet to be effectively integrated into dialogue-heavy games, it’s speculated that even Triple A games will be using it in the near future. 

With that being said, hiring a dialogue editor to work alongside a writer that uses some sort of AI to help enhance (not replace) their craft could prove to be a powerful combination. It’s viable with today’s technology and could likely lead to even more immersive game conversations. By using a prompt system, AI can suggest dialogue options to the writer who can then use their creative skills to shape and fine-tune the responses.

6. Consider The Player’s Stats When Writing Dialogue

When writing dialogue, it’s important to consider the player’s character stats and abilities. For example, a character with high charisma should have more persuasive dialogue options available to them compared to a character with low charisma.

Another way a player’s stats can be written during dialogue is intelligence. In RPG games, characters with higher intelligence should have more intelligent dialogue options available to them. This adds another layer of immersion and role-playing to the game, as players can truly feel like their character’s stats are impacting the way they interact with NPCs.

Reputation and progression in a game should also be taken into account when writing dialogue. For example, if someone has built a reputation for their use of magic and enters into an magic academy, respect seeking and status affirming dialogue may be present while a novice may not have those same options. If they do, the NPC should respond accordingly. They may take a back seat and respond submissively towards the character with a high reputation, or they may challenge and doubt the novice’s abilities.

Writing dialogue this way depending on the player’s stats can be cumbersome. Programming the correct dialogue to go alongside each gamer’s different character stats is no easy feat. However, it’s a small detail that can make a big difference in the overall player experience. It adds depth to the game and makes the player feel more connected to their character and makes them realize exactly how important it is to progress in the game as social situations can present unique challenges just as combat does.

Creating The Illusion of Choice

There are a few different conversation systems that game developers commonly use, such as dialogue trees and directed graphs. In a dialogue tree system, players are presented with a series of options or responses to choose from, often in a linear fashion. While this can provide a sense of control for the player, it can also limit their choices and make the conversation feel scripted. To avoid this, developers may employ the use of directed graphs, which allow for more branching paths and multiple outcomes based on player choices.

A time limited is also often used to create the illusion of choice, where players are given a limited amount of time to respond before the conversation moves on. This can add a sense of urgency and make decisions feel more important. Imagine a real-life situation. If someone were to ask you a question and you stare at them for 2 minutes, do you think they won’t be a little perturbed?

If there is not a lot of dialogue, a time limit is more effective as less wording in the different choices makes reading them easier and faster. However, if there is a lot of dialogue, having a time limit may cause players to feel rushed and make hasty decisions. A good examples of when a time limit can be used effectively is in games where players must make quick decisions in high-pressure situations, such as during a battle or escape sequence.

In story-heavy games, creating a dialogue tree where no matter what answers the player chooses, the game’s outcome can remain the same. This helps shape the narrative and ensures that the player experiences the intended story. However, for games that focus on player choices and branching paths, this type of dialogue system may feel restrictive. Dialogue trees should give the illusion of choice and have some meaningful impact without changing the overall outcome of the story’s game (if a definite ending is desired).

Final Thoughts

Adventure games were the pioneers in using dialogue trees and they continue to play a significant role in storytelling and player immersion. This interactive form of communication has evolved over the years, becoming more complex and nuanced with advancements in technology. From simple “yes” or “no” choices to time-sensitive responses, dialogue trees have the power to shape a game’s narrative and make players feel more connected to the story.

Along with gaming analytics from partners such as Helika, game developers can find areas for improvements in their game’s dialogue and other features. This allows for a more enjoyable experience for players and can ultimately lead to the success of a game. 

As games continue to push boundaries and offer more diverse experiences, dialogue systems will also evolve to meet the demands of players. Having a proper data partner can help developers better understand their player base and cater to their preferences for a more engaging gaming experience. 

ABOUT HELIKA

Helika is a web3 technology platform that delivers real-time analytics and onboards new users to gaming studios and popular NFT collections. With a focus on integrated analytics from Web2, in-game, on-chain and social media data, Helika helps top Web3 brands such as Yuga labs and Treasure to understand their communities, increase user acquisition and engagement, and drive overall growth with a data-driven approach.

Helika is backed by top VC firms including Diagram Ventures, Sfermion, Sparkle Ventures, Big Brain Holdings, Fenbushi and Builder Capital.

For more information, visit helika.io
We are onboarding select Studios to our platform. Drop your information here and we’ll be in touch soon.