When I undertook the task of creating a short level based off of my previously made Boardwalk Gulch environment, there were two things I set out to accomplish: create a unique character that would inhabit the level, and give the player a sense that this character was interacting with them.
Creating a Character:
The first task was fairly easy to begin. I had already created a mascot of sorts for the doomed "desert beach resort" I had created: Helios Sam, the Sun Cowboy. Creating Sam's backstory of a moderately deranged boardwalk employee accidentally locked into the PA booth and left with a book of cheesy mascot dialogue was to say the least, enjoyable, and being able to recruit the ever-talented Alex Norton to record the voice lines was truly a pleasure. With the character made and the voice lines recorded though, the more technical part of the project would begin.
The Beginning:
I reached the decision early on that it would be best to have Sam interacting with the player through an intercom rather than in person, as it both fit in more with the created backstory and, quite frankly, saved a lot of time that would've otherwise been spent on animation and modeling of a character model. This decision, however, came with a natural problem: how to successfully create the illusion of interaction with a NPC without the NPC being having a physical presence in the game space. To combat this problem, I decided to sort the dialogue into two separate groups: ambient and contextual. This first post will cover how I scripted the former.
Ambient Lines:
Ambient lines would be by far the easiest type of dialogue to script. A new function (pictured above) was set up in the global game instance to handle both the randomization of the dialogue and the actual audio playback itself. A "master array" of the sound files was set up alongside a string array which contained the corresponding written text for each line (see the example at the bottom of this post). This meant that when a ranged random integer was set for a line, the audio played would match the displayed subtitle. After playing the sound, a separate function would set a new interval of between 15 and 30 seconds before a new line could be played (script below).
Overall, this method proved to be an effective way of managing a dialogue system that felt fairly natural, albeit with some repetition of voice lines. While this method of scripting was by no means a flawless solution (more on that in a later post), it still proved suitable for the scope and stricter time limitation of the project it was a part of.
Thanks for reading! The next post will cover the scripting of the project's contextual dialogue, as well as a brief post-mortem on the dialogue system as a whole! Until next time!




