Bringing the dialogue into the game


Justin here!

Tanner recently gave you a devlog about writing the narrative, so here’s a devlog about implementing it.

First Iteration

A long time ago, in a classroom far far away....

The time for Shark Tank was fast approaching, which meant we needed to make our first Demo for Island Flight Courier, which was still known then as Plane Game.

As it was our first attempt at anything narrative, our first tutorial was haphazard, with the strings of text for various stages strewn about multiple scripts, and following it through almost required a poster board and a spool of red string. It was so poor, even now when trying to go back through it to write about it for this devlog, I’m losing my way. In some cases, I’m not even sure where to look.

After Shark Tank, in the spring semester, Zinan and Sarah left the team, and Tanner came onboard. One of Tanner’s tasks was to design the upgrades for the plane, and for the villages. Then it came to me to implement them into the game. For our Shark Tank build, the few upgrades we had were hard-coded, and as I said previously, scattered around the project. Not making that mistake again, I started looking into ways to read the data at runtime. Eventually, for this I settled on reading .csv (Comma Separated Value) files from a spreadsheet that Tanner created, with the data going into a custom class and then stored in a dedicated UpgradeManager script. This script knows which upgrade we’re at, and applies the values when an UpgradeZone reports an upgrade as finished.

Now I know what you’re thinking, “what do the UpgradeZones have to do with a Narrative Controller?” I’m getting there, just remember the .csv part.

Together Again

After a summer apart, it came time to create a new tutorial. This time, however, all of the text and control would be in a specific TutorialManager script, which the overall GameManager would call at the start of the game. This allowed us to keep everything contained in one location, and for the “Control” of the game to be handed back to the GameManager when the tutorial ended.

Another of Tanner’s tasks was to design and write the narrative for the game, including the flow of the game, locations, and dialogue. Then, it fell on me of course to implement his designs into our game. Since we now had everything dialogue related in the same file, I figured I would just drop the text into the tutorial manager itself and be done with it. While this did make the file more readable in the sense that we could easily see where we were, it added many lines of code. Soon the TutorialManager was the largest script in the entire project, as even the code for displaying text boxes was in there!

When it came time to work on the main story, it was obvious we needed to split apart some of the functions in the TutorialManager that were not tutorial specific. We also needed some dialogue when tourists were picked up, independent of both the tutorial and the story. 

This is where our Dialogue controller came into existence. In it would be housed the functions for displaying text to the screen, and where all text would be stored. Then, the TutorialManager would simply ask the DialogueController for specific text strings as it needed them. For this, we implemented the same file-reading as we did for Upgrades.

Tech Issues

But suddenly the .csv format wouldn’t work, as some of the dialogue has commas in it. So for reading in Dialogue at runtime we use .tsv (Tab Separated Value) files instead. Each entry also has extra columns for such things as…

  1. The key for the dialogue
  2. The speaker of the dialogue
  3. The dialogue itself
  4. It’s behavior

The behavior is an interesting one, because it tells the DialogueController what to do with the dialogue once it’s appeared on the screen. Do we need to wait for a player to acknowledge it? Does it automatically disappear after a short time? Or does it need to remain until some event happens in the world, such as an upgrade being finished? All of these can now be decided outside of the game, in a nicely formatted spreadsheet.

And so we’ve arrived at our final narrative implementation. The Narratives are controlled through dedicated scripts for each major section, and each calls on a separate DialogueController script when it comes to showing that narrative to the player.

As we have been working on our sound implementation, we also hope to eventually have spoken lines alongside our text, and that means our DialogueController will continue to evolve in order to enhance the narrative.

Get Island Flight Courier

Buy Now$5.00 USD or more

Leave a comment

Log in with itch.io to leave a comment.