Behind The Scenes - The Conversation System (Patreon)
Content
We wanted to make another Behind The Scenes post for you guys and figured it would be cool to give you a look into how conversations and dialogue trees work in Project Cappuccino 2. Project Capp 1, had a similar system but used a different tool kit that has been phased out for a more robust one.
Pixel Crusher’s Dialogue System
Project Cappuccino 2’s dialogue system is built on top of the Pixel Crusher’s Dialogue Asset. This tool had a bit of a learning curve at the beginning but its proven to be super flexible and extensible after getting through that initial rough patch. So far, its been able to support everything we wanted to do without having to reinvent the wheel.
Conversation Example
In-game conversations follow a flowchart of sorts that can range from a single line to a complex web of responses. The game's logic flows throw each node of the chart as the player clicks through dialogue.
This one for example is a simple chat with Rosaria that ends with a bit of code running that enables the UI for the player name input.
Charlotte on the other hand has several complicated webs that are affected by her frenzy state, which can change mid conversation!
Some conversations are unique in that they loop or trigger special things. The shop for example has branches for purchasing or rejecting a toy.
The shop flowchart takes into account how much gold a player has and if they even want to buy the toy or not in the first place.
Its easy to get lost with all of these conversation trees, so the story plans are actually kept outside of the game in Milanote, where it's more of a raw text format consisting of mad scientist story documents.
The succubus was summoned to the cafe, but she's connected to the underworld and they're trying to get her back. Now there's a power vacuum in the underworld because the queen was dethroned. The tomes in the human world have something to do with the underworld domains. Colette used a conjuration tome and Mira happens to be a conjuration succubus? Coincidence? NO! There's a mysterious evil succubus mommy trying to mess with things. The eyes everywhere mean something. They imprisoned Yani for a reason! They dethroned Rosaria for a reason! The council of the damned is operating from the shadows! Cerise's magic seems awfully similar to Life/Death domain magic! There are A LOT of boobs. Coffee at the Resting Bean is almost 5 bucks for the smallest size! ITS ALL CONNECTED!
LUA Commands
If all of that was sounding too simple, well worry not. There’s some more glue that holds all of this together called LUA scripting. At it’s simplest, LUA is a secondary coding language that is layered on top of the core game code and used to simplify complex code into simple one line commands. These commands are then injected into the conversations in order to control the game flow.
Check out these examples!
This simple line allows us to make a character’s portrait show up on screen with a specific expression. It takes into account a character, screen position, expression and whether or not the sprite is flipped.
Under the hood, it’s connected to various systems.
Cropped the code but you get the idea.
There’s various commands that have been implemented such as AddGold(), SetStanding(), LoadScene() and so on. This framework has made it so that most aspects of the game can be modified through a conversation if needed. Implementing the nodes one by one is tedious at times but a necessary part of the development process.
We hope you guys enjoyed this look at some of the work we do on the game. Let us know if you have any ideas for what other behind the scenes stuff you’d want to see!
-Vanis & Doku